├── .gitignore ├── CHANGELOG.md ├── CHANGELOG.md.meta ├── Editor.meta ├── Editor ├── LoopScrollRect.Editor.asmdef ├── LoopScrollRect.Editor.asmdef.meta ├── LoopScrollRectInspector.cs ├── LoopScrollRectInspector.cs.meta ├── SGDefaultControls.cs ├── SGDefaultControls.cs.meta ├── SGMenuOptions.cs └── SGMenuOptions.cs.meta ├── Images~ ├── Content.png ├── LoopVerticalScrollRect.png ├── ScrollCell.png ├── ScrollToIndex.gif ├── demo1.gif ├── demo2.gif └── demo3.gif ├── LICENSE ├── LICENSE.meta ├── README.md ├── README.md.meta ├── Runtime.meta ├── Runtime ├── LoopHorizontalScrollRect.cs ├── LoopHorizontalScrollRect.cs.meta ├── LoopHorizontalScrollRectMulti.cs ├── LoopHorizontalScrollRectMulti.cs.meta ├── LoopScrollDataSource.cs ├── LoopScrollDataSource.cs.meta ├── LoopScrollMultiDataSource.cs ├── LoopScrollMultiDataSource.cs.meta ├── LoopScrollPrefabSource.cs ├── LoopScrollPrefabSource.cs.meta ├── LoopScrollRect.Runtime.asmdef ├── LoopScrollRect.Runtime.asmdef.meta ├── LoopScrollRect.cs ├── LoopScrollRect.cs.meta ├── LoopScrollRectBase.cs ├── LoopScrollRectBase.cs.meta ├── LoopScrollRectMulti.cs ├── LoopScrollRectMulti.cs.meta ├── LoopScrollSizeHelper.cs ├── LoopScrollSizeHelper.cs.meta ├── LoopScrollSizeUtils.cs ├── LoopScrollSizeUtils.cs.meta ├── LoopVerticalScrollRect.cs ├── LoopVerticalScrollRect.cs.meta ├── LoopVerticalScrollRectMulti.cs └── LoopVerticalScrollRectMulti.cs.meta ├── Samples~ ├── Demo.meta └── Demo │ ├── DemoScene.unity │ ├── DemoScene.unity.meta │ ├── DemoSceneSingle.unity │ ├── DemoSceneSingle.unity.meta │ ├── DemoScene_MultiCell.unity │ ├── DemoScene_MultiCell.unity.meta │ ├── DemoScene_MultiCellFullScreen.unity │ ├── DemoScene_MultiCellFullScreen.unity.meta │ ├── Prefabs.meta │ ├── Prefabs │ ├── HorizontalScroll_CustomSize.prefab │ ├── HorizontalScroll_CustomSize.prefab.meta │ ├── HorizontalScroll_Grid.prefab │ ├── HorizontalScroll_Grid.prefab.meta │ ├── ScrollCell1.prefab │ ├── ScrollCell1.prefab.meta │ ├── ScrollCell2.prefab │ ├── ScrollCell2.prefab.meta │ ├── ScrollCell3.prefab │ ├── ScrollCell3.prefab.meta │ ├── ScrollCell4.prefab │ ├── ScrollCell4.prefab.meta │ ├── ScrollCell4_TypeA.prefab │ ├── ScrollCell4_TypeA.prefab.meta │ ├── ScrollCell4_TypeB.prefab │ ├── ScrollCell4_TypeB.prefab.meta │ ├── ScrollCell4_TypeC.prefab │ ├── ScrollCell4_TypeC.prefab.meta │ ├── ScrollCell5.prefab │ ├── ScrollCell5.prefab.meta │ ├── ScrollCell5_TypeA.prefab │ ├── ScrollCell5_TypeA.prefab.meta │ ├── ScrollCell5_TypeB.prefab │ ├── ScrollCell5_TypeB.prefab.meta │ ├── ScrollCell5_TypeC.prefab │ ├── ScrollCell5_TypeC.prefab.meta │ ├── UI_ControlScene.prefab │ ├── UI_ControlScene.prefab.meta │ ├── UI_ControllData_Horizontal.prefab │ ├── UI_ControllData_Horizontal.prefab.meta │ ├── UI_ControllData_HorizontalScroll_Grid.prefab │ ├── UI_ControllData_HorizontalScroll_Grid.prefab.meta │ ├── UI_ControllData_Vertical.prefab │ ├── UI_ControllData_Vertical.prefab.meta │ ├── UI_ControllData_VerticalScroll_Grid.prefab │ ├── UI_ControllData_VerticalScroll_Grid.prefab.meta │ ├── VerticalScroll_CustomSize.prefab │ ├── VerticalScroll_CustomSize.prefab.meta │ ├── VerticalScroll_Grid.prefab │ └── VerticalScroll_Grid.prefab.meta │ ├── Scripts.meta │ ├── Scripts │ ├── CustomListBank.cs │ ├── CustomListBank.cs.meta │ ├── InitOnStart.cs │ ├── InitOnStart.cs.meta │ ├── InitOnStartMulti.cs │ ├── InitOnStartMulti.cs.meta │ ├── LoopListBankBase.cs │ ├── LoopListBankBase.cs.meta │ ├── ScrollIndexCallback1.cs │ ├── ScrollIndexCallback1.cs.meta │ ├── ScrollIndexCallback2.cs │ ├── ScrollIndexCallback2.cs.meta │ ├── ScrollIndexCallback3.cs │ ├── ScrollIndexCallback3.cs.meta │ ├── ScrollIndexCallbackBase.cs │ ├── ScrollIndexCallbackBase.cs.meta │ ├── ScrollIndexCallback_Custom.cs │ ├── ScrollIndexCallback_Custom.cs.meta │ ├── SizeHelper.cs │ ├── SizeHelper.cs.meta │ ├── SizeHelper2.cs │ ├── SizeHelper2.cs.meta │ ├── UI_ControlData.cs │ ├── UI_ControlData.cs.meta │ ├── UI_ControlScene.cs │ └── UI_ControlScene.cs.meta │ ├── Sprite.meta │ └── Sprite │ ├── Light_Frame.png │ └── Light_Frame.png.meta ├── package.json └── package.json.meta /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /Logs/ 6 | # Autogenerated VS/MD solution and project files 7 | *.csproj 8 | *.unityproj 9 | *.sln 10 | *.suo 11 | *.tmp 12 | *.user 13 | *.userprefs 14 | *.pidb 15 | *.booproj 16 | 17 | # Unity3D generated meta files 18 | *.pidb.meta 19 | 20 | # Unity3D Generated File On Crash Reports 21 | sysinfo.txt 22 | 23 | # OS generated 24 | .DS_Store 25 | .DS_Store? 26 | ._* 27 | .Spotlight-V100 28 | .Trashes 29 | ehthumbs.db 30 | Thumbs.db 31 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [1.1.4] - 2025-07-18 4 | ### Changed 5 | - Avoid `UpdateBounds` when disabled 6 | - Apply inspector to `LoopScrollRectBase` 7 | - Improved element size estimation 8 | - Ensure `Rebuild` called as expected 9 | - Fix scrollbar precision problem with many items and avoid redundant callback 10 | - Fix `GetFirstItem`+`RefillCells` and `LastItem`+`RefillCellsFromEnd` usage, keeping ScrollRect stable 11 | - Add more tests in inspector 12 | 13 | ## [1.1.3] - 2025-02-28 14 | ### Added 15 | - Multi cell full screen sample. 16 | - Support item without `ILayoutElement` 17 | - Support `ToCenter`/`FirstAppear` in `ScrollToCell` 18 | - Add `contentOffset` in `RefillCellsFromEnd` 19 | ### Changed 20 | - Deprecated typo API 21 | - Fill last line in `RefillCellsFromEnd` 22 | - Consider padding in `RefillCellsFromEnd` 23 | - `UpdateItems` when `OnRectTransformDimensionsChange` 24 | 25 | ## [1.1.2] - 2022-07-18 26 | ### Added 27 | - Infinity sample for multi prefab. 28 | ### Changed 29 | - Fix API below Unity 2020 30 | - Fix `RefreshCells` with total count changes. 31 | - Check `m_Content` afterwards. 32 | - Fix SizeHelper with no content spacing considered. 33 | 34 | ## [1.1.1] - 2022-04-23 35 | ### Added 36 | - Register at OpenUPM. 37 | ### Changed 38 | - Fix `RefreshCells` when `totalCount` increases. 39 | 40 | ## [1.1.0] - 2022-03-25 41 | ### Added 42 | - Changelog 43 | - Add support for different sources. 44 | - More complex demo from @SyaoranChang (Great thanks for valuable suggestion) 45 | ### Changed 46 | - ReOrganize Project with Unity Package. 47 | - Improve scrolling within tiny steps. 48 | 49 | ## [1.0.6] - 2021-08-01 50 | ### Changed 51 | - Continue seperating data source and prefab source. 52 | - Fix padding from @CodingFishWu. 53 | - Fix issue when grid is not full from @zxsean. 54 | 55 | ## [1.0.5] - 2020-10-06 56 | ### Changed 57 | - Seperate data source. 58 | - Improve performance with more skippable cases and better pooling. 59 | - Implement `fillViewRect` in `RefillCells` from @roointan. 60 | 61 | ## [1.0.4] - 2018-01-04 62 | ### Added 63 | - Quick jump. 64 | 65 | ## [1.0.3] - 2016-10-12 66 | ### Added 67 | - ScrollBar support. 68 | ### Changed 69 | - Fix Grid issues. 70 | 71 | ## [1.0.2] - 2016-01-21 72 | ### Changed 73 | - Code cleanup. 74 | - Performance optimization from @zxsean. 75 | 76 | ## [1.0.1] - 2015-12-02 77 | ### Added 78 | - Infinity version. 79 | - Reverse Direction mode. 80 | - Threshold for better control. 81 | 82 | ## [1.0.0] - 2015-08-15 -------------------------------------------------------------------------------- /CHANGELOG.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab3222005e06e4c4aad63f7fd097f61c 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b10ceda9bec25b14ea5e190eb9bb0341 3 | folderAsset: yes 4 | timeCreated: 1476279504 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Editor/LoopScrollRect.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "LoopScrollRect.Editor", 3 | "rootNamespace": "", 4 | "references": [ 5 | "LoopScrollRect.Runtime" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Editor/LoopScrollRect.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8621d9949b0c96543ac733223ddc6f3c 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/LoopScrollRectInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 216d44a40b90b944db6c5f4624768e58 3 | timeCreated: 1439395663 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/SGDefaultControls.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | 4 | namespace UnityEngine.UI 5 | { 6 | public static class SGDefaultControls 7 | { 8 | #region code from DefaultControls.cs 9 | public struct Resources 10 | { 11 | public Sprite standard; 12 | public Sprite background; 13 | public Sprite inputField; 14 | public Sprite knob; 15 | public Sprite checkmark; 16 | public Sprite dropdown; 17 | public Sprite mask; 18 | } 19 | 20 | private const float kWidth = 160f; 21 | private const float kThickHeight = 30f; 22 | private const float kThinHeight = 20f; 23 | //private static Vector2 s_ThickElementSize = new Vector2(kWidth, kThickHeight); 24 | //private static Vector2 s_ThinElementSize = new Vector2(kWidth, kThinHeight); 25 | //private static Vector2 s_ImageElementSize = new Vector2(100f, 100f); 26 | //private static Color s_DefaultSelectableColor = new Color(1f, 1f, 1f, 1f); 27 | //private static Color s_PanelColor = new Color(1f, 1f, 1f, 0.392f); 28 | private static Color s_TextColor = new Color(50f / 255f, 50f / 255f, 50f / 255f, 1f); 29 | 30 | // Helper methods at top 31 | 32 | private static GameObject CreateUIElementRoot(string name, Vector2 size) 33 | { 34 | GameObject child = new GameObject(name); 35 | RectTransform rectTransform = child.AddComponent(); 36 | rectTransform.sizeDelta = size; 37 | return child; 38 | } 39 | 40 | static GameObject CreateUIObject(string name, GameObject parent) 41 | { 42 | GameObject go = new GameObject(name); 43 | go.AddComponent(); 44 | SetParentAndAlign(go, parent); 45 | return go; 46 | } 47 | 48 | private static void SetDefaultTextValues(Text lbl) 49 | { 50 | // Set text values we want across UI elements in default controls. 51 | // Don't set values which are the same as the default values for the Text component, 52 | // since there's no point in that, and it's good to keep them as consistent as possible. 53 | lbl.color = s_TextColor; 54 | } 55 | 56 | private static void SetDefaultColorTransitionValues(Selectable slider) 57 | { 58 | ColorBlock colors = slider.colors; 59 | colors.highlightedColor = new Color(0.882f, 0.882f, 0.882f); 60 | colors.pressedColor = new Color(0.698f, 0.698f, 0.698f); 61 | colors.disabledColor = new Color(0.521f, 0.521f, 0.521f); 62 | } 63 | 64 | private static void SetParentAndAlign(GameObject child, GameObject parent) 65 | { 66 | if (parent == null) 67 | return; 68 | 69 | child.transform.SetParent(parent.transform, false); 70 | SetLayerRecursively(child, parent.layer); 71 | } 72 | 73 | private static void SetLayerRecursively(GameObject go, int layer) 74 | { 75 | go.layer = layer; 76 | Transform t = go.transform; 77 | for (int i = 0; i < t.childCount; i++) 78 | SetLayerRecursively(t.GetChild(i).gameObject, layer); 79 | } 80 | #endregion 81 | 82 | public static GameObject CreateLoopHorizontalScrollRect(DefaultControls.Resources resources) 83 | { 84 | GameObject root = CreateUIElementRoot("Loop Horizontal Scroll Rect", new Vector2(200, 200)); 85 | 86 | GameObject viewport = CreateUIObject("Viewport", root); 87 | 88 | RectTransform viewportRT = viewport.GetComponent(); 89 | viewportRT.anchorMin = new Vector2(0, 0); 90 | viewportRT.anchorMax = new Vector2(1, 1); 91 | viewportRT.sizeDelta = new Vector2(0, 0); 92 | viewportRT.pivot = new Vector2(0.5f, 0.5f); 93 | 94 | viewport.AddComponent(); 95 | 96 | GameObject content = CreateUIObject("Content", viewport); 97 | 98 | RectTransform contentRT = content.GetComponent(); 99 | contentRT.anchorMin = new Vector2(0, 0); 100 | contentRT.anchorMax = new Vector2(0, 1); 101 | contentRT.sizeDelta = new Vector2(0, 0); 102 | contentRT.pivot = new Vector2(0, 0.5f); 103 | 104 | // Setup UI components. 105 | 106 | LoopHorizontalScrollRect scrollRect = root.AddComponent(); 107 | scrollRect.content = contentRT; 108 | scrollRect.viewport = viewportRT; 109 | scrollRect.horizontalScrollbar = null; 110 | scrollRect.verticalScrollbar = null; 111 | scrollRect.horizontal = true; 112 | scrollRect.vertical = false; 113 | scrollRect.horizontalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; 114 | scrollRect.verticalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; 115 | scrollRect.horizontalScrollbarSpacing = 0; 116 | scrollRect.verticalScrollbarSpacing = 0; 117 | 118 | HorizontalLayoutGroup layoutGroup = content.AddComponent(); 119 | layoutGroup.childAlignment = TextAnchor.MiddleLeft; 120 | layoutGroup.childForceExpandWidth = false; 121 | layoutGroup.childForceExpandHeight = true; 122 | 123 | ContentSizeFitter sizeFitter = content.AddComponent(); 124 | sizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; 125 | sizeFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained; 126 | 127 | return root; 128 | } 129 | 130 | public static GameObject CreateLoopVerticalScrollRect(DefaultControls.Resources resources) 131 | { 132 | GameObject root = CreateUIElementRoot("Loop Vertical Scroll Rect", new Vector2(200, 200)); 133 | 134 | GameObject viewport = CreateUIObject("Viewport", root); 135 | 136 | RectTransform viewportRT = viewport.GetComponent(); 137 | viewportRT.anchorMin = new Vector2(0, 0); 138 | viewportRT.anchorMax = new Vector2(1, 1); 139 | viewportRT.sizeDelta = new Vector2(0, 0); 140 | viewportRT.pivot = new Vector2(0.5f, 0.5f); 141 | 142 | viewport.AddComponent(); 143 | 144 | GameObject content = CreateUIObject("Content", viewport); 145 | 146 | RectTransform contentRT = content.GetComponent(); 147 | contentRT.anchorMin = new Vector2(0, 1); 148 | contentRT.anchorMax = new Vector2(1, 1); 149 | contentRT.sizeDelta = new Vector2(0, 0); 150 | contentRT.pivot = new Vector2(0.5f, 1); 151 | 152 | // Setup UI components. 153 | 154 | LoopVerticalScrollRect scrollRect = root.AddComponent(); 155 | scrollRect.content = contentRT; 156 | scrollRect.viewport = viewportRT; 157 | scrollRect.horizontalScrollbar = null; 158 | scrollRect.verticalScrollbar = null; 159 | scrollRect.horizontal = false; 160 | scrollRect.vertical = true; 161 | scrollRect.horizontalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; 162 | scrollRect.verticalScrollbarVisibility = LoopScrollRect.ScrollbarVisibility.Permanent; 163 | scrollRect.horizontalScrollbarSpacing = 0; 164 | scrollRect.verticalScrollbarSpacing = 0; 165 | 166 | VerticalLayoutGroup layoutGroup = content.AddComponent(); 167 | layoutGroup.childAlignment = TextAnchor.UpperCenter; 168 | layoutGroup.childForceExpandWidth = true; 169 | layoutGroup.childForceExpandHeight = false; 170 | 171 | ContentSizeFitter sizeFitter = content.AddComponent(); 172 | sizeFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; 173 | sizeFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; 174 | 175 | return root; 176 | } 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /Editor/SGDefaultControls.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e2cfa47387224a4eb069fc6dc8ac8b3 3 | timeCreated: 1476279563 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Editor/SGMenuOptions.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.EventSystems; 3 | using UnityEngine.UI; 4 | 5 | namespace UnityEditor.UI 6 | { 7 | static internal class SGMenuOptions 8 | { 9 | #region code from MenuOptions.cs 10 | private const string kUILayerName = "UI"; 11 | 12 | private const string kStandardSpritePath = "UI/Skin/UISprite.psd"; 13 | private const string kBackgroundSpritePath = "UI/Skin/Background.psd"; 14 | private const string kInputFieldBackgroundPath = "UI/Skin/InputFieldBackground.psd"; 15 | private const string kKnobPath = "UI/Skin/Knob.psd"; 16 | private const string kCheckmarkPath = "UI/Skin/Checkmark.psd"; 17 | private const string kDropdownArrowPath = "UI/Skin/DropdownArrow.psd"; 18 | private const string kMaskPath = "UI/Skin/UIMask.psd"; 19 | 20 | static private DefaultControls.Resources s_StandardResources; 21 | 22 | static private DefaultControls.Resources GetStandardResources() 23 | { 24 | if (s_StandardResources.standard == null) 25 | { 26 | s_StandardResources.standard = AssetDatabase.GetBuiltinExtraResource(kStandardSpritePath); 27 | s_StandardResources.background = AssetDatabase.GetBuiltinExtraResource(kBackgroundSpritePath); 28 | s_StandardResources.inputField = AssetDatabase.GetBuiltinExtraResource(kInputFieldBackgroundPath); 29 | s_StandardResources.knob = AssetDatabase.GetBuiltinExtraResource(kKnobPath); 30 | s_StandardResources.checkmark = AssetDatabase.GetBuiltinExtraResource(kCheckmarkPath); 31 | s_StandardResources.dropdown = AssetDatabase.GetBuiltinExtraResource(kDropdownArrowPath); 32 | s_StandardResources.mask = AssetDatabase.GetBuiltinExtraResource(kMaskPath); 33 | } 34 | return s_StandardResources; 35 | } 36 | 37 | private static void SetPositionVisibleinSceneView(RectTransform canvasRTransform, RectTransform itemTransform) 38 | { 39 | // Find the best scene view 40 | SceneView sceneView = SceneView.lastActiveSceneView; 41 | if (sceneView == null && SceneView.sceneViews.Count > 0) 42 | sceneView = SceneView.sceneViews[0] as SceneView; 43 | 44 | // Couldn't find a SceneView. Don't set position. 45 | if (sceneView == null || sceneView.camera == null) 46 | return; 47 | 48 | // Create world space Plane from canvas position. 49 | Vector2 localPlanePosition; 50 | Camera camera = sceneView.camera; 51 | Vector3 position = Vector3.zero; 52 | if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRTransform, new Vector2(camera.pixelWidth / 2, camera.pixelHeight / 2), camera, out localPlanePosition)) 53 | { 54 | // Adjust for canvas pivot 55 | localPlanePosition.x = localPlanePosition.x + canvasRTransform.sizeDelta.x * canvasRTransform.pivot.x; 56 | localPlanePosition.y = localPlanePosition.y + canvasRTransform.sizeDelta.y * canvasRTransform.pivot.y; 57 | 58 | localPlanePosition.x = Mathf.Clamp(localPlanePosition.x, 0, canvasRTransform.sizeDelta.x); 59 | localPlanePosition.y = Mathf.Clamp(localPlanePosition.y, 0, canvasRTransform.sizeDelta.y); 60 | 61 | // Adjust for anchoring 62 | position.x = localPlanePosition.x - canvasRTransform.sizeDelta.x * itemTransform.anchorMin.x; 63 | position.y = localPlanePosition.y - canvasRTransform.sizeDelta.y * itemTransform.anchorMin.y; 64 | 65 | Vector3 minLocalPosition; 66 | minLocalPosition.x = canvasRTransform.sizeDelta.x * (0 - canvasRTransform.pivot.x) + itemTransform.sizeDelta.x * itemTransform.pivot.x; 67 | minLocalPosition.y = canvasRTransform.sizeDelta.y * (0 - canvasRTransform.pivot.y) + itemTransform.sizeDelta.y * itemTransform.pivot.y; 68 | 69 | Vector3 maxLocalPosition; 70 | maxLocalPosition.x = canvasRTransform.sizeDelta.x * (1 - canvasRTransform.pivot.x) - itemTransform.sizeDelta.x * itemTransform.pivot.x; 71 | maxLocalPosition.y = canvasRTransform.sizeDelta.y * (1 - canvasRTransform.pivot.y) - itemTransform.sizeDelta.y * itemTransform.pivot.y; 72 | 73 | position.x = Mathf.Clamp(position.x, minLocalPosition.x, maxLocalPosition.x); 74 | position.y = Mathf.Clamp(position.y, minLocalPosition.y, maxLocalPosition.y); 75 | } 76 | 77 | itemTransform.anchoredPosition = position; 78 | itemTransform.localRotation = Quaternion.identity; 79 | itemTransform.localScale = Vector3.one; 80 | } 81 | 82 | private static void PlaceUIElementRoot(GameObject element, MenuCommand menuCommand) 83 | { 84 | GameObject parent = menuCommand.context as GameObject; 85 | if (parent == null || parent.GetComponentInParent() == null) 86 | { 87 | parent = GetOrCreateCanvasGameObject(); 88 | } 89 | 90 | string uniqueName = GameObjectUtility.GetUniqueNameForSibling(parent.transform, element.name); 91 | element.name = uniqueName; 92 | Undo.RegisterCreatedObjectUndo(element, "Create " + element.name); 93 | Undo.SetTransformParent(element.transform, parent.transform, "Parent " + element.name); 94 | GameObjectUtility.SetParentAndAlign(element, parent); 95 | if (parent != menuCommand.context) // not a context click, so center in sceneview 96 | SetPositionVisibleinSceneView(parent.GetComponent(), element.GetComponent()); 97 | 98 | Selection.activeGameObject = element; 99 | } 100 | 101 | static public GameObject CreateNewUI() 102 | { 103 | // Root for the UI 104 | var root = new GameObject("Canvas"); 105 | root.layer = LayerMask.NameToLayer(kUILayerName); 106 | Canvas canvas = root.AddComponent(); 107 | canvas.renderMode = RenderMode.ScreenSpaceOverlay; 108 | root.AddComponent(); 109 | root.AddComponent(); 110 | Undo.RegisterCreatedObjectUndo(root, "Create " + root.name); 111 | 112 | // if there is no event system add one... 113 | // CreateEventSystem(false); 114 | return root; 115 | } 116 | 117 | // Helper function that returns a Canvas GameObject; preferably a parent of the selection, or other existing Canvas. 118 | static public GameObject GetOrCreateCanvasGameObject() 119 | { 120 | GameObject selectedGo = Selection.activeGameObject; 121 | 122 | // Try to find a gameobject that is the selected GO or one if its parents. 123 | Canvas canvas = (selectedGo != null) ? selectedGo.GetComponentInParent() : null; 124 | if (canvas != null && canvas.gameObject.activeInHierarchy) 125 | return canvas.gameObject; 126 | 127 | // No canvas in selection or its parents? Then use just any canvas.. 128 | canvas = Object.FindObjectOfType(typeof(Canvas)) as Canvas; 129 | if (canvas != null && canvas.gameObject.activeInHierarchy) 130 | return canvas.gameObject; 131 | 132 | // No canvas in the scene at all? Then create a new one. 133 | return SGMenuOptions.CreateNewUI(); 134 | } 135 | #endregion 136 | 137 | [MenuItem("GameObject/UI/Loop Horizontal Scroll Rect", false, 2151)] 138 | static public void AddLoopHorizontalScrollRect(MenuCommand menuCommand) 139 | { 140 | GameObject go = SGDefaultControls.CreateLoopHorizontalScrollRect(GetStandardResources()); 141 | PlaceUIElementRoot(go, menuCommand); 142 | } 143 | 144 | [MenuItem("GameObject/UI/Loop Vertical Scroll Rect", false, 2152)] 145 | static public void AddLoopVerticalScrollRect(MenuCommand menuCommand) 146 | { 147 | GameObject go = SGDefaultControls.CreateLoopVerticalScrollRect(GetStandardResources()); 148 | PlaceUIElementRoot(go, menuCommand); 149 | } 150 | } 151 | } -------------------------------------------------------------------------------- /Editor/SGMenuOptions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4b63bf28f5af0e42a464ac316fef603 3 | timeCreated: 1476279563 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Images~/Content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiankanglai/LoopScrollRect/48735bdc5e6d9451b3015e54f2b1f858c404df3e/Images~/Content.png -------------------------------------------------------------------------------- /Images~/LoopVerticalScrollRect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiankanglai/LoopScrollRect/48735bdc5e6d9451b3015e54f2b1f858c404df3e/Images~/LoopVerticalScrollRect.png -------------------------------------------------------------------------------- /Images~/ScrollCell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiankanglai/LoopScrollRect/48735bdc5e6d9451b3015e54f2b1f858c404df3e/Images~/ScrollCell.png -------------------------------------------------------------------------------- /Images~/ScrollToIndex.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiankanglai/LoopScrollRect/48735bdc5e6d9451b3015e54f2b1f858c404df3e/Images~/ScrollToIndex.gif -------------------------------------------------------------------------------- /Images~/demo1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiankanglai/LoopScrollRect/48735bdc5e6d9451b3015e54f2b1f858c404df3e/Images~/demo1.gif -------------------------------------------------------------------------------- /Images~/demo2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiankanglai/LoopScrollRect/48735bdc5e6d9451b3015e54f2b1f858c404df3e/Images~/demo2.gif -------------------------------------------------------------------------------- /Images~/demo3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiankanglai/LoopScrollRect/48735bdc5e6d9451b3015e54f2b1f858c404df3e/Images~/demo3.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Kanglai Qian 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 715b0533d08f38d40829525f03a34ffd 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Loop Scroll Rect 2 | 3 | [![openupm](https://img.shields.io/npm/v/me.qiankanglai.loopscrollrect?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/me.qiankanglai.loopscrollrect/) 4 | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 5 | 6 | These scripts help make your ScrollRect `Reusable`, because it will only build cells when needed. If you have a large number of cells in a scroll rect, you absolutely need it! It will save a lot of time loading and draw call, along with memory in use, while still working smoothly. 7 | 8 | 中文说明请看[这里](http://qiankanglai.me/2015/08/15/LoopScrollRect/)。 9 | 10 | ## Installation 11 | 12 | Open Package Manager and Add package from git URL `https://github.com/qiankanglai/LoopScrollRect.git`. 13 | 14 | With [OpenUPM](https://openupm.com/), just one command `openupm add me.qiankanglai.loopscrollrect`. 15 | 16 | With older Unity version, just clone the repo and put into `Assets/`. 17 | 18 | ## Demo 19 | 20 | Demo for Loop Scroll Rect. Each cell knows its own index, and it is able to modify its content/size/color easily. 21 | 22 | Also ScrollBar is supported now! It supports both vertical & horizontal directions, back and forth. 23 | 24 | ![Demo1](Images~/demo1.gif) 25 | 26 | ![Demo2](Images~/demo2.gif) 27 | 28 | Demo without mask. As you can see, the cells are only instantiated when needed and recycled. 29 | 30 | ![Demo3](Images~/demo3.gif) 31 | 32 | **New**: Scroll to Index 33 | 34 | ![ScrollToIndex](Images~/ScrollToIndex.gif) 35 | 36 | ## Introduction 37 | 38 | The original idea comes from @ivomarel's [InfinityScroll](https://github.com/ivomarel/InfinityScroll). After serveral refactorisations, I almost rewrite all the codes: 39 | - Avoid using `sizeDelta` directly since it doesn't always mean size 40 | - Support GridLayout 41 | - Avoid blocking when dragging back 42 | - Take advantage of pool rather than instantiate/destroy every time 43 | - Improve some other details for performance 44 | - Supports reverse direction 45 | - **Supports ScrollBar** (this doesn't work in Infinite mode, and may behavior strange for cells with different size) 46 | 47 | My scripts copies `ScrollRect` from [UGUI](https://bitbucket.org/Unity-Technologies/ui) rather than inherit `ScrollRect` like InfinityScroll. I need to modify some private variants to make dragging smooth. All my codes is wrapped with comments like `==========LoopScrollRect==========`, making maintaining a little easier. 48 | 49 | ## Example 50 | 51 | Please refer to `InitOnStart.cs` for quick example implmentation. It's high recommended for implmentating your own cache pool. 52 | 53 | ### Infinite Version 54 | 55 | If you need scroll infinitely, you can simply set `totalCount` to a negative number. 56 | 57 | ### Quick Jump 58 | 59 | I've implemented a simple version with `Coroutine`. You can use the following API: 60 | 61 | public void SrollToCell(int index, float speed) 62 | 63 | Here is a corner case unsolved yet: You can't jump to the last cells which cannot be pulled to the start. 64 | 65 | ## Example: Loop Vertical Scroll Rect 66 | 67 | These steps may be confusing, so you can just open the demo scene and copy & paste :D 68 | 69 | You can also remove EasyObjPool and use your pool instead. 70 | 71 | - Prepare cell prefabs 72 | - The cell needs `Layout Element` attached and preferred width/height 73 | - You should add a script receiving message `void ScrollCellIndex (int idx) ` 74 | 75 | ![ScrollCell](Images~/ScrollCell.png) 76 | 77 | - Right click in Hierarchy and click **UI/Loop Horizontal Scroll Rect** or **UI/Loop Vertical Scroll Rect**. It is the same for these two in the Component Menu. 78 | - Init in Start: call Refill cells automatically when Start 79 | - Prefab Pool: the EasyObjPool gameObject 80 | - Prefab Pool Name: the corresponding pool in step 1 81 | - Total Count: How many cells are available (index: 0 ~ TotalCount-1) 82 | - Threshold: How many additional pixels of content should be prepared before start or after end? 83 | - ReverseDirection: If you want scroll from bottom or right, you should toggle this 84 | - Clear Cells: remove existing cells and keep uninitialized 85 | - Refill Cells: initialize and fill up cells 86 | 87 | ![LoopVerticalScrollRect](Images~/LoopVerticalScrollRect.png) 88 | 89 | If you need scroll from top or left, setting content's pivot to 1 and disable ReverseDirection. Otherwise, you should set 0 to pivot and enable ReverseDirection (I have made `VerticalScroll_Reverse` in the demo scene as reference). 90 | 91 | I highly suggests you trying these parameters by hand. More details can be found in the demo scene. 92 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1849c0aa4b3db7b4abb98f58e56ea315 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ec0ddcd49b026ab4fb6b7d49fd693e57 3 | folderAsset: yes 4 | timeCreated: 1439395131 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Runtime/LoopHorizontalScrollRect.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | namespace UnityEngine.UI 5 | { 6 | [AddComponentMenu("UI/Loop Horizontal Scroll Rect", 50)] 7 | [DisallowMultipleComponent] 8 | public class LoopHorizontalScrollRect : LoopScrollRect 9 | { 10 | protected LoopHorizontalScrollRect() 11 | { 12 | direction = LoopScrollRectDirection.Horizontal; 13 | } 14 | 15 | protected override float GetSize(RectTransform item, bool includeSpacing) 16 | { 17 | float size = includeSpacing ? contentSpacing : 0; 18 | if (m_GridLayout != null) 19 | { 20 | size += m_GridLayout.cellSize.x; 21 | } 22 | else 23 | { 24 | size += LoopScrollSizeUtils.GetPreferredWidth(item); 25 | } 26 | size *= m_Content.localScale.x; 27 | return size; 28 | } 29 | 30 | protected override float GetDimension(Vector2 vector) 31 | { 32 | return -vector.x; 33 | } 34 | 35 | protected override float GetAbsDimension(Vector2 vector) 36 | { 37 | return vector.x; 38 | } 39 | 40 | protected override Vector2 GetVector(float value) 41 | { 42 | return new Vector2(-value, 0); 43 | } 44 | 45 | protected override void Awake() 46 | { 47 | base.Awake(); 48 | if (m_Content) 49 | { 50 | GridLayoutGroup layout = m_Content.GetComponent(); 51 | if (layout != null && layout.constraint != GridLayoutGroup.Constraint.FixedRowCount) 52 | { 53 | Debug.LogError("[LoopScrollRect] unsupported GridLayoutGroup constraint"); 54 | } 55 | } 56 | } 57 | 58 | protected override bool UpdateItems(ref Bounds viewBounds, ref Bounds contentBounds) 59 | { 60 | bool changed = false; 61 | 62 | // special case: handling move several page in one frame 63 | if ((viewBounds.size.x < contentBounds.min.x - viewBounds.max.x) && itemTypeEnd > itemTypeStart) 64 | { 65 | float currentSize = contentBounds.size.x; 66 | float elementSize = EstimiateElementSize(); 67 | ReturnToTempPool(false, itemTypeEnd - itemTypeStart); 68 | itemTypeEnd = itemTypeStart; 69 | 70 | int offsetCount = Mathf.FloorToInt((contentBounds.min.x - viewBounds.max.x) / (elementSize + contentSpacing)); 71 | if (totalCount >= 0 && itemTypeStart - offsetCount * contentConstraintCount < 0) 72 | { 73 | offsetCount = Mathf.FloorToInt((float)(itemTypeStart) / contentConstraintCount); 74 | } 75 | itemTypeStart -= offsetCount * contentConstraintCount; 76 | if (totalCount >= 0) 77 | { 78 | itemTypeStart = Mathf.Max(itemTypeStart, 0); 79 | } 80 | itemTypeEnd = itemTypeStart; 81 | itemTypeSize = 0; 82 | 83 | float offset = offsetCount * (elementSize + contentSpacing); 84 | m_Content.anchoredPosition -= new Vector2(offset + (reverseDirection ? currentSize : 0), 0); 85 | contentBounds.center -= new Vector3(offset + currentSize / 2, 0, 0); 86 | contentBounds.size = Vector3.zero; 87 | 88 | changed = true; 89 | } 90 | 91 | if ((viewBounds.min.x - contentBounds.max.x > viewBounds.size.x) && itemTypeEnd > itemTypeStart) 92 | { 93 | int maxItemTypeStart = -1; 94 | if (totalCount >= 0) 95 | { 96 | maxItemTypeStart = Mathf.Max(0, totalCount - (itemTypeEnd - itemTypeStart)); 97 | maxItemTypeStart = (maxItemTypeStart / contentConstraintCount) * contentConstraintCount; 98 | } 99 | float currentSize = contentBounds.size.x; 100 | float elementSize = EstimiateElementSize(); 101 | ReturnToTempPool(true, itemTypeEnd - itemTypeStart); 102 | // TODO: fix with contentConstraint? 103 | itemTypeStart = itemTypeEnd; 104 | 105 | int offsetCount = Mathf.FloorToInt((viewBounds.min.x - contentBounds.max.x) / (elementSize + contentSpacing)); 106 | if (maxItemTypeStart >= 0 && itemTypeStart + offsetCount * contentConstraintCount > maxItemTypeStart) 107 | { 108 | offsetCount = Mathf.FloorToInt((float)(maxItemTypeStart - itemTypeStart) / contentConstraintCount); 109 | } 110 | itemTypeStart += offsetCount * contentConstraintCount; 111 | if (totalCount >= 0) 112 | { 113 | itemTypeStart = Mathf.Max(itemTypeStart, 0); 114 | } 115 | itemTypeEnd = itemTypeStart; 116 | itemTypeSize = 0; 117 | 118 | float offset = offsetCount * (elementSize + contentSpacing); 119 | m_Content.anchoredPosition += new Vector2(offset + (reverseDirection ? 0 : currentSize), 0); 120 | contentBounds.center += new Vector3(offset + currentSize / 2, 0, 0); 121 | contentBounds.size = Vector3.zero; 122 | 123 | changed = true; 124 | } 125 | 126 | if (viewBounds.max.x > contentBounds.max.x - m_ContentRightPadding) 127 | { 128 | float size = NewItemAtEnd(), totalSize = size; 129 | while (size > 0 && viewBounds.max.x > contentBounds.max.x - m_ContentRightPadding + totalSize) 130 | { 131 | size = NewItemAtEnd(); 132 | totalSize += size; 133 | } 134 | if (totalSize > 0) 135 | changed = true; 136 | } 137 | else if ((itemTypeEnd % contentConstraintCount != 0) && (itemTypeEnd < totalCount || totalCount < 0)) 138 | { 139 | NewItemAtEnd(); 140 | } 141 | 142 | if (viewBounds.min.x < contentBounds.min.x + m_ContentLeftPadding) 143 | { 144 | float size = NewItemAtStart(), totalSize = size; 145 | while (size > 0 && viewBounds.min.x < contentBounds.min.x + m_ContentLeftPadding - totalSize) 146 | { 147 | size = NewItemAtStart(); 148 | totalSize += size; 149 | } 150 | if (totalSize > 0) 151 | changed = true; 152 | } 153 | 154 | if (viewBounds.max.x < contentBounds.max.x - threshold - m_ContentRightPadding 155 | && viewBounds.size.x < contentBounds.size.x - threshold) 156 | { 157 | float size = DeleteItemAtEnd(), totalSize = size; 158 | while (size > 0 && viewBounds.max.x < contentBounds.max.x - threshold - m_ContentRightPadding - totalSize) 159 | { 160 | size = DeleteItemAtEnd(); 161 | totalSize += size; 162 | } 163 | if (totalSize > 0) 164 | changed = true; 165 | } 166 | 167 | if (viewBounds.min.x > contentBounds.min.x + threshold + m_ContentLeftPadding 168 | && viewBounds.size.x < contentBounds.size.x - threshold) 169 | { 170 | float size = DeleteItemAtStart(), totalSize = size; 171 | while (size > 0 && viewBounds.min.x > contentBounds.min.x + threshold + m_ContentLeftPadding + totalSize) 172 | { 173 | size = DeleteItemAtStart(); 174 | totalSize += size; 175 | } 176 | if (totalSize > 0) 177 | changed = true; 178 | } 179 | 180 | if (changed) 181 | { 182 | ClearTempPool(); 183 | } 184 | 185 | return changed; 186 | } 187 | } 188 | } -------------------------------------------------------------------------------- /Runtime/LoopHorizontalScrollRect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab7b38d60c9f6a944831d24146f39793 3 | timeCreated: 1439395663 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/LoopHorizontalScrollRectMulti.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | namespace UnityEngine.UI 5 | { 6 | [AddComponentMenu("UI/Loop Horizontal Scroll Rect(MultiPrefab)", 52)] 7 | [DisallowMultipleComponent] 8 | public class LoopHorizontalScrollRectMulti : LoopScrollRectMulti 9 | { 10 | protected LoopHorizontalScrollRectMulti() 11 | { 12 | direction = LoopScrollRectDirection.Horizontal; 13 | } 14 | 15 | protected override float GetSize(RectTransform item, bool includeSpacing) 16 | { 17 | float size = includeSpacing ? contentSpacing : 0; 18 | if (m_GridLayout != null) 19 | { 20 | size += m_GridLayout.cellSize.x; 21 | } 22 | else 23 | { 24 | size += LoopScrollSizeUtils.GetPreferredWidth(item); 25 | } 26 | size *= m_Content.localScale.x; 27 | return size; 28 | } 29 | 30 | protected override float GetDimension(Vector2 vector) 31 | { 32 | return -vector.x; 33 | } 34 | 35 | protected override float GetAbsDimension(Vector2 vector) 36 | { 37 | return vector.x; 38 | } 39 | 40 | protected override Vector2 GetVector(float value) 41 | { 42 | return new Vector2(-value, 0); 43 | } 44 | 45 | protected override void Awake() 46 | { 47 | base.Awake(); 48 | if (m_Content) 49 | { 50 | GridLayoutGroup layout = m_Content.GetComponent(); 51 | if (layout != null && layout.constraint != GridLayoutGroup.Constraint.FixedRowCount) 52 | { 53 | Debug.LogError("[LoopScrollRect] unsupported GridLayoutGroup constraint"); 54 | } 55 | } 56 | } 57 | 58 | protected override bool UpdateItems(ref Bounds viewBounds, ref Bounds contentBounds) 59 | { 60 | bool changed = false; 61 | 62 | // special case: handling move several page in one frame 63 | if ((viewBounds.size.x < contentBounds.min.x - viewBounds.max.x) && itemTypeEnd > itemTypeStart) 64 | { 65 | float currentSize = contentBounds.size.x; 66 | float elementSize = EstimiateElementSize(); 67 | ReturnToTempPool(false, itemTypeEnd - itemTypeStart); 68 | itemTypeEnd = itemTypeStart; 69 | 70 | int offsetCount = Mathf.FloorToInt((contentBounds.min.x - viewBounds.max.x) / (elementSize + contentSpacing)); 71 | if (totalCount >= 0 && itemTypeStart - offsetCount * contentConstraintCount < 0) 72 | { 73 | offsetCount = Mathf.FloorToInt((float)(itemTypeStart) / contentConstraintCount); 74 | } 75 | itemTypeStart -= offsetCount * contentConstraintCount; 76 | if (totalCount >= 0) 77 | { 78 | itemTypeStart = Mathf.Max(itemTypeStart, 0); 79 | } 80 | itemTypeEnd = itemTypeStart; 81 | itemTypeSize = 0; 82 | 83 | float offset = offsetCount * (elementSize + contentSpacing); 84 | m_Content.anchoredPosition -= new Vector2(offset + (reverseDirection ? currentSize : 0), 0); 85 | contentBounds.center -= new Vector3(offset + currentSize / 2, 0, 0); 86 | contentBounds.size = Vector3.zero; 87 | 88 | changed = true; 89 | } 90 | 91 | if ((viewBounds.min.x - contentBounds.max.x > viewBounds.size.x) && itemTypeEnd > itemTypeStart) 92 | { 93 | int maxItemTypeStart = -1; 94 | if (totalCount >= 0) 95 | { 96 | maxItemTypeStart = Mathf.Max(0, totalCount - (itemTypeEnd - itemTypeStart)); 97 | maxItemTypeStart = (maxItemTypeStart / contentConstraintCount) * contentConstraintCount; 98 | } 99 | float currentSize = contentBounds.size.x; 100 | float elementSize = EstimiateElementSize(); 101 | ReturnToTempPool(true, itemTypeEnd - itemTypeStart); 102 | // TODO: fix with contentConstraint? 103 | itemTypeStart = itemTypeEnd; 104 | 105 | int offsetCount = Mathf.FloorToInt((viewBounds.min.x - contentBounds.max.x) / (elementSize + contentSpacing)); 106 | if (maxItemTypeStart >= 0 && itemTypeStart + offsetCount * contentConstraintCount > maxItemTypeStart) 107 | { 108 | offsetCount = Mathf.FloorToInt((float)(maxItemTypeStart - itemTypeStart) / contentConstraintCount); 109 | } 110 | itemTypeStart += offsetCount * contentConstraintCount; 111 | if (totalCount >= 0) 112 | { 113 | itemTypeStart = Mathf.Max(itemTypeStart, 0); 114 | } 115 | itemTypeEnd = itemTypeStart; 116 | itemTypeSize = 0; 117 | 118 | float offset = offsetCount * (elementSize + contentSpacing); 119 | m_Content.anchoredPosition += new Vector2(offset + (reverseDirection ? 0 : currentSize), 0); 120 | contentBounds.center += new Vector3(offset + currentSize / 2, 0, 0); 121 | contentBounds.size = Vector3.zero; 122 | 123 | changed = true; 124 | } 125 | 126 | if (viewBounds.max.x > contentBounds.max.x - m_ContentRightPadding) 127 | { 128 | float size = NewItemAtEnd(), totalSize = size; 129 | while (size > 0 && viewBounds.max.x > contentBounds.max.x - m_ContentRightPadding + totalSize) 130 | { 131 | size = NewItemAtEnd(); 132 | totalSize += size; 133 | } 134 | if (totalSize > 0) 135 | changed = true; 136 | } 137 | else if ((itemTypeEnd % contentConstraintCount != 0) && (itemTypeEnd < totalCount || totalCount < 0)) 138 | { 139 | NewItemAtEnd(); 140 | } 141 | 142 | if (viewBounds.min.x < contentBounds.min.x + m_ContentLeftPadding) 143 | { 144 | float size = NewItemAtStart(), totalSize = size; 145 | while (size > 0 && viewBounds.min.x < contentBounds.min.x + m_ContentLeftPadding - totalSize) 146 | { 147 | size = NewItemAtStart(); 148 | totalSize += size; 149 | } 150 | if (totalSize > 0) 151 | changed = true; 152 | } 153 | 154 | if (viewBounds.max.x < contentBounds.max.x - threshold - m_ContentRightPadding 155 | && viewBounds.size.x < contentBounds.size.x - threshold) 156 | { 157 | float size = DeleteItemAtEnd(), totalSize = size; 158 | while (size > 0 && viewBounds.max.x < contentBounds.max.x - threshold - m_ContentRightPadding - totalSize) 159 | { 160 | size = DeleteItemAtEnd(); 161 | totalSize += size; 162 | } 163 | if (totalSize > 0) 164 | changed = true; 165 | } 166 | 167 | if (viewBounds.min.x > contentBounds.min.x + threshold + m_ContentLeftPadding 168 | && viewBounds.size.x < contentBounds.size.x - threshold) 169 | { 170 | float size = DeleteItemAtStart(), totalSize = size; 171 | while (size > 0 && viewBounds.min.x > contentBounds.min.x + threshold + m_ContentLeftPadding + totalSize) 172 | { 173 | size = DeleteItemAtStart(); 174 | totalSize += size; 175 | } 176 | if (totalSize > 0) 177 | changed = true; 178 | } 179 | 180 | if (changed) 181 | { 182 | ClearTempPool(); 183 | } 184 | 185 | return changed; 186 | } 187 | } 188 | } -------------------------------------------------------------------------------- /Runtime/LoopHorizontalScrollRectMulti.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0aa64ab4e86f574469b5d4fda2e9c85f 3 | timeCreated: 1439395663 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/LoopScrollDataSource.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | namespace UnityEngine.UI 5 | { 6 | public interface LoopScrollDataSource 7 | { 8 | void ProvideData(Transform transform, int idx); 9 | } 10 | } -------------------------------------------------------------------------------- /Runtime/LoopScrollDataSource.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: be1ddd0ddf17846f0b38566071ee623e 3 | timeCreated: 1500356133 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/LoopScrollMultiDataSource.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | namespace UnityEngine.UI 5 | { 6 | public interface LoopScrollMultiDataSource 7 | { 8 | void ProvideData(Transform transform, int index); 9 | } 10 | } -------------------------------------------------------------------------------- /Runtime/LoopScrollMultiDataSource.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8730c6d35f93cb946b80539f595b48c1 3 | timeCreated: 1500356133 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/LoopScrollPrefabSource.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | namespace UnityEngine.UI 5 | { 6 | public interface LoopScrollPrefabSource 7 | { 8 | GameObject GetObject(int index); 9 | 10 | void ReturnObject(Transform trans); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Runtime/LoopScrollPrefabSource.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4cea3807a046c4500be20219e5c46432 3 | timeCreated: 1500356133 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/LoopScrollRect.Runtime.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "LoopScrollRect.Runtime", 3 | "rootNamespace": "", 4 | "references": [ 5 | "UnityEngine.UI" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [], 14 | "versionDefines": [], 15 | "noEngineReferences": false 16 | } -------------------------------------------------------------------------------- /Runtime/LoopScrollRect.Runtime.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 174b432621f01fb418be26ffc6c90e22 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/LoopScrollRect.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Events; 3 | using UnityEngine.EventSystems; 4 | using System; 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | 8 | namespace UnityEngine.UI 9 | { 10 | public abstract class LoopScrollRect : LoopScrollRectBase 11 | { 12 | [HideInInspector] 13 | [NonSerialized] 14 | public LoopScrollDataSource dataSource = null; 15 | 16 | protected override void ProvideData(Transform transform, int index) 17 | { 18 | dataSource.ProvideData(transform, index); 19 | } 20 | 21 | protected override RectTransform GetFromTempPool(int itemIdx) 22 | { 23 | RectTransform nextItem = null; 24 | if (deletedItemTypeStart > 0) 25 | { 26 | deletedItemTypeStart--; 27 | nextItem = m_Content.GetChild(0) as RectTransform; 28 | nextItem.SetSiblingIndex(itemIdx - itemTypeStart + deletedItemTypeStart); 29 | } 30 | else if (deletedItemTypeEnd > 0) 31 | { 32 | deletedItemTypeEnd--; 33 | nextItem = m_Content.GetChild(m_Content.childCount - 1) as RectTransform; 34 | nextItem.SetSiblingIndex(itemIdx - itemTypeStart + deletedItemTypeStart); 35 | } 36 | else 37 | { 38 | nextItem = prefabSource.GetObject(itemIdx).transform as RectTransform; 39 | nextItem.transform.SetParent(m_Content, false); 40 | nextItem.gameObject.SetActive(true); 41 | } 42 | ProvideData(nextItem, itemIdx); 43 | return nextItem; 44 | } 45 | 46 | protected override void ReturnToTempPool(bool fromStart, int count) 47 | { 48 | if (fromStart) 49 | deletedItemTypeStart += count; 50 | else 51 | deletedItemTypeEnd += count; 52 | } 53 | 54 | protected override void ClearTempPool() 55 | { 56 | Debug.Assert(m_Content.childCount >= deletedItemTypeStart + deletedItemTypeEnd); 57 | if (deletedItemTypeStart > 0) 58 | { 59 | for (int i = deletedItemTypeStart - 1; i >= 0; i--) 60 | { 61 | prefabSource.ReturnObject(m_Content.GetChild(i)); 62 | } 63 | deletedItemTypeStart = 0; 64 | } 65 | if (deletedItemTypeEnd > 0) 66 | { 67 | int t = m_Content.childCount - deletedItemTypeEnd; 68 | for (int i = m_Content.childCount - 1; i >= t; i--) 69 | { 70 | prefabSource.ReturnObject(m_Content.GetChild(i)); 71 | } 72 | deletedItemTypeEnd = 0; 73 | } 74 | } 75 | } 76 | } -------------------------------------------------------------------------------- /Runtime/LoopScrollRect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ec983a492fb0204bacc07738659994f 3 | timeCreated: 1439395663 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/LoopScrollRectBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33aaabb8aa0854047a50d2d2b0c6f1a5 3 | timeCreated: 1439395663 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/LoopScrollRectMulti.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Events; 3 | using UnityEngine.EventSystems; 4 | using System; 5 | using System.Collections; 6 | using System.Collections.Generic; 7 | 8 | namespace UnityEngine.UI 9 | { 10 | public abstract class LoopScrollRectMulti : LoopScrollRectBase 11 | { 12 | [HideInInspector] 13 | [NonSerialized] 14 | public LoopScrollMultiDataSource dataSource = null; 15 | 16 | protected override void ProvideData(Transform transform, int index) 17 | { 18 | dataSource.ProvideData(transform, index); 19 | } 20 | 21 | // Multi Data Source cannot support TempPool 22 | protected override RectTransform GetFromTempPool(int itemIdx) 23 | { 24 | RectTransform nextItem = prefabSource.GetObject(itemIdx).transform as RectTransform; 25 | nextItem.transform.SetParent(m_Content, false); 26 | nextItem.gameObject.SetActive(true); 27 | 28 | ProvideData(nextItem, itemIdx); 29 | return nextItem; 30 | } 31 | 32 | protected override void ReturnToTempPool(bool fromStart, int count) 33 | { 34 | Debug.Assert(m_Content.childCount >= count); 35 | if (fromStart) 36 | { 37 | for (int i = count - 1; i >= 0; i--) 38 | { 39 | prefabSource.ReturnObject(m_Content.GetChild(i)); 40 | } 41 | } 42 | else 43 | { 44 | int t = m_Content.childCount - count; 45 | for (int i = m_Content.childCount - 1; i >= t; i--) 46 | { 47 | prefabSource.ReturnObject(m_Content.GetChild(i)); 48 | } 49 | } 50 | } 51 | 52 | protected override void ClearTempPool() 53 | { 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Runtime/LoopScrollRectMulti.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1bb4b17b11dd527499b49566928fed17 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/LoopScrollSizeHelper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | namespace UnityEngine.UI 5 | { 6 | // optional class for better scroll support 7 | public interface LoopScrollSizeHelper 8 | { 9 | Vector2 GetItemsSize(int itemsCount); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Runtime/LoopScrollSizeHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34053817472810d49a0a82b79338dde5 3 | timeCreated: 1500356133 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/LoopScrollSizeUtils.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace UnityEngine.UI 5 | { 6 | public static class LoopScrollSizeUtils 7 | { 8 | public static float GetPreferredHeight(RectTransform item) 9 | { 10 | ILayoutElement minLayoutElement; 11 | ILayoutElement preferredLayoutElement; 12 | var minHeight = LayoutUtility.GetLayoutProperty(item, e => e.minHeight, 0, out minLayoutElement); 13 | var preferredHeight = LayoutUtility.GetLayoutProperty(item, e => e.preferredHeight, 0, out preferredLayoutElement); 14 | var result = Mathf.Max(minHeight, preferredHeight); 15 | if (preferredLayoutElement == null && minLayoutElement == null) 16 | { 17 | result = item.rect.height; 18 | } 19 | Debug.Assert(result > 0); 20 | return result; 21 | } 22 | 23 | public static float GetPreferredWidth(RectTransform item) 24 | { 25 | ILayoutElement minLayoutElement; 26 | ILayoutElement preferredLayoutElement; 27 | var minWidth = LayoutUtility.GetLayoutProperty(item, e => e.minWidth, 0, out minLayoutElement); 28 | var preferredWidth = LayoutUtility.GetLayoutProperty(item, e => e.preferredWidth, 0, out preferredLayoutElement); 29 | var result = Mathf.Max(minWidth, preferredWidth); 30 | if (preferredLayoutElement == null && minLayoutElement == null) 31 | { 32 | result = item.rect.width; 33 | } 34 | Debug.Assert(result > 0); 35 | return result; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Runtime/LoopScrollSizeUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e089162759fe4031997b918866745978 3 | timeCreated: 1721785991 -------------------------------------------------------------------------------- /Runtime/LoopVerticalScrollRect.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using System.Collections; 4 | 5 | namespace UnityEngine.UI 6 | { 7 | [AddComponentMenu("UI/Loop Vertical Scroll Rect", 51)] 8 | [DisallowMultipleComponent] 9 | public class LoopVerticalScrollRect : LoopScrollRect 10 | { 11 | protected LoopVerticalScrollRect() 12 | { 13 | direction = LoopScrollRectDirection.Vertical; 14 | } 15 | 16 | protected override float GetSize(RectTransform item, bool includeSpacing) 17 | { 18 | float size = includeSpacing ? contentSpacing : 0; 19 | if (m_GridLayout != null) 20 | { 21 | size += m_GridLayout.cellSize.y; 22 | } 23 | else 24 | { 25 | size += LoopScrollSizeUtils.GetPreferredHeight(item); 26 | } 27 | size *= m_Content.localScale.y; 28 | return size; 29 | } 30 | 31 | protected override float GetDimension(Vector2 vector) 32 | { 33 | return vector.y; 34 | } 35 | 36 | protected override float GetAbsDimension(Vector2 vector) 37 | { 38 | return vector.y; 39 | } 40 | 41 | protected override Vector2 GetVector(float value) 42 | { 43 | return new Vector2(0, value); 44 | } 45 | 46 | protected override void Awake() 47 | { 48 | base.Awake(); 49 | if (m_Content) 50 | { 51 | GridLayoutGroup layout = m_Content.GetComponent(); 52 | if (layout != null && layout.constraint != GridLayoutGroup.Constraint.FixedColumnCount) 53 | { 54 | Debug.LogError("[LoopScrollRect] unsupported GridLayoutGroup constraint"); 55 | } 56 | } 57 | } 58 | 59 | protected override bool UpdateItems(ref Bounds viewBounds, ref Bounds contentBounds) 60 | { 61 | bool changed = false; 62 | 63 | // special case: handling move several page in one frame 64 | if ((viewBounds.size.y < contentBounds.min.y - viewBounds.max.y) && itemTypeEnd > itemTypeStart) 65 | { 66 | int maxItemTypeStart = -1; 67 | if (totalCount >= 0) 68 | { 69 | maxItemTypeStart = Mathf.Max(0, totalCount - (itemTypeEnd - itemTypeStart)); 70 | } 71 | float currentSize = contentBounds.size.y; 72 | float elementSize = EstimiateElementSize(); 73 | ReturnToTempPool(true, itemTypeEnd - itemTypeStart); 74 | itemTypeStart = itemTypeEnd; 75 | 76 | int offsetCount = Mathf.FloorToInt((contentBounds.min.y - viewBounds.max.y) / (elementSize + contentSpacing)); 77 | if (maxItemTypeStart >= 0 && itemTypeStart + offsetCount * contentConstraintCount > maxItemTypeStart) 78 | { 79 | offsetCount = Mathf.FloorToInt((float)(maxItemTypeStart - itemTypeStart) / contentConstraintCount); 80 | } 81 | itemTypeStart += offsetCount * contentConstraintCount; 82 | if (totalCount >= 0) 83 | { 84 | itemTypeStart = Mathf.Max(itemTypeStart, 0); 85 | } 86 | itemTypeEnd = itemTypeStart; 87 | itemTypeSize = 0; 88 | 89 | float offset = offsetCount * (elementSize + contentSpacing); 90 | m_Content.anchoredPosition -= new Vector2(0, offset + (reverseDirection ? 0 : currentSize)); 91 | contentBounds.center -= new Vector3(0, offset + currentSize / 2, 0); 92 | contentBounds.size = Vector3.zero; 93 | 94 | changed = true; 95 | } 96 | 97 | if ((viewBounds.min.y - contentBounds.max.y > viewBounds.size.y) && itemTypeEnd > itemTypeStart) 98 | { 99 | float currentSize = contentBounds.size.y; 100 | float elementSize = EstimiateElementSize(); 101 | ReturnToTempPool(false, itemTypeEnd - itemTypeStart); 102 | itemTypeEnd = itemTypeStart; 103 | 104 | int offsetCount = Mathf.FloorToInt((viewBounds.min.y - contentBounds.max.y) / (elementSize + contentSpacing)); 105 | if (totalCount >= 0 && itemTypeStart - offsetCount * contentConstraintCount < 0) 106 | { 107 | offsetCount = Mathf.FloorToInt((float)(itemTypeStart) / contentConstraintCount); 108 | } 109 | itemTypeStart -= offsetCount * contentConstraintCount; 110 | if (totalCount >= 0) 111 | { 112 | itemTypeStart = Mathf.Max(itemTypeStart, 0); 113 | } 114 | itemTypeEnd = itemTypeStart; 115 | itemTypeSize = 0; 116 | 117 | float offset = offsetCount * (elementSize + contentSpacing); 118 | m_Content.anchoredPosition += new Vector2(0, offset + (reverseDirection ? currentSize : 0)); 119 | contentBounds.center += new Vector3(0, offset + currentSize / 2, 0); 120 | contentBounds.size = Vector3.zero; 121 | 122 | changed = true; 123 | } 124 | // issue #149: new item before delete 125 | if (viewBounds.min.y < contentBounds.min.y + m_ContentBottomPadding) 126 | { 127 | float size = NewItemAtEnd(), totalSize = size; 128 | while (size > 0 && viewBounds.min.y < contentBounds.min.y + m_ContentBottomPadding - totalSize) 129 | { 130 | size = NewItemAtEnd(); 131 | totalSize += size; 132 | } 133 | if (totalSize > 0) 134 | changed = true; 135 | } 136 | // issue #178: grid layout could increase totalCount at any time 137 | else if ((itemTypeEnd % contentConstraintCount != 0) && (itemTypeEnd < totalCount || totalCount < 0)) 138 | { 139 | NewItemAtEnd(); 140 | } 141 | 142 | if (viewBounds.max.y > contentBounds.max.y - m_ContentTopPadding) 143 | { 144 | float size = NewItemAtStart(), totalSize = size; 145 | while (size > 0 && viewBounds.max.y > contentBounds.max.y - m_ContentTopPadding + totalSize) 146 | { 147 | size = NewItemAtStart(); 148 | totalSize += size; 149 | } 150 | if (totalSize > 0) 151 | changed = true; 152 | } 153 | 154 | if (viewBounds.min.y > contentBounds.min.y + threshold + m_ContentBottomPadding 155 | && viewBounds.size.y < contentBounds.size.y - threshold) 156 | { 157 | float size = DeleteItemAtEnd(), totalSize = size; 158 | while (size > 0 && viewBounds.min.y > contentBounds.min.y + threshold + m_ContentBottomPadding + totalSize) 159 | { 160 | size = DeleteItemAtEnd(); 161 | totalSize += size; 162 | } 163 | if (totalSize > 0) 164 | changed = true; 165 | } 166 | 167 | if (viewBounds.max.y < contentBounds.max.y - threshold - m_ContentTopPadding 168 | && viewBounds.size.y < contentBounds.size.y - threshold) 169 | { 170 | float size = DeleteItemAtStart(), totalSize = size; 171 | while (size > 0 && viewBounds.max.y < contentBounds.max.y - threshold - m_ContentTopPadding - totalSize) 172 | { 173 | size = DeleteItemAtStart(); 174 | totalSize += size; 175 | } 176 | if (totalSize > 0) 177 | changed = true; 178 | } 179 | 180 | if (changed) 181 | { 182 | ClearTempPool(); 183 | } 184 | 185 | return changed; 186 | } 187 | } 188 | } -------------------------------------------------------------------------------- /Runtime/LoopVerticalScrollRect.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce71017a2903f7c4c9a699e438d0b897 3 | timeCreated: 1439395663 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Runtime/LoopVerticalScrollRectMulti.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using System.Collections; 4 | 5 | namespace UnityEngine.UI 6 | { 7 | [AddComponentMenu("UI/Loop Vertical Scroll Rect(MultiPrefab)", 53)] 8 | [DisallowMultipleComponent] 9 | public class LoopVerticalScrollRectMulti : LoopScrollRectMulti 10 | { 11 | protected LoopVerticalScrollRectMulti() 12 | { 13 | direction = LoopScrollRectDirection.Vertical; 14 | } 15 | 16 | protected override float GetSize(RectTransform item, bool includeSpacing) 17 | { 18 | float size = includeSpacing ? contentSpacing : 0; 19 | if (m_GridLayout != null) 20 | { 21 | size += m_GridLayout.cellSize.y; 22 | } 23 | else 24 | { 25 | size += LoopScrollSizeUtils.GetPreferredHeight(item); 26 | } 27 | size *= m_Content.localScale.y; 28 | return size; 29 | } 30 | 31 | protected override float GetDimension(Vector2 vector) 32 | { 33 | return vector.y; 34 | } 35 | 36 | protected override float GetAbsDimension(Vector2 vector) 37 | { 38 | return vector.y; 39 | } 40 | 41 | protected override Vector2 GetVector(float value) 42 | { 43 | return new Vector2(0, value); 44 | } 45 | 46 | protected override void Awake() 47 | { 48 | base.Awake(); 49 | if (m_Content) 50 | { 51 | GridLayoutGroup layout = m_Content.GetComponent(); 52 | if (layout != null && layout.constraint != GridLayoutGroup.Constraint.FixedColumnCount) 53 | { 54 | Debug.LogError("[LoopScrollRect] unsupported GridLayoutGroup constraint"); 55 | } 56 | } 57 | } 58 | 59 | protected override bool UpdateItems(ref Bounds viewBounds, ref Bounds contentBounds) 60 | { 61 | bool changed = false; 62 | 63 | // special case: handling move several page in one frame 64 | if ((viewBounds.size.y < contentBounds.min.y - viewBounds.max.y) && itemTypeEnd > itemTypeStart) 65 | { 66 | int maxItemTypeStart = -1; 67 | if (totalCount >= 0) 68 | { 69 | maxItemTypeStart = Mathf.Max(0, totalCount - (itemTypeEnd - itemTypeStart)); 70 | } 71 | float currentSize = contentBounds.size.y; 72 | float elementSize = EstimiateElementSize(); 73 | ReturnToTempPool(true, itemTypeEnd - itemTypeStart); 74 | itemTypeStart = itemTypeEnd; 75 | 76 | int offsetCount = Mathf.FloorToInt((contentBounds.min.y - viewBounds.max.y) / (elementSize + contentSpacing)); 77 | if (maxItemTypeStart >= 0 && itemTypeStart + offsetCount * contentConstraintCount > maxItemTypeStart) 78 | { 79 | offsetCount = Mathf.FloorToInt((float)(maxItemTypeStart - itemTypeStart) / contentConstraintCount); 80 | } 81 | itemTypeStart += offsetCount * contentConstraintCount; 82 | if (totalCount >= 0) 83 | { 84 | itemTypeStart = Mathf.Max(itemTypeStart, 0); 85 | } 86 | itemTypeEnd = itemTypeStart; 87 | itemTypeSize = 0; 88 | 89 | float offset = offsetCount * (elementSize + contentSpacing); 90 | m_Content.anchoredPosition -= new Vector2(0, offset + (reverseDirection ? 0 : currentSize)); 91 | contentBounds.center -= new Vector3(0, offset + currentSize / 2, 0); 92 | contentBounds.size = Vector3.zero; 93 | 94 | changed = true; 95 | } 96 | 97 | if ((viewBounds.min.y - contentBounds.max.y > viewBounds.size.y) && itemTypeEnd > itemTypeStart) 98 | { 99 | float currentSize = contentBounds.size.y; 100 | float elementSize = EstimiateElementSize(); 101 | ReturnToTempPool(false, itemTypeEnd - itemTypeStart); 102 | itemTypeEnd = itemTypeStart; 103 | 104 | int offsetCount = Mathf.FloorToInt((viewBounds.min.y - contentBounds.max.y) / (elementSize + contentSpacing)); 105 | if (totalCount >= 0 && itemTypeStart - offsetCount * contentConstraintCount < 0) 106 | { 107 | offsetCount = Mathf.FloorToInt((float)(itemTypeStart) / contentConstraintCount); 108 | } 109 | itemTypeStart -= offsetCount * contentConstraintCount; 110 | if (totalCount >= 0) 111 | { 112 | itemTypeStart = Mathf.Max(itemTypeStart, 0); 113 | } 114 | itemTypeEnd = itemTypeStart; 115 | itemTypeSize = 0; 116 | 117 | float offset = offsetCount * (elementSize + contentSpacing); 118 | m_Content.anchoredPosition += new Vector2(0, offset + (reverseDirection ? currentSize : 0)); 119 | contentBounds.center += new Vector3(0, offset + currentSize / 2, 0); 120 | contentBounds.size = Vector3.zero; 121 | 122 | changed = true; 123 | } 124 | 125 | if (viewBounds.min.y < contentBounds.min.y + m_ContentBottomPadding) 126 | { 127 | float size = NewItemAtEnd(), totalSize = size; 128 | while (size > 0 && viewBounds.min.y < contentBounds.min.y + m_ContentBottomPadding - totalSize) 129 | { 130 | size = NewItemAtEnd(); 131 | totalSize += size; 132 | } 133 | if (totalSize > 0) 134 | changed = true; 135 | } 136 | else if ((itemTypeEnd % contentConstraintCount != 0) && (itemTypeEnd < totalCount || totalCount < 0)) 137 | { 138 | NewItemAtEnd(); 139 | } 140 | 141 | if (viewBounds.max.y > contentBounds.max.y - m_ContentTopPadding) 142 | { 143 | float size = NewItemAtStart(), totalSize = size; 144 | while (size > 0 && viewBounds.max.y > contentBounds.max.y - m_ContentTopPadding + totalSize) 145 | { 146 | size = NewItemAtStart(); 147 | totalSize += size; 148 | } 149 | if (totalSize > 0) 150 | changed = true; 151 | } 152 | 153 | if (viewBounds.min.y > contentBounds.min.y + threshold + m_ContentBottomPadding 154 | && viewBounds.size.y < contentBounds.size.y - threshold) 155 | { 156 | float size = DeleteItemAtEnd(), totalSize = size; 157 | while (size > 0 && viewBounds.min.y > contentBounds.min.y + threshold + m_ContentBottomPadding + totalSize) 158 | { 159 | size = DeleteItemAtEnd(); 160 | totalSize += size; 161 | } 162 | if (totalSize > 0) 163 | changed = true; 164 | } 165 | 166 | if (viewBounds.max.y < contentBounds.max.y - threshold - m_ContentTopPadding 167 | && viewBounds.size.y < contentBounds.size.y - threshold) 168 | { 169 | float size = DeleteItemAtStart(), totalSize = size; 170 | while (size > 0 && viewBounds.max.y < contentBounds.max.y - threshold - m_ContentTopPadding - totalSize) 171 | { 172 | size = DeleteItemAtStart(); 173 | totalSize += size; 174 | } 175 | if (totalSize > 0) 176 | changed = true; 177 | } 178 | 179 | if (changed) 180 | { 181 | ClearTempPool(); 182 | } 183 | 184 | return changed; 185 | } 186 | } 187 | } -------------------------------------------------------------------------------- /Runtime/LoopVerticalScrollRectMulti.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4ae502f584e1924d83adb15f18817dc 3 | timeCreated: 1439395663 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Samples~/Demo.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d2175890aaf8a5a4ca0d06dbd5b30932 3 | folderAsset: yes 4 | timeCreated: 1439396419 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Samples~/Demo/DemoScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb16de1fffe5c164696efe7c5c3bb7d1 3 | timeCreated: 1439396359 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/DemoSceneSingle.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9abc1eadc4e97414c832bf8dfd0a1dac 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/DemoScene_MultiCell.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 11c5a7b57e4e7614089d677e82993d1d 3 | timeCreated: 1439396359 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/DemoScene_MultiCellFullScreen.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 06e4fd0edb46e424ba9213395e58ec48 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcd8464e40b5d9d40b2cb448cdcad0d5 3 | folderAsset: yes 4 | timeCreated: 1439425346 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/HorizontalScroll_CustomSize.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8aa656b077a35c54fb82009b1ee9e4f8 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/HorizontalScroll_Grid.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2446adbc9117c31408d10594ed51594c 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell1.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &108710 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 4 9 | m_Component: 10 | - 224: {fileID: 22435118} 11 | - 222: {fileID: 22270478} 12 | - 114: {fileID: 11410392} 13 | m_Layer: 5 14 | m_Name: Text 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!1 &183744 21 | GameObject: 22 | m_ObjectHideFlags: 0 23 | m_PrefabParentObject: {fileID: 0} 24 | m_PrefabInternal: {fileID: 100100000} 25 | serializedVersion: 4 26 | m_Component: 27 | - 224: {fileID: 22418634} 28 | - 222: {fileID: 22216460} 29 | - 114: {fileID: 11487888} 30 | - 114: {fileID: 11439716} 31 | - 114: {fileID: 11464570} 32 | - 114: {fileID: 11468506} 33 | m_Layer: 5 34 | m_Name: ScrollCell1 35 | m_TagString: Untagged 36 | m_Icon: {fileID: 0} 37 | m_NavMeshLayer: 0 38 | m_StaticEditorFlags: 0 39 | m_IsActive: 1 40 | --- !u!114 &11410392 41 | MonoBehaviour: 42 | m_ObjectHideFlags: 1 43 | m_PrefabParentObject: {fileID: 0} 44 | m_PrefabInternal: {fileID: 100100000} 45 | m_GameObject: {fileID: 108710} 46 | m_Enabled: 1 47 | m_EditorHideFlags: 0 48 | m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 49 | m_Name: 50 | m_EditorClassIdentifier: 51 | m_Material: {fileID: 0} 52 | m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} 53 | m_FontData: 54 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 55 | m_FontSize: 14 56 | m_FontStyle: 0 57 | m_BestFit: 0 58 | m_MinSize: 10 59 | m_MaxSize: 40 60 | m_Alignment: 4 61 | m_RichText: 1 62 | m_HorizontalOverflow: 0 63 | m_VerticalOverflow: 0 64 | m_LineSpacing: 1 65 | m_Text: Button 66 | --- !u!114 &11439716 67 | MonoBehaviour: 68 | m_ObjectHideFlags: 1 69 | m_PrefabParentObject: {fileID: 0} 70 | m_PrefabInternal: {fileID: 100100000} 71 | m_GameObject: {fileID: 183744} 72 | m_Enabled: 1 73 | m_EditorHideFlags: 0 74 | m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 75 | m_Name: 76 | m_EditorClassIdentifier: 77 | m_Navigation: 78 | m_Mode: 3 79 | m_SelectOnUp: {fileID: 0} 80 | m_SelectOnDown: {fileID: 0} 81 | m_SelectOnLeft: {fileID: 0} 82 | m_SelectOnRight: {fileID: 0} 83 | m_Transition: 1 84 | m_Colors: 85 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 86 | m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1} 87 | m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1} 88 | m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} 89 | m_ColorMultiplier: 1 90 | m_FadeDuration: .100000001 91 | m_SpriteState: 92 | m_HighlightedSprite: {fileID: 0} 93 | m_PressedSprite: {fileID: 0} 94 | m_DisabledSprite: {fileID: 0} 95 | m_AnimationTriggers: 96 | m_NormalTrigger: Normal 97 | m_HighlightedTrigger: Highlighted 98 | m_PressedTrigger: Pressed 99 | m_DisabledTrigger: Disabled 100 | m_Interactable: 1 101 | m_TargetGraphic: {fileID: 11487888} 102 | m_OnClick: 103 | m_PersistentCalls: 104 | m_Calls: [] 105 | m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, 106 | Culture=neutral, PublicKeyToken=null 107 | --- !u!114 &11464570 108 | MonoBehaviour: 109 | m_ObjectHideFlags: 1 110 | m_PrefabParentObject: {fileID: 0} 111 | m_PrefabInternal: {fileID: 100100000} 112 | m_GameObject: {fileID: 183744} 113 | m_Enabled: 1 114 | m_EditorHideFlags: 0 115 | m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 116 | m_Name: 117 | m_EditorClassIdentifier: 118 | m_IgnoreLayout: 0 119 | m_MinWidth: -1 120 | m_MinHeight: -1 121 | m_PreferredWidth: 150 122 | m_PreferredHeight: 50 123 | m_FlexibleWidth: -1 124 | m_FlexibleHeight: -1 125 | --- !u!114 &11468506 126 | MonoBehaviour: 127 | m_ObjectHideFlags: 1 128 | m_PrefabParentObject: {fileID: 0} 129 | m_PrefabInternal: {fileID: 100100000} 130 | m_GameObject: {fileID: 183744} 131 | m_Enabled: 1 132 | m_EditorHideFlags: 0 133 | m_Script: {fileID: 11500000, guid: aae79c5fe0add56479237307a95fbb7f, type: 3} 134 | m_Name: 135 | m_EditorClassIdentifier: 136 | image: {fileID: 11487888} 137 | text: {fileID: 11410392} 138 | --- !u!114 &11487888 139 | MonoBehaviour: 140 | m_ObjectHideFlags: 1 141 | m_PrefabParentObject: {fileID: 0} 142 | m_PrefabInternal: {fileID: 100100000} 143 | m_GameObject: {fileID: 183744} 144 | m_Enabled: 1 145 | m_EditorHideFlags: 0 146 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 147 | m_Name: 148 | m_EditorClassIdentifier: 149 | m_Material: {fileID: 0} 150 | m_Color: {r: 1, g: 1, b: 1, a: 1} 151 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 152 | m_Type: 1 153 | m_PreserveAspect: 0 154 | m_FillCenter: 1 155 | m_FillMethod: 4 156 | m_FillAmount: 1 157 | m_FillClockwise: 1 158 | m_FillOrigin: 0 159 | --- !u!222 &22216460 160 | CanvasRenderer: 161 | m_ObjectHideFlags: 1 162 | m_PrefabParentObject: {fileID: 0} 163 | m_PrefabInternal: {fileID: 100100000} 164 | m_GameObject: {fileID: 183744} 165 | --- !u!222 &22270478 166 | CanvasRenderer: 167 | m_ObjectHideFlags: 1 168 | m_PrefabParentObject: {fileID: 0} 169 | m_PrefabInternal: {fileID: 100100000} 170 | m_GameObject: {fileID: 108710} 171 | --- !u!224 &22418634 172 | RectTransform: 173 | m_ObjectHideFlags: 1 174 | m_PrefabParentObject: {fileID: 0} 175 | m_PrefabInternal: {fileID: 100100000} 176 | m_GameObject: {fileID: 183744} 177 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 178 | m_LocalPosition: {x: 0, y: 0, z: 0} 179 | m_LocalScale: {x: 1, y: 1, z: 1} 180 | m_Children: 181 | - {fileID: 22435118} 182 | m_Father: {fileID: 0} 183 | m_RootOrder: 0 184 | m_AnchorMin: {x: 0, y: 0} 185 | m_AnchorMax: {x: 0, y: 0} 186 | m_AnchoredPosition: {x: 0, y: 0} 187 | m_SizeDelta: {x: 0, y: 0} 188 | m_Pivot: {x: .5, y: .5} 189 | --- !u!224 &22435118 190 | RectTransform: 191 | m_ObjectHideFlags: 1 192 | m_PrefabParentObject: {fileID: 0} 193 | m_PrefabInternal: {fileID: 100100000} 194 | m_GameObject: {fileID: 108710} 195 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 196 | m_LocalPosition: {x: 0, y: 0, z: 0} 197 | m_LocalScale: {x: 1, y: 1, z: 1} 198 | m_Children: [] 199 | m_Father: {fileID: 22418634} 200 | m_RootOrder: 0 201 | m_AnchorMin: {x: 0, y: 0} 202 | m_AnchorMax: {x: 1, y: 1} 203 | m_AnchoredPosition: {x: 0, y: 0} 204 | m_SizeDelta: {x: 0, y: 0} 205 | m_Pivot: {x: .5, y: .5} 206 | --- !u!1001 &100100000 207 | Prefab: 208 | m_ObjectHideFlags: 1 209 | serializedVersion: 2 210 | m_Modification: 211 | m_TransformParent: {fileID: 0} 212 | m_Modifications: 213 | - target: {fileID: 0} 214 | propertyPath: m_PreferredWidth 215 | value: 150 216 | objectReference: {fileID: 0} 217 | - target: {fileID: 0} 218 | propertyPath: m_PreferredHeight 219 | value: 50 220 | objectReference: {fileID: 0} 221 | - target: {fileID: 0} 222 | propertyPath: image 223 | value: 224 | objectReference: {fileID: 11487888} 225 | m_RemovedComponents: [] 226 | m_ParentPrefab: {fileID: 0} 227 | m_RootGameObject: {fileID: 183744} 228 | m_IsPrefabParent: 1 229 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell1.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22b5f8ed284b7904299d6ca6a21597ad 3 | timeCreated: 1439425233 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell2.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &108666 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 4 9 | m_Component: 10 | - 224: {fileID: 22478042} 11 | - 222: {fileID: 22298252} 12 | - 114: {fileID: 11410352} 13 | m_Layer: 5 14 | m_Name: Text 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!1 &137000 21 | GameObject: 22 | m_ObjectHideFlags: 0 23 | m_PrefabParentObject: {fileID: 0} 24 | m_PrefabInternal: {fileID: 100100000} 25 | serializedVersion: 4 26 | m_Component: 27 | - 224: {fileID: 22424898} 28 | - 222: {fileID: 22244204} 29 | - 114: {fileID: 11476074} 30 | - 114: {fileID: 11496432} 31 | - 114: {fileID: 11418372} 32 | - 114: {fileID: 11477872} 33 | m_Layer: 5 34 | m_Name: ScrollCell2 35 | m_TagString: Untagged 36 | m_Icon: {fileID: 0} 37 | m_NavMeshLayer: 0 38 | m_StaticEditorFlags: 0 39 | m_IsActive: 1 40 | --- !u!114 &11410352 41 | MonoBehaviour: 42 | m_ObjectHideFlags: 1 43 | m_PrefabParentObject: {fileID: 0} 44 | m_PrefabInternal: {fileID: 100100000} 45 | m_GameObject: {fileID: 108666} 46 | m_Enabled: 1 47 | m_EditorHideFlags: 0 48 | m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 49 | m_Name: 50 | m_EditorClassIdentifier: 51 | m_Material: {fileID: 0} 52 | m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} 53 | m_FontData: 54 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 55 | m_FontSize: 14 56 | m_FontStyle: 0 57 | m_BestFit: 0 58 | m_MinSize: 10 59 | m_MaxSize: 40 60 | m_Alignment: 4 61 | m_RichText: 1 62 | m_HorizontalOverflow: 0 63 | m_VerticalOverflow: 0 64 | m_LineSpacing: 1 65 | m_Text: Button 66 | --- !u!114 &11418372 67 | MonoBehaviour: 68 | m_ObjectHideFlags: 1 69 | m_PrefabParentObject: {fileID: 0} 70 | m_PrefabInternal: {fileID: 100100000} 71 | m_GameObject: {fileID: 137000} 72 | m_Enabled: 1 73 | m_EditorHideFlags: 0 74 | m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 75 | m_Name: 76 | m_EditorClassIdentifier: 77 | m_IgnoreLayout: 0 78 | m_MinWidth: -1 79 | m_MinHeight: -1 80 | m_PreferredWidth: 100 81 | m_PreferredHeight: 150 82 | m_FlexibleWidth: -1 83 | m_FlexibleHeight: -1 84 | --- !u!114 &11476074 85 | MonoBehaviour: 86 | m_ObjectHideFlags: 1 87 | m_PrefabParentObject: {fileID: 0} 88 | m_PrefabInternal: {fileID: 100100000} 89 | m_GameObject: {fileID: 137000} 90 | m_Enabled: 1 91 | m_EditorHideFlags: 0 92 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 93 | m_Name: 94 | m_EditorClassIdentifier: 95 | m_Material: {fileID: 0} 96 | m_Color: {r: 1, g: 1, b: 1, a: 1} 97 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 98 | m_Type: 1 99 | m_PreserveAspect: 0 100 | m_FillCenter: 1 101 | m_FillMethod: 4 102 | m_FillAmount: 1 103 | m_FillClockwise: 1 104 | m_FillOrigin: 0 105 | --- !u!114 &11477872 106 | MonoBehaviour: 107 | m_ObjectHideFlags: 1 108 | m_PrefabParentObject: {fileID: 0} 109 | m_PrefabInternal: {fileID: 100100000} 110 | m_GameObject: {fileID: 137000} 111 | m_Enabled: 1 112 | m_EditorHideFlags: 0 113 | m_Script: {fileID: 11500000, guid: 4d2a1b5a8e8308e4fbd894c93c0caa09, type: 3} 114 | m_Name: 115 | m_EditorClassIdentifier: 116 | text: {fileID: 11410352} 117 | element: {fileID: 11418372} 118 | --- !u!114 &11496432 119 | MonoBehaviour: 120 | m_ObjectHideFlags: 1 121 | m_PrefabParentObject: {fileID: 0} 122 | m_PrefabInternal: {fileID: 100100000} 123 | m_GameObject: {fileID: 137000} 124 | m_Enabled: 1 125 | m_EditorHideFlags: 0 126 | m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 127 | m_Name: 128 | m_EditorClassIdentifier: 129 | m_Navigation: 130 | m_Mode: 3 131 | m_SelectOnUp: {fileID: 0} 132 | m_SelectOnDown: {fileID: 0} 133 | m_SelectOnLeft: {fileID: 0} 134 | m_SelectOnRight: {fileID: 0} 135 | m_Transition: 1 136 | m_Colors: 137 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 138 | m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1} 139 | m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1} 140 | m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} 141 | m_ColorMultiplier: 1 142 | m_FadeDuration: .100000001 143 | m_SpriteState: 144 | m_HighlightedSprite: {fileID: 0} 145 | m_PressedSprite: {fileID: 0} 146 | m_DisabledSprite: {fileID: 0} 147 | m_AnimationTriggers: 148 | m_NormalTrigger: Normal 149 | m_HighlightedTrigger: Highlighted 150 | m_PressedTrigger: Pressed 151 | m_DisabledTrigger: Disabled 152 | m_Interactable: 1 153 | m_TargetGraphic: {fileID: 11476074} 154 | m_OnClick: 155 | m_PersistentCalls: 156 | m_Calls: [] 157 | m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, 158 | Culture=neutral, PublicKeyToken=null 159 | --- !u!222 &22244204 160 | CanvasRenderer: 161 | m_ObjectHideFlags: 1 162 | m_PrefabParentObject: {fileID: 0} 163 | m_PrefabInternal: {fileID: 100100000} 164 | m_GameObject: {fileID: 137000} 165 | --- !u!222 &22298252 166 | CanvasRenderer: 167 | m_ObjectHideFlags: 1 168 | m_PrefabParentObject: {fileID: 0} 169 | m_PrefabInternal: {fileID: 100100000} 170 | m_GameObject: {fileID: 108666} 171 | --- !u!224 &22424898 172 | RectTransform: 173 | m_ObjectHideFlags: 1 174 | m_PrefabParentObject: {fileID: 0} 175 | m_PrefabInternal: {fileID: 100100000} 176 | m_GameObject: {fileID: 137000} 177 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 178 | m_LocalPosition: {x: 0, y: 0, z: 0} 179 | m_LocalScale: {x: 1, y: 1, z: 1} 180 | m_Children: 181 | - {fileID: 22478042} 182 | m_Father: {fileID: 0} 183 | m_RootOrder: 0 184 | m_AnchorMin: {x: 0, y: 0} 185 | m_AnchorMax: {x: 0, y: 0} 186 | m_AnchoredPosition: {x: 0, y: 0} 187 | m_SizeDelta: {x: 0, y: 0} 188 | m_Pivot: {x: .5, y: .5} 189 | --- !u!224 &22478042 190 | RectTransform: 191 | m_ObjectHideFlags: 1 192 | m_PrefabParentObject: {fileID: 0} 193 | m_PrefabInternal: {fileID: 100100000} 194 | m_GameObject: {fileID: 108666} 195 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 196 | m_LocalPosition: {x: 0, y: 0, z: 0} 197 | m_LocalScale: {x: 1, y: 1, z: 1} 198 | m_Children: [] 199 | m_Father: {fileID: 22424898} 200 | m_RootOrder: 0 201 | m_AnchorMin: {x: 0, y: 0} 202 | m_AnchorMax: {x: 1, y: 1} 203 | m_AnchoredPosition: {x: 0, y: 0} 204 | m_SizeDelta: {x: 0, y: 0} 205 | m_Pivot: {x: .5, y: .5} 206 | --- !u!1001 &100100000 207 | Prefab: 208 | m_ObjectHideFlags: 1 209 | serializedVersion: 2 210 | m_Modification: 211 | m_TransformParent: {fileID: 0} 212 | m_Modifications: [] 213 | m_RemovedComponents: [] 214 | m_ParentPrefab: {fileID: 0} 215 | m_RootGameObject: {fileID: 137000} 216 | m_IsPrefabParent: 1 217 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell2.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58f2a669cd6976d4ca4c72cd7bfa298c 3 | timeCreated: 1439607751 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell3.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &125280 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 4 9 | m_Component: 10 | - 224: {fileID: 22436942} 11 | - 222: {fileID: 22215342} 12 | - 114: {fileID: 11469264} 13 | m_Layer: 5 14 | m_Name: Text 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 0 19 | m_IsActive: 1 20 | --- !u!1 &174784 21 | GameObject: 22 | m_ObjectHideFlags: 0 23 | m_PrefabParentObject: {fileID: 0} 24 | m_PrefabInternal: {fileID: 100100000} 25 | serializedVersion: 4 26 | m_Component: 27 | - 224: {fileID: 22411180} 28 | - 222: {fileID: 22240748} 29 | - 114: {fileID: 11429772} 30 | - 114: {fileID: 11402414} 31 | - 114: {fileID: 11425032} 32 | - 114: {fileID: 11478532} 33 | m_Layer: 5 34 | m_Name: ScrollCell3 35 | m_TagString: Untagged 36 | m_Icon: {fileID: 0} 37 | m_NavMeshLayer: 0 38 | m_StaticEditorFlags: 0 39 | m_IsActive: 1 40 | --- !u!114 &11402414 41 | MonoBehaviour: 42 | m_ObjectHideFlags: 1 43 | m_PrefabParentObject: {fileID: 0} 44 | m_PrefabInternal: {fileID: 100100000} 45 | m_GameObject: {fileID: 174784} 46 | m_Enabled: 1 47 | m_EditorHideFlags: 0 48 | m_Script: {fileID: 1392445389, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 49 | m_Name: 50 | m_EditorClassIdentifier: 51 | m_Navigation: 52 | m_Mode: 3 53 | m_SelectOnUp: {fileID: 0} 54 | m_SelectOnDown: {fileID: 0} 55 | m_SelectOnLeft: {fileID: 0} 56 | m_SelectOnRight: {fileID: 0} 57 | m_Transition: 1 58 | m_Colors: 59 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 60 | m_HighlightedColor: {r: .960784316, g: .960784316, b: .960784316, a: 1} 61 | m_PressedColor: {r: .784313738, g: .784313738, b: .784313738, a: 1} 62 | m_DisabledColor: {r: .784313738, g: .784313738, b: .784313738, a: .501960814} 63 | m_ColorMultiplier: 1 64 | m_FadeDuration: .100000001 65 | m_SpriteState: 66 | m_HighlightedSprite: {fileID: 0} 67 | m_PressedSprite: {fileID: 0} 68 | m_DisabledSprite: {fileID: 0} 69 | m_AnimationTriggers: 70 | m_NormalTrigger: Normal 71 | m_HighlightedTrigger: Highlighted 72 | m_PressedTrigger: Pressed 73 | m_DisabledTrigger: Disabled 74 | m_Interactable: 1 75 | m_TargetGraphic: {fileID: 11429772} 76 | m_OnClick: 77 | m_PersistentCalls: 78 | m_Calls: [] 79 | m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, 80 | Culture=neutral, PublicKeyToken=null 81 | --- !u!114 &11425032 82 | MonoBehaviour: 83 | m_ObjectHideFlags: 1 84 | m_PrefabParentObject: {fileID: 0} 85 | m_PrefabInternal: {fileID: 100100000} 86 | m_GameObject: {fileID: 174784} 87 | m_Enabled: 1 88 | m_EditorHideFlags: 0 89 | m_Script: {fileID: 11500000, guid: 485315e3fd2b43d4d8d15c437f7f01d3, type: 3} 90 | m_Name: 91 | m_EditorClassIdentifier: 92 | text: {fileID: 11469264} 93 | --- !u!114 &11429772 94 | MonoBehaviour: 95 | m_ObjectHideFlags: 1 96 | m_PrefabParentObject: {fileID: 0} 97 | m_PrefabInternal: {fileID: 100100000} 98 | m_GameObject: {fileID: 174784} 99 | m_Enabled: 1 100 | m_EditorHideFlags: 0 101 | m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 102 | m_Name: 103 | m_EditorClassIdentifier: 104 | m_Material: {fileID: 0} 105 | m_Color: {r: 1, g: 1, b: 1, a: 1} 106 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 107 | m_Type: 1 108 | m_PreserveAspect: 0 109 | m_FillCenter: 1 110 | m_FillMethod: 4 111 | m_FillAmount: 1 112 | m_FillClockwise: 1 113 | m_FillOrigin: 0 114 | --- !u!114 &11469264 115 | MonoBehaviour: 116 | m_ObjectHideFlags: 1 117 | m_PrefabParentObject: {fileID: 0} 118 | m_PrefabInternal: {fileID: 100100000} 119 | m_GameObject: {fileID: 125280} 120 | m_Enabled: 1 121 | m_EditorHideFlags: 0 122 | m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 123 | m_Name: 124 | m_EditorClassIdentifier: 125 | m_Material: {fileID: 0} 126 | m_Color: {r: .196078435, g: .196078435, b: .196078435, a: 1} 127 | m_FontData: 128 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 129 | m_FontSize: 14 130 | m_FontStyle: 0 131 | m_BestFit: 0 132 | m_MinSize: 10 133 | m_MaxSize: 40 134 | m_Alignment: 4 135 | m_RichText: 1 136 | m_HorizontalOverflow: 0 137 | m_VerticalOverflow: 0 138 | m_LineSpacing: 1 139 | m_Text: Button 140 | --- !u!114 &11478532 141 | MonoBehaviour: 142 | m_ObjectHideFlags: 1 143 | m_PrefabParentObject: {fileID: 0} 144 | m_PrefabInternal: {fileID: 100100000} 145 | m_GameObject: {fileID: 174784} 146 | m_Enabled: 1 147 | m_EditorHideFlags: 0 148 | m_Script: {fileID: 1679637790, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3} 149 | m_Name: 150 | m_EditorClassIdentifier: 151 | m_IgnoreLayout: 0 152 | m_MinWidth: -1 153 | m_MinHeight: -1 154 | m_PreferredWidth: 100 155 | m_PreferredHeight: 100 156 | m_FlexibleWidth: -1 157 | m_FlexibleHeight: -1 158 | --- !u!222 &22215342 159 | CanvasRenderer: 160 | m_ObjectHideFlags: 1 161 | m_PrefabParentObject: {fileID: 0} 162 | m_PrefabInternal: {fileID: 100100000} 163 | m_GameObject: {fileID: 125280} 164 | --- !u!222 &22240748 165 | CanvasRenderer: 166 | m_ObjectHideFlags: 1 167 | m_PrefabParentObject: {fileID: 0} 168 | m_PrefabInternal: {fileID: 100100000} 169 | m_GameObject: {fileID: 174784} 170 | --- !u!224 &22411180 171 | RectTransform: 172 | m_ObjectHideFlags: 1 173 | m_PrefabParentObject: {fileID: 0} 174 | m_PrefabInternal: {fileID: 100100000} 175 | m_GameObject: {fileID: 174784} 176 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 177 | m_LocalPosition: {x: 0, y: 0, z: 0} 178 | m_LocalScale: {x: 1, y: 1, z: 1} 179 | m_Children: 180 | - {fileID: 22436942} 181 | m_Father: {fileID: 0} 182 | m_RootOrder: 0 183 | m_AnchorMin: {x: 0, y: 0} 184 | m_AnchorMax: {x: 0, y: 0} 185 | m_AnchoredPosition: {x: 0, y: 0} 186 | m_SizeDelta: {x: 0, y: 0} 187 | m_Pivot: {x: .5, y: .5} 188 | --- !u!224 &22436942 189 | RectTransform: 190 | m_ObjectHideFlags: 1 191 | m_PrefabParentObject: {fileID: 0} 192 | m_PrefabInternal: {fileID: 100100000} 193 | m_GameObject: {fileID: 125280} 194 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 195 | m_LocalPosition: {x: 0, y: 0, z: 0} 196 | m_LocalScale: {x: 1, y: 1, z: 1} 197 | m_Children: [] 198 | m_Father: {fileID: 22411180} 199 | m_RootOrder: 0 200 | m_AnchorMin: {x: 0, y: 0} 201 | m_AnchorMax: {x: 1, y: 1} 202 | m_AnchoredPosition: {x: 0, y: 0} 203 | m_SizeDelta: {x: 0, y: 0} 204 | m_Pivot: {x: .5, y: .5} 205 | --- !u!1001 &100100000 206 | Prefab: 207 | m_ObjectHideFlags: 1 208 | serializedVersion: 2 209 | m_Modification: 210 | m_TransformParent: {fileID: 0} 211 | m_Modifications: 212 | - target: {fileID: 0} 213 | propertyPath: m_PreferredWidth 214 | value: 0 215 | objectReference: {fileID: 0} 216 | m_RemovedComponents: [] 217 | m_ParentPrefab: {fileID: 0} 218 | m_RootGameObject: {fileID: 174784} 219 | m_IsPrefabParent: 1 220 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell3.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56b618cf8c6e1584db503ad2cee1f27f 3 | timeCreated: 1439608466 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell4.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82144dfcec1bf354397b698bf49a9b6c 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell4_TypeA.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &2388450501707386297 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1383504190229465006} 12 | - component: {fileID: 1230426226602962748} 13 | - component: {fileID: 4956828980401063857} 14 | m_Layer: 5 15 | m_Name: ValueText 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &1383504190229465006 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 2388450501707386297} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 3687556073957676897} 33 | m_RootOrder: 1 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | m_AnchorMin: {x: 0, y: 0} 36 | m_AnchorMax: {x: 1, y: 1} 37 | m_AnchoredPosition: {x: 0, y: -50} 38 | m_SizeDelta: {x: 0, y: -100} 39 | m_Pivot: {x: 0.5, y: 0.5} 40 | --- !u!222 &1230426226602962748 41 | CanvasRenderer: 42 | m_ObjectHideFlags: 0 43 | m_CorrespondingSourceObject: {fileID: 0} 44 | m_PrefabInstance: {fileID: 0} 45 | m_PrefabAsset: {fileID: 0} 46 | m_GameObject: {fileID: 2388450501707386297} 47 | m_CullTransparentMesh: 1 48 | --- !u!114 &4956828980401063857 49 | MonoBehaviour: 50 | m_ObjectHideFlags: 0 51 | m_CorrespondingSourceObject: {fileID: 0} 52 | m_PrefabInstance: {fileID: 0} 53 | m_PrefabAsset: {fileID: 0} 54 | m_GameObject: {fileID: 2388450501707386297} 55 | m_Enabled: 1 56 | m_EditorHideFlags: 0 57 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 58 | m_Name: 59 | m_EditorClassIdentifier: 60 | m_Material: {fileID: 0} 61 | m_Color: {r: 0.0009430714, g: 0, b: 0.6320754, a: 1} 62 | m_RaycastTarget: 1 63 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 64 | m_Maskable: 1 65 | m_OnCullStateChanged: 66 | m_PersistentCalls: 67 | m_Calls: [] 68 | m_FontData: 69 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 70 | m_FontSize: 14 71 | m_FontStyle: 0 72 | m_BestFit: 0 73 | m_MinSize: 1 74 | m_MaxSize: 100 75 | m_Alignment: 4 76 | m_AlignByGeometry: 0 77 | m_RichText: 1 78 | m_HorizontalOverflow: 0 79 | m_VerticalOverflow: 0 80 | m_LineSpacing: 1 81 | m_Text: Button 82 | --- !u!1 &3687556073842649997 83 | GameObject: 84 | m_ObjectHideFlags: 0 85 | m_CorrespondingSourceObject: {fileID: 0} 86 | m_PrefabInstance: {fileID: 0} 87 | m_PrefabAsset: {fileID: 0} 88 | serializedVersion: 6 89 | m_Component: 90 | - component: {fileID: 3687556073842649996} 91 | - component: {fileID: 3687556073842650002} 92 | - component: {fileID: 3687556073842650003} 93 | m_Layer: 5 94 | m_Name: Image 95 | m_TagString: Untagged 96 | m_Icon: {fileID: 0} 97 | m_NavMeshLayer: 0 98 | m_StaticEditorFlags: 0 99 | m_IsActive: 1 100 | --- !u!224 &3687556073842649996 101 | RectTransform: 102 | m_ObjectHideFlags: 0 103 | m_CorrespondingSourceObject: {fileID: 0} 104 | m_PrefabInstance: {fileID: 0} 105 | m_PrefabAsset: {fileID: 0} 106 | m_GameObject: {fileID: 3687556073842649997} 107 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 108 | m_LocalPosition: {x: 0, y: 0, z: 0} 109 | m_LocalScale: {x: 1, y: 1, z: 1} 110 | m_Children: [] 111 | m_Father: {fileID: 3687556073957676897} 112 | m_RootOrder: 2 113 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 114 | m_AnchorMin: {x: 0.5, y: 0.5} 115 | m_AnchorMax: {x: 0.5, y: 0.5} 116 | m_AnchoredPosition: {x: 0, y: 20} 117 | m_SizeDelta: {x: 100, y: 86} 118 | m_Pivot: {x: 0.5, y: 0.5} 119 | --- !u!222 &3687556073842650002 120 | CanvasRenderer: 121 | m_ObjectHideFlags: 0 122 | m_CorrespondingSourceObject: {fileID: 0} 123 | m_PrefabInstance: {fileID: 0} 124 | m_PrefabAsset: {fileID: 0} 125 | m_GameObject: {fileID: 3687556073842649997} 126 | m_CullTransparentMesh: 1 127 | --- !u!114 &3687556073842650003 128 | MonoBehaviour: 129 | m_ObjectHideFlags: 0 130 | m_CorrespondingSourceObject: {fileID: 0} 131 | m_PrefabInstance: {fileID: 0} 132 | m_PrefabAsset: {fileID: 0} 133 | m_GameObject: {fileID: 3687556073842649997} 134 | m_Enabled: 1 135 | m_EditorHideFlags: 0 136 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 137 | m_Name: 138 | m_EditorClassIdentifier: 139 | m_Material: {fileID: 0} 140 | m_Color: {r: 1, g: 1, b: 1, a: 1} 141 | m_RaycastTarget: 1 142 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 143 | m_Maskable: 1 144 | m_OnCullStateChanged: 145 | m_PersistentCalls: 146 | m_Calls: [] 147 | m_Sprite: {fileID: 21300000, guid: a855f4ba6619d54479a6224ade07fa03, type: 3} 148 | m_Type: 0 149 | m_PreserveAspect: 0 150 | m_FillCenter: 1 151 | m_FillMethod: 4 152 | m_FillAmount: 1 153 | m_FillClockwise: 1 154 | m_FillOrigin: 0 155 | m_UseSpriteMesh: 0 156 | m_PixelsPerUnitMultiplier: 1 157 | --- !u!1 &3687556073943788811 158 | GameObject: 159 | m_ObjectHideFlags: 0 160 | m_CorrespondingSourceObject: {fileID: 0} 161 | m_PrefabInstance: {fileID: 0} 162 | m_PrefabAsset: {fileID: 0} 163 | serializedVersion: 6 164 | m_Component: 165 | - component: {fileID: 3687556073957676897} 166 | - component: {fileID: 3687556073957462351} 167 | - component: {fileID: 3687556073938347593} 168 | - component: {fileID: 3687556073938325971} 169 | - component: {fileID: 4689999971354973312} 170 | - component: {fileID: 3687556073938272551} 171 | m_Layer: 5 172 | m_Name: ScrollCell4_TypeA 173 | m_TagString: Untagged 174 | m_Icon: {fileID: 0} 175 | m_NavMeshLayer: 0 176 | m_StaticEditorFlags: 0 177 | m_IsActive: 1 178 | --- !u!224 &3687556073957676897 179 | RectTransform: 180 | m_ObjectHideFlags: 0 181 | m_CorrespondingSourceObject: {fileID: 0} 182 | m_PrefabInstance: {fileID: 0} 183 | m_PrefabAsset: {fileID: 0} 184 | m_GameObject: {fileID: 3687556073943788811} 185 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 186 | m_LocalPosition: {x: 0, y: 0, z: 0} 187 | m_LocalScale: {x: 1, y: 1, z: 1} 188 | m_Children: 189 | - {fileID: 3687556073957623545} 190 | - {fileID: 1383504190229465006} 191 | - {fileID: 3687556073842649996} 192 | m_Father: {fileID: 0} 193 | m_RootOrder: 0 194 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 195 | m_AnchorMin: {x: 0, y: 0} 196 | m_AnchorMax: {x: 0, y: 0} 197 | m_AnchoredPosition: {x: 0, y: 0} 198 | m_SizeDelta: {x: 0, y: 0} 199 | m_Pivot: {x: 0.5, y: 0.5} 200 | --- !u!222 &3687556073957462351 201 | CanvasRenderer: 202 | m_ObjectHideFlags: 0 203 | m_CorrespondingSourceObject: {fileID: 0} 204 | m_PrefabInstance: {fileID: 0} 205 | m_PrefabAsset: {fileID: 0} 206 | m_GameObject: {fileID: 3687556073943788811} 207 | m_CullTransparentMesh: 1 208 | --- !u!114 &3687556073938347593 209 | MonoBehaviour: 210 | m_ObjectHideFlags: 0 211 | m_CorrespondingSourceObject: {fileID: 0} 212 | m_PrefabInstance: {fileID: 0} 213 | m_PrefabAsset: {fileID: 0} 214 | m_GameObject: {fileID: 3687556073943788811} 215 | m_Enabled: 1 216 | m_EditorHideFlags: 0 217 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 218 | m_Name: 219 | m_EditorClassIdentifier: 220 | m_Material: {fileID: 0} 221 | m_Color: {r: 1, g: 1, b: 1, a: 1} 222 | m_RaycastTarget: 1 223 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 224 | m_Maskable: 1 225 | m_OnCullStateChanged: 226 | m_PersistentCalls: 227 | m_Calls: [] 228 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 229 | m_Type: 1 230 | m_PreserveAspect: 0 231 | m_FillCenter: 1 232 | m_FillMethod: 4 233 | m_FillAmount: 1 234 | m_FillClockwise: 1 235 | m_FillOrigin: 0 236 | m_UseSpriteMesh: 0 237 | m_PixelsPerUnitMultiplier: 1 238 | --- !u!114 &3687556073938325971 239 | MonoBehaviour: 240 | m_ObjectHideFlags: 0 241 | m_CorrespondingSourceObject: {fileID: 0} 242 | m_PrefabInstance: {fileID: 0} 243 | m_PrefabAsset: {fileID: 0} 244 | m_GameObject: {fileID: 3687556073943788811} 245 | m_Enabled: 1 246 | m_EditorHideFlags: 0 247 | m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} 248 | m_Name: 249 | m_EditorClassIdentifier: 250 | m_Navigation: 251 | m_Mode: 3 252 | m_WrapAround: 0 253 | m_SelectOnUp: {fileID: 0} 254 | m_SelectOnDown: {fileID: 0} 255 | m_SelectOnLeft: {fileID: 0} 256 | m_SelectOnRight: {fileID: 0} 257 | m_Transition: 1 258 | m_Colors: 259 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 260 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 261 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 262 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 263 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 264 | m_ColorMultiplier: 1 265 | m_FadeDuration: 0.1 266 | m_SpriteState: 267 | m_HighlightedSprite: {fileID: 0} 268 | m_PressedSprite: {fileID: 0} 269 | m_SelectedSprite: {fileID: 0} 270 | m_DisabledSprite: {fileID: 0} 271 | m_AnimationTriggers: 272 | m_NormalTrigger: Normal 273 | m_HighlightedTrigger: Highlighted 274 | m_PressedTrigger: Pressed 275 | m_SelectedTrigger: Highlighted 276 | m_DisabledTrigger: Disabled 277 | m_Interactable: 1 278 | m_TargetGraphic: {fileID: 3687556073938347593} 279 | m_OnClick: 280 | m_PersistentCalls: 281 | m_Calls: [] 282 | --- !u!114 &4689999971354973312 283 | MonoBehaviour: 284 | m_ObjectHideFlags: 0 285 | m_CorrespondingSourceObject: {fileID: 0} 286 | m_PrefabInstance: {fileID: 0} 287 | m_PrefabAsset: {fileID: 0} 288 | m_GameObject: {fileID: 3687556073943788811} 289 | m_Enabled: 1 290 | m_EditorHideFlags: 0 291 | m_Script: {fileID: 11500000, guid: bf7395977ed555040a786e04c4c4d722, type: 3} 292 | m_Name: 293 | m_EditorClassIdentifier: 294 | m_Element: {fileID: 3687556073938272551} 295 | m_Button: {fileID: 3687556073938325971} 296 | m_CellText: {fileID: 3687556073938280851} 297 | m_ValueText: {fileID: 4956828980401063857} 298 | --- !u!114 &3687556073938272551 299 | MonoBehaviour: 300 | m_ObjectHideFlags: 0 301 | m_CorrespondingSourceObject: {fileID: 0} 302 | m_PrefabInstance: {fileID: 0} 303 | m_PrefabAsset: {fileID: 0} 304 | m_GameObject: {fileID: 3687556073943788811} 305 | m_Enabled: 1 306 | m_EditorHideFlags: 0 307 | m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} 308 | m_Name: 309 | m_EditorClassIdentifier: 310 | m_IgnoreLayout: 0 311 | m_MinWidth: -1 312 | m_MinHeight: -1 313 | m_PreferredWidth: 120 314 | m_PreferredHeight: 120 315 | m_FlexibleWidth: -1 316 | m_FlexibleHeight: -1 317 | m_LayoutPriority: 1 318 | --- !u!1 &3687556073943945817 319 | GameObject: 320 | m_ObjectHideFlags: 0 321 | m_CorrespondingSourceObject: {fileID: 0} 322 | m_PrefabInstance: {fileID: 0} 323 | m_PrefabAsset: {fileID: 0} 324 | serializedVersion: 6 325 | m_Component: 326 | - component: {fileID: 3687556073957623545} 327 | - component: {fileID: 3687556073957803183} 328 | - component: {fileID: 3687556073938280851} 329 | m_Layer: 5 330 | m_Name: CellText 331 | m_TagString: Untagged 332 | m_Icon: {fileID: 0} 333 | m_NavMeshLayer: 0 334 | m_StaticEditorFlags: 0 335 | m_IsActive: 1 336 | --- !u!224 &3687556073957623545 337 | RectTransform: 338 | m_ObjectHideFlags: 0 339 | m_CorrespondingSourceObject: {fileID: 0} 340 | m_PrefabInstance: {fileID: 0} 341 | m_PrefabAsset: {fileID: 0} 342 | m_GameObject: {fileID: 3687556073943945817} 343 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 344 | m_LocalPosition: {x: 0, y: 0, z: 0} 345 | m_LocalScale: {x: 1, y: 1, z: 1} 346 | m_Children: [] 347 | m_Father: {fileID: 3687556073957676897} 348 | m_RootOrder: 0 349 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 350 | m_AnchorMin: {x: 0, y: 0} 351 | m_AnchorMax: {x: 1, y: 1} 352 | m_AnchoredPosition: {x: 0, y: -37.5} 353 | m_SizeDelta: {x: 0, y: -75} 354 | m_Pivot: {x: 0.5, y: 0.5} 355 | --- !u!222 &3687556073957803183 356 | CanvasRenderer: 357 | m_ObjectHideFlags: 0 358 | m_CorrespondingSourceObject: {fileID: 0} 359 | m_PrefabInstance: {fileID: 0} 360 | m_PrefabAsset: {fileID: 0} 361 | m_GameObject: {fileID: 3687556073943945817} 362 | m_CullTransparentMesh: 1 363 | --- !u!114 &3687556073938280851 364 | MonoBehaviour: 365 | m_ObjectHideFlags: 0 366 | m_CorrespondingSourceObject: {fileID: 0} 367 | m_PrefabInstance: {fileID: 0} 368 | m_PrefabAsset: {fileID: 0} 369 | m_GameObject: {fileID: 3687556073943945817} 370 | m_Enabled: 1 371 | m_EditorHideFlags: 0 372 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 373 | m_Name: 374 | m_EditorClassIdentifier: 375 | m_Material: {fileID: 0} 376 | m_Color: {r: 0.0009430714, g: 0, b: 0.6320754, a: 1} 377 | m_RaycastTarget: 1 378 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 379 | m_Maskable: 1 380 | m_OnCullStateChanged: 381 | m_PersistentCalls: 382 | m_Calls: [] 383 | m_FontData: 384 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 385 | m_FontSize: 14 386 | m_FontStyle: 0 387 | m_BestFit: 0 388 | m_MinSize: 1 389 | m_MaxSize: 100 390 | m_Alignment: 4 391 | m_AlignByGeometry: 0 392 | m_RichText: 1 393 | m_HorizontalOverflow: 0 394 | m_VerticalOverflow: 0 395 | m_LineSpacing: 1 396 | m_Text: Button 397 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell4_TypeA.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ed87a35389a7dcc4db44e39574f1d340 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell4_TypeB.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29c32f5e19061204280602cb6108ffe3 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell4_TypeC.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7acc6beddc8be94891e119289cd6f0c 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell5.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &2388450501707386297 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 1383504190229465006} 12 | - component: {fileID: 1230426226602962748} 13 | - component: {fileID: 4956828980401063857} 14 | m_Layer: 5 15 | m_Name: ValueText 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &1383504190229465006 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 2388450501707386297} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 3687556073957676897} 33 | m_RootOrder: 1 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | m_AnchorMin: {x: 0, y: 0} 36 | m_AnchorMax: {x: 1, y: 1} 37 | m_AnchoredPosition: {x: 0, y: -50} 38 | m_SizeDelta: {x: 0, y: -100} 39 | m_Pivot: {x: 0.5, y: 0.5} 40 | --- !u!222 &1230426226602962748 41 | CanvasRenderer: 42 | m_ObjectHideFlags: 0 43 | m_CorrespondingSourceObject: {fileID: 0} 44 | m_PrefabInstance: {fileID: 0} 45 | m_PrefabAsset: {fileID: 0} 46 | m_GameObject: {fileID: 2388450501707386297} 47 | m_CullTransparentMesh: 1 48 | --- !u!114 &4956828980401063857 49 | MonoBehaviour: 50 | m_ObjectHideFlags: 0 51 | m_CorrespondingSourceObject: {fileID: 0} 52 | m_PrefabInstance: {fileID: 0} 53 | m_PrefabAsset: {fileID: 0} 54 | m_GameObject: {fileID: 2388450501707386297} 55 | m_Enabled: 1 56 | m_EditorHideFlags: 0 57 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 58 | m_Name: 59 | m_EditorClassIdentifier: 60 | m_Material: {fileID: 0} 61 | m_Color: {r: 0.0009430714, g: 0, b: 0.6320754, a: 1} 62 | m_RaycastTarget: 1 63 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 64 | m_Maskable: 1 65 | m_OnCullStateChanged: 66 | m_PersistentCalls: 67 | m_Calls: [] 68 | m_FontData: 69 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 70 | m_FontSize: 14 71 | m_FontStyle: 0 72 | m_BestFit: 0 73 | m_MinSize: 1 74 | m_MaxSize: 100 75 | m_Alignment: 4 76 | m_AlignByGeometry: 0 77 | m_RichText: 1 78 | m_HorizontalOverflow: 0 79 | m_VerticalOverflow: 0 80 | m_LineSpacing: 1 81 | m_Text: Button 82 | --- !u!1 &3687556073842649997 83 | GameObject: 84 | m_ObjectHideFlags: 0 85 | m_CorrespondingSourceObject: {fileID: 0} 86 | m_PrefabInstance: {fileID: 0} 87 | m_PrefabAsset: {fileID: 0} 88 | serializedVersion: 6 89 | m_Component: 90 | - component: {fileID: 3687556073842649996} 91 | - component: {fileID: 3687556073842650002} 92 | - component: {fileID: 3687556073842650003} 93 | m_Layer: 5 94 | m_Name: Image 95 | m_TagString: Untagged 96 | m_Icon: {fileID: 0} 97 | m_NavMeshLayer: 0 98 | m_StaticEditorFlags: 0 99 | m_IsActive: 1 100 | --- !u!224 &3687556073842649996 101 | RectTransform: 102 | m_ObjectHideFlags: 0 103 | m_CorrespondingSourceObject: {fileID: 0} 104 | m_PrefabInstance: {fileID: 0} 105 | m_PrefabAsset: {fileID: 0} 106 | m_GameObject: {fileID: 3687556073842649997} 107 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 108 | m_LocalPosition: {x: 0, y: 0, z: 0} 109 | m_LocalScale: {x: 1, y: 1, z: 1} 110 | m_Children: [] 111 | m_Father: {fileID: 3687556073957676897} 112 | m_RootOrder: 2 113 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 114 | m_AnchorMin: {x: 0.5, y: 0.5} 115 | m_AnchorMax: {x: 0.5, y: 0.5} 116 | m_AnchoredPosition: {x: 0, y: 20} 117 | m_SizeDelta: {x: 100, y: 86} 118 | m_Pivot: {x: 0.5, y: 0.5} 119 | --- !u!222 &3687556073842650002 120 | CanvasRenderer: 121 | m_ObjectHideFlags: 0 122 | m_CorrespondingSourceObject: {fileID: 0} 123 | m_PrefabInstance: {fileID: 0} 124 | m_PrefabAsset: {fileID: 0} 125 | m_GameObject: {fileID: 3687556073842649997} 126 | m_CullTransparentMesh: 1 127 | --- !u!114 &3687556073842650003 128 | MonoBehaviour: 129 | m_ObjectHideFlags: 0 130 | m_CorrespondingSourceObject: {fileID: 0} 131 | m_PrefabInstance: {fileID: 0} 132 | m_PrefabAsset: {fileID: 0} 133 | m_GameObject: {fileID: 3687556073842649997} 134 | m_Enabled: 1 135 | m_EditorHideFlags: 0 136 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 137 | m_Name: 138 | m_EditorClassIdentifier: 139 | m_Material: {fileID: 0} 140 | m_Color: {r: 1, g: 1, b: 1, a: 1} 141 | m_RaycastTarget: 1 142 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 143 | m_Maskable: 1 144 | m_OnCullStateChanged: 145 | m_PersistentCalls: 146 | m_Calls: [] 147 | m_Sprite: {fileID: 21300000, guid: a855f4ba6619d54479a6224ade07fa03, type: 3} 148 | m_Type: 0 149 | m_PreserveAspect: 0 150 | m_FillCenter: 1 151 | m_FillMethod: 4 152 | m_FillAmount: 1 153 | m_FillClockwise: 1 154 | m_FillOrigin: 0 155 | m_UseSpriteMesh: 0 156 | m_PixelsPerUnitMultiplier: 1 157 | --- !u!1 &3687556073943788811 158 | GameObject: 159 | m_ObjectHideFlags: 0 160 | m_CorrespondingSourceObject: {fileID: 0} 161 | m_PrefabInstance: {fileID: 0} 162 | m_PrefabAsset: {fileID: 0} 163 | serializedVersion: 6 164 | m_Component: 165 | - component: {fileID: 3687556073957676897} 166 | - component: {fileID: 3687556073957462351} 167 | - component: {fileID: 3687556073938347593} 168 | - component: {fileID: 3687556073938325971} 169 | - component: {fileID: 4689999971354973312} 170 | - component: {fileID: 3687556073938272551} 171 | m_Layer: 5 172 | m_Name: ScrollCell5 173 | m_TagString: Untagged 174 | m_Icon: {fileID: 0} 175 | m_NavMeshLayer: 0 176 | m_StaticEditorFlags: 0 177 | m_IsActive: 1 178 | --- !u!224 &3687556073957676897 179 | RectTransform: 180 | m_ObjectHideFlags: 0 181 | m_CorrespondingSourceObject: {fileID: 0} 182 | m_PrefabInstance: {fileID: 0} 183 | m_PrefabAsset: {fileID: 0} 184 | m_GameObject: {fileID: 3687556073943788811} 185 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 186 | m_LocalPosition: {x: 0, y: 0, z: 0} 187 | m_LocalScale: {x: 1, y: 1, z: 1} 188 | m_Children: 189 | - {fileID: 3687556073957623545} 190 | - {fileID: 1383504190229465006} 191 | - {fileID: 3687556073842649996} 192 | m_Father: {fileID: 0} 193 | m_RootOrder: 0 194 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 195 | m_AnchorMin: {x: 0, y: 0} 196 | m_AnchorMax: {x: 0, y: 0} 197 | m_AnchoredPosition: {x: 0, y: 0} 198 | m_SizeDelta: {x: 0, y: 0} 199 | m_Pivot: {x: 0.5, y: 0.5} 200 | --- !u!222 &3687556073957462351 201 | CanvasRenderer: 202 | m_ObjectHideFlags: 0 203 | m_CorrespondingSourceObject: {fileID: 0} 204 | m_PrefabInstance: {fileID: 0} 205 | m_PrefabAsset: {fileID: 0} 206 | m_GameObject: {fileID: 3687556073943788811} 207 | m_CullTransparentMesh: 1 208 | --- !u!114 &3687556073938347593 209 | MonoBehaviour: 210 | m_ObjectHideFlags: 0 211 | m_CorrespondingSourceObject: {fileID: 0} 212 | m_PrefabInstance: {fileID: 0} 213 | m_PrefabAsset: {fileID: 0} 214 | m_GameObject: {fileID: 3687556073943788811} 215 | m_Enabled: 1 216 | m_EditorHideFlags: 0 217 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 218 | m_Name: 219 | m_EditorClassIdentifier: 220 | m_Material: {fileID: 0} 221 | m_Color: {r: 1, g: 1, b: 1, a: 1} 222 | m_RaycastTarget: 1 223 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 224 | m_Maskable: 1 225 | m_OnCullStateChanged: 226 | m_PersistentCalls: 227 | m_Calls: [] 228 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 229 | m_Type: 1 230 | m_PreserveAspect: 0 231 | m_FillCenter: 1 232 | m_FillMethod: 4 233 | m_FillAmount: 1 234 | m_FillClockwise: 1 235 | m_FillOrigin: 0 236 | m_UseSpriteMesh: 0 237 | m_PixelsPerUnitMultiplier: 1 238 | --- !u!114 &3687556073938325971 239 | MonoBehaviour: 240 | m_ObjectHideFlags: 0 241 | m_CorrespondingSourceObject: {fileID: 0} 242 | m_PrefabInstance: {fileID: 0} 243 | m_PrefabAsset: {fileID: 0} 244 | m_GameObject: {fileID: 3687556073943788811} 245 | m_Enabled: 1 246 | m_EditorHideFlags: 0 247 | m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} 248 | m_Name: 249 | m_EditorClassIdentifier: 250 | m_Navigation: 251 | m_Mode: 3 252 | m_WrapAround: 0 253 | m_SelectOnUp: {fileID: 0} 254 | m_SelectOnDown: {fileID: 0} 255 | m_SelectOnLeft: {fileID: 0} 256 | m_SelectOnRight: {fileID: 0} 257 | m_Transition: 1 258 | m_Colors: 259 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 260 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 261 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 262 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 263 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 264 | m_ColorMultiplier: 1 265 | m_FadeDuration: 0.1 266 | m_SpriteState: 267 | m_HighlightedSprite: {fileID: 0} 268 | m_PressedSprite: {fileID: 0} 269 | m_SelectedSprite: {fileID: 0} 270 | m_DisabledSprite: {fileID: 0} 271 | m_AnimationTriggers: 272 | m_NormalTrigger: Normal 273 | m_HighlightedTrigger: Highlighted 274 | m_PressedTrigger: Pressed 275 | m_SelectedTrigger: Highlighted 276 | m_DisabledTrigger: Disabled 277 | m_Interactable: 1 278 | m_TargetGraphic: {fileID: 3687556073938347593} 279 | m_OnClick: 280 | m_PersistentCalls: 281 | m_Calls: [] 282 | --- !u!114 &4689999971354973312 283 | MonoBehaviour: 284 | m_ObjectHideFlags: 0 285 | m_CorrespondingSourceObject: {fileID: 0} 286 | m_PrefabInstance: {fileID: 0} 287 | m_PrefabAsset: {fileID: 0} 288 | m_GameObject: {fileID: 3687556073943788811} 289 | m_Enabled: 1 290 | m_EditorHideFlags: 0 291 | m_Script: {fileID: 11500000, guid: bf7395977ed555040a786e04c4c4d722, type: 3} 292 | m_Name: 293 | m_EditorClassIdentifier: 294 | m_Element: {fileID: 3687556073938272551} 295 | m_Button: {fileID: 3687556073938325971} 296 | m_CellText: {fileID: 3687556073938280851} 297 | m_ValueText: {fileID: 4956828980401063857} 298 | --- !u!114 &3687556073938272551 299 | MonoBehaviour: 300 | m_ObjectHideFlags: 0 301 | m_CorrespondingSourceObject: {fileID: 0} 302 | m_PrefabInstance: {fileID: 0} 303 | m_PrefabAsset: {fileID: 0} 304 | m_GameObject: {fileID: 3687556073943788811} 305 | m_Enabled: 1 306 | m_EditorHideFlags: 0 307 | m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} 308 | m_Name: 309 | m_EditorClassIdentifier: 310 | m_IgnoreLayout: 0 311 | m_MinWidth: -1 312 | m_MinHeight: -1 313 | m_PreferredWidth: 120 314 | m_PreferredHeight: 120 315 | m_FlexibleWidth: -1 316 | m_FlexibleHeight: -1 317 | m_LayoutPriority: 1 318 | --- !u!1 &3687556073943945817 319 | GameObject: 320 | m_ObjectHideFlags: 0 321 | m_CorrespondingSourceObject: {fileID: 0} 322 | m_PrefabInstance: {fileID: 0} 323 | m_PrefabAsset: {fileID: 0} 324 | serializedVersion: 6 325 | m_Component: 326 | - component: {fileID: 3687556073957623545} 327 | - component: {fileID: 3687556073957803183} 328 | - component: {fileID: 3687556073938280851} 329 | m_Layer: 5 330 | m_Name: CellText 331 | m_TagString: Untagged 332 | m_Icon: {fileID: 0} 333 | m_NavMeshLayer: 0 334 | m_StaticEditorFlags: 0 335 | m_IsActive: 1 336 | --- !u!224 &3687556073957623545 337 | RectTransform: 338 | m_ObjectHideFlags: 0 339 | m_CorrespondingSourceObject: {fileID: 0} 340 | m_PrefabInstance: {fileID: 0} 341 | m_PrefabAsset: {fileID: 0} 342 | m_GameObject: {fileID: 3687556073943945817} 343 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 344 | m_LocalPosition: {x: 0, y: 0, z: 0} 345 | m_LocalScale: {x: 1, y: 1, z: 1} 346 | m_Children: [] 347 | m_Father: {fileID: 3687556073957676897} 348 | m_RootOrder: 0 349 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 350 | m_AnchorMin: {x: 0, y: 0} 351 | m_AnchorMax: {x: 1, y: 1} 352 | m_AnchoredPosition: {x: 0, y: -37.5} 353 | m_SizeDelta: {x: 0, y: -75} 354 | m_Pivot: {x: 0.5, y: 0.5} 355 | --- !u!222 &3687556073957803183 356 | CanvasRenderer: 357 | m_ObjectHideFlags: 0 358 | m_CorrespondingSourceObject: {fileID: 0} 359 | m_PrefabInstance: {fileID: 0} 360 | m_PrefabAsset: {fileID: 0} 361 | m_GameObject: {fileID: 3687556073943945817} 362 | m_CullTransparentMesh: 1 363 | --- !u!114 &3687556073938280851 364 | MonoBehaviour: 365 | m_ObjectHideFlags: 0 366 | m_CorrespondingSourceObject: {fileID: 0} 367 | m_PrefabInstance: {fileID: 0} 368 | m_PrefabAsset: {fileID: 0} 369 | m_GameObject: {fileID: 3687556073943945817} 370 | m_Enabled: 1 371 | m_EditorHideFlags: 0 372 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 373 | m_Name: 374 | m_EditorClassIdentifier: 375 | m_Material: {fileID: 0} 376 | m_Color: {r: 0.0009430714, g: 0, b: 0.6320754, a: 1} 377 | m_RaycastTarget: 1 378 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 379 | m_Maskable: 1 380 | m_OnCullStateChanged: 381 | m_PersistentCalls: 382 | m_Calls: [] 383 | m_FontData: 384 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 385 | m_FontSize: 14 386 | m_FontStyle: 0 387 | m_BestFit: 0 388 | m_MinSize: 1 389 | m_MaxSize: 100 390 | m_Alignment: 4 391 | m_AlignByGeometry: 0 392 | m_RichText: 1 393 | m_HorizontalOverflow: 0 394 | m_VerticalOverflow: 0 395 | m_LineSpacing: 1 396 | m_Text: Button 397 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell5.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df4049cd059ee034781fd1b01694aa6c 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell5_TypeA.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &3038222276336731437 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 3038222276336731436} 12 | - component: {fileID: 3038222276336731442} 13 | - component: {fileID: 3038222276336731443} 14 | m_Layer: 5 15 | m_Name: Image 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &3038222276336731436 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 3038222276336731437} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 3038222276485429697} 33 | m_RootOrder: 2 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | m_AnchorMin: {x: 0.5, y: 0.5} 36 | m_AnchorMax: {x: 0.5, y: 0.5} 37 | m_AnchoredPosition: {x: 0, y: 20} 38 | m_SizeDelta: {x: 100, y: 86} 39 | m_Pivot: {x: 0.5, y: 0.5} 40 | --- !u!222 &3038222276336731442 41 | CanvasRenderer: 42 | m_ObjectHideFlags: 0 43 | m_CorrespondingSourceObject: {fileID: 0} 44 | m_PrefabInstance: {fileID: 0} 45 | m_PrefabAsset: {fileID: 0} 46 | m_GameObject: {fileID: 3038222276336731437} 47 | m_CullTransparentMesh: 1 48 | --- !u!114 &3038222276336731443 49 | MonoBehaviour: 50 | m_ObjectHideFlags: 0 51 | m_CorrespondingSourceObject: {fileID: 0} 52 | m_PrefabInstance: {fileID: 0} 53 | m_PrefabAsset: {fileID: 0} 54 | m_GameObject: {fileID: 3038222276336731437} 55 | m_Enabled: 1 56 | m_EditorHideFlags: 0 57 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 58 | m_Name: 59 | m_EditorClassIdentifier: 60 | m_Material: {fileID: 0} 61 | m_Color: {r: 1, g: 1, b: 1, a: 1} 62 | m_RaycastTarget: 1 63 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 64 | m_Maskable: 1 65 | m_OnCullStateChanged: 66 | m_PersistentCalls: 67 | m_Calls: [] 68 | m_Sprite: {fileID: 21300000, guid: a855f4ba6619d54479a6224ade07fa03, type: 3} 69 | m_Type: 0 70 | m_PreserveAspect: 0 71 | m_FillCenter: 1 72 | m_FillMethod: 4 73 | m_FillAmount: 1 74 | m_FillClockwise: 1 75 | m_FillOrigin: 0 76 | m_UseSpriteMesh: 0 77 | m_PixelsPerUnitMultiplier: 1 78 | --- !u!1 &3038222276504861945 79 | GameObject: 80 | m_ObjectHideFlags: 0 81 | m_CorrespondingSourceObject: {fileID: 0} 82 | m_PrefabInstance: {fileID: 0} 83 | m_PrefabAsset: {fileID: 0} 84 | serializedVersion: 6 85 | m_Component: 86 | - component: {fileID: 3038222276485408857} 87 | - component: {fileID: 3038222276485294607} 88 | - component: {fileID: 3038222276499574579} 89 | m_Layer: 5 90 | m_Name: CellText 91 | m_TagString: Untagged 92 | m_Icon: {fileID: 0} 93 | m_NavMeshLayer: 0 94 | m_StaticEditorFlags: 0 95 | m_IsActive: 1 96 | --- !u!224 &3038222276485408857 97 | RectTransform: 98 | m_ObjectHideFlags: 0 99 | m_CorrespondingSourceObject: {fileID: 0} 100 | m_PrefabInstance: {fileID: 0} 101 | m_PrefabAsset: {fileID: 0} 102 | m_GameObject: {fileID: 3038222276504861945} 103 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 104 | m_LocalPosition: {x: 0, y: 0, z: 0} 105 | m_LocalScale: {x: 1, y: 1, z: 1} 106 | m_Children: [] 107 | m_Father: {fileID: 3038222276485429697} 108 | m_RootOrder: 0 109 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 110 | m_AnchorMin: {x: 0, y: 0} 111 | m_AnchorMax: {x: 1, y: 1} 112 | m_AnchoredPosition: {x: 0, y: -37.5} 113 | m_SizeDelta: {x: 0, y: -75} 114 | m_Pivot: {x: 0.5, y: 0.5} 115 | --- !u!222 &3038222276485294607 116 | CanvasRenderer: 117 | m_ObjectHideFlags: 0 118 | m_CorrespondingSourceObject: {fileID: 0} 119 | m_PrefabInstance: {fileID: 0} 120 | m_PrefabAsset: {fileID: 0} 121 | m_GameObject: {fileID: 3038222276504861945} 122 | m_CullTransparentMesh: 1 123 | --- !u!114 &3038222276499574579 124 | MonoBehaviour: 125 | m_ObjectHideFlags: 0 126 | m_CorrespondingSourceObject: {fileID: 0} 127 | m_PrefabInstance: {fileID: 0} 128 | m_PrefabAsset: {fileID: 0} 129 | m_GameObject: {fileID: 3038222276504861945} 130 | m_Enabled: 1 131 | m_EditorHideFlags: 0 132 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 133 | m_Name: 134 | m_EditorClassIdentifier: 135 | m_Material: {fileID: 0} 136 | m_Color: {r: 0.0009430714, g: 0, b: 0.6320754, a: 1} 137 | m_RaycastTarget: 1 138 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 139 | m_Maskable: 1 140 | m_OnCullStateChanged: 141 | m_PersistentCalls: 142 | m_Calls: [] 143 | m_FontData: 144 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 145 | m_FontSize: 14 146 | m_FontStyle: 0 147 | m_BestFit: 0 148 | m_MinSize: 1 149 | m_MaxSize: 100 150 | m_Alignment: 4 151 | m_AlignByGeometry: 0 152 | m_RichText: 1 153 | m_HorizontalOverflow: 0 154 | m_VerticalOverflow: 0 155 | m_LineSpacing: 1 156 | m_Text: Button 157 | --- !u!1 &3038222276505076651 158 | GameObject: 159 | m_ObjectHideFlags: 0 160 | m_CorrespondingSourceObject: {fileID: 0} 161 | m_PrefabInstance: {fileID: 0} 162 | m_PrefabAsset: {fileID: 0} 163 | serializedVersion: 6 164 | m_Component: 165 | - component: {fileID: 3038222276485429697} 166 | - component: {fileID: 3038222276485119983} 167 | - component: {fileID: 3038222276499507433} 168 | - component: {fileID: 3038222276499537779} 169 | - component: {fileID: 6346417975305173536} 170 | - component: {fileID: 3038222276499582855} 171 | m_Layer: 5 172 | m_Name: ScrollCell5_TypeA 173 | m_TagString: Untagged 174 | m_Icon: {fileID: 0} 175 | m_NavMeshLayer: 0 176 | m_StaticEditorFlags: 0 177 | m_IsActive: 1 178 | --- !u!224 &3038222276485429697 179 | RectTransform: 180 | m_ObjectHideFlags: 0 181 | m_CorrespondingSourceObject: {fileID: 0} 182 | m_PrefabInstance: {fileID: 0} 183 | m_PrefabAsset: {fileID: 0} 184 | m_GameObject: {fileID: 3038222276505076651} 185 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 186 | m_LocalPosition: {x: 0, y: 0, z: 0} 187 | m_LocalScale: {x: 1, y: 1, z: 1} 188 | m_Children: 189 | - {fileID: 3038222276485408857} 190 | - {fileID: 735786709276895502} 191 | - {fileID: 3038222276336731436} 192 | m_Father: {fileID: 0} 193 | m_RootOrder: 0 194 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 195 | m_AnchorMin: {x: 0, y: 0} 196 | m_AnchorMax: {x: 0, y: 0} 197 | m_AnchoredPosition: {x: 0, y: 0} 198 | m_SizeDelta: {x: 0, y: 0} 199 | m_Pivot: {x: 0.5, y: 0.5} 200 | --- !u!222 &3038222276485119983 201 | CanvasRenderer: 202 | m_ObjectHideFlags: 0 203 | m_CorrespondingSourceObject: {fileID: 0} 204 | m_PrefabInstance: {fileID: 0} 205 | m_PrefabAsset: {fileID: 0} 206 | m_GameObject: {fileID: 3038222276505076651} 207 | m_CullTransparentMesh: 1 208 | --- !u!114 &3038222276499507433 209 | MonoBehaviour: 210 | m_ObjectHideFlags: 0 211 | m_CorrespondingSourceObject: {fileID: 0} 212 | m_PrefabInstance: {fileID: 0} 213 | m_PrefabAsset: {fileID: 0} 214 | m_GameObject: {fileID: 3038222276505076651} 215 | m_Enabled: 1 216 | m_EditorHideFlags: 0 217 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 218 | m_Name: 219 | m_EditorClassIdentifier: 220 | m_Material: {fileID: 0} 221 | m_Color: {r: 1, g: 1, b: 1, a: 1} 222 | m_RaycastTarget: 1 223 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 224 | m_Maskable: 1 225 | m_OnCullStateChanged: 226 | m_PersistentCalls: 227 | m_Calls: [] 228 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 229 | m_Type: 1 230 | m_PreserveAspect: 0 231 | m_FillCenter: 1 232 | m_FillMethod: 4 233 | m_FillAmount: 1 234 | m_FillClockwise: 1 235 | m_FillOrigin: 0 236 | m_UseSpriteMesh: 0 237 | m_PixelsPerUnitMultiplier: 1 238 | --- !u!114 &3038222276499537779 239 | MonoBehaviour: 240 | m_ObjectHideFlags: 0 241 | m_CorrespondingSourceObject: {fileID: 0} 242 | m_PrefabInstance: {fileID: 0} 243 | m_PrefabAsset: {fileID: 0} 244 | m_GameObject: {fileID: 3038222276505076651} 245 | m_Enabled: 1 246 | m_EditorHideFlags: 0 247 | m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} 248 | m_Name: 249 | m_EditorClassIdentifier: 250 | m_Navigation: 251 | m_Mode: 3 252 | m_WrapAround: 0 253 | m_SelectOnUp: {fileID: 0} 254 | m_SelectOnDown: {fileID: 0} 255 | m_SelectOnLeft: {fileID: 0} 256 | m_SelectOnRight: {fileID: 0} 257 | m_Transition: 1 258 | m_Colors: 259 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 260 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 261 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 262 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 263 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 264 | m_ColorMultiplier: 1 265 | m_FadeDuration: 0.1 266 | m_SpriteState: 267 | m_HighlightedSprite: {fileID: 0} 268 | m_PressedSprite: {fileID: 0} 269 | m_SelectedSprite: {fileID: 0} 270 | m_DisabledSprite: {fileID: 0} 271 | m_AnimationTriggers: 272 | m_NormalTrigger: Normal 273 | m_HighlightedTrigger: Highlighted 274 | m_PressedTrigger: Pressed 275 | m_SelectedTrigger: Highlighted 276 | m_DisabledTrigger: Disabled 277 | m_Interactable: 1 278 | m_TargetGraphic: {fileID: 3038222276499507433} 279 | m_OnClick: 280 | m_PersistentCalls: 281 | m_Calls: [] 282 | --- !u!114 &6346417975305173536 283 | MonoBehaviour: 284 | m_ObjectHideFlags: 0 285 | m_CorrespondingSourceObject: {fileID: 0} 286 | m_PrefabInstance: {fileID: 0} 287 | m_PrefabAsset: {fileID: 0} 288 | m_GameObject: {fileID: 3038222276505076651} 289 | m_Enabled: 1 290 | m_EditorHideFlags: 0 291 | m_Script: {fileID: 11500000, guid: bf7395977ed555040a786e04c4c4d722, type: 3} 292 | m_Name: 293 | m_EditorClassIdentifier: 294 | m_Element: {fileID: 3038222276499582855} 295 | m_Button: {fileID: 3038222276499537779} 296 | m_OnClick_InitOnStart: 297 | m_PersistentCalls: 298 | m_Calls: [] 299 | m_OnClick_Custom: 300 | m_PersistentCalls: 301 | m_Calls: [] 302 | m_CellText: {fileID: 3038222276499574579} 303 | m_ValueText: {fileID: 6759632663803963665} 304 | --- !u!114 &3038222276499582855 305 | MonoBehaviour: 306 | m_ObjectHideFlags: 0 307 | m_CorrespondingSourceObject: {fileID: 0} 308 | m_PrefabInstance: {fileID: 0} 309 | m_PrefabAsset: {fileID: 0} 310 | m_GameObject: {fileID: 3038222276505076651} 311 | m_Enabled: 1 312 | m_EditorHideFlags: 0 313 | m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} 314 | m_Name: 315 | m_EditorClassIdentifier: 316 | m_IgnoreLayout: 0 317 | m_MinWidth: -1 318 | m_MinHeight: -1 319 | m_PreferredWidth: 120 320 | m_PreferredHeight: 120 321 | m_FlexibleWidth: -1 322 | m_FlexibleHeight: -1 323 | m_LayoutPriority: 1 324 | --- !u!1 &4044303614244299545 325 | GameObject: 326 | m_ObjectHideFlags: 0 327 | m_CorrespondingSourceObject: {fileID: 0} 328 | m_PrefabInstance: {fileID: 0} 329 | m_PrefabAsset: {fileID: 0} 330 | serializedVersion: 6 331 | m_Component: 332 | - component: {fileID: 735786709276895502} 333 | - component: {fileID: 582760422595953052} 334 | - component: {fileID: 6759632663803963665} 335 | m_Layer: 5 336 | m_Name: ValueText 337 | m_TagString: Untagged 338 | m_Icon: {fileID: 0} 339 | m_NavMeshLayer: 0 340 | m_StaticEditorFlags: 0 341 | m_IsActive: 1 342 | --- !u!224 &735786709276895502 343 | RectTransform: 344 | m_ObjectHideFlags: 0 345 | m_CorrespondingSourceObject: {fileID: 0} 346 | m_PrefabInstance: {fileID: 0} 347 | m_PrefabAsset: {fileID: 0} 348 | m_GameObject: {fileID: 4044303614244299545} 349 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 350 | m_LocalPosition: {x: 0, y: 0, z: 0} 351 | m_LocalScale: {x: 1, y: 1, z: 1} 352 | m_Children: [] 353 | m_Father: {fileID: 3038222276485429697} 354 | m_RootOrder: 1 355 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 356 | m_AnchorMin: {x: 0, y: 0} 357 | m_AnchorMax: {x: 1, y: 1} 358 | m_AnchoredPosition: {x: 0, y: -50} 359 | m_SizeDelta: {x: 0, y: -100} 360 | m_Pivot: {x: 0.5, y: 0.5} 361 | --- !u!222 &582760422595953052 362 | CanvasRenderer: 363 | m_ObjectHideFlags: 0 364 | m_CorrespondingSourceObject: {fileID: 0} 365 | m_PrefabInstance: {fileID: 0} 366 | m_PrefabAsset: {fileID: 0} 367 | m_GameObject: {fileID: 4044303614244299545} 368 | m_CullTransparentMesh: 1 369 | --- !u!114 &6759632663803963665 370 | MonoBehaviour: 371 | m_ObjectHideFlags: 0 372 | m_CorrespondingSourceObject: {fileID: 0} 373 | m_PrefabInstance: {fileID: 0} 374 | m_PrefabAsset: {fileID: 0} 375 | m_GameObject: {fileID: 4044303614244299545} 376 | m_Enabled: 1 377 | m_EditorHideFlags: 0 378 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 379 | m_Name: 380 | m_EditorClassIdentifier: 381 | m_Material: {fileID: 0} 382 | m_Color: {r: 0.0009430714, g: 0, b: 0.6320754, a: 1} 383 | m_RaycastTarget: 1 384 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 385 | m_Maskable: 1 386 | m_OnCullStateChanged: 387 | m_PersistentCalls: 388 | m_Calls: [] 389 | m_FontData: 390 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 391 | m_FontSize: 14 392 | m_FontStyle: 0 393 | m_BestFit: 0 394 | m_MinSize: 1 395 | m_MaxSize: 100 396 | m_Alignment: 4 397 | m_AlignByGeometry: 0 398 | m_RichText: 1 399 | m_HorizontalOverflow: 0 400 | m_VerticalOverflow: 0 401 | m_LineSpacing: 1 402 | m_Text: Button 403 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell5_TypeA.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd9a84f56a208c24cbd264b3d142dc07 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell5_TypeB.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5717589705847511400 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 9029364463765263231} 12 | - component: {fileID: 9182510588660136941} 13 | - component: {fileID: 3078139053221942112} 14 | m_Layer: 5 15 | m_Name: ValueText 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &9029364463765263231 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 5717589705847511400} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 6724254875681751984} 33 | m_RootOrder: 1 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | m_AnchorMin: {x: 0, y: 0} 36 | m_AnchorMax: {x: 1, y: 1} 37 | m_AnchoredPosition: {x: 0, y: -50} 38 | m_SizeDelta: {x: 0, y: -100} 39 | m_Pivot: {x: 0.5, y: 0.5} 40 | --- !u!222 &9182510588660136941 41 | CanvasRenderer: 42 | m_ObjectHideFlags: 0 43 | m_CorrespondingSourceObject: {fileID: 0} 44 | m_PrefabInstance: {fileID: 0} 45 | m_PrefabAsset: {fileID: 0} 46 | m_GameObject: {fileID: 5717589705847511400} 47 | m_CullTransparentMesh: 1 48 | --- !u!114 &3078139053221942112 49 | MonoBehaviour: 50 | m_ObjectHideFlags: 0 51 | m_CorrespondingSourceObject: {fileID: 0} 52 | m_PrefabInstance: {fileID: 0} 53 | m_PrefabAsset: {fileID: 0} 54 | m_GameObject: {fileID: 5717589705847511400} 55 | m_Enabled: 1 56 | m_EditorHideFlags: 0 57 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 58 | m_Name: 59 | m_EditorClassIdentifier: 60 | m_Material: {fileID: 0} 61 | m_Color: {r: 0.0009430714, g: 0, b: 0.6320754, a: 1} 62 | m_RaycastTarget: 1 63 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 64 | m_Maskable: 1 65 | m_OnCullStateChanged: 66 | m_PersistentCalls: 67 | m_Calls: [] 68 | m_FontData: 69 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 70 | m_FontSize: 14 71 | m_FontStyle: 0 72 | m_BestFit: 0 73 | m_MinSize: 1 74 | m_MaxSize: 100 75 | m_Alignment: 4 76 | m_AlignByGeometry: 0 77 | m_RichText: 1 78 | m_HorizontalOverflow: 0 79 | m_VerticalOverflow: 0 80 | m_LineSpacing: 1 81 | m_Text: Button 82 | --- !u!1 &6724254875701773960 83 | GameObject: 84 | m_ObjectHideFlags: 0 85 | m_CorrespondingSourceObject: {fileID: 0} 86 | m_PrefabInstance: {fileID: 0} 87 | m_PrefabAsset: {fileID: 0} 88 | serializedVersion: 6 89 | m_Component: 90 | - component: {fileID: 6724254875681804840} 91 | - component: {fileID: 6724254875681624190} 92 | - component: {fileID: 6724254875708503362} 93 | m_Layer: 5 94 | m_Name: CellText 95 | m_TagString: Untagged 96 | m_Icon: {fileID: 0} 97 | m_NavMeshLayer: 0 98 | m_StaticEditorFlags: 0 99 | m_IsActive: 1 100 | --- !u!224 &6724254875681804840 101 | RectTransform: 102 | m_ObjectHideFlags: 0 103 | m_CorrespondingSourceObject: {fileID: 0} 104 | m_PrefabInstance: {fileID: 0} 105 | m_PrefabAsset: {fileID: 0} 106 | m_GameObject: {fileID: 6724254875701773960} 107 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 108 | m_LocalPosition: {x: 0, y: 0, z: 0} 109 | m_LocalScale: {x: 1, y: 1, z: 1} 110 | m_Children: [] 111 | m_Father: {fileID: 6724254875681751984} 112 | m_RootOrder: 0 113 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 114 | m_AnchorMin: {x: 0, y: 0} 115 | m_AnchorMax: {x: 1, y: 1} 116 | m_AnchoredPosition: {x: 0, y: -37.5} 117 | m_SizeDelta: {x: 0, y: -75} 118 | m_Pivot: {x: 0.5, y: 0.5} 119 | --- !u!222 &6724254875681624190 120 | CanvasRenderer: 121 | m_ObjectHideFlags: 0 122 | m_CorrespondingSourceObject: {fileID: 0} 123 | m_PrefabInstance: {fileID: 0} 124 | m_PrefabAsset: {fileID: 0} 125 | m_GameObject: {fileID: 6724254875701773960} 126 | m_CullTransparentMesh: 1 127 | --- !u!114 &6724254875708503362 128 | MonoBehaviour: 129 | m_ObjectHideFlags: 0 130 | m_CorrespondingSourceObject: {fileID: 0} 131 | m_PrefabInstance: {fileID: 0} 132 | m_PrefabAsset: {fileID: 0} 133 | m_GameObject: {fileID: 6724254875701773960} 134 | m_Enabled: 1 135 | m_EditorHideFlags: 0 136 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 137 | m_Name: 138 | m_EditorClassIdentifier: 139 | m_Material: {fileID: 0} 140 | m_Color: {r: 0.0009430714, g: 0, b: 0.6320754, a: 1} 141 | m_RaycastTarget: 1 142 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 143 | m_Maskable: 1 144 | m_OnCullStateChanged: 145 | m_PersistentCalls: 146 | m_Calls: [] 147 | m_FontData: 148 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 149 | m_FontSize: 14 150 | m_FontStyle: 0 151 | m_BestFit: 0 152 | m_MinSize: 1 153 | m_MaxSize: 100 154 | m_Alignment: 4 155 | m_AlignByGeometry: 0 156 | m_RichText: 1 157 | m_HorizontalOverflow: 0 158 | m_VerticalOverflow: 0 159 | m_LineSpacing: 1 160 | m_Text: Button 161 | --- !u!1 &6724254875701950938 162 | GameObject: 163 | m_ObjectHideFlags: 0 164 | m_CorrespondingSourceObject: {fileID: 0} 165 | m_PrefabInstance: {fileID: 0} 166 | m_PrefabAsset: {fileID: 0} 167 | serializedVersion: 6 168 | m_Component: 169 | - component: {fileID: 6724254875681751984} 170 | - component: {fileID: 6724254875681965470} 171 | - component: {fileID: 6724254875708437144} 172 | - component: {fileID: 6724254875708441858} 173 | - component: {fileID: 3417023448559599697} 174 | - component: {fileID: 6724254875708495350} 175 | m_Layer: 5 176 | m_Name: ScrollCell5_TypeB 177 | m_TagString: Untagged 178 | m_Icon: {fileID: 0} 179 | m_NavMeshLayer: 0 180 | m_StaticEditorFlags: 0 181 | m_IsActive: 1 182 | --- !u!224 &6724254875681751984 183 | RectTransform: 184 | m_ObjectHideFlags: 0 185 | m_CorrespondingSourceObject: {fileID: 0} 186 | m_PrefabInstance: {fileID: 0} 187 | m_PrefabAsset: {fileID: 0} 188 | m_GameObject: {fileID: 6724254875701950938} 189 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 190 | m_LocalPosition: {x: 0, y: 0, z: 0} 191 | m_LocalScale: {x: 1, y: 1, z: 1} 192 | m_Children: 193 | - {fileID: 6724254875681804840} 194 | - {fileID: 9029364463765263231} 195 | - {fileID: 6724254875864956765} 196 | m_Father: {fileID: 0} 197 | m_RootOrder: 0 198 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 199 | m_AnchorMin: {x: 0, y: 0} 200 | m_AnchorMax: {x: 0, y: 0} 201 | m_AnchoredPosition: {x: 0, y: 0} 202 | m_SizeDelta: {x: 0, y: 0} 203 | m_Pivot: {x: 0.5, y: 0.5} 204 | --- !u!222 &6724254875681965470 205 | CanvasRenderer: 206 | m_ObjectHideFlags: 0 207 | m_CorrespondingSourceObject: {fileID: 0} 208 | m_PrefabInstance: {fileID: 0} 209 | m_PrefabAsset: {fileID: 0} 210 | m_GameObject: {fileID: 6724254875701950938} 211 | m_CullTransparentMesh: 1 212 | --- !u!114 &6724254875708437144 213 | MonoBehaviour: 214 | m_ObjectHideFlags: 0 215 | m_CorrespondingSourceObject: {fileID: 0} 216 | m_PrefabInstance: {fileID: 0} 217 | m_PrefabAsset: {fileID: 0} 218 | m_GameObject: {fileID: 6724254875701950938} 219 | m_Enabled: 1 220 | m_EditorHideFlags: 0 221 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 222 | m_Name: 223 | m_EditorClassIdentifier: 224 | m_Material: {fileID: 0} 225 | m_Color: {r: 1, g: 1, b: 1, a: 1} 226 | m_RaycastTarget: 1 227 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 228 | m_Maskable: 1 229 | m_OnCullStateChanged: 230 | m_PersistentCalls: 231 | m_Calls: [] 232 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 233 | m_Type: 1 234 | m_PreserveAspect: 0 235 | m_FillCenter: 1 236 | m_FillMethod: 4 237 | m_FillAmount: 1 238 | m_FillClockwise: 1 239 | m_FillOrigin: 0 240 | m_UseSpriteMesh: 0 241 | m_PixelsPerUnitMultiplier: 1 242 | --- !u!114 &6724254875708441858 243 | MonoBehaviour: 244 | m_ObjectHideFlags: 0 245 | m_CorrespondingSourceObject: {fileID: 0} 246 | m_PrefabInstance: {fileID: 0} 247 | m_PrefabAsset: {fileID: 0} 248 | m_GameObject: {fileID: 6724254875701950938} 249 | m_Enabled: 1 250 | m_EditorHideFlags: 0 251 | m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} 252 | m_Name: 253 | m_EditorClassIdentifier: 254 | m_Navigation: 255 | m_Mode: 3 256 | m_WrapAround: 0 257 | m_SelectOnUp: {fileID: 0} 258 | m_SelectOnDown: {fileID: 0} 259 | m_SelectOnLeft: {fileID: 0} 260 | m_SelectOnRight: {fileID: 0} 261 | m_Transition: 1 262 | m_Colors: 263 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 264 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 265 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 266 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 267 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 268 | m_ColorMultiplier: 1 269 | m_FadeDuration: 0.1 270 | m_SpriteState: 271 | m_HighlightedSprite: {fileID: 0} 272 | m_PressedSprite: {fileID: 0} 273 | m_SelectedSprite: {fileID: 0} 274 | m_DisabledSprite: {fileID: 0} 275 | m_AnimationTriggers: 276 | m_NormalTrigger: Normal 277 | m_HighlightedTrigger: Highlighted 278 | m_PressedTrigger: Pressed 279 | m_SelectedTrigger: Highlighted 280 | m_DisabledTrigger: Disabled 281 | m_Interactable: 1 282 | m_TargetGraphic: {fileID: 6724254875708437144} 283 | m_OnClick: 284 | m_PersistentCalls: 285 | m_Calls: [] 286 | --- !u!114 &3417023448559599697 287 | MonoBehaviour: 288 | m_ObjectHideFlags: 0 289 | m_CorrespondingSourceObject: {fileID: 0} 290 | m_PrefabInstance: {fileID: 0} 291 | m_PrefabAsset: {fileID: 0} 292 | m_GameObject: {fileID: 6724254875701950938} 293 | m_Enabled: 1 294 | m_EditorHideFlags: 0 295 | m_Script: {fileID: 11500000, guid: bf7395977ed555040a786e04c4c4d722, type: 3} 296 | m_Name: 297 | m_EditorClassIdentifier: 298 | m_Element: {fileID: 6724254875708495350} 299 | m_Button: {fileID: 6724254875708441858} 300 | m_OnClick_InitOnStart: 301 | m_PersistentCalls: 302 | m_Calls: [] 303 | m_OnClick_Custom: 304 | m_PersistentCalls: 305 | m_Calls: [] 306 | m_CellText: {fileID: 6724254875708503362} 307 | m_ValueText: {fileID: 3078139053221942112} 308 | --- !u!114 &6724254875708495350 309 | MonoBehaviour: 310 | m_ObjectHideFlags: 0 311 | m_CorrespondingSourceObject: {fileID: 0} 312 | m_PrefabInstance: {fileID: 0} 313 | m_PrefabAsset: {fileID: 0} 314 | m_GameObject: {fileID: 6724254875701950938} 315 | m_Enabled: 1 316 | m_EditorHideFlags: 0 317 | m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} 318 | m_Name: 319 | m_EditorClassIdentifier: 320 | m_IgnoreLayout: 0 321 | m_MinWidth: -1 322 | m_MinHeight: -1 323 | m_PreferredWidth: 120 324 | m_PreferredHeight: 120 325 | m_FlexibleWidth: -1 326 | m_FlexibleHeight: -1 327 | m_LayoutPriority: 1 328 | --- !u!1 &6724254875864956764 329 | GameObject: 330 | m_ObjectHideFlags: 0 331 | m_CorrespondingSourceObject: {fileID: 0} 332 | m_PrefabInstance: {fileID: 0} 333 | m_PrefabAsset: {fileID: 0} 334 | serializedVersion: 6 335 | m_Component: 336 | - component: {fileID: 6724254875864956765} 337 | - component: {fileID: 6724254875864956739} 338 | - component: {fileID: 6724254875864956738} 339 | m_Layer: 5 340 | m_Name: Image 341 | m_TagString: Untagged 342 | m_Icon: {fileID: 0} 343 | m_NavMeshLayer: 0 344 | m_StaticEditorFlags: 0 345 | m_IsActive: 1 346 | --- !u!224 &6724254875864956765 347 | RectTransform: 348 | m_ObjectHideFlags: 0 349 | m_CorrespondingSourceObject: {fileID: 0} 350 | m_PrefabInstance: {fileID: 0} 351 | m_PrefabAsset: {fileID: 0} 352 | m_GameObject: {fileID: 6724254875864956764} 353 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 354 | m_LocalPosition: {x: 0, y: 0, z: 0} 355 | m_LocalScale: {x: 1, y: 1, z: 1} 356 | m_Children: [] 357 | m_Father: {fileID: 6724254875681751984} 358 | m_RootOrder: 2 359 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 360 | m_AnchorMin: {x: 0.5, y: 0.5} 361 | m_AnchorMax: {x: 0.5, y: 0.5} 362 | m_AnchoredPosition: {x: 0, y: 20} 363 | m_SizeDelta: {x: 100, y: 86} 364 | m_Pivot: {x: 0.5, y: 0.5} 365 | --- !u!222 &6724254875864956739 366 | CanvasRenderer: 367 | m_ObjectHideFlags: 0 368 | m_CorrespondingSourceObject: {fileID: 0} 369 | m_PrefabInstance: {fileID: 0} 370 | m_PrefabAsset: {fileID: 0} 371 | m_GameObject: {fileID: 6724254875864956764} 372 | m_CullTransparentMesh: 1 373 | --- !u!114 &6724254875864956738 374 | MonoBehaviour: 375 | m_ObjectHideFlags: 0 376 | m_CorrespondingSourceObject: {fileID: 0} 377 | m_PrefabInstance: {fileID: 0} 378 | m_PrefabAsset: {fileID: 0} 379 | m_GameObject: {fileID: 6724254875864956764} 380 | m_Enabled: 1 381 | m_EditorHideFlags: 0 382 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 383 | m_Name: 384 | m_EditorClassIdentifier: 385 | m_Material: {fileID: 0} 386 | m_Color: {r: 0, g: 0.5794997, b: 1, a: 1} 387 | m_RaycastTarget: 1 388 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 389 | m_Maskable: 1 390 | m_OnCullStateChanged: 391 | m_PersistentCalls: 392 | m_Calls: [] 393 | m_Sprite: {fileID: 21300000, guid: a855f4ba6619d54479a6224ade07fa03, type: 3} 394 | m_Type: 0 395 | m_PreserveAspect: 0 396 | m_FillCenter: 1 397 | m_FillMethod: 4 398 | m_FillAmount: 1 399 | m_FillClockwise: 1 400 | m_FillOrigin: 0 401 | m_UseSpriteMesh: 0 402 | m_PixelsPerUnitMultiplier: 1 403 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell5_TypeB.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 681b5456317102f469bb9e7ef42acebc 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/ScrollCell5_TypeC.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08258499f7f53874db3a5f029e72cec6 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/UI_ControlScene.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98e6cb3464e1d58428319dfba371e42f 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/UI_ControllData_Horizontal.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e46cc2dcf5d58e04caecedbe5c88ef02 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/UI_ControllData_HorizontalScroll_Grid.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4bc17b9b6481a04aad49e8804757c1b 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/UI_ControllData_Vertical.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 567efa73420f7244497042fb8f5c0a07 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/UI_ControllData_VerticalScroll_Grid.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 77a59573c8fca3d4dbc4281913aef5a3 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/VerticalScroll_CustomSize.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0d842661fe359348868e7e65dd8e1d7 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Prefabs/VerticalScroll_Grid.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 707c02a3e6431494f9c3a41e7c5ecb48 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38f39d5416d65c848acd1bf8a6fe769b 3 | folderAsset: yes 4 | timeCreated: 1439609534 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/CustomListBank.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace Demo 5 | { 6 | 7 | public class CustomListBank : LoopListBankBase 8 | { 9 | private List m_ContentsForInitData = new List 10 | { 11 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 13 | }; 14 | 15 | private List _LoopListBankDataList; 16 | private List m_LoopListBankDataList 17 | { 18 | get 19 | { 20 | if (_LoopListBankDataList == null) 21 | { 22 | _LoopListBankDataList = new List(); 23 | _LoopListBankDataList = InitLoopListBankDataList(); 24 | } 25 | 26 | return _LoopListBankDataList; 27 | } 28 | set { _LoopListBankDataList = value; } 29 | } 30 | 31 | // Cell Sizes 32 | public List m_CellSizes = new List 33 | { 34 | new Vector2(120, 120), 35 | new Vector2(170, 120), 36 | new Vector2(220, 120) 37 | }; 38 | 39 | public override List InitLoopListBankDataList() 40 | { 41 | m_LoopListBankDataList.Clear(); 42 | LoopListBankData TempCustomData = null; 43 | for (int i = 0; i < m_ContentsForInitData.Count; ++i) 44 | { 45 | TempCustomData = new LoopListBankData(); 46 | TempCustomData.Content = m_ContentsForInitData[i]; 47 | TempCustomData.UniqueID = System.Guid.NewGuid().ToString(); 48 | m_LoopListBankDataList.Add(TempCustomData); 49 | } 50 | 51 | return m_LoopListBankDataList; 52 | } 53 | 54 | public override int GetListLength() 55 | { 56 | return m_LoopListBankDataList.Count; 57 | } 58 | 59 | public override LoopListBankData GetLoopListBankData(int index) 60 | { 61 | if(m_LoopListBankDataList.Count == 0) 62 | { 63 | return new LoopListBankData(); 64 | } 65 | index = index % m_LoopListBankDataList.Count; 66 | if (index < 0) 67 | { 68 | index += m_LoopListBankDataList.Count; 69 | } 70 | return m_LoopListBankDataList[index]; 71 | } 72 | 73 | public override List GetLoopListBankDatas() 74 | { 75 | return m_LoopListBankDataList; 76 | } 77 | 78 | public override void SetLoopListBankDatas(List newDatas) 79 | { 80 | m_LoopListBankDataList = newDatas; 81 | } 82 | 83 | public int FindUniqueID(string UniqueID) 84 | { 85 | if (string.IsNullOrEmpty(UniqueID)) 86 | { 87 | return -1; 88 | } 89 | 90 | for (int i = 0; i < m_LoopListBankDataList.Count; ++i) 91 | { 92 | if (m_LoopListBankDataList[i].UniqueID == UniqueID) 93 | { 94 | return i; 95 | } 96 | } 97 | 98 | return -1; 99 | } 100 | 101 | public void AddContent(object newContent) 102 | { 103 | LoopListBankData TempCustomData = new LoopListBankData(); 104 | TempCustomData.Content = newContent; 105 | TempCustomData.UniqueID = System.Guid.NewGuid().ToString(); 106 | m_LoopListBankDataList.Add(TempCustomData); 107 | } 108 | 109 | public void DelContentByIndex(int index) 110 | { 111 | if (m_LoopListBankDataList.Count <= index) 112 | { 113 | return; 114 | } 115 | m_LoopListBankDataList.RemoveAt(index); 116 | } 117 | 118 | public void SetContents(List newContents) 119 | { 120 | m_ContentsForInitData = newContents; 121 | InitLoopListBankDataList(); 122 | } 123 | 124 | public override int GetCellPreferredTypeIndex(int index) 125 | { 126 | var TempConten = GetLoopListBankData(index).Content; 127 | 128 | int TempData = (int)TempConten; 129 | int ResultIndex = Mathf.Abs(TempData) % 3; 130 | 131 | return ResultIndex; 132 | } 133 | 134 | public override Vector2 GetCellPreferredSize(int index) 135 | { 136 | int ResultIndex = GetCellPreferredTypeIndex(index); 137 | 138 | Vector2 FinalValue = m_CellSizes[ResultIndex]; 139 | 140 | return FinalValue; 141 | } 142 | } 143 | } -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/CustomListBank.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0b70e646703e9974ab153bc359304955 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/InitOnStart.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | using UnityEngine.UI; 4 | 5 | namespace Demo 6 | { 7 | [RequireComponent(typeof(UnityEngine.UI.LoopScrollRect))] 8 | [DisallowMultipleComponent] 9 | public class InitOnStart : MonoBehaviour, LoopScrollPrefabSource, LoopScrollDataSource 10 | { 11 | public GameObject item; 12 | public int totalCount = -1; 13 | 14 | // Implement your own Cache Pool here. The following is just for example. 15 | Stack pool = new Stack(); 16 | public GameObject GetObject(int index) 17 | { 18 | if (pool.Count == 0) 19 | { 20 | return Instantiate(item); 21 | } 22 | Transform candidate = pool.Pop(); 23 | candidate.gameObject.SetActive(true); 24 | return candidate.gameObject; 25 | } 26 | 27 | public void ReturnObject(Transform trans) 28 | { 29 | // Use `DestroyImmediate` here if you don't need Pool 30 | trans.SendMessage("ScrollCellReturn", SendMessageOptions.DontRequireReceiver); 31 | trans.gameObject.SetActive(false); 32 | trans.SetParent(transform, false); 33 | pool.Push(trans); 34 | } 35 | 36 | public void ProvideData(Transform transform, int idx) 37 | { 38 | transform.SendMessage("ScrollCellIndex", idx); 39 | } 40 | 41 | void Start() 42 | { 43 | var ls = GetComponent(); 44 | ls.prefabSource = this; 45 | ls.dataSource = this; 46 | ls.totalCount = totalCount; 47 | ls.RefillCells(); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/InitOnStart.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c41ca759a5d70b448b991ca2699766ba 3 | timeCreated: 1476327660 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/InitOnStartMulti.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace Demo 6 | { 7 | [RequireComponent(typeof(UnityEngine.UI.LoopScrollRectMulti))] 8 | [DisallowMultipleComponent] 9 | public class InitOnStartMulti : MonoBehaviour, LoopScrollPrefabSource, LoopScrollMultiDataSource 10 | { 11 | public LoopScrollRectMulti m_LoopScrollRect; 12 | 13 | public LoopListBankBase m_LoopListBank; 14 | 15 | // Is Use MulitiPrefab 16 | public bool m_IsUseMultiPrefabs = false; 17 | // Cell Prefab 18 | public GameObject m_Item; 19 | // Cell MulitiPrefab 20 | public List m_ItemList = new List(); 21 | 22 | [HideInInspector] 23 | public string m_ClickUniqueID = ""; 24 | [HideInInspector] 25 | public object m_ClickObject; 26 | 27 | protected virtual void Awake() 28 | { 29 | m_LoopScrollRect.prefabSource = this; 30 | m_LoopScrollRect.dataSource = this; 31 | m_LoopScrollRect.totalCount = m_LoopListBank.GetListLength(); 32 | m_LoopScrollRect.RefillCells(); 33 | } 34 | 35 | protected virtual void Start() 36 | { 37 | 38 | } 39 | 40 | // Implement your own Cache Pool here. The following is just for example. 41 | Stack pool = new Stack(); 42 | Dictionary> m_Pool_Type = new Dictionary>(); 43 | public virtual GameObject GetObject(int index) 44 | { 45 | Transform candidate = null; 46 | ScrollIndexCallbackBase TempScrollIndexCallbackBase = null; 47 | // Is Use MulitiPrefab 48 | if (!m_IsUseMultiPrefabs) 49 | { 50 | if (pool.Count == 0) 51 | { 52 | candidate = Instantiate(m_Item.transform); 53 | } 54 | else 55 | { 56 | candidate = pool.Pop(); 57 | } 58 | 59 | // One Cell Prefab, Set PreferredSize as runtime. 60 | TempScrollIndexCallbackBase = candidate.GetComponent(); 61 | if (null != TempScrollIndexCallbackBase) 62 | { 63 | TempScrollIndexCallbackBase.SetPrefabName(m_Item.name); 64 | if (m_LoopScrollRect.horizontal) 65 | { 66 | float RandomWidth = m_LoopListBank.GetCellPreferredSize(index).x; 67 | TempScrollIndexCallbackBase.SetLayoutElementPreferredWidth(RandomWidth); 68 | } 69 | 70 | if (m_LoopScrollRect.vertical) 71 | { 72 | float RandomHeight = m_LoopListBank.GetCellPreferredSize(index).y; 73 | TempScrollIndexCallbackBase.SetLayoutElementPreferredHeight(RandomHeight); 74 | } 75 | } 76 | } 77 | else 78 | { 79 | // Cell MulitiPrefab, Get Cell Preferred Type by custom data 80 | int CellTypeIndex = m_LoopListBank.GetCellPreferredTypeIndex(index); 81 | if (m_ItemList.Count <= CellTypeIndex) 82 | { 83 | Debug.LogWarningFormat("TempPrefab is null! CellTypeIndex: {0}", CellTypeIndex); 84 | return null; 85 | } 86 | var TempPrefab = m_ItemList[CellTypeIndex]; 87 | 88 | Stack TempStack = null; 89 | if (!m_Pool_Type.TryGetValue(TempPrefab.name, out TempStack)) 90 | { 91 | TempStack = new Stack(); 92 | m_Pool_Type.Add(TempPrefab.name, TempStack); 93 | } 94 | 95 | if (TempStack.Count == 0) 96 | { 97 | candidate = Instantiate(TempPrefab).GetComponent(); 98 | TempScrollIndexCallbackBase = candidate.GetComponent(); 99 | if (null != TempScrollIndexCallbackBase) 100 | { 101 | TempScrollIndexCallbackBase.SetPrefabName(TempPrefab.name); 102 | } 103 | } 104 | else 105 | { 106 | candidate = TempStack.Pop(); 107 | candidate.gameObject.SetActive(true); 108 | } 109 | } 110 | 111 | TempScrollIndexCallbackBase = candidate.gameObject.GetComponent(); 112 | if (null != TempScrollIndexCallbackBase) 113 | { 114 | TempScrollIndexCallbackBase.SetUniqueID(m_LoopListBank.GetLoopListBankData(index).UniqueID); 115 | TempScrollIndexCallbackBase.onClick_InitOnStart.RemoveAllListeners(); 116 | TempScrollIndexCallbackBase.onClick_InitOnStart.AddListener(() => OnButtonScrollIndexCallbackClick(TempScrollIndexCallbackBase, index, TempScrollIndexCallbackBase.GetContent(), TempScrollIndexCallbackBase.GetUniqueID())); 117 | } 118 | 119 | return candidate.gameObject; 120 | } 121 | 122 | public virtual void ReturnObject(Transform trans) 123 | { 124 | trans.SendMessage("ScrollCellReturn", SendMessageOptions.DontRequireReceiver); 125 | trans.gameObject.SetActive(false); 126 | trans.SetParent(transform, false); 127 | // Is Use MulitiPrefab 128 | if (!m_IsUseMultiPrefabs) 129 | { 130 | pool.Push(trans); 131 | } 132 | else 133 | { 134 | // Use PrefabName as Key for Pool Manager 135 | ScrollIndexCallbackBase TempScrollIndexCallbackBase = trans.GetComponent(); 136 | if (null == TempScrollIndexCallbackBase) 137 | { 138 | // Use `DestroyImmediate` here if you don't need Pool 139 | DestroyImmediate(trans.gameObject); 140 | return; 141 | } 142 | 143 | Stack TempStack = null; 144 | if (m_Pool_Type.TryGetValue(TempScrollIndexCallbackBase.GetPrefabName(), out TempStack)) 145 | { 146 | TempStack.Push(trans); 147 | } 148 | else 149 | { 150 | TempStack = new Stack(); 151 | TempStack.Push(trans); 152 | 153 | m_Pool_Type.Add(TempScrollIndexCallbackBase.GetPrefabName(), TempStack); 154 | } 155 | } 156 | } 157 | 158 | public virtual void ProvideData(Transform transform, int idx) 159 | { 160 | //transform.SendMessage("ScrollCellIndex", idx); 161 | 162 | // Use direct call for better performance 163 | transform.GetComponent()?.ScrollCellIndex(idx, m_LoopListBank.GetLoopListBankData(idx).Content, m_ClickUniqueID, m_ClickObject); 164 | } 165 | 166 | private void OnButtonScrollIndexCallbackClick(ScrollIndexCallbackBase ScrollIndexCallback, int index, object content, string ClickUniqueID) 167 | { 168 | //Debug.LogWarningFormat("InitOnStartMulti => Click index: {0}, content: {1}, ClickUniqueID: {2}", index, content, ClickUniqueID); 169 | 170 | m_ClickUniqueID = ClickUniqueID; 171 | m_ClickObject = content; 172 | 173 | foreach (var TempScrollIndexCallback in m_LoopScrollRect.content.GetComponentsInChildren()) 174 | { 175 | TempScrollIndexCallback.RefreshUI(ClickUniqueID, m_ClickObject); 176 | } 177 | } 178 | 179 | public virtual ScrollIndexCallbackBase GetScrollIndexCallbackByIndex(int idx) 180 | { 181 | foreach (var TempScrollIndexCallback in m_LoopScrollRect.content.GetComponentsInChildren()) 182 | { 183 | if (TempScrollIndexCallback.GetIndexID() == idx) 184 | { 185 | return TempScrollIndexCallback; 186 | } 187 | } 188 | return null; 189 | } 190 | } 191 | } -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/InitOnStartMulti.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6dda6a5a8d0bfc74cb3a87344d9092bd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/LoopListBankBase.cs: -------------------------------------------------------------------------------- 1 | /* Store the contents for ListBoxes to display. 2 | */ 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | namespace Demo 7 | { 8 | // LoopListBankData 9 | public class LoopListBankData 10 | { 11 | public object Content; 12 | public string UniqueID = ""; 13 | 14 | public bool IsEmpty() 15 | { 16 | if(null == Content 17 | || string.IsNullOrEmpty(UniqueID)) 18 | { 19 | return true; 20 | } 21 | return false; 22 | } 23 | } 24 | /* The base class of the list content container 25 | * 26 | * Create the individual ListBank by inheriting this class 27 | */ 28 | public abstract class LoopListBankBase : MonoBehaviour 29 | { 30 | // Init DataList 31 | public abstract List InitLoopListBankDataList(); 32 | 33 | // Get Data count in list 34 | public abstract int GetListLength(); 35 | 36 | // Get Data in list by index 37 | public abstract LoopListBankData GetLoopListBankData(int index); 38 | 39 | // Get All Data in list 40 | public abstract List GetLoopListBankDatas(); 41 | 42 | // Set Data into list 43 | public abstract void SetLoopListBankDatas(List newDatas); 44 | 45 | // Get cell preferred type index by index 46 | public abstract int GetCellPreferredTypeIndex(int index); 47 | // Get cell preferred size by index 48 | public abstract Vector2 GetCellPreferredSize(int index); 49 | } 50 | 51 | /* The example of the ListBank 52 | */ 53 | public class LoopListBank : LoopListBankBase 54 | { 55 | private List m_ContentsForInitData = new List 56 | { 57 | 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 58 | }; 59 | 60 | private List _LoopListBankDataList; 61 | private List m_LoopListBankDataList 62 | { 63 | get 64 | { 65 | if (_LoopListBankDataList == null) 66 | { 67 | _LoopListBankDataList = new List(); 68 | _LoopListBankDataList = InitLoopListBankDataList(); 69 | } 70 | 71 | return _LoopListBankDataList; 72 | } 73 | set { _LoopListBankDataList = value; } 74 | } 75 | 76 | // Cell Sizes 77 | public List m_CellSizes = new List 78 | { 79 | new Vector2(120, 120), 80 | new Vector2(170, 120), 81 | new Vector2(220, 120) 82 | }; 83 | 84 | public override List InitLoopListBankDataList() 85 | { 86 | m_LoopListBankDataList.Clear(); 87 | LoopListBankData TempCustomData = null; 88 | for (int i = 0; i < m_ContentsForInitData.Count; ++i) 89 | { 90 | TempCustomData = new LoopListBankData(); 91 | TempCustomData.Content = m_ContentsForInitData[i]; 92 | TempCustomData.UniqueID = System.Guid.NewGuid().ToString(); 93 | m_LoopListBankDataList.Add(TempCustomData); 94 | } 95 | 96 | return m_LoopListBankDataList; 97 | } 98 | 99 | public override int GetListLength() 100 | { 101 | return m_LoopListBankDataList.Count; 102 | } 103 | 104 | public override LoopListBankData GetLoopListBankData(int index) 105 | { 106 | if (m_LoopListBankDataList.Count <= index) 107 | { 108 | return new LoopListBankData(); 109 | } 110 | return m_LoopListBankDataList[index]; 111 | } 112 | 113 | public override List GetLoopListBankDatas() 114 | { 115 | return m_LoopListBankDataList; 116 | } 117 | 118 | public override void SetLoopListBankDatas(List newDatas) 119 | { 120 | m_LoopListBankDataList = newDatas; 121 | } 122 | 123 | public int FindUniqueID(string UniqueID) 124 | { 125 | if(string.IsNullOrEmpty(UniqueID)) 126 | { 127 | return -1; 128 | } 129 | 130 | for(int i=0;i newContents) 159 | { 160 | m_ContentsForInitData = newContents; 161 | InitLoopListBankDataList(); 162 | } 163 | 164 | public override int GetCellPreferredTypeIndex(int index) 165 | { 166 | return 0; 167 | } 168 | 169 | public override Vector2 GetCellPreferredSize(int index) 170 | { 171 | int ResultIndex = GetCellPreferredTypeIndex(index); 172 | 173 | Vector2 FinalValue = m_CellSizes[ResultIndex]; 174 | 175 | return FinalValue; 176 | } 177 | } 178 | } 179 | 180 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/LoopListBankBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32d70bf1ac9291b4b9bec518f2ded486 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallback1.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using System.Collections; 4 | 5 | public class ScrollIndexCallback1 : MonoBehaviour 6 | { 7 | public Image image; 8 | public Text text; 9 | 10 | void ScrollCellIndex (int idx) 11 | { 12 | string name = "Cell " + idx.ToString (); 13 | if (text != null) 14 | { 15 | text.text = name; 16 | } 17 | if (image != null) 18 | { 19 | image.color = Rainbow(idx / 50.0f); 20 | } 21 | gameObject.name = name; 22 | } 23 | 24 | // http://stackoverflow.com/questions/2288498/how-do-i-get-a-rainbow-color-gradient-in-c 25 | public static Color Rainbow(float progress) 26 | { 27 | progress = Mathf.Clamp01(progress); 28 | float r = 0.0f; 29 | float g = 0.0f; 30 | float b = 0.0f; 31 | int i = (int)(progress * 6); 32 | float f = progress * 6.0f - i; 33 | float q = 1 - f; 34 | 35 | switch (i % 6) 36 | { 37 | case 0: 38 | r = 1; 39 | g = f; 40 | b = 0; 41 | break; 42 | case 1: 43 | r = q; 44 | g = 1; 45 | b = 0; 46 | break; 47 | case 2: 48 | r = 0; 49 | g = 1; 50 | b = f; 51 | break; 52 | case 3: 53 | r = 0; 54 | g = q; 55 | b = 1; 56 | break; 57 | case 4: 58 | r = f; 59 | g = 0; 60 | b = 1; 61 | break; 62 | case 5: 63 | r = 1; 64 | g = 0; 65 | b = q; 66 | break; 67 | } 68 | return new Color(r, g, b); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallback1.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aae79c5fe0add56479237307a95fbb7f 3 | timeCreated: 1439396433 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallback2.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using System.Collections; 4 | 5 | public class ScrollIndexCallback2 : MonoBehaviour 6 | { 7 | public Text text; 8 | public LayoutElement element; 9 | public static float[] randomWidths = new float[3] { 100, 150, 50 }; 10 | void ScrollCellIndex(int idx) 11 | { 12 | string name = "Cell " + idx.ToString(); 13 | if (text != null) 14 | { 15 | text.text = name; 16 | } 17 | element.preferredWidth = randomWidths[Mathf.Abs(idx) % 3]; 18 | gameObject.name = name; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallback2.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d2a1b5a8e8308e4fbd894c93c0caa09 3 | timeCreated: 1439607769 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallback3.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | using System.Collections; 4 | 5 | public class ScrollIndexCallback3 : MonoBehaviour 6 | { 7 | public Text text; 8 | void ScrollCellIndex(int idx) 9 | { 10 | string name = "Cell " + idx.ToString(); 11 | if (text != null) 12 | { 13 | text.text = name; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallback3.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 485315e3fd2b43d4d8d15c437f7f01d3 3 | timeCreated: 1439608418 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallbackBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Events; 4 | using UnityEngine.Serialization; 5 | using UnityEngine.UI; 6 | 7 | namespace Demo 8 | { 9 | public class ScrollIndexCallbackBase : MonoBehaviour 10 | { 11 | public LayoutElement m_Element; 12 | public Button m_Button; 13 | private int m_IndexID = 0; 14 | private string m_UniqueID = ""; 15 | private string m_PrefabName = ""; 16 | private object m_Content; 17 | private bool m_IsUpdateGameObjectName = true; 18 | 19 | [Serializable] 20 | public class ButtonClickedEvent : UnityEvent { } 21 | 22 | // Event delegates triggered on click for Base. 23 | [FormerlySerializedAs("onClick_InitOnStart")] 24 | [SerializeField] 25 | private ButtonClickedEvent m_OnClick_InitOnStart = new ButtonClickedEvent(); 26 | 27 | public ButtonClickedEvent onClick_InitOnStart 28 | { 29 | get { return m_OnClick_InitOnStart; } 30 | set { m_OnClick_InitOnStart = value; } 31 | } 32 | 33 | // Event delegates triggered on click for Custom. 34 | [FormerlySerializedAs("onClick_Custom")] 35 | [SerializeField] 36 | private ButtonClickedEvent m_OnClick_Custom = new ButtonClickedEvent(); 37 | 38 | public ButtonClickedEvent onClick_Custom 39 | { 40 | get { return m_OnClick_Custom; } 41 | set { m_OnClick_Custom = value; } 42 | } 43 | 44 | protected virtual void Awake() 45 | { 46 | m_Button.onClick.AddListener(OnButtonClickCallBack); 47 | } 48 | 49 | protected virtual void OnDestroy() 50 | { 51 | m_Button.onClick.RemoveAllListeners(); 52 | } 53 | 54 | private void OnButtonClickCallBack() 55 | { 56 | m_OnClick_InitOnStart.Invoke(); 57 | m_OnClick_Custom.Invoke(); 58 | } 59 | 60 | // Get IndexID 61 | public int GetIndexID() 62 | { 63 | return m_IndexID; 64 | } 65 | 66 | public string GetUniqueID() 67 | { 68 | return m_UniqueID; 69 | } 70 | 71 | public void SetUniqueID(string UniqueID) 72 | { 73 | m_UniqueID = UniqueID; 74 | } 75 | 76 | public void SetPrefabName(string name) 77 | { 78 | m_PrefabName = name; 79 | } 80 | 81 | // Get PrefabName 82 | public string GetPrefabName() 83 | { 84 | return m_PrefabName; 85 | } 86 | 87 | public void SetIsUpdateGameObjectName(bool value) 88 | { 89 | m_IsUpdateGameObjectName = value; 90 | } 91 | 92 | public object GetContent() 93 | { 94 | return m_Content; 95 | } 96 | 97 | // Set Element PreferredWidth 98 | public virtual void SetLayoutElementPreferredWidth(float value) 99 | { 100 | m_Element.preferredWidth = value; 101 | } 102 | 103 | // Set Element PreferredHeight 104 | public virtual void SetLayoutElementPreferredHeight(float value) 105 | { 106 | m_Element.preferredHeight = value; 107 | } 108 | 109 | public virtual void ScrollCellIndex(int idx, object content, string ClickUniqueID = "", object ClickObject = null) 110 | { 111 | m_IndexID = idx; 112 | m_Content = content; 113 | 114 | if (m_IsUpdateGameObjectName) 115 | { 116 | gameObject.name = string.Format("{0} Cell {1}", m_PrefabName, idx.ToString()); 117 | } 118 | } 119 | 120 | public virtual void RefreshUI(string ClickUniqueID, object ClickContent) 121 | { 122 | 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallbackBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: acb3751379a2cba4eb54805d157d0388 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallback_Custom.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace Demo 5 | { 6 | public class ScrollIndexCallback_Custom : ScrollIndexCallbackBase 7 | { 8 | public Text m_CellText; 9 | public Text m_ValueText; 10 | 11 | public override void ScrollCellIndex(int idx, object content, string ClickUniqueID = "", object ClickObject = null) 12 | { 13 | base.ScrollCellIndex(idx, content, ClickUniqueID, ClickObject); 14 | 15 | onClick_Custom.RemoveAllListeners(); 16 | onClick_Custom.AddListener(() => OnButtonScrollIndexCallbackClick(this, idx, content)); 17 | 18 | var Tempcontent = (int)content; 19 | 20 | string name = "Cell " + idx.ToString(); 21 | if (m_CellText != null) 22 | { 23 | m_CellText.text = name; 24 | } 25 | 26 | if(m_ValueText != null) 27 | { 28 | m_ValueText.text = string.Format("Value: {0}", Tempcontent); 29 | } 30 | 31 | if (GetUniqueID() == ClickUniqueID) 32 | { 33 | SetClickedColor(true); 34 | } 35 | else 36 | { 37 | SetClickedColor(false); 38 | } 39 | } 40 | 41 | public static void OnButtonScrollIndexCallbackClick(ScrollIndexCallback_Custom ScrollIndexCallback, int index, object content) 42 | { 43 | //Debug.LogWarningFormat("ScrollIndexCallback_Custom => Click index: {0}, content: {1}, ClickUniqueID: {2}", index, content, ScrollIndexCallback.GetUniqueID()); 44 | } 45 | 46 | public override void RefreshUI(string ClickUniqueID, object ClickContent) 47 | { 48 | base.RefreshUI(ClickUniqueID, ClickContent); 49 | 50 | if(GetUniqueID() == ClickUniqueID) 51 | { 52 | SetClickedColor(true); 53 | } 54 | else 55 | { 56 | SetClickedColor(false); 57 | } 58 | } 59 | 60 | public void SetClickedColor(bool IsClicked) 61 | { 62 | if (IsClicked) 63 | { 64 | m_Button.image.color = Color.cyan; 65 | } 66 | else 67 | { 68 | m_Button.image.color = Color.white; 69 | } 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/ScrollIndexCallback_Custom.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bf7395977ed555040a786e04c4c4d722 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/SizeHelper.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace Demo 5 | { 6 | public class SizeHelper : MonoBehaviour, LoopScrollSizeHelper 7 | { 8 | [HideInInspector] 9 | public LoopScrollRectMulti m_LoopScrollRect; 10 | 11 | [HideInInspector] 12 | public LoopListBankBase m_LoopListBank; 13 | 14 | // Start is called before the first frame update 15 | void Start() 16 | { 17 | m_LoopScrollRect = GetComponent(); 18 | m_LoopScrollRect.sizeHelper = this; 19 | 20 | m_LoopListBank = GetComponent(); 21 | } 22 | 23 | public Vector2 GetItemsSize(int itemsCount) 24 | { 25 | if (itemsCount <= 0) return new Vector2(); 26 | int count = m_LoopListBank.GetListLength(); 27 | Vector2 sum = new Vector2(); 28 | for (int i = 0; i < count; i++) 29 | { 30 | if (itemsCount <= i) break; 31 | int t = (itemsCount - 1 - i) / count + 1; 32 | sum += t * m_LoopListBank.GetCellPreferredSize(i); 33 | } 34 | return sum; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/SizeHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 54f5affce35e0814b9afc7e66434caaa 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/SizeHelper2.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | public class SizeHelper2 : MonoBehaviour, LoopScrollSizeHelper 7 | { 8 | // Start is called before the first frame update 9 | void Start() 10 | { 11 | var ls = GetComponent(); 12 | ls.sizeHelper = this; 13 | } 14 | 15 | public Vector2 GetItemsSize(int itemsCount) 16 | { 17 | if (itemsCount <= 0) return new Vector2(); 18 | int count = ScrollIndexCallback2.randomWidths.Length; 19 | Vector2 sum = new Vector2(); 20 | for (int i = 0; i < count; i++) 21 | { 22 | if (itemsCount <= i) break; 23 | int t = (itemsCount - 1 - i) / count + 1; 24 | sum.x += t * ScrollIndexCallback2.randomWidths[i]; 25 | } 26 | return sum; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/SizeHelper2.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: abdfb551e64c9084ca02d9b1e8b1aeda 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/UI_ControlData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | namespace Demo 7 | { 8 | public class UI_ControlData : MonoBehaviour 9 | { 10 | public Button m_ButtonAddData; 11 | public Button m_ButtonSetInfinity; 12 | public Button m_ButtonSetData; 13 | public Button m_ButtonDelData; 14 | public Button m_ButtonSortData; 15 | public Button m_ButtonReverseSortData; 16 | public Button m_ButtonSrollToCell; 17 | public Button m_ButtonSrollToCellWithTime; 18 | 19 | public InputField m_InputFieldSrollToCell_AddCount; 20 | 21 | public InputField m_InputFieldSrollToCell_CellIndex; 22 | public InputField m_InputButtonSrollToCell_MoveSpeed; 23 | 24 | public InputField m_InputFieldSrollToCellWithTime_CellIndex; 25 | public InputField m_InputButtonSrollToCellWithTime_MoveSpeed; 26 | 27 | public InitOnStartMulti m_InitOnStart; 28 | 29 | private CustomListBank m_ListBank; 30 | 31 | private void Awake() 32 | { 33 | m_ListBank = m_InitOnStart.m_LoopListBank as CustomListBank; 34 | 35 | m_ButtonAddData.onClick.AddListener(OnButtonAddDataClick); 36 | m_ButtonSetInfinity.onClick.AddListener(OnButtonSetInfinityClick); 37 | m_ButtonSetData.onClick.AddListener(OnButtonSetDataClick); 38 | m_ButtonDelData.onClick.AddListener(OnButtonDelDataClick); 39 | m_ButtonSortData.onClick.AddListener(OnButtonSortDataClick); 40 | m_ButtonReverseSortData.onClick.AddListener(OnButtonReverseSortDataClick); 41 | m_ButtonSrollToCell.onClick.AddListener(OnButtonSrollToCellClick); 42 | m_ButtonSrollToCellWithTime.onClick.AddListener(OnButtonSrollToCellWithTimeClick); 43 | } 44 | 45 | private void OnDestroy() 46 | { 47 | m_ButtonAddData.onClick.RemoveListener(OnButtonAddDataClick); 48 | m_ButtonSetData.onClick.RemoveListener(OnButtonSetDataClick); 49 | m_ButtonDelData.onClick.RemoveListener(OnButtonDelDataClick); 50 | m_ButtonSortData.onClick.RemoveListener(OnButtonSortDataClick); 51 | m_ButtonReverseSortData.onClick.RemoveListener(OnButtonReverseSortDataClick); 52 | m_ButtonSrollToCell.onClick.RemoveListener(OnButtonSrollToCellClick); 53 | m_ButtonSrollToCellWithTime.onClick.RemoveListener(OnButtonSrollToCellWithTimeClick); 54 | } 55 | 56 | private void OnButtonAddDataClick() 57 | { 58 | int AddCount = 0; 59 | int.TryParse(m_InputFieldSrollToCell_AddCount.text, out AddCount); 60 | 61 | int TargetCount = Mathf.Max(1, AddCount); 62 | for (int i = 0; i < TargetCount; ++i) 63 | { 64 | int RandomResult = Random.Range(0, 10); 65 | m_ListBank.AddContent(RandomResult); 66 | } 67 | 68 | m_InitOnStart.m_LoopScrollRect.totalCount = m_InitOnStart.m_LoopListBank.GetListLength(); 69 | m_InitOnStart.m_LoopScrollRect.RefreshCells(); 70 | } 71 | 72 | private void OnButtonSetInfinityClick() 73 | { 74 | m_InitOnStart.m_LoopScrollRect.totalCount = -1; 75 | m_InitOnStart.m_LoopScrollRect.RefillCells(); 76 | } 77 | 78 | private void OnButtonSetDataClick() 79 | { 80 | List contents = new List{ 81 | 3, 4, 5, 6, 7 82 | }; 83 | 84 | m_ListBank.SetContents(contents); 85 | 86 | // Refresh m_ClickIndex, m_ClickObject 87 | if (m_InitOnStart.m_LoopListBank.GetListLength() > 0) 88 | { 89 | m_InitOnStart.m_ClickUniqueID = m_InitOnStart.m_LoopListBank.GetLoopListBankData(0).UniqueID; 90 | m_InitOnStart.m_ClickObject = m_InitOnStart.m_LoopListBank.GetLoopListBankData(0).Content; 91 | } 92 | else 93 | { 94 | m_InitOnStart.m_ClickUniqueID = ""; 95 | m_InitOnStart.m_ClickObject = null; 96 | } 97 | 98 | m_InitOnStart.m_LoopScrollRect.totalCount = m_InitOnStart.m_LoopListBank.GetListLength(); 99 | m_InitOnStart.m_LoopScrollRect.RefillCells(); 100 | } 101 | 102 | private void OnButtonDelDataClick() 103 | { 104 | string TempUniqueID = m_InitOnStart.m_LoopListBank.GetLoopListBankData(0).UniqueID; 105 | m_ListBank.DelContentByIndex(0); 106 | 107 | float offset; 108 | int LeftIndex = m_InitOnStart.m_LoopScrollRect.GetFirstItem(out offset); 109 | 110 | m_InitOnStart.m_LoopScrollRect.ClearCells(); 111 | m_InitOnStart.m_LoopScrollRect.totalCount = m_InitOnStart.m_LoopListBank.GetListLength(); 112 | if (LeftIndex > 0) 113 | { 114 | // try keep the same position 115 | m_InitOnStart.m_LoopScrollRect.RefillCells(LeftIndex - 1, offset); 116 | } 117 | else 118 | { 119 | // Refresh m_ClickUniqueID, m_ClickObject 120 | if (m_InitOnStart.m_LoopListBank.GetListLength() > 0) 121 | { 122 | // Check UniqueID is same 123 | if (m_InitOnStart.m_ClickUniqueID == TempUniqueID) 124 | { 125 | m_InitOnStart.m_ClickUniqueID = m_InitOnStart.m_LoopListBank.GetLoopListBankData(0).UniqueID; 126 | m_InitOnStart.m_ClickObject = m_InitOnStart.m_LoopListBank.GetLoopListBankData(0).Content; 127 | } 128 | } 129 | else 130 | { 131 | m_InitOnStart.m_ClickUniqueID = ""; 132 | m_InitOnStart.m_ClickObject = null; 133 | } 134 | 135 | m_InitOnStart.m_LoopScrollRect.RefillCells(); 136 | } 137 | } 138 | 139 | private void OnButtonSortDataClick() 140 | { 141 | var TempContent = m_ListBank.GetLoopListBankDatas(); 142 | TempContent = TempContent.OrderBy(x => (int)x.Content).ToList(); 143 | m_ListBank.SetLoopListBankDatas(TempContent); 144 | 145 | // Refresh m_ClickIndex, m_ClickObject 146 | if (m_InitOnStart.m_LoopListBank.GetListLength() > 0) 147 | { 148 | m_InitOnStart.m_ClickUniqueID = m_InitOnStart.m_LoopListBank.GetLoopListBankData(0).UniqueID; 149 | m_InitOnStart.m_ClickObject = m_InitOnStart.m_LoopListBank.GetLoopListBankData(0).Content; 150 | } 151 | else 152 | { 153 | m_InitOnStart.m_ClickUniqueID = ""; 154 | m_InitOnStart.m_ClickObject = null; 155 | } 156 | 157 | m_InitOnStart.m_LoopScrollRect.ClearCells(); 158 | m_InitOnStart.m_LoopScrollRect.totalCount = m_InitOnStart.m_LoopListBank.GetListLength(); 159 | m_InitOnStart.m_LoopScrollRect.RefillCells(); 160 | } 161 | 162 | private void OnButtonReverseSortDataClick() 163 | { 164 | var TempContent = m_ListBank.GetLoopListBankDatas(); 165 | TempContent = TempContent.OrderByDescending(x => (int)x.Content).ToList(); 166 | m_ListBank.SetLoopListBankDatas(TempContent); 167 | 168 | // Refresh m_ClickIndex, m_ClickObject 169 | if (m_InitOnStart.m_LoopListBank.GetListLength() > 0) 170 | { 171 | m_InitOnStart.m_ClickUniqueID = m_InitOnStart.m_LoopListBank.GetLoopListBankData(0).UniqueID; 172 | m_InitOnStart.m_ClickObject = m_InitOnStart.m_LoopListBank.GetLoopListBankData(0).Content; 173 | } 174 | else 175 | { 176 | m_InitOnStart.m_ClickUniqueID = ""; 177 | m_InitOnStart.m_ClickObject = null; 178 | } 179 | 180 | m_InitOnStart.m_LoopScrollRect.ClearCells(); 181 | m_InitOnStart.m_LoopScrollRect.totalCount = m_InitOnStart.m_LoopListBank.GetListLength(); 182 | m_InitOnStart.m_LoopScrollRect.RefillCells(); 183 | } 184 | 185 | private void OnButtonSrollToCellClick() 186 | { 187 | int Index = 0; 188 | int.TryParse(m_InputFieldSrollToCell_CellIndex.text, out Index); 189 | 190 | float MoveSpeed = 0; 191 | float.TryParse(m_InputButtonSrollToCell_MoveSpeed.text, out MoveSpeed); 192 | 193 | m_InitOnStart.m_LoopScrollRect.ScrollToCell(Index, MoveSpeed); 194 | } 195 | 196 | private void OnButtonSrollToCellWithTimeClick() 197 | { 198 | int Index = 0; 199 | int.TryParse(m_InputFieldSrollToCellWithTime_CellIndex.text, out Index); 200 | 201 | float MoveTime = 0; 202 | float.TryParse(m_InputButtonSrollToCellWithTime_MoveSpeed.text, out MoveTime); 203 | 204 | m_InitOnStart.m_LoopScrollRect.ScrollToCellWithinTime(Index, MoveTime); 205 | } 206 | } 207 | } -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/UI_ControlData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1414290e8d46be54dbdafa9470f7870d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/UI_ControlScene.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.UI; 3 | 4 | namespace Demo 5 | { 6 | public class UI_ControlScene : MonoBehaviour 7 | { 8 | public Button m_ButtonFPS; 9 | public InputField m_InputField_FPS; 10 | 11 | private void Awake() 12 | { 13 | m_ButtonFPS.onClick.AddListener(OnButtonFPSClick); 14 | } 15 | 16 | private void OnButtonFPSClick() 17 | { 18 | int FPS = 0; 19 | int.TryParse(m_InputField_FPS.text, out FPS); 20 | 21 | int TargetCount = Mathf.Max(1, FPS); 22 | Application.targetFrameRate = FPS; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Samples~/Demo/Scripts/UI_ControlScene.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b422313c7d5293e429fd18629d78d714 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprite.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 371d6515960ad4f4596dc2bfa24cdf22 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Samples~/Demo/Sprite/Light_Frame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qiankanglai/LoopScrollRect/48735bdc5e6d9451b3015e54f2b1f858c404df3e/Samples~/Demo/Sprite/Light_Frame.png -------------------------------------------------------------------------------- /Samples~/Demo/Sprite/Light_Frame.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a855f4ba6619d54479a6224ade07fa03 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | grayScaleToAlpha: 0 28 | generateCubemap: 6 29 | cubemapConvolution: 0 30 | seamlessCubemap: 0 31 | textureFormat: 1 32 | maxTextureSize: 2048 33 | textureSettings: 34 | serializedVersion: 2 35 | filterMode: 1 36 | aniso: 1 37 | mipBias: 0 38 | wrapU: 1 39 | wrapV: 1 40 | wrapW: 0 41 | nPOTScale: 0 42 | lightmap: 0 43 | compressionQuality: 50 44 | spriteMode: 1 45 | spriteExtrude: 1 46 | spriteMeshType: 1 47 | alignment: 0 48 | spritePivot: {x: 0.5, y: 0.5} 49 | spritePixelsToUnits: 100 50 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 51 | spriteGenerateFallbackPhysicsShape: 1 52 | alphaUsage: 1 53 | alphaIsTransparency: 1 54 | spriteTessellationDetail: -1 55 | textureType: 8 56 | textureShape: 1 57 | singleChannelComponent: 0 58 | flipbookRows: 1 59 | flipbookColumns: 1 60 | maxTextureSizeSet: 0 61 | compressionQualitySet: 0 62 | textureFormatSet: 0 63 | ignorePngGamma: 0 64 | applyGammaDecoding: 0 65 | platformSettings: 66 | - serializedVersion: 3 67 | buildTarget: DefaultTexturePlatform 68 | maxTextureSize: 2048 69 | resizeAlgorithm: 0 70 | textureFormat: -1 71 | textureCompression: 1 72 | compressionQuality: 50 73 | crunchedCompression: 0 74 | allowsAlphaSplitting: 0 75 | overridden: 0 76 | androidETC2FallbackOverride: 0 77 | forceMaximumCompressionQuality_BC6H_BC7: 0 78 | - serializedVersion: 3 79 | buildTarget: Standalone 80 | maxTextureSize: 2048 81 | resizeAlgorithm: 0 82 | textureFormat: -1 83 | textureCompression: 1 84 | compressionQuality: 50 85 | crunchedCompression: 0 86 | allowsAlphaSplitting: 0 87 | overridden: 0 88 | androidETC2FallbackOverride: 0 89 | forceMaximumCompressionQuality_BC6H_BC7: 0 90 | - serializedVersion: 3 91 | buildTarget: iPhone 92 | maxTextureSize: 2048 93 | resizeAlgorithm: 0 94 | textureFormat: 33 95 | textureCompression: 1 96 | compressionQuality: 50 97 | crunchedCompression: 0 98 | allowsAlphaSplitting: 0 99 | overridden: 1 100 | androidETC2FallbackOverride: 0 101 | forceMaximumCompressionQuality_BC6H_BC7: 0 102 | - serializedVersion: 3 103 | buildTarget: Android 104 | maxTextureSize: 2048 105 | resizeAlgorithm: 0 106 | textureFormat: 48 107 | textureCompression: 1 108 | compressionQuality: 50 109 | crunchedCompression: 0 110 | allowsAlphaSplitting: 0 111 | overridden: 1 112 | androidETC2FallbackOverride: 0 113 | forceMaximumCompressionQuality_BC6H_BC7: 0 114 | spriteSheet: 115 | serializedVersion: 2 116 | sprites: [] 117 | outline: [] 118 | physicsShape: [] 119 | bones: [] 120 | spriteID: 5e97eb03825dee720800000000000000 121 | internalID: 0 122 | vertices: [] 123 | indices: 124 | edges: [] 125 | weights: [] 126 | secondaryTextures: [] 127 | spritePackingTag: 128 | pSDRemoveMatte: 0 129 | pSDShowRemoveMatteOption: 0 130 | userData: 131 | assetBundleName: 132 | assetBundleVariant: 133 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "me.qiankanglai.loopscrollrect", 3 | "version": "1.1.4", 4 | "displayName": "LoopScrollRect", 5 | "description": "make your ScrollRect `Reusable`", 6 | "repository": { 7 | "type": "git", 8 | "url": "ssh://git@github.com:qiankanglai/LoopScrollRect.git" 9 | }, 10 | "unity": "2019.4", 11 | "documentationUrl": "https://github.com/qiankanglai/LoopScrollRect/blob/master/README.md", 12 | "licensesUrl": "https://github.com/qiankanglai/LoopScrollRect/blob/master/LICENSE.md", 13 | "dependencies": { 14 | "com.unity.ugui": "1.0.0" 15 | }, 16 | "keywords": [ 17 | "UGUI" 18 | ], 19 | "author": { 20 | "name": "Kanglai Qian", 21 | "email": "qiankanglai@gmail.com", 22 | "url": "https://qiankanglai.me" 23 | }, 24 | "samples": [ 25 | { 26 | "displayName": "Demo", 27 | "description": "Contains several Loop Scroll demo", 28 | "path": "Samples~/Demo" 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f78e6866c9700084eac29c4d47125214 3 | PackageManifestImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | --------------------------------------------------------------------------------