diff --git a/Examples/ComboBox/ComboBoxChanged.cs b/Examples/ComboBox/ComboBoxChanged.cs index abf97bf..6691d5d 100644 --- a/Examples/ComboBox/ComboBoxChanged.cs +++ b/Examples/ComboBox/ComboBoxChanged.cs @@ -1,28 +1,30 @@ using UnityEngine; - -public class ComboBoxChanged : MonoBehaviour { - - - public void ComboBoxChangedEvent (string text) { - - Debug.Log("ComboBox changed [" + text + "]"); - } - - public void AutoCompleteComboBoxChangedEvent(string text) +namespace UnityEngine.UI.Extensions.Examples +{ + public class ComboBoxChanged : MonoBehaviour { + public void ComboBoxChangedEvent(string text) + { - Debug.Log("AutoCompleteComboBox changed [" + text + "]"); + Debug.Log("ComboBox changed [" + text + "]"); + } + + public void AutoCompleteComboBoxChangedEvent(string text) + { + + Debug.Log("AutoCompleteComboBox changed [" + text + "]"); + } + + public void AutoCompleteComboBoxSelectionChangedEvent(string text, bool valid) + { + + Debug.Log("AutoCompleteComboBox selection changed [" + text + "] and its validity was [" + valid + "]"); + } + + public void DropDownChangedEvent(int newValue) + { + + Debug.Log("DropDown changed [" + newValue + "]"); + } } - - public void AutoCompleteComboBoxSelectionChangedEvent(string text, bool valid) - { - - Debug.Log("AutoCompleteComboBox selection changed [" + text + "] and its validity was [" + valid + "]"); - } - - public void DropDownChangedEvent(int newValue) - { - - Debug.Log("DropDown changed [" + newValue + "]"); - } -} +} \ No newline at end of file diff --git a/Examples/Cooldown/CooldownEffect_Image.cs b/Examples/Cooldown/CooldownEffect_Image.cs index c39c668..828796b 100644 --- a/Examples/Cooldown/CooldownEffect_Image.cs +++ b/Examples/Cooldown/CooldownEffect_Image.cs @@ -1,7 +1,7 @@ /// Credit SimonDarksideJ /// Sourced from my head -namespace UnityEngine.UI.Extensions +namespace UnityEngine.UI.Extensions.Examples { [RequireComponent(typeof(Image))] public class CooldownEffect_Image : MonoBehaviour diff --git a/Examples/Cooldown/CooldownEffect_SAUIM.cs b/Examples/Cooldown/CooldownEffect_SAUIM.cs index 5600ad4..2899356 100644 --- a/Examples/Cooldown/CooldownEffect_SAUIM.cs +++ b/Examples/Cooldown/CooldownEffect_SAUIM.cs @@ -1,7 +1,7 @@ /// Credit SimonDarksideJ /// Sourced from my head -namespace UnityEngine.UI.Extensions +namespace UnityEngine.UI.Extensions.Examples { [RequireComponent(typeof(SoftMaskScript))] public class CooldownEffect_SAUIM : MonoBehaviour { diff --git a/Examples/CurlyUI/Test.unity b/Examples/CurlyUI/CurlyUIDemo.unity similarity index 99% rename from Examples/CurlyUI/Test.unity rename to Examples/CurlyUI/CurlyUIDemo.unity index be66f1f..cc70e28 100644 --- a/Examples/CurlyUI/Test.unity +++ b/Examples/CurlyUI/CurlyUIDemo.unity @@ -239,10 +239,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: controlPoints: - - {x: -0.47069454, y: 85.28231, z: 0} - - {x: -25.58096, y: -25.659853, z: 0} - - {x: 99.10907, y: -90.427376, z: 0} - - {x: 124.96505, y: 15.533395, z: 0} + - {x: -1.0848525, y: 177.10716, z: 0} + - {x: -58.958763, y: -53.288235, z: 0} + - {x: 228.42569, y: -187.79199, z: 0} + - {x: 288.0183, y: 32.258453, z: 0} --- !u!1 &99378105 GameObject: m_ObjectHideFlags: 0 @@ -347,15 +347,15 @@ MonoBehaviour: - {fileID: 1125965643} refCurvesControlRatioPoints: - array: - - {x: -0.004798109, y: 1.1478106, z: 0} + - {x: -0.0047981087, y: 1.1478106, z: 0} - {x: -0.2607641, y: -0.34535474, z: 0} - {x: 1.0102861, y: -1.2170577, z: 0} - {x: 1.2738537, y: 0.20906323, z: 0} - array: - - {x: 0.42000008, y: 1.1185882, z: 0} - - {x: 0.47966036, y: 0.50782657, z: 0} - - {x: 0.6819315, y: 0.40149453, z: 0} - - {x: 0.9160537, y: 0.84320074, z: 0} + - {x: 0.42000005, y: 1.1185882, z: 0} + - {x: 0.47966033, y: 0.50782657, z: 0} + - {x: 0.68193156, y: 0.40149453, z: 0} + - {x: 0.91605365, y: 0.84320074, z: 0} --- !u!114 &123690155 MonoBehaviour: m_ObjectHideFlags: 0 @@ -768,10 +768,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: controlPoints: - - {x: 41.20201, y: 83.11109, z: 0} - - {x: 47.054684, y: 37.731506, z: 0} - - {x: 66.897484, y: 29.831038, z: 0} - - {x: 89.864876, y: 62.649803, z: 0} + - {x: 94.96201, y: 172.59814, z: 0} + - {x: 108.4512, y: 78.35763, z: 0} + - {x: 154.18472, y: 61.9506, z: 0} + - {x: 207.11974, y: 130.10587, z: 0} --- !u!1 &1128544828 GameObject: m_ObjectHideFlags: 0 diff --git a/Examples/CurlyUI/Test.unity.meta b/Examples/CurlyUI/CurlyUIDemo.unity.meta similarity index 100% rename from Examples/CurlyUI/Test.unity.meta rename to Examples/CurlyUI/CurlyUIDemo.unity.meta diff --git a/Examples/FancyScrollView.meta b/Examples/FancyScrollView.meta new file mode 100644 index 0000000..2d6def2 --- /dev/null +++ b/Examples/FancyScrollView.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e4715bcc5adadca46ac601c64bd58681 +folderAsset: yes +timeCreated: 1501610666 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/01_Basic.meta b/Examples/FancyScrollView/01_Basic.meta new file mode 100644 index 0000000..0520b51 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0e019a51b207adf4dbc65576e8a03ed9 +folderAsset: yes +timeCreated: 1501610675 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/01_Basic/01_BasicScene.unity b/Examples/FancyScrollView/01_Basic/01_BasicScene.unity new file mode 100644 index 0000000..627eb27 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/01_BasicScene.unity @@ -0,0 +1,706 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 8 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.37311947, g: 0.38074005, b: 0.35872722, a: 1} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 8 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFiltering: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousColorSigma: 1 + m_PVRFilteringAtrousNormalSigma: 1 + m_PVRFilteringAtrousPositionSigma: 1 + m_LightingDataAsset: {fileID: 0} + m_ShadowMaskMode: 2 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &650160435 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 650160439} + - component: {fileID: 650160438} + - component: {fileID: 650160437} + - component: {fileID: 650160436} + - component: {fileID: 650160440} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &650160436 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &650160437 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &650160438 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 777088607} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 25 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &650160439 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1492537696} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &650160440 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 69123a589054bf041ba5ead99364646f, type: 3} + m_Name: + m_EditorClassIdentifier: + scrollView: {fileID: 1492537700} +--- !u!1 &777088603 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 777088608} + - component: {fileID: 777088607} + - component: {fileID: 777088606} + - component: {fileID: 777088605} + - component: {fileID: 777088604} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &777088604 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 +--- !u!124 &777088605 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 +--- !u!92 &777088606 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 +--- !u!20 &777088607 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &777088608 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1012097242 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1012097243} + - component: {fileID: 1012097245} + - component: {fileID: 1012097244} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1012097243 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} + m_LocalRotation: {x: 0.5, y: 0, z: 0, w: 0.8660254} + m_LocalPosition: {x: 0, y: 0, z: 276} + m_LocalScale: {x: 0.3, y: 0.3, z: 1} + m_Children: + - {fileID: 1506879310} + m_Father: {fileID: 1590362722} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 60, y: 0, z: 0} + m_AnchorMin: {x: -0.2, y: 0.5} + m_AnchorMax: {x: -0.2, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 450} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1012097244 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.3019608} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1012097245 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} +--- !u!1 &1492537695 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1492537696} + - component: {fileID: 1492537700} + - component: {fileID: 1492537699} + - component: {fileID: 1492537702} + - component: {fileID: 1492537701} + m_Layer: 5 + m_Name: ScrollView + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1492537696 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1590362722} + m_Father: {fileID: 650160439} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1492537699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc9ad31350b1b6348b57c626195a562d, type: 3} + m_Name: + m_EditorClassIdentifier: + viewport: {fileID: 1492537696} + directionOfRecognize: 1 + movementType: 1 + elasticity: 0.1 + scrollSensitivity: 7 + inertia: 1 + decelerationRate: 0.03 + snap: + Enable: 1 + VelocityThreshold: 0.5 + Duration: 0.3 + dataCount: 0 +--- !u!114 &1492537700 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c7e0222f92bdad84c9ee57a127efe088, type: 3} + m_Name: + m_EditorClassIdentifier: + cellInterval: 0.15 + cellOffset: 0.5 + loop: 0 + cellBase: {fileID: 1590362721} + scrollPositionController: {fileID: 1492537699} +--- !u!114 &1492537701 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1492537702 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} +--- !u!1 &1506879309 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1506879310} + - component: {fileID: 1506879312} + - component: {fileID: 1506879311} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1506879310 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1506879309} + m_LocalRotation: {x: 0.008726558, y: 0, z: 0, w: 0.999962} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1012097243} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 1, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 160, y: 35} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1506879311 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1506879309} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 3 + m_BestFit: 0 + m_MinSize: 3 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!222 &1506879312 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1506879309} +--- !u!1 &1590362721 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1590362722} + - component: {fileID: 1590362725} + - component: {fileID: 1590362723} + - component: {fileID: 1590362724} + - component: {fileID: 1590362726} + m_Layer: 5 + m_Name: Cell + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1590362722 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1012097243} + m_Father: {fileID: 1492537696} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!95 &1590362723 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 8bbdb068c73989c438aef167096a86cb, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 +--- !u!114 &1590362724 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b77a04c729f174c478baf21a47c16620, type: 3} + m_Name: + m_EditorClassIdentifier: + animator: {fileID: 1590362723} + message: {fileID: 1506879311} +--- !u!222 &1590362725 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} +--- !u!225 &1590362726 +CanvasGroup: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!1 &1770868449 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1770868452} + - component: {fileID: 1770868451} + - component: {fileID: 1770868450} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1770868450 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1770868449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1770868451 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1770868449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &1770868452 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1770868449} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Examples/FancyScrollView/01_Basic/01_BasicScene.unity.meta b/Examples/FancyScrollView/01_Basic/01_BasicScene.unity.meta new file mode 100644 index 0000000..f73f85f --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/01_BasicScene.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f5666b6c719a9b544ab322e1066aef5f +timeCreated: 1487186707 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/01_Basic/Animations.meta b/Examples/FancyScrollView/01_Basic/Animations.meta new file mode 100644 index 0000000..26c8a54 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Animations.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0f8e29708d324ea48ba2af889fea2c5a +folderAsset: yes +timeCreated: 1487186581 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/01_Basic/Animations/01_Basic_Animation.anim b/Examples/FancyScrollView/01_Basic/Animations/01_Basic_Animation.anim new file mode 100644 index 0000000..aa47812 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Animations/01_Basic_Animation.anim @@ -0,0 +1,600 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: 01_Basic_Animation + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: {x: 90, y: 0, z: 0} + inSlope: {x: -198.47397, y: 0, z: 0} + outSlope: {x: -198.47397, y: 0, z: 0} + tangentMode: 0 + - serializedVersion: 2 + time: 0.5 + value: {x: 0, y: 0, z: 0} + inSlope: {x: -180, y: 0, z: 0} + outSlope: {x: -180, y: 0, z: 0} + tangentMode: 0 + - serializedVersion: 2 + time: 1 + value: {x: -90, y: 0, z: 0} + inSlope: {x: -178.53796, y: 0, z: 0} + outSlope: {x: -178.53796, y: 0, z: 0} + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Image + m_PositionCurves: [] + m_ScaleCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: {x: 0.3, y: 0.3, z: 1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + - serializedVersion: 2 + time: 0.5 + value: {x: 1, y: 1, z: 1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + - serializedVersion: 2 + time: 1 + value: {x: 0.2, y: 0.2, z: 1} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Image + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: -0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0.5 + inSlope: 1.4000001 + outSlope: 1.4000001 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 1.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchorMax.x + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchorMax.y + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: -0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0.5 + inSlope: 1.4000001 + outSlope: 1.4000001 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 1.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchorMin.x + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchorMin.y + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - path: 83635035 + attribute: 4 + script: {fileID: 0} + classID: 4 + customType: 14 + isPPtrCurve: 0 + - path: 83635035 + attribute: 3 + script: {fileID: 0} + classID: 4 + customType: 0 + isPPtrCurve: 0 + - path: 83635035 + attribute: 2711263438 + script: {fileID: 0} + classID: 224 + customType: 0 + isPPtrCurve: 0 + - path: 83635035 + attribute: 2089119715 + script: {fileID: 0} + classID: 224 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 1574349066 + script: {fileID: 0} + classID: 225 + customType: 0 + isPPtrCurve: 0 + - path: 83635035 + attribute: 3600656472 + script: {fileID: 0} + classID: 224 + customType: 0 + isPPtrCurve: 0 + - path: 83635035 + attribute: 193093493 + script: {fileID: 0} + classID: 224 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: -0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0.5 + inSlope: 1.4000001 + outSlope: 1.4000001 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 1.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchorMax.x + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchorMax.y + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: -0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0.5 + inSlope: 1.4000001 + outSlope: 1.4000001 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 1.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchorMin.x + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_AnchorMin.y + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.x + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0.2 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.y + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalScale.z + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 90 + inSlope: -198.47397 + outSlope: -198.47397 + tangentMode: 0 + - serializedVersion: 2 + time: 0.5 + value: 0 + inSlope: -180 + outSlope: -180 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: -90 + inSlope: -178.53796 + outSlope: -178.53796 + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.x + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.y + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.z + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + m_EulerEditorCurves: + - curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.x + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.y + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.z + path: Image + classID: 224 + script: {fileID: 0} + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_GenerateMotionCurves: 0 + m_IsEmpty: 0 + m_Events: [] diff --git a/Examples/FancyScrollView/01_Basic/Animations/01_Basic_Animation.anim.meta b/Examples/FancyScrollView/01_Basic/Animations/01_Basic_Animation.anim.meta new file mode 100644 index 0000000..83f1fac --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Animations/01_Basic_Animation.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9e6e4c5500df9dc439749ba892b2995c +timeCreated: 1487186596 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/01_Basic/Animations/01_Basic_CellScroll.controller b/Examples/FancyScrollView/01_Basic/Animations/01_Basic_CellScroll.controller new file mode 100644 index 0000000..9b8d31d --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Animations/01_Basic_CellScroll.controller @@ -0,0 +1,95 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: 01_Basic_CellScroll + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: scroll + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 1 + m_Controller: {fileID: 9100000} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 1107904440216339570} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1101 &1101181072344081740 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102900943980948860} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.1 + m_TransitionOffset: 0 + m_ExitTime: 0.9 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &1102900943980948860 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: scroll + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 9e6e4c5500df9dc439749ba892b2995c, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: +--- !u!1107 &1107904440216339570 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102900943980948860} + m_Position: {x: 252, y: 24, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: + - {fileID: 1101181072344081740} + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102900943980948860} diff --git a/Examples/FancyScrollView/01_Basic/Animations/01_Basic_CellScroll.controller.meta b/Examples/FancyScrollView/01_Basic/Animations/01_Basic_CellScroll.controller.meta new file mode 100644 index 0000000..59097c2 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Animations/01_Basic_CellScroll.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8bbdb068c73989c438aef167096a86cb +timeCreated: 1487186612 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/01_Basic/Example01CellDto.cs b/Examples/FancyScrollView/01_Basic/Example01CellDto.cs new file mode 100644 index 0000000..9cfb5d7 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Example01CellDto.cs @@ -0,0 +1,7 @@ +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example01CellDto + { + public string Message; + } +} diff --git a/Examples/FancyScrollView/01_Basic/Example01CellDto.cs.meta b/Examples/FancyScrollView/01_Basic/Example01CellDto.cs.meta new file mode 100644 index 0000000..220ee03 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Example01CellDto.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e14503efd7a60d54db0d148e00aa2169 +timeCreated: 1487508481 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/01_Basic/Example01Scene.cs b/Examples/FancyScrollView/01_Basic/Example01Scene.cs new file mode 100644 index 0000000..1212164 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Example01Scene.cs @@ -0,0 +1,19 @@ +using System.Linq; + +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example01Scene : MonoBehaviour + { + [SerializeField] + Example01ScrollView scrollView; + + void Start() + { + var cellData = Enumerable.Range(0, 20) + .Select(i => new Example01CellDto { Message = "Cell " + i }) + .ToList(); + + scrollView.UpdateData(cellData); + } + } +} diff --git a/Examples/FancyScrollView/01_Basic/Example01Scene.cs.meta b/Examples/FancyScrollView/01_Basic/Example01Scene.cs.meta new file mode 100644 index 0000000..856450e --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Example01Scene.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 69123a589054bf041ba5ead99364646f +timeCreated: 1487186233 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/01_Basic/Example01ScrollView.cs b/Examples/FancyScrollView/01_Basic/Example01ScrollView.cs new file mode 100644 index 0000000..91a03ab --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Example01ScrollView.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example01ScrollView : FancyScrollView + { + + [SerializeField] + ScrollPositionController scrollPositionController; + + new void Awake() + { + base.Awake(); + scrollPositionController.OnUpdatePosition.AddListener(UpdatePosition); + } + + public void UpdateData(List data) + { + cellData = data; + scrollPositionController.SetDataCount(cellData.Count); + UpdateContents(); + } + } +} diff --git a/Examples/FancyScrollView/01_Basic/Example01ScrollView.cs.meta b/Examples/FancyScrollView/01_Basic/Example01ScrollView.cs.meta new file mode 100644 index 0000000..a9da031 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Example01ScrollView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c7e0222f92bdad84c9ee57a127efe088 +timeCreated: 1487262733 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/01_Basic/Example01ScrollViewCell.cs b/Examples/FancyScrollView/01_Basic/Example01ScrollViewCell.cs new file mode 100644 index 0000000..a35b7f7 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Example01ScrollViewCell.cs @@ -0,0 +1,40 @@ +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example01ScrollViewCell : FancyScrollViewCell + { + [SerializeField] + Animator animator; + [SerializeField] + Text message; + + readonly int scrollTriggerHash = Animator.StringToHash("scroll"); + + void Start() + { + var rectTransform = transform as RectTransform; + rectTransform.anchorMax = Vector2.one; + rectTransform.anchorMin = Vector2.zero; + rectTransform.anchoredPosition3D = Vector3.zero; + UpdatePosition(0); + } + + /// + /// セルの内容を更新します + /// + /// + public override void UpdateContent(Example01CellDto itemData) + { + message.text = itemData.Message; + } + + /// + /// セルの位置を更新します + /// + /// + public override void UpdatePosition(float position) + { + animator.Play(scrollTriggerHash, -1, position); + animator.speed = 0; + } + } +} diff --git a/Examples/FancyScrollView/01_Basic/Example01ScrollViewCell.cs.meta b/Examples/FancyScrollView/01_Basic/Example01ScrollViewCell.cs.meta new file mode 100644 index 0000000..826e107 --- /dev/null +++ b/Examples/FancyScrollView/01_Basic/Example01ScrollViewCell.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b77a04c729f174c478baf21a47c16620 +timeCreated: 1487184978 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/02_CellEventHandling.meta b/Examples/FancyScrollView/02_CellEventHandling.meta new file mode 100644 index 0000000..b4f0cd4 --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 577dcbd98667cbb47ba8c97b564802d2 +folderAsset: yes +timeCreated: 1501610675 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/02_CellEventHandling/02_CellEventHandling.unity b/Examples/FancyScrollView/02_CellEventHandling/02_CellEventHandling.unity new file mode 100644 index 0000000..6a07247 --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/02_CellEventHandling.unity @@ -0,0 +1,750 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 8 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.37311947, g: 0.38074005, b: 0.35872722, a: 1} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 8 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFiltering: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousColorSigma: 1 + m_PVRFilteringAtrousNormalSigma: 1 + m_PVRFilteringAtrousPositionSigma: 1 + m_LightingDataAsset: {fileID: 0} + m_ShadowMaskMode: 2 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &650160435 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 650160439} + - component: {fileID: 650160438} + - component: {fileID: 650160437} + - component: {fileID: 650160436} + - component: {fileID: 650160440} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &650160436 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &650160437 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &650160438 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 777088607} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 25 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &650160439 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1492537696} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &650160440 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b945ba693af0d824989e76c183a47fb3, type: 3} + m_Name: + m_EditorClassIdentifier: + scrollView: {fileID: 1492537697} +--- !u!1 &777088603 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 777088608} + - component: {fileID: 777088607} + - component: {fileID: 777088606} + - component: {fileID: 777088605} + - component: {fileID: 777088604} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &777088604 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 +--- !u!124 &777088605 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 +--- !u!92 &777088606 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 +--- !u!20 &777088607 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &777088608 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1012097242 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1012097243} + - component: {fileID: 1012097245} + - component: {fileID: 1012097244} + - component: {fileID: 1012097246} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1012097243 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} + m_LocalRotation: {x: 0.5, y: 0, z: 0, w: 0.8660254} + m_LocalPosition: {x: 0, y: 0, z: 276} + m_LocalScale: {x: 0.3, y: 0.3, z: 1} + m_Children: + - {fileID: 1506879310} + m_Father: {fileID: 1590362722} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 60, y: 0, z: 0} + m_AnchorMin: {x: -0.2, y: 0.5} + m_AnchorMax: {x: -0.2, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 450} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1012097244 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1012097245 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} +--- !u!114 &1012097246 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1012097244} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!1 &1492537695 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1492537696} + - component: {fileID: 1492537699} + - component: {fileID: 1492537702} + - component: {fileID: 1492537701} + - component: {fileID: 1492537697} + m_Layer: 5 + m_Name: ScrollView + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1492537696 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1590362722} + m_Father: {fileID: 650160439} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1492537697 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5b1ee62a075132e49b6fc82cd114e89d, type: 3} + m_Name: + m_EditorClassIdentifier: + cellInterval: 0.15 + cellOffset: 0.5 + loop: 0 + cellBase: {fileID: 1590362721} + scrollPositionController: {fileID: 1492537699} +--- !u!114 &1492537699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc9ad31350b1b6348b57c626195a562d, type: 3} + m_Name: + m_EditorClassIdentifier: + viewport: {fileID: 1492537696} + directionOfRecognize: 1 + movementType: 1 + elasticity: 0.1 + scrollSensitivity: 7 + inertia: 1 + decelerationRate: 0.03 + snap: + Enable: 1 + VelocityThreshold: 0.5 + Duration: 0.3 + dataCount: 0 +--- !u!114 &1492537701 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1492537702 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} +--- !u!1 &1506879309 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1506879310} + - component: {fileID: 1506879312} + - component: {fileID: 1506879311} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1506879310 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1506879309} + m_LocalRotation: {x: 0.008726558, y: 0, z: 0, w: 0.999962} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1012097243} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 1, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 160, y: 35} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1506879311 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1506879309} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 3 + m_BestFit: 0 + m_MinSize: 3 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!222 &1506879312 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1506879309} +--- !u!1 &1590362721 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1590362722} + - component: {fileID: 1590362725} + - component: {fileID: 1590362723} + - component: {fileID: 1590362724} + - component: {fileID: 1590362726} + m_Layer: 5 + m_Name: Cell + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1590362722 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1012097243} + m_Father: {fileID: 1492537696} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!95 &1590362723 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 8bbdb068c73989c438aef167096a86cb, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 +--- !u!114 &1590362724 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9409f360a0deeb949a3635126edf8000, type: 3} + m_Name: + m_EditorClassIdentifier: + animator: {fileID: 1590362723} + message: {fileID: 1506879311} + image: {fileID: 1012097244} + button: {fileID: 1012097246} +--- !u!222 &1590362725 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} +--- !u!225 &1590362726 +CanvasGroup: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!1 &1770868449 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1770868452} + - component: {fileID: 1770868451} + - component: {fileID: 1770868450} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1770868450 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1770868449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1770868451 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1770868449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &1770868452 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1770868449} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Examples/FancyScrollView/02_CellEventHandling/02_CellEventHandling.unity.meta b/Examples/FancyScrollView/02_CellEventHandling/02_CellEventHandling.unity.meta new file mode 100644 index 0000000..32d19cb --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/02_CellEventHandling.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 22d1be941599faf45b04ab4c6a2def09 +timeCreated: 1487505810 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02CellDto.cs b/Examples/FancyScrollView/02_CellEventHandling/Example02CellDto.cs new file mode 100644 index 0000000..b3f1a83 --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02CellDto.cs @@ -0,0 +1,7 @@ +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example02CellDto + { + public string Message; + } +} diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02CellDto.cs.meta b/Examples/FancyScrollView/02_CellEventHandling/Example02CellDto.cs.meta new file mode 100644 index 0000000..9ad4a3c --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02CellDto.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cf9eb20bd16f1aa448580b085861a75b +timeCreated: 1487505929 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02Scene.cs b/Examples/FancyScrollView/02_CellEventHandling/Example02Scene.cs new file mode 100644 index 0000000..0684e5a --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02Scene.cs @@ -0,0 +1,19 @@ +using System.Linq; + +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example02Scene : MonoBehaviour + { + [SerializeField] + Example02ScrollView scrollView; + + void Start() + { + var cellData = Enumerable.Range(0, 20) + .Select(i => new Example02CellDto { Message = "Cell " + i }) + .ToList(); + + scrollView.UpdateData(cellData); + } + } +} diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02Scene.cs.meta b/Examples/FancyScrollView/02_CellEventHandling/Example02Scene.cs.meta new file mode 100644 index 0000000..29cff92 --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02Scene.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b945ba693af0d824989e76c183a47fb3 +timeCreated: 1487506430 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollView.cs b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollView.cs new file mode 100644 index 0000000..d1e56c9 --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollView.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example02ScrollView : FancyScrollView + { + [SerializeField] + ScrollPositionController scrollPositionController; + + new void Awake() + { + scrollPositionController.OnUpdatePosition.AddListener(UpdatePosition); + SetContext(new Example02ScrollViewContext { OnPressedCell = OnPressedCell }); + base.Awake(); + } + + public void UpdateData(List data) + { + cellData = data; + scrollPositionController.SetDataCount(cellData.Count); + UpdateContents(); + } + + void OnPressedCell(Example02ScrollViewCell cell) + { + scrollPositionController.ScrollTo(cell.DataIndex, 0.4f); + context.SelectedIndex = cell.DataIndex; + UpdateContents(); + } + } +} diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollView.cs.meta b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollView.cs.meta new file mode 100644 index 0000000..af0e6af --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5b1ee62a075132e49b6fc82cd114e89d +timeCreated: 1487505830 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewCell.cs b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewCell.cs new file mode 100644 index 0000000..31d3ce3 --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewCell.cs @@ -0,0 +1,73 @@ +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example02ScrollViewCell + : FancyScrollViewCell + { + [SerializeField] + Animator animator; + [SerializeField] + Text message; + [SerializeField] + Image image; + [SerializeField] + Button button; + + readonly int scrollTriggerHash = Animator.StringToHash("scroll"); + Example02ScrollViewContext context; + + void Start() + { + var rectTransform = transform as RectTransform; + rectTransform.anchorMax = Vector2.one; + rectTransform.anchorMin = Vector2.zero; + rectTransform.anchoredPosition3D = Vector3.zero; + UpdatePosition(0); + + button.onClick.AddListener(OnPressedCell); + } + + /// + /// コンテキストを設定します + /// + /// + public override void SetContext(Example02ScrollViewContext context) + { + this.context = context; + } + + /// + /// セルの内容を更新します + /// + /// + public override void UpdateContent(Example02CellDto itemData) + { + message.text = itemData.Message; + + if (context != null) + { + var isSelected = context.SelectedIndex == DataIndex; + image.color = isSelected + ? new Color32(0, 255, 255, 100) + : new Color32(255, 255, 255, 77); + } + } + + /// + /// セルの位置を更新します + /// + /// + public override void UpdatePosition(float position) + { + animator.Play(scrollTriggerHash, -1, position); + animator.speed = 0; + } + + public void OnPressedCell() + { + if (context != null) + { + context.OnPressedCell(this); + } + } + } +} diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewCell.cs.meta b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewCell.cs.meta new file mode 100644 index 0000000..9092214 --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewCell.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9409f360a0deeb949a3635126edf8000 +timeCreated: 1487505842 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewContext.cs b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewContext.cs new file mode 100644 index 0000000..fdfd6fd --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewContext.cs @@ -0,0 +1,8 @@ +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example02ScrollViewContext + { + public System.Action OnPressedCell; + public int SelectedIndex; + } +} diff --git a/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewContext.cs.meta b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewContext.cs.meta new file mode 100644 index 0000000..d2ec0bc --- /dev/null +++ b/Examples/FancyScrollView/02_CellEventHandling/Example02ScrollViewContext.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 82429dd602c927c4faab5b80397e65a3 +timeCreated: 1487505870 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll.meta b/Examples/FancyScrollView/03_InfiniteScroll.meta new file mode 100644 index 0000000..df80474 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: d648997d940777f41b77d17ab29f5cea +folderAsset: yes +timeCreated: 1501610675 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll/03_InfiniteScroll.unity b/Examples/FancyScrollView/03_InfiniteScroll/03_InfiniteScroll.unity new file mode 100644 index 0000000..3953772 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/03_InfiniteScroll.unity @@ -0,0 +1,755 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 8 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.37311947, g: 0.38074005, b: 0.35872722, a: 1} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 8 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 1 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFiltering: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousColorSigma: 1 + m_PVRFilteringAtrousNormalSigma: 1 + m_PVRFilteringAtrousPositionSigma: 1 + m_LightingDataAsset: {fileID: 0} + m_ShadowMaskMode: 2 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &650160435 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 650160439} + - component: {fileID: 650160438} + - component: {fileID: 650160437} + - component: {fileID: 650160436} + - component: {fileID: 650160440} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &650160436 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &650160437 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &650160438 +Canvas: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 777088607} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 25 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &650160439 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1492537696} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!114 &650160440 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 650160435} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45018617dd0e7cf4d8b8800224ac5d40, type: 3} + m_Name: + m_EditorClassIdentifier: + scrollView: {fileID: 1492537697} +--- !u!1 &777088603 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 777088608} + - component: {fileID: 777088607} + - component: {fileID: 777088606} + - component: {fileID: 777088605} + - component: {fileID: 777088604} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &777088604 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 +--- !u!124 &777088605 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 +--- !u!92 &777088606 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 +--- !u!20 &777088607 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 1 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &777088608 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 777088603} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1012097242 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1012097243} + - component: {fileID: 1012097245} + - component: {fileID: 1012097244} + - component: {fileID: 1012097246} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1012097243 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} + m_LocalRotation: {x: 0.6427876, y: 0, z: 0, w: 0.7660445} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.8, y: 0.8, z: 1} + m_Children: + - {fileID: 1506879310} + m_Father: {fileID: 1590362722} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: -80, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.7} + m_AnchorMax: {x: 0.5, y: 0.7} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 200, y: 400} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1012097244 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1012097245 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} +--- !u!114 &1012097246 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1012097242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 0 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1012097244} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!1 &1492537695 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1492537696} + - component: {fileID: 1492537699} + - component: {fileID: 1492537702} + - component: {fileID: 1492537701} + - component: {fileID: 1492537697} + m_Layer: 5 + m_Name: ScrollView + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1492537696 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1590362722} + m_Father: {fileID: 650160439} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1492537697 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7454b91158ad32e49ab5d3cdac132574, type: 3} + m_Name: + m_EditorClassIdentifier: + cellInterval: 0.06666667 + cellOffset: 0.5 + loop: 1 + cellBase: {fileID: 1590362721} + scrollPositionController: {fileID: 1492537699} +--- !u!114 &1492537699 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cc9ad31350b1b6348b57c626195a562d, type: 3} + m_Name: + m_EditorClassIdentifier: + viewport: {fileID: 1492537696} + directionOfRecognize: 1 + movementType: 0 + elasticity: 0.1 + scrollSensitivity: 7 + inertia: 1 + decelerationRate: 0.03 + snap: + Enable: 1 + VelocityThreshold: 0.5 + Duration: 0.3 + dataCount: 0 + OnUpdatePosition: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Extensions.ScrollPositionController+UpdatePositionEvent, + Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null +--- !u!114 &1492537701 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1492537702 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1492537695} +--- !u!1 &1506879309 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1506879310} + - component: {fileID: 1506879312} + - component: {fileID: 1506879311} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1506879310 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1506879309} + m_LocalRotation: {x: 0.008726558, y: 0, z: 0, w: 0.999962} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1012097243} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 1, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 160, y: 35} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1506879311 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1506879309} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 3 + m_BestFit: 0 + m_MinSize: 3 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: +--- !u!222 &1506879312 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1506879309} +--- !u!1 &1590362721 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1590362722} + - component: {fileID: 1590362725} + - component: {fileID: 1590362723} + - component: {fileID: 1590362724} + - component: {fileID: 1590362728} + m_Layer: 5 + m_Name: Cell + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1590362722 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_LocalRotation: {x: -0, y: -0.026176924, z: -0.99965733, w: 0} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1012097243} + m_Father: {fileID: 1492537696} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: -3, y: 0, z: -180} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 980, y: 552} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!95 &1590362723 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: c1a16bf117472bf47b662d4bc2647177, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 +--- !u!114 &1590362724 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 173c545de5ff4e048bcc3642f8392e4e, type: 3} + m_Name: + m_EditorClassIdentifier: + animator: {fileID: 1590362723} + message: {fileID: 1506879311} + image: {fileID: 1012097244} + button: {fileID: 1012097246} +--- !u!222 &1590362725 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} +--- !u!225 &1590362728 +CanvasGroup: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1590362721} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!1 &1770868449 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1770868452} + - component: {fileID: 1770868451} + - component: {fileID: 1770868450} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1770868450 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1770868449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &1770868451 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1770868449} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 5 +--- !u!4 &1770868452 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1770868449} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Examples/FancyScrollView/03_InfiniteScroll/03_InfiniteScroll.unity.meta b/Examples/FancyScrollView/03_InfiniteScroll/03_InfiniteScroll.unity.meta new file mode 100644 index 0000000..d7534c5 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/03_InfiniteScroll.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1f93c60c8aa572040a751a20a626451f +timeCreated: 1487505810 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Animations.meta b/Examples/FancyScrollView/03_InfiniteScroll/Animations.meta new file mode 100644 index 0000000..82c7dcb --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Animations.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 94b9a5282934b8c43b2aeb7a25815a99 +folderAsset: yes +timeCreated: 1488028867 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_Animation.anim b/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_Animation.anim new file mode 100644 index 0000000..a541fd7 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_Animation.anim @@ -0,0 +1,468 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: 03_InfiniteScroll_Animation + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: {x: 0, y: 0, z: -250} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + - serializedVersion: 2 + time: 0.5 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 450} + outSlope: {x: 0, y: 0, z: 450} + tangentMode: 0 + - serializedVersion: 2 + time: 1 + value: {x: 0, y: 0, z: 200} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: {x: 80, y: -80, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + - serializedVersion: 2 + time: 0.5 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 160, z: 0} + outSlope: {x: 0, y: 160, z: 0} + tangentMode: 0 + - serializedVersion: 2 + time: 1 + value: {x: 80, y: 80, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: Image + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: -250 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 250 + inSlope: 2000 + outSlope: 2000 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 2750 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: + classID: 224 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - path: 0 + attribute: 4 + script: {fileID: 0} + classID: 4 + customType: 14 + isPPtrCurve: 0 + - path: 83635035 + attribute: 4 + script: {fileID: 0} + classID: 4 + customType: 14 + isPPtrCurve: 0 + - path: 0 + attribute: 1574349066 + script: {fileID: 0} + classID: 225 + customType: 0 + isPPtrCurve: 0 + - path: 0 + attribute: 2033536083 + script: {fileID: 0} + classID: 224 + customType: 28 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.x + path: + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.y + path: + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: -250 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0 + inSlope: 450 + outSlope: 450 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 200 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.z + path: + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 80 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 80 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.x + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: -80 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0 + inSlope: 160 + outSlope: 160 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 80 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.y + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: localEulerAnglesRaw.z + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 2 + time: 0 + value: -250 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + - serializedVersion: 2 + time: 0.5 + value: 250 + inSlope: 2000 + outSlope: 2000 + tangentMode: 136 + - serializedVersion: 2 + time: 1 + value: 2750 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: + classID: 224 + script: {fileID: 0} + m_EulerEditorCurves: + - curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.z + path: + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.y + path: + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.x + path: + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.x + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.y + path: Image + classID: 224 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalEulerAngles.z + path: Image + classID: 224 + script: {fileID: 0} + m_HasGenericRootTransform: 1 + m_HasMotionFloatCurves: 0 + m_GenerateMotionCurves: 0 + m_IsEmpty: 0 + m_Events: [] diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_Animation.anim.meta b/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_Animation.anim.meta new file mode 100644 index 0000000..df6b1ed --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_Animation.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: add491cbb06317b48a88a94b0081db1d +timeCreated: 1487186596 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_CellScroll.controller b/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_CellScroll.controller new file mode 100644 index 0000000..86c8605 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_CellScroll.controller @@ -0,0 +1,121 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: 03_InfiniteScroll_CellScroll + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: scroll + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 1 + m_Controller: {fileID: 9100000} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 1107904440216339570} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1101 &1101181072344081740 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 1102900943980948860} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.1 + m_TransitionOffset: 0 + m_ExitTime: 0.9 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &1102483224443493760 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: New State + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 0} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: +--- !u!1102 &1102900943980948860 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: scroll + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_Motion: {fileID: 7400000, guid: add491cbb06317b48a88a94b0081db1d, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: +--- !u!1107 &1107904440216339570 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 1102483224443493760} + m_Position: {x: 264, y: 144, z: 0} + - serializedVersion: 1 + m_State: {fileID: 1102900943980948860} + m_Position: {x: 252, y: 24, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: + - {fileID: 1101181072344081740} + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 1102483224443493760} diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_CellScroll.controller.meta b/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_CellScroll.controller.meta new file mode 100644 index 0000000..b89da69 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Animations/03_InfiniteScroll_CellScroll.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c1a16bf117472bf47b662d4bc2647177 +timeCreated: 1487186612 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03CellDto.cs b/Examples/FancyScrollView/03_InfiniteScroll/Example03CellDto.cs new file mode 100644 index 0000000..f84fd25 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03CellDto.cs @@ -0,0 +1,7 @@ +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example03CellDto + { + public string Message; + } +} diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03CellDto.cs.meta b/Examples/FancyScrollView/03_InfiniteScroll/Example03CellDto.cs.meta new file mode 100644 index 0000000..8ba8e07 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03CellDto.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: f620c6407f9b6c74390ab02bfa99d777 +timeCreated: 1487505929 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03Scene.cs b/Examples/FancyScrollView/03_InfiniteScroll/Example03Scene.cs new file mode 100644 index 0000000..1e07d18 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03Scene.cs @@ -0,0 +1,19 @@ +using System.Linq; + +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example03Scene : MonoBehaviour + { + [SerializeField] + Example03ScrollView scrollView; + + void Start() + { + var cellData = Enumerable.Range(0, 20) + .Select(i => new Example03CellDto { Message = "Cell " + i }) + .ToList(); + + scrollView.UpdateData(cellData); + } + } +} diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03Scene.cs.meta b/Examples/FancyScrollView/03_InfiniteScroll/Example03Scene.cs.meta new file mode 100644 index 0000000..b69367b --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03Scene.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 45018617dd0e7cf4d8b8800224ac5d40 +timeCreated: 1487506430 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollView.cs b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollView.cs new file mode 100644 index 0000000..c51e273 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollView.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example03ScrollView : FancyScrollView + { + [SerializeField] + ScrollPositionController scrollPositionController; + + new void Awake() + { + scrollPositionController.OnUpdatePosition.AddListener(UpdatePosition); + SetContext(new Example03ScrollViewContext { OnPressedCell = OnPressedCell }); + base.Awake(); + } + + public void UpdateData(List data) + { + cellData = data; + scrollPositionController.SetDataCount(cellData.Count); + UpdateContents(); + } + + void OnPressedCell(Example03ScrollViewCell cell) + { + scrollPositionController.ScrollTo(cell.DataIndex, 0.4f); + context.SelectedIndex = cell.DataIndex; + UpdateContents(); + } + + } +} diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollView.cs.meta b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollView.cs.meta new file mode 100644 index 0000000..b5f7a1b --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7454b91158ad32e49ab5d3cdac132574 +timeCreated: 1487505830 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewCell.cs b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewCell.cs new file mode 100644 index 0000000..3318fea --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewCell.cs @@ -0,0 +1,73 @@ +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example03ScrollViewCell + : FancyScrollViewCell + { + [SerializeField] + Animator animator; + [SerializeField] + Text message; + [SerializeField] + Image image; + [SerializeField] + Button button; + + readonly int scrollTriggerHash = Animator.StringToHash("scroll"); + Example03ScrollViewContext context; + + void Start() + { + var rectTransform = transform as RectTransform; + rectTransform.anchorMax = Vector2.one; + rectTransform.anchorMin = Vector2.zero; + rectTransform.anchoredPosition3D = Vector3.zero; + UpdatePosition(0); + + button.onClick.AddListener(OnPressedCell); + } + + /// + /// コンテキストを設定します + /// + /// + public override void SetContext(Example03ScrollViewContext context) + { + this.context = context; + } + + /// + /// セルの内容を更新します + /// + /// + public override void UpdateContent(Example03CellDto itemData) + { + message.text = itemData.Message; + + if (context != null) + { + var isSelected = context.SelectedIndex == DataIndex; + image.color = isSelected + ? new Color32(0, 255, 255, 100) + : new Color32(255, 255, 255, 77); + } + } + + /// + /// セルの位置を更新します + /// + /// + public override void UpdatePosition(float position) + { + animator.Play(scrollTriggerHash, -1, position); + animator.speed = 0; + } + + public void OnPressedCell() + { + if (context != null) + { + context.OnPressedCell(this); + } + } + } +} diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewCell.cs.meta b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewCell.cs.meta new file mode 100644 index 0000000..5d437a8 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewCell.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 173c545de5ff4e048bcc3642f8392e4e +timeCreated: 1487505842 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewContext.cs b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewContext.cs new file mode 100644 index 0000000..ecb1eaa --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewContext.cs @@ -0,0 +1,8 @@ +namespace UnityEngine.UI.Extensions.Examples +{ + public class Example03ScrollViewContext + { + public System.Action OnPressedCell; + public int SelectedIndex; + } +} diff --git a/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewContext.cs.meta b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewContext.cs.meta new file mode 100644 index 0000000..ad6e507 --- /dev/null +++ b/Examples/FancyScrollView/03_InfiniteScroll/Example03ScrollViewContext.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 90b3672ca30312045afd42deb38c2f6e +timeCreated: 1487505870 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Examples/HSS-VSS-ScrollSnap/PaginationScript.cs b/Examples/HSS-VSS-ScrollSnap/PaginationScript.cs index c00c0bc..f2f0b0c 100644 --- a/Examples/HSS-VSS-ScrollSnap/PaginationScript.cs +++ b/Examples/HSS-VSS-ScrollSnap/PaginationScript.cs @@ -1,17 +1,18 @@ -using UnityEngine; -using UnityEngine.EventSystems; -using UnityEngine.UI.Extensions; +using UnityEngine.EventSystems; -public class PaginationScript : MonoBehaviour, IPointerClickHandler +namespace UnityEngine.UI.Extensions.Examples { - public HorizontalScrollSnap hss; - public int Page; - - public void OnPointerClick(PointerEventData eventData) + public class PaginationScript : MonoBehaviour, IPointerClickHandler { - if (hss != null) + public HorizontalScrollSnap hss; + public int Page; + + public void OnPointerClick(PointerEventData eventData) { - hss.GoToScreen(Page); + if (hss != null) + { + hss.GoToScreen(Page); + } } } -} +} \ No newline at end of file diff --git a/Examples/HSS-VSS-ScrollSnap/ScrollSnapManagedTests.unity b/Examples/HSS-VSS-ScrollSnap/ScrollSnapManagedTests.unity index 00129e9..7494927 100644 --- a/Examples/HSS-VSS-ScrollSnap/ScrollSnapManagedTests.unity +++ b/Examples/HSS-VSS-ScrollSnap/ScrollSnapManagedTests.unity @@ -141,11 +141,11 @@ RectTransform: - {fileID: 2093228243} - {fileID: 1673151533} m_Father: {fileID: 448991457} - m_RootOrder: 5 + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 225.1, y: -99.100006} + m_AnchoredPosition: {x: 225.10002, y: -99.100006} m_SizeDelta: {x: -496.4, y: -233.4} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2641525 @@ -291,6 +291,8 @@ RectTransform: m_Children: - {fileID: 1826600021} - {fileID: 472879517} + - {fileID: 1112321045} + - {fileID: 803284190} m_Father: {fileID: 448991457} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -545,7 +547,7 @@ RectTransform: - {fileID: 896078184} - {fileID: 1096492862} m_Father: {fileID: 448991457} - m_RootOrder: 4 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -844,8 +846,6 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - {fileID: 67156822} - - {fileID: 1112321045} - - {fileID: 803284190} - {fileID: 1200934015} - {fileID: 266467292} - {fileID: 2641524} @@ -1661,6 +1661,80 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 628800540} +--- !u!1 &665010633 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 665010634} + - component: {fileID: 665010636} + - component: {fileID: 665010635} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &665010634 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 665010633} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1530543973} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &665010635 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 665010633} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Scroll Down +--- !u!222 &665010636 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 665010633} --- !u!1 &675753574 GameObject: m_ObjectHideFlags: 0 @@ -1896,17 +1970,17 @@ RectTransform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 803284189} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1482741892} - m_Father: {fileID: 448991457} - m_RootOrder: 2 + m_Father: {fileID: 67156822} + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -113.899994, y: -183.2} + m_AnchoredPosition: {x: -96.399994, y: -169.20001} m_SizeDelta: {x: 150, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &803284191 @@ -2394,6 +2468,8 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1318750537} + - {fileID: 1264033139} + - {fileID: 1530543973} m_Father: {fileID: 1200934015} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2416,8 +2492,8 @@ MonoBehaviour: StartingScreen: 5 PageStep: 1.27 Pagination: {fileID: 0} - PrevButton: {fileID: 1112321044} - NextButton: {fileID: 803284189} + PrevButton: {fileID: 1530543972} + NextButton: {fileID: 1264033135} transitionSpeed: 7.5 UseFastSwipe: 0 FastSwipeThreshold: 100 @@ -2549,6 +2625,80 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1005665639} +--- !u!1 &1011318431 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1011318432} + - component: {fileID: 1011318434} + - component: {fileID: 1011318433} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1011318432 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1011318431} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1264033139} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1011318433 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1011318431} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: "Scroll Up\t" +--- !u!222 &1011318434 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1011318431} --- !u!1 &1045913701 GameObject: m_ObjectHideFlags: 0 @@ -2742,17 +2892,17 @@ RectTransform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1112321044} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1045913702} - m_Father: {fileID: 448991457} - m_RootOrder: 1 + m_Father: {fileID: 67156822} + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: -326.9, y: -183.2} + m_AnchoredPosition: {x: -309.4, y: -169.20001} m_SizeDelta: {x: 150, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1112321046 @@ -3115,7 +3265,7 @@ RectTransform: m_Children: - {fileID: 1005665640} m_Father: {fileID: 448991457} - m_RootOrder: 3 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -3133,6 +3283,117 @@ MonoBehaviour: m_Script: {fileID: -146154839, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &1264033135 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1264033139} + - component: {fileID: 1264033138} + - component: {fileID: 1264033137} + - component: {fileID: 1264033136} + m_Layer: 5 + m_Name: Up Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1264033136 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1264033135} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1264033137} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &1264033137 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1264033135} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1264033138 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1264033135} +--- !u!224 &1264033139 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1264033135} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1011318432} + m_Father: {fileID: 1005665640} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -99, y: 114} + m_SizeDelta: {x: 150, y: 30} + m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1264921919 GameObject: m_ObjectHideFlags: 0 @@ -4024,6 +4285,117 @@ CanvasRenderer: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1522540075} +--- !u!1 &1530543972 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1530543973} + - component: {fileID: 1530543976} + - component: {fileID: 1530543975} + - component: {fileID: 1530543974} + m_Layer: 5 + m_Name: Down Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1530543973 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1530543972} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 665010634} + m_Father: {fileID: 1005665640} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -99, y: -262} + m_SizeDelta: {x: 150, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1530543974 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1530543972} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1530543975} + m_OnClick: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, + Culture=neutral, PublicKeyToken=null +--- !u!114 &1530543975 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1530543972} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1530543976 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1530543972} --- !u!1 &1535867278 GameObject: m_ObjectHideFlags: 0 diff --git a/Examples/HSS-VSS-ScrollSnap/UpdateScrollSnap.cs b/Examples/HSS-VSS-ScrollSnap/UpdateScrollSnap.cs index 1e69c20..37e08dd 100644 --- a/Examples/HSS-VSS-ScrollSnap/UpdateScrollSnap.cs +++ b/Examples/HSS-VSS-ScrollSnap/UpdateScrollSnap.cs @@ -1,78 +1,80 @@ -using UnityEngine; - -public class UpdateScrollSnap : MonoBehaviour { - - public UnityEngine.UI.Extensions.HorizontalScrollSnap HSS; - public UnityEngine.UI.Extensions.VerticalScrollSnap VSS; - public GameObject HorizontalPagePrefab; - public GameObject VerticalPagePrefab; - public UnityEngine.UI.InputField JumpPage; - - - public void AddButton() +namespace UnityEngine.UI.Extensions.Examples +{ + public class UpdateScrollSnap : MonoBehaviour { - if (HSS) + + public UnityEngine.UI.Extensions.HorizontalScrollSnap HSS; + public UnityEngine.UI.Extensions.VerticalScrollSnap VSS; + public GameObject HorizontalPagePrefab; + public GameObject VerticalPagePrefab; + public UnityEngine.UI.InputField JumpPage; + + + public void AddButton() { - var newHSSPage = GameObject.Instantiate(HorizontalPagePrefab); - HSS.AddChild(newHSSPage); + if (HSS) + { + var newHSSPage = GameObject.Instantiate(HorizontalPagePrefab); + HSS.AddChild(newHSSPage); + } + if (VSS) + { + var newVSSPage = GameObject.Instantiate(VerticalPagePrefab); + VSS.AddChild(newVSSPage); + } } - if (VSS) + + public void RemoveButton() { - var newVSSPage = GameObject.Instantiate(VerticalPagePrefab); - VSS.AddChild(newVSSPage); + GameObject removed, removed2; + if (HSS) + { + HSS.RemoveChild(HSS.CurrentPage, out removed); + removed.SetActive(false); + } + if (VSS) + { + VSS.RemoveChild(VSS.CurrentPage, out removed2); + removed2.SetActive(false); + } + } + + public void JumpToPage() + { + int jumpPage = int.Parse(JumpPage.text); + if (HSS) + { + HSS.GoToScreen(jumpPage); + } + if (VSS) + { + VSS.GoToScreen(jumpPage); + } + } + + public void SelectionStartChange() + { + Debug.Log("Scroll Snap change started"); + } + public void SelectionEndChange() + { + Debug.Log("Scroll Snap change finished"); + } + public void PageChange(int page) + { + Debug.Log(string.Format("Scroll Snap page changed to {0}", page)); + } + + public void RemoveAll() + { + GameObject[] children; + HSS.RemoveAllChildren(out children); + VSS.RemoveAllChildren(out children); + } + + public void JumpToSelectedToggle(int page) + { + HSS.GoToScreen(page); } } - - public void RemoveButton() - { - GameObject removed, removed2; - if (HSS) - { - HSS.RemoveChild(HSS.CurrentPage, out removed); - removed.SetActive(false); - } - if (VSS) - { - VSS.RemoveChild(VSS.CurrentPage, out removed2); - removed2.SetActive(false); - } - } - - public void JumpToPage() - { - int jumpPage = int.Parse(JumpPage.text); - if (HSS) - { - HSS.GoToScreen(jumpPage); - } - if (VSS) - { - VSS.GoToScreen(jumpPage); - } - } - - public void SelectionStartChange() - { - Debug.Log("Scroll Snap change started"); - } - public void SelectionEndChange() - { - Debug.Log("Scroll Snap change finished"); - } - public void PageChange(int page) - { - Debug.Log(string.Format("Scroll Snap page changed to {0}",page)); - } - - public void RemoveAll() - { - GameObject[] children; - HSS.RemoveAllChildren(out children); - VSS.RemoveAllChildren(out children); - } - - public void JumpToSelectedToggle(int page) - { - HSS.GoToScreen(page); - } -} +} \ No newline at end of file diff --git a/Examples/RadialSlider/UpdateRadialValue.cs b/Examples/RadialSlider/UpdateRadialValue.cs index 43b964d..1d2b2d8 100644 --- a/Examples/RadialSlider/UpdateRadialValue.cs +++ b/Examples/RadialSlider/UpdateRadialValue.cs @@ -1,30 +1,29 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using UnityEngine.UI.Extensions; - -public class UpdateRadialValue : MonoBehaviour { - - public InputField input; - public RadialSlider slider; - - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - public void UpdateSliderValue () { - float value; - float.TryParse(input.text, out value); - slider.Value = value; - } - - public void UpdateSliderAndle() +namespace UnityEngine.UI.Extensions.Examples +{ + public class UpdateRadialValue : MonoBehaviour { - int value; - int.TryParse(input.text, out value); - slider.Angle = value; + public InputField input; + public RadialSlider slider; + + // Use this for initialization + void Start() + { + + } + + // Update is called once per frame + public void UpdateSliderValue() + { + float value; + float.TryParse(input.text, out value); + slider.Value = value; + } + + public void UpdateSliderAndle() + { + int value; + int.TryParse(input.text, out value); + slider.Angle = value; + } } -} +} \ No newline at end of file diff --git a/Examples/RadialSlider/radial_slider.unity b/Examples/RadialSlider/radial_slider.unity index e357371..b7a51d4 100644 --- a/Examples/RadialSlider/radial_slider.unity +++ b/Examples/RadialSlider/radial_slider.unity @@ -1748,10 +1748,10 @@ RectTransform: m_Father: {fileID: 1428970668} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 128, y: 128} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2138750733 MonoBehaviour: diff --git a/Examples/SerialisationExampleScriptsAndClasses/TestClass.cs b/Examples/SerialisationExampleScriptsAndClasses/TestClass.cs index 1fef88a..c5b2d2d 100644 --- a/Examples/SerialisationExampleScriptsAndClasses/TestClass.cs +++ b/Examples/SerialisationExampleScriptsAndClasses/TestClass.cs @@ -1,13 +1,13 @@ -using UnityEngine; - -[System.Serializable] -public class TestClass { - - public string myString; - public GameObject go; - public string go_id; - public Vector3 somePosition; - public Color color; - public int[] myArray = new int[] {2,43,12}; -} - +namespace UnityEngine.UI.Extensions.Examples +{ + [System.Serializable] + public class TestClass + { + public string myString; + public GameObject go; + public string go_id; + public Vector3 somePosition; + public Color color; + public int[] myArray = new int[] { 2, 43, 12 }; + } +} \ No newline at end of file diff --git a/Examples/SerialisationExampleScriptsAndClasses/TestScript.cs b/Examples/SerialisationExampleScriptsAndClasses/TestScript.cs index 580ebbd..7034958 100644 --- a/Examples/SerialisationExampleScriptsAndClasses/TestScript.cs +++ b/Examples/SerialisationExampleScriptsAndClasses/TestScript.cs @@ -1,81 +1,98 @@ -using UnityEngine; -using UnityEngine.UI.Extensions; +namespace UnityEngine.UI.Extensions.Examples +{ + public class TestScript : MonoBehaviour + { + public string testString = "Hello"; + public GameObject someGameObject; + public string someGameObject_id; + public TestClass testClass = new TestClass(); + public TestClass[] testClassArray = new TestClass[2]; + [DontSaveField] public Transform TransformThatWontBeSaved;//The [DontSaveField] attribute we wrote ourselves prevents the field from being included in the packed component data -public class TestScript : MonoBehaviour { + public void OnSerialize() + { + //This is an example of a OnSerialize method, called before a gameobject is packed into serializable form. + //In this case, the GameObject variable "someGameObject" and those in the testClass and testclass Array instances of TestClass should be reconstructed after loading. + //Since GameObject (and Transform) references assigned during runtime can't be serialized directly, + //we keep a seperate string variable for each GO variable that holds the ID of the GO instead. + //This allows us to just save the ID instead. - public string testString = "Hello"; - public GameObject someGameObject; - public string someGameObject_id; - public TestClass testClass = new TestClass(); - public TestClass[] testClassArray = new TestClass[2]; - [DontSaveField] public Transform TransformThatWontBeSaved;//The [DontSaveField] attribute we wrote ourselves prevents the field from being included in the packed component data + //This example is one way of dealing with GameObject (and Transform) references. If a lot of those occur in your project, + //it might be more efficient to go directly into the static SaveLoad.PackComponent method. and doing it there. - public void OnSerialize() { - //This is an example of a OnSerialize method, called before a gameobject is packed into serializable form. - //In this case, the GameObject variable "someGameObject" and those in the testClass and testclass Array instances of TestClass should be reconstructed after loading. - //Since GameObject (and Transform) references assigned during runtime can't be serialized directly, - //we keep a seperate string variable for each GO variable that holds the ID of the GO instead. - //This allows us to just save the ID instead. + if (someGameObject != null && someGameObject.GetComponent()) + { + someGameObject_id = someGameObject.GetComponent().id; + } + else + { + someGameObject_id = null; + } - //This example is one way of dealing with GameObject (and Transform) references. If a lot of those occur in your project, - //it might be more efficient to go directly into the static SaveLoad.PackComponent method. and doing it there. + if (testClassArray != null) + { + foreach (TestClass testClass_cur in testClassArray) + { + if (testClass_cur.go != null && testClass_cur.go.GetComponent()) + { + testClass_cur.go_id = testClass_cur.go.GetComponent().id; + } + else + { + testClass_cur.go_id = null; + } + } - if(someGameObject != null && someGameObject.GetComponent()) { - someGameObject_id = someGameObject.GetComponent().id; - } - else { - someGameObject_id = null; - } + } + } - if(testClassArray != null) { - foreach(TestClass testClass_cur in testClassArray) { - if(testClass_cur.go != null && testClass_cur.go.GetComponent()) { - testClass_cur.go_id = testClass_cur.go.GetComponent().id; - } - else { - testClass_cur.go_id = null; - } - } + public void OnDeserialize() + { - } - } + //Since we saved the ID of the GameObject references, we can now use those to recreate the references. + //We just iterate through all the ObjectIdentifier component occurences in the scene, compare their id value to our saved and loaded someGameObject id (etc.) value, + //and assign the component's GameObject if it matches. + //Note that the "break" command is important, both because it elimitates unneccessary iterations, + //and because continuing after having found a match might for some reason find another, wrong match that makes a null reference. - public void OnDeserialize() { + ObjectIdentifier[] objectsIdentifiers = FindObjectsOfType(typeof(ObjectIdentifier)) as ObjectIdentifier[]; - //Since we saved the ID of the GameObject references, we can now use those to recreate the references. - //We just iterate through all the ObjectIdentifier component occurences in the scene, compare their id value to our saved and loaded someGameObject id (etc.) value, - //and assign the component's GameObject if it matches. - //Note that the "break" command is important, both because it elimitates unneccessary iterations, - //and because continuing after having found a match might for some reason find another, wrong match that makes a null reference. + if (string.IsNullOrEmpty(someGameObject_id) == false) + { + foreach (ObjectIdentifier objectIdentifier in objectsIdentifiers) + { - ObjectIdentifier[] objectsIdentifiers = FindObjectsOfType(typeof(ObjectIdentifier)) as ObjectIdentifier[]; - - if(string.IsNullOrEmpty(someGameObject_id) == false) { - foreach(ObjectIdentifier objectIdentifier in objectsIdentifiers) { - - if(string.IsNullOrEmpty(objectIdentifier.id) == false) { - if(objectIdentifier.id == someGameObject_id) { - someGameObject = objectIdentifier.gameObject; - break; - } - } - } - } - - if(testClassArray != null) { - foreach(TestClass testClass_cur in testClassArray) { - if(string.IsNullOrEmpty(testClass_cur.go_id) == false) { - foreach (ObjectIdentifier objectIdentifier in objectsIdentifiers) { - if(string.IsNullOrEmpty(objectIdentifier.id) == false) { - if(objectIdentifier.id == testClass_cur.go_id) { - testClass_cur.go = objectIdentifier.gameObject; - break; - } - } - } - } - } - } - } -} + if (string.IsNullOrEmpty(objectIdentifier.id) == false) + { + if (objectIdentifier.id == someGameObject_id) + { + someGameObject = objectIdentifier.gameObject; + break; + } + } + } + } + if (testClassArray != null) + { + foreach (TestClass testClass_cur in testClassArray) + { + if (string.IsNullOrEmpty(testClass_cur.go_id) == false) + { + foreach (ObjectIdentifier objectIdentifier in objectsIdentifiers) + { + if (string.IsNullOrEmpty(objectIdentifier.id) == false) + { + if (objectIdentifier.id == testClass_cur.go_id) + { + testClass_cur.go = objectIdentifier.gameObject; + break; + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/Examples/TextEffects/AnimateEffects.cs b/Examples/TextEffects/AnimateEffects.cs index 58dbf00..78dee3b 100644 --- a/Examples/TextEffects/AnimateEffects.cs +++ b/Examples/TextEffects/AnimateEffects.cs @@ -1,54 +1,51 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI.Extensions; - -public class AnimateEffects : MonoBehaviour +namespace UnityEngine.UI.Extensions.Examples { - - public LetterSpacing letterSpacing; - float letterSpacingMax = 10, letterSpacingMin = -10, letterSpacingModifier = 0.1f; - public CurvedText curvedText; - float curvedTextMax = 0.05f, curvedTextMin = -0.05f, curvedTextModifier = 0.001f; - public Gradient2 gradient2; - float gradient2Max = 1, gradient2Min = -1, gradient2Modifier = 0.01f; - public CylinderText cylinderText; - private Transform cylinderTextRT; - Vector3 cylinderRotation = new Vector3(0, 1, 0); - public SoftMaskScript SAUIM; - float SAUIMMax = 1, SAUIMMin = 0, SAUIMModifier = 0.01f; - // Use this for initialization - void Start() + public class AnimateEffects : MonoBehaviour { - cylinderTextRT = cylinderText.GetComponent(); + public LetterSpacing letterSpacing; + float letterSpacingMax = 10, letterSpacingMin = -10, letterSpacingModifier = 0.1f; + public CurvedText curvedText; + float curvedTextMax = 0.05f, curvedTextMin = -0.05f, curvedTextModifier = 0.001f; + public Gradient2 gradient2; + float gradient2Max = 1, gradient2Min = -1, gradient2Modifier = 0.01f; + public CylinderText cylinderText; + private Transform cylinderTextRT; + Vector3 cylinderRotation = new Vector3(0, 1, 0); + public SoftMaskScript SAUIM; + float SAUIMMax = 1, SAUIMMin = 0, SAUIMModifier = 0.01f; + // Use this for initialization + void Start() + { + cylinderTextRT = cylinderText.GetComponent(); + } + + // Update is called once per frame + void Update() + { + letterSpacing.spacing += letterSpacingModifier; + if (letterSpacing.spacing > letterSpacingMax || letterSpacing.spacing < letterSpacingMin) + { + letterSpacingModifier = -letterSpacingModifier; + } + curvedText.CurveMultiplier += curvedTextModifier; + if (curvedText.CurveMultiplier > curvedTextMax || curvedText.CurveMultiplier < curvedTextMin) + { + curvedTextModifier = -curvedTextModifier; + } + gradient2.Offset += gradient2Modifier; + if (gradient2.Offset > gradient2Max || gradient2.Offset < gradient2Min) + { + gradient2Modifier = -gradient2Modifier; + } + + cylinderTextRT.Rotate(cylinderRotation); + + SAUIM.CutOff += SAUIMModifier; + if (SAUIM.CutOff > SAUIMMax || SAUIM.CutOff < SAUIMMin) + { + SAUIMModifier = -SAUIMModifier; + } + + } } - - // Update is called once per frame - void Update() - { - letterSpacing.spacing += letterSpacingModifier; - if (letterSpacing.spacing > letterSpacingMax || letterSpacing.spacing < letterSpacingMin) - { - letterSpacingModifier = -letterSpacingModifier; - } - curvedText.CurveMultiplier += curvedTextModifier; - if (curvedText.CurveMultiplier > curvedTextMax || curvedText.CurveMultiplier < curvedTextMin) - { - curvedTextModifier = -curvedTextModifier; - } - gradient2.Offset += gradient2Modifier; - if (gradient2.Offset > gradient2Max || gradient2.Offset < gradient2Min) - { - gradient2Modifier = -gradient2Modifier; - } - - cylinderTextRT.Rotate(cylinderRotation); - - SAUIM.CutOff += SAUIMModifier; - if (SAUIM.CutOff > SAUIMMax || SAUIM.CutOff < SAUIMMin) - { - SAUIMModifier = -SAUIMModifier; - } - - } -} +} \ No newline at end of file diff --git a/Examples/TextEffects/testHref.cs b/Examples/TextEffects/testHref.cs index 7d64382..6af6eb2 100644 --- a/Examples/TextEffects/testHref.cs +++ b/Examples/TextEffects/testHref.cs @@ -1,30 +1,30 @@ /// Credit playemgames /// Sourced from - http://forum.unity3d.com/threads/sprite-icons-with-text-e-g-emoticons.265927/ -using UnityEngine; -using UnityEngine.UI.Extensions; - -public class testHref : MonoBehaviour +namespace UnityEngine.UI.Extensions.Examples { - public TextPic textPic; - - void Awake() + public class testHref : MonoBehaviour { - textPic = GetComponent(); - } + public TextPic textPic; - void OnEnable() - { - textPic.onHrefClick.AddListener(OnHrefClick); - } + void Awake() + { + textPic = GetComponent(); + } - void OnDisable() - { - textPic.onHrefClick.RemoveListener(OnHrefClick); - } + void OnEnable() + { + textPic.onHrefClick.AddListener(OnHrefClick); + } - private void OnHrefClick(string hrefName) - { - Debug.Log("Click on the " + hrefName); + void OnDisable() + { + textPic.onHrefClick.RemoveListener(OnHrefClick); + } + + private void OnHrefClick(string hrefName) + { + Debug.Log("Click on the " + hrefName); + } } -} +} \ No newline at end of file diff --git a/Examples/UILineRenderer/LineRendererOrbit.cs b/Examples/UILineRenderer/LineRendererOrbit.cs index 9573285..57085fc 100644 --- a/Examples/UILineRenderer/LineRendererOrbit.cs +++ b/Examples/UILineRenderer/LineRendererOrbit.cs @@ -1,79 +1,78 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI.Extensions; +using System.Collections.Generic; -[RequireComponent(typeof(UILineRenderer))] -public class LineRendererOrbit : MonoBehaviour { - - - UILineRenderer lr; - Circle circle; - public GameObject OrbitGO; - RectTransform orbitGOrt; - float orbitTime; - - [SerializeField] - private float _xAxis = 3; - - public float xAxis +namespace UnityEngine.UI.Extensions.Examples +{ + [RequireComponent(typeof(UILineRenderer))] + public class LineRendererOrbit : MonoBehaviour { - get { return _xAxis; } - set { _xAxis = value; GenerateOrbit(); } - } + UILineRenderer lr; + Circle circle; + public GameObject OrbitGO; + RectTransform orbitGOrt; + float orbitTime; - [SerializeField] - private float _yAxis = 3; + [SerializeField] + private float _xAxis = 3; - public float yAxis - { - get { return _yAxis; } - set { _yAxis = value; GenerateOrbit(); } - } - - [SerializeField] - private int _steps = 10; - - public int Steps - { - get { return _steps; } - set { _steps = value; GenerateOrbit(); } - } - - - - // Use this for initialization - void Awake () { - lr = GetComponent(); - orbitGOrt = OrbitGO.GetComponent(); - GenerateOrbit(); - } - - // Update is called once per frame - void Update () { - orbitTime = orbitTime > _steps ? orbitTime = 0 : orbitTime + Time.deltaTime; - orbitGOrt.localPosition = circle.Evaluate(orbitTime); - } - - void GenerateOrbit() - { - circle = new Circle(xAxis: _xAxis,yAxis: _yAxis, steps: _steps); - List Points = new List(); - for (int i = 0; i < _steps; i++) + public float xAxis { - Points.Add(circle.Evaluate(i)); + get { return _xAxis; } + set { _xAxis = value; GenerateOrbit(); } } - Points.Add(circle.Evaluate(0)); - lr.Points = Points.ToArray(); - } - private void OnValidate() - { - if (lr != null) + [SerializeField] + private float _yAxis = 3; + + public float yAxis { + get { return _yAxis; } + set { _yAxis = value; GenerateOrbit(); } + } + + [SerializeField] + private int _steps = 10; + + public int Steps + { + get { return _steps; } + set { _steps = value; GenerateOrbit(); } + } + + + + // Use this for initialization + void Awake() + { + lr = GetComponent(); + orbitGOrt = OrbitGO.GetComponent(); GenerateOrbit(); } + + // Update is called once per frame + void Update() + { + orbitTime = orbitTime > _steps ? orbitTime = 0 : orbitTime + Time.deltaTime; + orbitGOrt.localPosition = circle.Evaluate(orbitTime); + } + + void GenerateOrbit() + { + circle = new Circle(xAxis: _xAxis, yAxis: _yAxis, steps: _steps); + List Points = new List(); + for (int i = 0; i < _steps; i++) + { + Points.Add(circle.Evaluate(i)); + } + Points.Add(circle.Evaluate(0)); + lr.Points = Points.ToArray(); + } + + private void OnValidate() + { + if (lr != null) + { + GenerateOrbit(); + } + } } - - -} +} \ No newline at end of file diff --git a/Examples/UILineRenderer/TestAddingPoints.cs b/Examples/UILineRenderer/TestAddingPoints.cs index bdeb5fc..7bcbb6c 100644 --- a/Examples/UILineRenderer/TestAddingPoints.cs +++ b/Examples/UILineRenderer/TestAddingPoints.cs @@ -1,22 +1,25 @@ using System.Collections.Generic; -using UnityEngine; -public class TestAddingPoints : MonoBehaviour { - - public UnityEngine.UI.Extensions.UILineRenderer LineRenderer; - public UnityEngine.UI.Text XValue; - public UnityEngine.UI.Text YValue; - - // Use this for initialization - public void AddNewPoint () { - var point = new Vector2() { x = float.Parse(XValue.text), y = float.Parse(YValue.text) }; - var pointlist = new List(LineRenderer.Points); - pointlist.Add(point); - LineRenderer.Points = pointlist.ToArray(); - } - - public void ClearPoints() +namespace UnityEngine.UI.Extensions.Examples +{ + public class TestAddingPoints : MonoBehaviour { - LineRenderer.Points = new Vector2[0]; + public UILineRenderer LineRenderer; + public Text XValue; + public Text YValue; + + // Use this for initialization + public void AddNewPoint() + { + var point = new Vector2() { x = float.Parse(XValue.text), y = float.Parse(YValue.text) }; + var pointlist = new List(LineRenderer.Points); + pointlist.Add(point); + LineRenderer.Points = pointlist.ToArray(); + } + + public void ClearPoints() + { + LineRenderer.Points = new Vector2[0]; + } } -} +} \ No newline at end of file diff --git a/Examples/UILineRenderer/UILineRendererDemo.unity b/Examples/UILineRenderer/UILineRendererDemo.unity index 577ca67..a881512 100644 --- a/Examples/UILineRenderer/UILineRendererDemo.unity +++ b/Examples/UILineRenderer/UILineRendererDemo.unity @@ -140,8 +140,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: -220, y: 1.5} - m_SizeDelta: {x: 263, y: 52} + m_AnchoredPosition: {x: -116, y: -23.5} + m_SizeDelta: {x: 361, y: 47} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &23818492 MonoBehaviour: @@ -284,9 +284,9 @@ RectTransform: m_Father: {fileID: 1754109030} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -339.5, y: -40} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 58, y: 186} m_SizeDelta: {x: 100, y: 102} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &125539413 @@ -735,9 +735,9 @@ RectTransform: m_Father: {fileID: 1754109030} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 243, y: -109} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 0} + m_AnchoredPosition: {x: -165, y: 112} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &651515359 @@ -777,12 +777,7 @@ MonoBehaviour: m_Sprite: {fileID: 0} m_improveResolution: 0 m_Resolution: 0 - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 + m_useNativeSize: 0 m_points: [] lineThickness: 2 relativeSize: 0 @@ -929,6 +924,7 @@ MonoBehaviour: m_Sprite: {fileID: 0} m_improveResolution: 0 m_Resolution: 0 + m_useNativeSize: 0 m_fillPercent: 100 FixedToSegments: 0 m_fill: 1 @@ -974,7 +970,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 314, y: -148} + m_AnchoredPosition: {x: 332, y: -121} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &772182605 @@ -1083,7 +1079,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 35.5, y: 244} + m_AnchoredPosition: {x: 184.5, y: 197} m_SizeDelta: {x: 311, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &977566256 @@ -1157,7 +1153,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -120, y: 40} + m_AnchoredPosition: {x: 29, y: 25.5} m_SizeDelta: {x: 311, y: 189} m_Pivot: {x: 0, y: 0} --- !u!114 &1025621201 @@ -1182,12 +1178,7 @@ MonoBehaviour: m_Sprite: {fileID: 0} m_improveResolution: 0 m_Resolution: 0 - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 + m_useNativeSize: 0 m_points: - {x: 0, y: 0} - {x: 1, y: 0} @@ -1239,7 +1230,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 309, y: -193} + m_AnchoredPosition: {x: 320, y: -169} m_SizeDelta: {x: 358, y: 44} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1032145591 @@ -1984,7 +1975,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: -178, y: 114.5} + m_AnchoredPosition: {x: -124, y: 81} m_SizeDelta: {x: 154, y: 162} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1545772328 @@ -2253,9 +2244,9 @@ RectTransform: m_Father: {fileID: 1754109030} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchorMin: {x: 1, y: 1} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: -358, y: -224} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1625078207 @@ -2843,17 +2834,12 @@ MonoBehaviour: m_Sprite: {fileID: 0} m_improveResolution: 0 m_Resolution: 0 - m_UVRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 + m_useNativeSize: 0 m_points: - - {x: -339, y: -39.5} - - {x: -266, y: -180.5} - - {x: -127, y: -67.5} - - {x: -25, y: -187.5} + - {x: -300, y: -37.5} + - {x: -227, y: -178.5} + - {x: -88, y: -65.5} + - {x: 32, y: -158.5} lineThickness: 7.41 relativeSize: 0 lineList: 0 diff --git a/Examples/UIVerticalScrollerDemo/Scripts/ScrollingCalendar.cs b/Examples/UIVerticalScrollerDemo/Scripts/ScrollingCalendar.cs index acd5d25..65b1f7e 100644 --- a/Examples/UIVerticalScrollerDemo/Scripts/ScrollingCalendar.cs +++ b/Examples/UIVerticalScrollerDemo/Scripts/ScrollingCalendar.cs @@ -5,226 +5,222 @@ /// Please donate: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RJ8D9FRFQF9VS /// -using UnityEngine; -using UnityEngine.UI; -using UnityEngine.UI.Extensions; - - - -public class ScrollingCalendar : MonoBehaviour - +namespace UnityEngine.UI.Extensions.Examples { - public RectTransform monthsScrollingPanel; - public RectTransform yearsScrollingPanel; - public RectTransform daysScrollingPanel; - - public GameObject yearsButtonPrefab; - public GameObject monthsButtonPrefab; - public GameObject daysButtonPrefab; - - private GameObject[] monthsButtons; - private GameObject[] yearsButtons; - private GameObject[] daysButtons; - - public RectTransform monthCenter; - public RectTransform yearsCenter; - public RectTransform daysCenter; - - UIVerticalScroller yearsVerticalScroller; - UIVerticalScroller monthsVerticalScroller; - UIVerticalScroller daysVerticalScroller; - - public InputField inputFieldDays; - public InputField inputFieldMonths; - public InputField inputFieldYears; - - public Text dateText; - - private int daysSet; - private int monthsSet; - private int yearsSet; - - private void InitializeYears() - { - int currentYear = int.Parse(System.DateTime.Now.ToString("yyyy")); - - int[] arrayYears = new int[currentYear+1 - 1900]; - - yearsButtons = new GameObject[arrayYears.Length]; - - for (int i = 0; i < arrayYears.Length; i++) - { - arrayYears[i] = 1900 + i; - - GameObject clone = (GameObject)Instantiate(yearsButtonPrefab, new Vector3(0, i*80, 0), Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject; - clone.transform.SetParent(yearsScrollingPanel,false); - clone.transform.localScale = new Vector3(1, 1, 1); - clone.GetComponentInChildren().text = "" + arrayYears[i]; - clone.name = "Year_" + arrayYears[i]; - clone.AddComponent(); - yearsButtons[i] = clone; - - } - - } - - //Initialize Months - private void InitializeMonths() - { - int[] months = new int[12]; - - monthsButtons = new GameObject[months.Length]; - for (int i = 0; i < months.Length; i++) - { - string month = ""; - months[i] = i; - - GameObject clone = (GameObject)Instantiate(monthsButtonPrefab, new Vector3(0, i * 80, 0), Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject; - clone.transform.SetParent(monthsScrollingPanel,false); - clone.transform.localScale = new Vector3(1, 1, 1); - - switch(i) - { - case 0: - month = "Jan"; - break; - case 1: - month = "Feb"; - break; - case 2: - month = "Mar"; - break; - case 3: - month = "Apr"; - break; - case 4: - month = "May"; - break; - case 5: - month = "Jun"; - break; - case 6: - month = "Jul"; - break; - case 7: - month = "Aug"; - break; - case 8: - month = "Sep"; - break; - case 9: - month = "Oct"; - break; - case 10: - month = "Nov"; - break; - case 11: - month = "Dec"; - break; - } - - clone.GetComponentInChildren().text = month; - clone.name = "Month_" + months[i]; - clone.AddComponent(); - monthsButtons[i] = clone; - } - } - - private void InitializeDays() - { - int[] days = new int[31]; - daysButtons = new GameObject[days.Length]; - - for (var i = 0; i < days.Length; i++) - { - days[i] = i+1; - GameObject clone = (GameObject)Instantiate(daysButtonPrefab, new Vector3(0, i * 80, 0), Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject; - clone.transform.SetParent(daysScrollingPanel,false); - clone.transform.localScale = new Vector3(1, 1, 1); - clone.GetComponentInChildren().text = "" + days[i]; - clone.name = "Day_" + days[i]; - clone.AddComponent(); - daysButtons[i] = clone; - } - } - - // Use this for initialization - public void Awake() + public class ScrollingCalendar : MonoBehaviour { - InitializeYears(); - InitializeMonths(); - InitializeDays(); + public RectTransform monthsScrollingPanel; + public RectTransform yearsScrollingPanel; + public RectTransform daysScrollingPanel; - //Yes Unity complains about this but it doesn't matter in this case. - monthsVerticalScroller = new UIVerticalScroller(monthsScrollingPanel, monthsButtons, monthCenter); - yearsVerticalScroller = new UIVerticalScroller (yearsScrollingPanel, yearsButtons, yearsCenter); - daysVerticalScroller = new UIVerticalScroller (daysScrollingPanel, daysButtons, daysCenter); + public GameObject yearsButtonPrefab; + public GameObject monthsButtonPrefab; + public GameObject daysButtonPrefab; - monthsVerticalScroller.Start(); - yearsVerticalScroller.Start(); - daysVerticalScroller.Start(); + private GameObject[] monthsButtons; + private GameObject[] yearsButtons; + private GameObject[] daysButtons; + + public RectTransform monthCenter; + public RectTransform yearsCenter; + public RectTransform daysCenter; + + UIVerticalScroller yearsVerticalScroller; + UIVerticalScroller monthsVerticalScroller; + UIVerticalScroller daysVerticalScroller; + + public InputField inputFieldDays; + public InputField inputFieldMonths; + public InputField inputFieldYears; + + public Text dateText; + + private int daysSet; + private int monthsSet; + private int yearsSet; + + private void InitializeYears() + { + int currentYear = int.Parse(System.DateTime.Now.ToString("yyyy")); + + int[] arrayYears = new int[currentYear + 1 - 1900]; + + yearsButtons = new GameObject[arrayYears.Length]; + + for (int i = 0; i < arrayYears.Length; i++) + { + arrayYears[i] = 1900 + i; + + GameObject clone = (GameObject)Instantiate(yearsButtonPrefab, new Vector3(0, i * 80, 0), Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject; + clone.transform.SetParent(yearsScrollingPanel, false); + clone.transform.localScale = new Vector3(1, 1, 1); + clone.GetComponentInChildren().text = "" + arrayYears[i]; + clone.name = "Year_" + arrayYears[i]; + clone.AddComponent(); + yearsButtons[i] = clone; + + } + + } + + //Initialize Months + private void InitializeMonths() + { + int[] months = new int[12]; + + monthsButtons = new GameObject[months.Length]; + for (int i = 0; i < months.Length; i++) + { + string month = ""; + months[i] = i; + + GameObject clone = (GameObject)Instantiate(monthsButtonPrefab, new Vector3(0, i * 80, 0), Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject; + clone.transform.SetParent(monthsScrollingPanel, false); + clone.transform.localScale = new Vector3(1, 1, 1); + + switch (i) + { + case 0: + month = "Jan"; + break; + case 1: + month = "Feb"; + break; + case 2: + month = "Mar"; + break; + case 3: + month = "Apr"; + break; + case 4: + month = "May"; + break; + case 5: + month = "Jun"; + break; + case 6: + month = "Jul"; + break; + case 7: + month = "Aug"; + break; + case 8: + month = "Sep"; + break; + case 9: + month = "Oct"; + break; + case 10: + month = "Nov"; + break; + case 11: + month = "Dec"; + break; + } + + clone.GetComponentInChildren().text = month; + clone.name = "Month_" + months[i]; + clone.AddComponent(); + monthsButtons[i] = clone; + } + } + + private void InitializeDays() + { + int[] days = new int[31]; + daysButtons = new GameObject[days.Length]; + + for (var i = 0; i < days.Length; i++) + { + days[i] = i + 1; + GameObject clone = (GameObject)Instantiate(daysButtonPrefab, new Vector3(0, i * 80, 0), Quaternion.Euler(new Vector3(0, 0, 0))) as GameObject; + clone.transform.SetParent(daysScrollingPanel, false); + clone.transform.localScale = new Vector3(1, 1, 1); + clone.GetComponentInChildren().text = "" + days[i]; + clone.name = "Day_" + days[i]; + clone.AddComponent(); + daysButtons[i] = clone; + } + } + + // Use this for initialization + public void Awake() + { + InitializeYears(); + InitializeMonths(); + InitializeDays(); + + //Yes Unity complains about this but it doesn't matter in this case. + monthsVerticalScroller = new UIVerticalScroller(monthsScrollingPanel, monthsButtons, monthCenter); + yearsVerticalScroller = new UIVerticalScroller(yearsScrollingPanel, yearsButtons, yearsCenter); + daysVerticalScroller = new UIVerticalScroller(daysScrollingPanel, daysButtons, daysCenter); + + monthsVerticalScroller.Start(); + yearsVerticalScroller.Start(); + daysVerticalScroller.Start(); + } + + public void SetDate() + { + daysSet = int.Parse(inputFieldDays.text) - 1; + monthsSet = int.Parse(inputFieldMonths.text) - 1; + yearsSet = int.Parse(inputFieldYears.text) - 1900; + + daysVerticalScroller.SnapToElement(daysSet); + monthsVerticalScroller.SnapToElement(monthsSet); + yearsVerticalScroller.SnapToElement(yearsSet); + } + + void Update() + { + monthsVerticalScroller.Update(); + yearsVerticalScroller.Update(); + daysVerticalScroller.Update(); + + string dayString = daysVerticalScroller.GetResults(); + string monthString = monthsVerticalScroller.GetResults(); + string yearsString = yearsVerticalScroller.GetResults(); + + if (dayString.EndsWith("1") && dayString != "11") + dayString = dayString + "st"; + else if (dayString.EndsWith("2") && dayString != "12") + dayString = dayString + "nd"; + else if (dayString.EndsWith("3") && dayString != "13") + dayString = dayString + "rd"; + else + dayString = dayString + "th"; + + dateText.text = monthString + " " + dayString + " " + yearsString; + } + + public void DaysScrollUp() + { + daysVerticalScroller.ScrollUp(); + } + + public void DaysScrollDown() + { + daysVerticalScroller.ScrollDown(); + } + + public void MonthsScrollUp() + { + monthsVerticalScroller.ScrollUp(); + } + + public void MonthsScrollDown() + { + monthsVerticalScroller.ScrollDown(); + } + + public void YearsScrollUp() + { + yearsVerticalScroller.ScrollUp(); + } + + public void YearsScrollDown() + { + yearsVerticalScroller.ScrollDown(); + } } - - public void SetDate() - { - daysSet = int.Parse(inputFieldDays.text) - 1; - monthsSet = int.Parse(inputFieldMonths.text) - 1; - yearsSet = int.Parse(inputFieldYears.text) - 1900; - - daysVerticalScroller.SnapToElement(daysSet); - monthsVerticalScroller.SnapToElement(monthsSet); - yearsVerticalScroller.SnapToElement(yearsSet); - } - - void Update () - { - monthsVerticalScroller.Update(); - yearsVerticalScroller.Update(); - daysVerticalScroller.Update(); - - string dayString = daysVerticalScroller.GetResults(); - string monthString = monthsVerticalScroller.GetResults(); - string yearsString = yearsVerticalScroller.GetResults(); - - if (dayString.EndsWith("1") && dayString != "11") - dayString = dayString + "st"; - else if (dayString.EndsWith("2") && dayString != "12") - dayString = dayString + "nd"; - else if (dayString.EndsWith("3") && dayString != "13") - dayString = dayString + "rd"; - else - dayString = dayString + "th"; - - dateText.text = monthString + " " + dayString + " " + yearsString; - } - - public void DaysScrollUp() - { - daysVerticalScroller.ScrollUp(); - } - - public void DaysScrollDown() - { - daysVerticalScroller.ScrollDown(); - } - - public void MonthsScrollUp() - { - monthsVerticalScroller.ScrollUp(); - } - - public void MonthsScrollDown() - { - monthsVerticalScroller.ScrollDown(); - } - - public void YearsScrollUp() - { - yearsVerticalScroller.ScrollUp(); - } - - public void YearsScrollDown() - { - yearsVerticalScroller.ScrollDown(); - } -} +} \ No newline at end of file diff --git a/Examples/SelectionBox/ExampleSelectable.cs b/Scripts/Controls/SelectionBox/ExampleSelectable.cs similarity index 99% rename from Examples/SelectionBox/ExampleSelectable.cs rename to Scripts/Controls/SelectionBox/ExampleSelectable.cs index a651064..26eb952 100644 --- a/Examples/SelectionBox/ExampleSelectable.cs +++ b/Scripts/Controls/SelectionBox/ExampleSelectable.cs @@ -3,12 +3,10 @@ /// Updated Credit BenZed /// Sourced from - http://forum.unity3d.com/threads/color-picker.267043/ - namespace UnityEngine.UI.Extensions { public class ExampleSelectable : MonoBehaviour, IBoxSelectable { - #region Implemented members of IBoxSelectable bool _selected = false; public bool selected diff --git a/Examples/SelectionBox/ExampleSelectable.cs.meta b/Scripts/Controls/SelectionBox/ExampleSelectable.cs.meta similarity index 100% rename from Examples/SelectionBox/ExampleSelectable.cs.meta rename to Scripts/Controls/SelectionBox/ExampleSelectable.cs.meta diff --git a/Scripts/Layout/FancyScrollView.cs b/Scripts/Layout/FancyScrollView.cs new file mode 100644 index 0000000..fd062a8 --- /dev/null +++ b/Scripts/Layout/FancyScrollView.cs @@ -0,0 +1,208 @@ +/// Credit setchi (https://github.com/setchi) +/// Sourced from - https://github.com/setchi/FancyScrollView + +using System.Collections.Generic; + +namespace UnityEngine.UI.Extensions +{ + public class FancyScrollView : MonoBehaviour where TContext : class + { + [SerializeField, Range(float.Epsilon, 1f)] + float cellInterval; + [SerializeField, Range(0f, 1f)] + float cellOffset; + [SerializeField] + bool loop; + [SerializeField] + GameObject cellBase; + + float currentPosition; + readonly List> cells = + new List>(); + + protected TContext context; + protected List cellData = new List(); + + protected void Awake() + { + cellBase.SetActive(false); + } + + /// + /// コンテキストを設定します + /// + /// + protected void SetContext(TContext context) + { + this.context = context; + + for (int i = 0; i < cells.Count; i++) + { + cells[i].SetContext(context); + } + } + + /// + /// セルを生成して返します + /// + /// + FancyScrollViewCell CreateCell() + { + var cellObject = Instantiate(cellBase); + cellObject.SetActive(true); + var cell = cellObject.GetComponent>(); + + var cellRectTransform = cell.transform as RectTransform; + + // 親要素の付け替えをおこなうとスケールやサイズが失われるため、変数に保持しておく + var scale = cell.transform.localScale; + var sizeDelta = Vector2.zero; + var offsetMin = Vector2.zero; + var offsetMax = Vector2.zero; + + if (cellRectTransform) + { + sizeDelta = cellRectTransform.sizeDelta; + offsetMin = cellRectTransform.offsetMin; + offsetMax = cellRectTransform.offsetMax; + } + + cell.transform.SetParent(cellBase.transform.parent); + + cell.transform.localScale = scale; + if (cellRectTransform) + { + cellRectTransform.sizeDelta = sizeDelta; + cellRectTransform.offsetMin = offsetMin; + cellRectTransform.offsetMax = offsetMax; + } + + cell.SetContext(context); + cell.SetVisible(false); + + return cell; + } + +#if UNITY_EDITOR + float prevCellInterval, prevCellOffset; + bool prevLoop; + + void LateUpdate() + { + if (prevLoop != loop || + prevCellOffset != cellOffset || + prevCellInterval != cellInterval) + { + UpdatePosition(currentPosition); + + prevLoop = loop; + prevCellOffset = cellOffset; + prevCellInterval = cellInterval; + } + } +#endif + + /// + /// セルの内容を更新します + /// + /// + /// + void UpdateCellForIndex(FancyScrollViewCell cell, int dataIndex) + { + if (loop) + { + dataIndex = GetLoopIndex(dataIndex, cellData.Count); + } + else if (dataIndex < 0 || dataIndex > cellData.Count - 1) + { + // セルに対応するデータが存在しなければセルを表示しない + cell.SetVisible(false); + return; + } + + cell.SetVisible(true); + cell.DataIndex = dataIndex; + cell.UpdateContent(cellData[dataIndex]); + } + + /// + /// 円環構造の index を取得します + /// + /// + /// + /// + int GetLoopIndex(int index, int length) + { + if (index < 0) + { + index = (length - 1) + (index + 1) % length; + } + else if (index > length - 1) + { + index = index % length; + } + return index; + } + + /// + /// 表示内容を更新します + /// + protected void UpdateContents() + { + UpdatePosition(currentPosition); + } + + /// + /// スクロール位置を更新します + /// + /// + protected void UpdatePosition(float position) + { + currentPosition = position; + + var visibleMinPosition = position - (cellOffset / cellInterval); + var firstCellPosition = (Mathf.Ceil(visibleMinPosition) - visibleMinPosition) * cellInterval; + var dataStartIndex = Mathf.CeilToInt(visibleMinPosition); + var count = 0; + var cellIndex = 0; + + for (float pos = firstCellPosition; pos <= 1f; pos += cellInterval, count++) + { + if (count >= cells.Count) + { + cells.Add(CreateCell()); + } + } + + count = 0; + + for (float pos = firstCellPosition; pos <= 1f; count++, pos += cellInterval) + { + var dataIndex = dataStartIndex + count; + cellIndex = GetLoopIndex(dataIndex, cells.Count); + if (cells[cellIndex].gameObject.activeSelf) + { + cells[cellIndex].UpdatePosition(pos); + } + UpdateCellForIndex(cells[cellIndex], dataIndex); + } + + cellIndex = GetLoopIndex(dataStartIndex + count, cells.Count); + + for (; count < cells.Count; count++, cellIndex = GetLoopIndex(dataStartIndex + count, cells.Count)) + { + cells[cellIndex].SetVisible(false); + } + } + } + + public sealed class FancyScrollViewNullContext + { + + } + + public class FancyScrollView : FancyScrollView + { + + } +} \ No newline at end of file diff --git a/Scripts/Layout/FancyScrollView.cs.meta b/Scripts/Layout/FancyScrollView.cs.meta new file mode 100644 index 0000000..d8ff05a --- /dev/null +++ b/Scripts/Layout/FancyScrollView.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 51a6dd27af9048f45a7fc0019884d41e +timeCreated: 1501610618 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Layout/FancyScrollViewCell.cs b/Scripts/Layout/FancyScrollViewCell.cs new file mode 100644 index 0000000..0de4c4c --- /dev/null +++ b/Scripts/Layout/FancyScrollViewCell.cs @@ -0,0 +1,52 @@ +/// Credit setchi (https://github.com/setchi) +/// Sourced from - https://github.com/setchi/FancyScrollView + +namespace UnityEngine.UI.Extensions +{ + + public class FancyScrollViewCell : MonoBehaviour where TContext : class + { + /// + /// コンテキストを設定します + /// + /// + public virtual void SetContext(TContext context) + { + } + + /// + /// セルの内容を更新します + /// + /// + public virtual void UpdateContent(TData itemData) + { + } + + /// + /// セルの位置を更新します + /// + /// + public virtual void UpdatePosition(float position) + { + } + + /// + /// セルの表示/非表示を設定します + /// + /// + public virtual void SetVisible(bool visible) + { + gameObject.SetActive(visible); + } + + /// + /// このセルで表示しているデータのインデックス + /// + public int DataIndex { get; set; } + } + + public class FancyScrollViewCell : FancyScrollViewCell + { + + } +} \ No newline at end of file diff --git a/Scripts/Layout/FancyScrollViewCell.cs.meta b/Scripts/Layout/FancyScrollViewCell.cs.meta new file mode 100644 index 0000000..32abbb5 --- /dev/null +++ b/Scripts/Layout/FancyScrollViewCell.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 73c54b1a82a56fb4f906ab8c75f7a030 +timeCreated: 1501610618 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Layout/HorizontalScrollSnap.cs b/Scripts/Layout/HorizontalScrollSnap.cs index 1a85021..4af6331 100644 --- a/Scripts/Layout/HorizontalScrollSnap.cs +++ b/Scripts/Layout/HorizontalScrollSnap.cs @@ -193,6 +193,7 @@ namespace UnityEngine.UI.Extensions { _scrollStartPosition = _screensContainer.localPosition.x; _scroll_rect.horizontalNormalizedPosition = (float)(_currentPage) / (_screens - 1); + OnCurrentScreenChange(_currentPage); } /// diff --git a/Scripts/Layout/ScrollPositionController.cs b/Scripts/Layout/ScrollPositionController.cs new file mode 100644 index 0000000..fe6b1ec --- /dev/null +++ b/Scripts/Layout/ScrollPositionController.cs @@ -0,0 +1,312 @@ +/// Credit setchi (https://github.com/setchi) +/// Sourced from - https://github.com/setchi/FancyScrollView + +using System; +using UnityEngine.Events; +using UnityEngine.EventSystems; + +namespace UnityEngine.UI.Extensions +{ + + public class ScrollPositionController : UIBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler + { + #region Sub-Classes + [System.Serializable] + public class UpdatePositionEvent : UnityEvent { } + #endregion + + [Serializable] + struct Snap + { + public bool Enable; + public float VelocityThreshold; + public float Duration; + } + + enum ScrollDirection + { + Vertical, + Horizontal, + } + + enum MovementType + { + Unrestricted = ScrollRect.MovementType.Unrestricted, + Elastic = ScrollRect.MovementType.Elastic, + Clamped = ScrollRect.MovementType.Clamped + } + + [SerializeField] + RectTransform viewport; + [SerializeField] + ScrollDirection directionOfRecognize = ScrollDirection.Vertical; + [SerializeField] + MovementType movementType = MovementType.Elastic; + [SerializeField] + float elasticity = 0.1f; + [SerializeField] + float scrollSensitivity = 1f; + [SerializeField] + bool inertia = true; + [SerializeField, Tooltip("Only used when inertia is enabled")] + float decelerationRate = 0.03f; + [SerializeField, Tooltip("Only used when inertia is enabled")] + Snap snap = new Snap { Enable = true, VelocityThreshold = 0.5f, Duration = 0.3f }; + [SerializeField] + int dataCount; + + #region Events + [Tooltip("Event that fires when the position of an item changes")] + public UpdatePositionEvent OnUpdatePosition; + #endregion + + Vector2 pointerStartLocalPosition; + float dragStartScrollPosition; + float currentScrollPosition; + bool dragging; + + void IBeginDragHandler.OnBeginDrag(PointerEventData eventData) + { + if (eventData.button != PointerEventData.InputButton.Left) + { + return; + } + + pointerStartLocalPosition = Vector2.zero; + RectTransformUtility.ScreenPointToLocalPointInRectangle( + viewport, + eventData.position, + eventData.pressEventCamera, + out pointerStartLocalPosition); + + dragStartScrollPosition = currentScrollPosition; + dragging = true; + } + + void IDragHandler.OnDrag(PointerEventData eventData) + { + if (eventData.button != PointerEventData.InputButton.Left) + { + return; + } + + if (!dragging) + { + return; + } + + Vector2 localCursor; + if (!RectTransformUtility.ScreenPointToLocalPointInRectangle( + viewport, + eventData.position, + eventData.pressEventCamera, + out localCursor)) + { + return; + } + + var pointerDelta = localCursor - pointerStartLocalPosition; + var position = (directionOfRecognize == ScrollDirection.Horizontal ? -pointerDelta.x : pointerDelta.y) + / GetViewportSize() + * scrollSensitivity + + dragStartScrollPosition; + + var offset = CalculateOffset(position); + position += offset; + + if (movementType == MovementType.Elastic) + { + if (offset != 0) + { + position -= RubberDelta(offset, scrollSensitivity); + } + } + UpdatePosition(position); + } + + void IEndDragHandler.OnEndDrag(PointerEventData eventData) + { + if (eventData.button != PointerEventData.InputButton.Left) + { + return; + } + + dragging = false; + } + + float GetViewportSize() + { + return directionOfRecognize == ScrollDirection.Horizontal + ? viewport.rect.size.x + : viewport.rect.size.y; + } + + float CalculateOffset(float position) + { + if (movementType == MovementType.Unrestricted) + { + return 0; + } + if (position < 0) + { + return -position; + } + if (position > dataCount - 1) + { + return (dataCount - 1) - position; + } + return 0f; + } + + void UpdatePosition(float position) + { + currentScrollPosition = position; + + if (OnUpdatePosition != null) + { + OnUpdatePosition.Invoke(currentScrollPosition); + } + } + + float RubberDelta(float overStretching, float viewSize) + { + return (1 - (1 / ((Mathf.Abs(overStretching) * 0.55f / viewSize) + 1))) * viewSize * Mathf.Sign(overStretching); + } + + //public void OnUpdatePosition(Action onUpdatePosition) + //{ + // this.onUpdatePosition = onUpdatePosition; + //} + + public void SetDataCount(int dataCont) + { + this.dataCount = dataCont; + } + + float velocity; + float prevScrollPosition; + + bool autoScrolling; + float autoScrollDuration; + float autoScrollStartTime; + float autoScrollPosition; + + void Update() + { + var deltaTime = Time.unscaledDeltaTime; + var offset = CalculateOffset(currentScrollPosition); + + if (autoScrolling) + { + var alpha = Mathf.Clamp01((Time.unscaledTime - autoScrollStartTime) / Mathf.Max(autoScrollDuration, float.Epsilon)); + var position = Mathf.Lerp(dragStartScrollPosition, autoScrollPosition, EaseInOutCubic(0, 1, alpha)); + UpdatePosition(position); + + if (Mathf.Approximately(alpha, 1f)) + { + autoScrolling = false; + } + } + else if (!dragging && (offset != 0 || velocity != 0)) + { + var position = currentScrollPosition; + // Apply spring physics if movement is elastic and content has an offset from the view. + if (movementType == MovementType.Elastic && offset != 0) + { + var speed = velocity; + position = Mathf.SmoothDamp(currentScrollPosition, currentScrollPosition + offset, ref speed, elasticity, Mathf.Infinity, deltaTime); + velocity = speed; + } + // Else move content according to velocity with deceleration applied. + else if (inertia) + { + velocity *= Mathf.Pow(decelerationRate, deltaTime); + if (Mathf.Abs(velocity) < 0.001f) + velocity = 0; + position += velocity * deltaTime; + + if (snap.Enable && Mathf.Abs(velocity) < snap.VelocityThreshold) + { + ScrollTo(Mathf.RoundToInt(currentScrollPosition), snap.Duration); + } + } + // If we have neither elaticity or friction, there shouldn't be any velocity. + else + { + velocity = 0; + } + + if (velocity != 0) + { + if (movementType == MovementType.Clamped) + { + offset = CalculateOffset(position); + position += offset; + } + UpdatePosition(position); + } + } + + if (!autoScrolling && dragging && inertia) + { + var newVelocity = (currentScrollPosition - prevScrollPosition) / deltaTime; + velocity = Mathf.Lerp(velocity, newVelocity, deltaTime * 10f); + } + + if (currentScrollPosition != prevScrollPosition) + { + prevScrollPosition = currentScrollPosition; + } + } + + public void ScrollTo(int index, float duration) + { + velocity = 0; + autoScrolling = true; + autoScrollDuration = duration; + autoScrollStartTime = Time.unscaledTime; + dragStartScrollPosition = currentScrollPosition; + + autoScrollPosition = movementType == MovementType.Unrestricted + ? CalculateClosestPosition(index) + : index; + } + + float CalculateClosestPosition(int index) + { + var diff = GetLoopPosition(index, dataCount) + - GetLoopPosition(currentScrollPosition, dataCount); + + if (Mathf.Abs(diff) > dataCount * 0.5f) + { + diff = Mathf.Sign(-diff) * (dataCount - Mathf.Abs(diff)); + } + return diff + currentScrollPosition; + } + + float GetLoopPosition(float position, int length) + { + if (position < 0) + { + position = (length - 1) + (position + 1) % length; + } + else if (position > length - 1) + { + position = position % length; + } + return position; + } + + float EaseInOutCubic(float start, float end, float value) + { + value /= 0.5f; + end -= start; + if (value < 1f) + { + return end * 0.5f * value * value * value + start; + } + value -= 2f; + return end * 0.5f * (value * value * value + 2f) + start; + } + } +} \ No newline at end of file diff --git a/Scripts/Layout/ScrollPositionController.cs.meta b/Scripts/Layout/ScrollPositionController.cs.meta new file mode 100644 index 0000000..a163311 --- /dev/null +++ b/Scripts/Layout/ScrollPositionController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: cc9ad31350b1b6348b57c626195a562d +timeCreated: 1501610618 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Layout/VerticalScrollSnap.cs b/Scripts/Layout/VerticalScrollSnap.cs index f6be4ec..762a115 100644 --- a/Scripts/Layout/VerticalScrollSnap.cs +++ b/Scripts/Layout/VerticalScrollSnap.cs @@ -195,6 +195,7 @@ namespace UnityEngine.UI.Extensions { _scrollStartPosition = _screensContainer.localPosition.y; _scroll_rect.verticalNormalizedPosition = (float)(_currentPage) / (_screens - 1); + OnCurrentScreenChange(_currentPage); } ///