From 4169c12f1a0d149a0c754499b65928ec51cff0e5 Mon Sep 17 00:00:00 2001 From: setchi Date: Sat, 18 Jan 2020 17:37:54 +0900 Subject: [PATCH] Sync --- Samples~/Sources/01_Basic/Cell.cs | 2 +- Samples~/Sources/01_Basic/Example01.cs | 2 +- Samples~/Sources/01_Basic/ItemData.cs | 2 +- Samples~/Sources/01_Basic/ScrollView.cs | 2 +- Samples~/Sources/02_FocusOn/Cell.cs | 2 +- Samples~/Sources/02_FocusOn/Context.cs | 2 +- Samples~/Sources/02_FocusOn/Example02.cs | 2 +- Samples~/Sources/02_FocusOn/ItemData.cs | 2 +- Samples~/Sources/02_FocusOn/ScrollView.cs | 2 +- Samples~/Sources/03_InfiniteScroll/Cell.cs | 2 +- Samples~/Sources/03_InfiniteScroll/Context.cs | 2 +- .../Sources/03_InfiniteScroll/Example03.cs | 2 +- .../Sources/03_InfiniteScroll/ItemData.cs | 2 +- .../Sources/03_InfiniteScroll/ScrollView.cs | 2 +- Samples~/Sources/04_Metaball/Background.cs | 2 +- Samples~/Sources/04_Metaball/Cell.cs | 2 +- Samples~/Sources/04_Metaball/Context.cs | 2 +- Samples~/Sources/04_Metaball/Example04.cs | 2 +- Samples~/Sources/04_Metaball/ItemData.cs | 2 +- Samples~/Sources/04_Metaball/ScrollView.cs | 2 +- Samples~/Sources/05_Voronoi/Background.cs | 2 +- Samples~/Sources/05_Voronoi/Cell.cs | 2 +- Samples~/Sources/05_Voronoi/Context.cs | 2 +- Samples~/Sources/05_Voronoi/Example05.cs | 2 +- Samples~/Sources/05_Voronoi/ItemData.cs | 2 +- Samples~/Sources/05_Voronoi/ScrollView.cs | 2 +- Samples~/Sources/06_LoopTabBar/Context.cs | 2 +- Samples~/Sources/06_LoopTabBar/Example06.cs | 2 +- Samples~/Sources/06_LoopTabBar/ItemData.cs | 2 +- Samples~/Sources/06_LoopTabBar/ScrollView.cs | 2 +- .../06_LoopTabBar/SlideScreenTransition.cs | 2 +- Samples~/Sources/06_LoopTabBar/Tab.cs | 2 +- Samples~/Sources/06_LoopTabBar/Window.cs | 2 +- Samples~/Sources/07_ScrollRect/Alignment.cs | 2 +- Samples~/Sources/07_ScrollRect/Cell.cs | 8 +++- Samples~/Sources/07_ScrollRect/Cell.prefab | 45 +++++++++++++++++++ Samples~/Sources/07_ScrollRect/Context.cs | 5 ++- Samples~/Sources/07_ScrollRect/Example07.cs | 4 +- Samples~/Sources/07_ScrollRect/ItemData.cs | 2 +- Samples~/Sources/07_ScrollRect/ScrollView.cs | 8 +++- Samples~/Sources/08_GridView/Alignment.cs | 2 +- Samples~/Sources/08_GridView/Cell.cs | 10 ++++- Samples~/Sources/08_GridView/Cell.prefab | 45 +++++++++++++++++++ Samples~/Sources/08_GridView/Context.cs | 7 ++- Samples~/Sources/08_GridView/Example08.cs | 4 +- Samples~/Sources/08_GridView/GridView.cs | 12 +++-- Samples~/Sources/08_GridView/ItemData.cs | 2 +- Samples~/Sources/09_LoadTexture/Cell.cs | 2 +- Samples~/Sources/09_LoadTexture/Example09.cs | 2 +- Samples~/Sources/09_LoadTexture/ItemData.cs | 2 +- Samples~/Sources/09_LoadTexture/ScrollView.cs | 2 +- .../Sources/09_LoadTexture/TextureLoader.cs | 2 +- Samples~/Sources/Common/ScenesDropdown.cs | 7 +-- 53 files changed, 180 insertions(+), 59 deletions(-) diff --git a/Samples~/Sources/01_Basic/Cell.cs b/Samples~/Sources/01_Basic/Cell.cs index 21edb9b..c10e8e7 100644 --- a/Samples~/Sources/01_Basic/Cell.cs +++ b/Samples~/Sources/01_Basic/Cell.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example01 { - public class Cell : FancyCell + class Cell : FancyCell { [SerializeField] Animator animator = default; [SerializeField] Text message = default; diff --git a/Samples~/Sources/01_Basic/Example01.cs b/Samples~/Sources/01_Basic/Example01.cs index 59c53ab..447c997 100644 --- a/Samples~/Sources/01_Basic/Example01.cs +++ b/Samples~/Sources/01_Basic/Example01.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example01 { - public class Example01 : MonoBehaviour + class Example01 : MonoBehaviour { [SerializeField] ScrollView scrollView = default; diff --git a/Samples~/Sources/01_Basic/ItemData.cs b/Samples~/Sources/01_Basic/ItemData.cs index 1541491..cd230cb 100644 --- a/Samples~/Sources/01_Basic/ItemData.cs +++ b/Samples~/Sources/01_Basic/ItemData.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example01 { - public class ItemData + class ItemData { public string Message { get; } diff --git a/Samples~/Sources/01_Basic/ScrollView.cs b/Samples~/Sources/01_Basic/ScrollView.cs index b11a66a..eefca41 100644 --- a/Samples~/Sources/01_Basic/ScrollView.cs +++ b/Samples~/Sources/01_Basic/ScrollView.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example01 { - public class ScrollView : FancyScrollView + class ScrollView : FancyScrollView { [SerializeField] Scroller scroller = default; [SerializeField] GameObject cellPrefab = default; diff --git a/Samples~/Sources/02_FocusOn/Cell.cs b/Samples~/Sources/02_FocusOn/Cell.cs index 3806b59..db1150d 100644 --- a/Samples~/Sources/02_FocusOn/Cell.cs +++ b/Samples~/Sources/02_FocusOn/Cell.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example02 { - public class Cell : FancyCell + class Cell : FancyCell { [SerializeField] Animator animator = default; [SerializeField] Text message = default; diff --git a/Samples~/Sources/02_FocusOn/Context.cs b/Samples~/Sources/02_FocusOn/Context.cs index b2fad7e..26c1941 100644 --- a/Samples~/Sources/02_FocusOn/Context.cs +++ b/Samples~/Sources/02_FocusOn/Context.cs @@ -8,7 +8,7 @@ namespace FancyScrollView.Example02 { - public class Context + class Context { public int SelectedIndex = -1; public Action OnCellClicked; diff --git a/Samples~/Sources/02_FocusOn/Example02.cs b/Samples~/Sources/02_FocusOn/Example02.cs index bce972d..57bb25b 100644 --- a/Samples~/Sources/02_FocusOn/Example02.cs +++ b/Samples~/Sources/02_FocusOn/Example02.cs @@ -10,7 +10,7 @@ namespace FancyScrollView.Example02 { - public class Example02 : MonoBehaviour + class Example02 : MonoBehaviour { [SerializeField] ScrollView scrollView = default; [SerializeField] Button prevCellButton = default; diff --git a/Samples~/Sources/02_FocusOn/ItemData.cs b/Samples~/Sources/02_FocusOn/ItemData.cs index 55c60c3..84e2c59 100644 --- a/Samples~/Sources/02_FocusOn/ItemData.cs +++ b/Samples~/Sources/02_FocusOn/ItemData.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example02 { - public class ItemData + class ItemData { public string Message { get; } diff --git a/Samples~/Sources/02_FocusOn/ScrollView.cs b/Samples~/Sources/02_FocusOn/ScrollView.cs index 3885236..af235ed 100644 --- a/Samples~/Sources/02_FocusOn/ScrollView.cs +++ b/Samples~/Sources/02_FocusOn/ScrollView.cs @@ -11,7 +11,7 @@ namespace FancyScrollView.Example02 { - public class ScrollView : FancyScrollView + class ScrollView : FancyScrollView { [SerializeField] Scroller scroller = default; [SerializeField] GameObject cellPrefab = default; diff --git a/Samples~/Sources/03_InfiniteScroll/Cell.cs b/Samples~/Sources/03_InfiniteScroll/Cell.cs index 04d0699..e0982a8 100644 --- a/Samples~/Sources/03_InfiniteScroll/Cell.cs +++ b/Samples~/Sources/03_InfiniteScroll/Cell.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example03 { - public class Cell : FancyCell + class Cell : FancyCell { [SerializeField] Animator animator = default; [SerializeField] Text message = default; diff --git a/Samples~/Sources/03_InfiniteScroll/Context.cs b/Samples~/Sources/03_InfiniteScroll/Context.cs index c93c142..3063362 100644 --- a/Samples~/Sources/03_InfiniteScroll/Context.cs +++ b/Samples~/Sources/03_InfiniteScroll/Context.cs @@ -8,7 +8,7 @@ namespace FancyScrollView.Example03 { - public class Context + class Context { public int SelectedIndex = -1; public Action OnCellClicked; diff --git a/Samples~/Sources/03_InfiniteScroll/Example03.cs b/Samples~/Sources/03_InfiniteScroll/Example03.cs index 5a1d969..d1d1b9f 100644 --- a/Samples~/Sources/03_InfiniteScroll/Example03.cs +++ b/Samples~/Sources/03_InfiniteScroll/Example03.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example03 { - public class Example03 : MonoBehaviour + class Example03 : MonoBehaviour { [SerializeField] ScrollView scrollView = default; diff --git a/Samples~/Sources/03_InfiniteScroll/ItemData.cs b/Samples~/Sources/03_InfiniteScroll/ItemData.cs index 02cd4ba..19b8296 100644 --- a/Samples~/Sources/03_InfiniteScroll/ItemData.cs +++ b/Samples~/Sources/03_InfiniteScroll/ItemData.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example03 { - public class ItemData + class ItemData { public string Message { get; } diff --git a/Samples~/Sources/03_InfiniteScroll/ScrollView.cs b/Samples~/Sources/03_InfiniteScroll/ScrollView.cs index f5d62d8..22b2362 100644 --- a/Samples~/Sources/03_InfiniteScroll/ScrollView.cs +++ b/Samples~/Sources/03_InfiniteScroll/ScrollView.cs @@ -10,7 +10,7 @@ namespace FancyScrollView.Example03 { - public class ScrollView : FancyScrollView + class ScrollView : FancyScrollView { [SerializeField] Scroller scroller = default; [SerializeField] GameObject cellPrefab = default; diff --git a/Samples~/Sources/04_Metaball/Background.cs b/Samples~/Sources/04_Metaball/Background.cs index bfa043c..2eb36de 100644 --- a/Samples~/Sources/04_Metaball/Background.cs +++ b/Samples~/Sources/04_Metaball/Background.cs @@ -11,7 +11,7 @@ namespace FancyScrollView.Example04 { - public class Background : MonoBehaviour, IPointerClickHandler + class Background : MonoBehaviour, IPointerClickHandler { [SerializeField] Image background = default; [SerializeField] ScrollView scrollView = default; diff --git a/Samples~/Sources/04_Metaball/Cell.cs b/Samples~/Sources/04_Metaball/Cell.cs index 6ef3879..f056178 100644 --- a/Samples~/Sources/04_Metaball/Cell.cs +++ b/Samples~/Sources/04_Metaball/Cell.cs @@ -10,7 +10,7 @@ namespace FancyScrollView.Example04 { [ExecuteInEditMode] - public class Cell : FancyCell + class Cell : FancyCell { [SerializeField] Animator scrollAnimator = default; [SerializeField] Animator selectAnimator = default; diff --git a/Samples~/Sources/04_Metaball/Context.cs b/Samples~/Sources/04_Metaball/Context.cs index b1c21c1..d341424 100755 --- a/Samples~/Sources/04_Metaball/Context.cs +++ b/Samples~/Sources/04_Metaball/Context.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example04 { - public class Context + class Context { public int SelectedIndex = -1; diff --git a/Samples~/Sources/04_Metaball/Example04.cs b/Samples~/Sources/04_Metaball/Example04.cs index 5831318..30deca1 100644 --- a/Samples~/Sources/04_Metaball/Example04.cs +++ b/Samples~/Sources/04_Metaball/Example04.cs @@ -10,7 +10,7 @@ namespace FancyScrollView.Example04 { - public class Example04 : MonoBehaviour + class Example04 : MonoBehaviour { [SerializeField] ScrollView scrollView = default; [SerializeField] Button prevCellButton = default; diff --git a/Samples~/Sources/04_Metaball/ItemData.cs b/Samples~/Sources/04_Metaball/ItemData.cs index ea0f58f..cf61119 100644 --- a/Samples~/Sources/04_Metaball/ItemData.cs +++ b/Samples~/Sources/04_Metaball/ItemData.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example04 { - public class ItemData + class ItemData { public string Message { get; } diff --git a/Samples~/Sources/04_Metaball/ScrollView.cs b/Samples~/Sources/04_Metaball/ScrollView.cs index 1a36252..18e9791 100644 --- a/Samples~/Sources/04_Metaball/ScrollView.cs +++ b/Samples~/Sources/04_Metaball/ScrollView.cs @@ -11,7 +11,7 @@ namespace FancyScrollView.Example04 { - public class ScrollView : FancyScrollView + class ScrollView : FancyScrollView { [SerializeField] Scroller scroller = default; [SerializeField] GameObject cellPrefab = default; diff --git a/Samples~/Sources/05_Voronoi/Background.cs b/Samples~/Sources/05_Voronoi/Background.cs index b92c6fe..ce7e512 100755 --- a/Samples~/Sources/05_Voronoi/Background.cs +++ b/Samples~/Sources/05_Voronoi/Background.cs @@ -11,7 +11,7 @@ namespace FancyScrollView.Example05 { - public class Background : MonoBehaviour, IPointerClickHandler + class Background : MonoBehaviour, IPointerClickHandler { [SerializeField] Image background = default; [SerializeField] ScrollView scrollView = default; diff --git a/Samples~/Sources/05_Voronoi/Cell.cs b/Samples~/Sources/05_Voronoi/Cell.cs index 5171b60..ab84ecb 100644 --- a/Samples~/Sources/05_Voronoi/Cell.cs +++ b/Samples~/Sources/05_Voronoi/Cell.cs @@ -10,7 +10,7 @@ namespace FancyScrollView.Example05 { [ExecuteInEditMode] - public class Cell : FancyCell + class Cell : FancyCell { [SerializeField] Animator scrollAnimator = default; [SerializeField] Animator selectAnimator = default; diff --git a/Samples~/Sources/05_Voronoi/Context.cs b/Samples~/Sources/05_Voronoi/Context.cs index 41d4f9d..8ec4ebf 100755 --- a/Samples~/Sources/05_Voronoi/Context.cs +++ b/Samples~/Sources/05_Voronoi/Context.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example05 { - public class Context + class Context { public int SelectedIndex = -1; diff --git a/Samples~/Sources/05_Voronoi/Example05.cs b/Samples~/Sources/05_Voronoi/Example05.cs index 01aa6e1..fa94b30 100644 --- a/Samples~/Sources/05_Voronoi/Example05.cs +++ b/Samples~/Sources/05_Voronoi/Example05.cs @@ -10,7 +10,7 @@ namespace FancyScrollView.Example05 { - public class Example05 : MonoBehaviour + class Example05 : MonoBehaviour { [SerializeField] ScrollView scrollView = default; [SerializeField] Button prevCellButton = default; diff --git a/Samples~/Sources/05_Voronoi/ItemData.cs b/Samples~/Sources/05_Voronoi/ItemData.cs index 4a793c4..fa291b3 100644 --- a/Samples~/Sources/05_Voronoi/ItemData.cs +++ b/Samples~/Sources/05_Voronoi/ItemData.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example05 { - public class ItemData + class ItemData { public string Message { get; } diff --git a/Samples~/Sources/05_Voronoi/ScrollView.cs b/Samples~/Sources/05_Voronoi/ScrollView.cs index d3b080e..6d5e0ec 100644 --- a/Samples~/Sources/05_Voronoi/ScrollView.cs +++ b/Samples~/Sources/05_Voronoi/ScrollView.cs @@ -11,7 +11,7 @@ namespace FancyScrollView.Example05 { - public class ScrollView : FancyScrollView + class ScrollView : FancyScrollView { [SerializeField] Scroller scroller = default; [SerializeField] GameObject cellPrefab = default; diff --git a/Samples~/Sources/06_LoopTabBar/Context.cs b/Samples~/Sources/06_LoopTabBar/Context.cs index 7abf2ce..2503d5a 100644 --- a/Samples~/Sources/06_LoopTabBar/Context.cs +++ b/Samples~/Sources/06_LoopTabBar/Context.cs @@ -8,7 +8,7 @@ namespace FancyScrollView.Example06 { - public class Context + class Context { public int SelectedIndex = -1; public Action OnCellClicked; diff --git a/Samples~/Sources/06_LoopTabBar/Example06.cs b/Samples~/Sources/06_LoopTabBar/Example06.cs index a5bc7eb..b739b37 100644 --- a/Samples~/Sources/06_LoopTabBar/Example06.cs +++ b/Samples~/Sources/06_LoopTabBar/Example06.cs @@ -10,7 +10,7 @@ namespace FancyScrollView.Example06 { - public class Example06 : MonoBehaviour + class Example06 : MonoBehaviour { [SerializeField] ScrollView scrollView = default; [SerializeField] Text selectedItemInfo = default; diff --git a/Samples~/Sources/06_LoopTabBar/ItemData.cs b/Samples~/Sources/06_LoopTabBar/ItemData.cs index fb329db..f0f5383 100644 --- a/Samples~/Sources/06_LoopTabBar/ItemData.cs +++ b/Samples~/Sources/06_LoopTabBar/ItemData.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example06 { - public class ItemData + class ItemData { public string Message { get; } diff --git a/Samples~/Sources/06_LoopTabBar/ScrollView.cs b/Samples~/Sources/06_LoopTabBar/ScrollView.cs index 865934b..8f2704d 100644 --- a/Samples~/Sources/06_LoopTabBar/ScrollView.cs +++ b/Samples~/Sources/06_LoopTabBar/ScrollView.cs @@ -11,7 +11,7 @@ namespace FancyScrollView.Example06 { - public class ScrollView : FancyScrollView + class ScrollView : FancyScrollView { [SerializeField] Scroller scroller = default; [SerializeField] GameObject cellPrefab = default; diff --git a/Samples~/Sources/06_LoopTabBar/SlideScreenTransition.cs b/Samples~/Sources/06_LoopTabBar/SlideScreenTransition.cs index a07b6ac..a00c4b0 100644 --- a/Samples~/Sources/06_LoopTabBar/SlideScreenTransition.cs +++ b/Samples~/Sources/06_LoopTabBar/SlideScreenTransition.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example06 { - public class SlideScreenTransition : MonoBehaviour + class SlideScreenTransition : MonoBehaviour { [SerializeField] RectTransform targetTransform = default; [SerializeField] GraphicRaycaster graphicRaycaster = default; diff --git a/Samples~/Sources/06_LoopTabBar/Tab.cs b/Samples~/Sources/06_LoopTabBar/Tab.cs index 500cf06..1a93197 100644 --- a/Samples~/Sources/06_LoopTabBar/Tab.cs +++ b/Samples~/Sources/06_LoopTabBar/Tab.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example06 { - public class Tab : FancyCell + class Tab : FancyCell { [SerializeField] Animator animator = default; [SerializeField] Text message = default; diff --git a/Samples~/Sources/06_LoopTabBar/Window.cs b/Samples~/Sources/06_LoopTabBar/Window.cs index 7640d4c..165baa0 100644 --- a/Samples~/Sources/06_LoopTabBar/Window.cs +++ b/Samples~/Sources/06_LoopTabBar/Window.cs @@ -8,7 +8,7 @@ namespace FancyScrollView.Example06 { - public class Window : MonoBehaviour + class Window : MonoBehaviour { [SerializeField] SlideScreenTransition transition = default; diff --git a/Samples~/Sources/07_ScrollRect/Alignment.cs b/Samples~/Sources/07_ScrollRect/Alignment.cs index 3929ba0..aa464f8 100644 --- a/Samples~/Sources/07_ScrollRect/Alignment.cs +++ b/Samples~/Sources/07_ScrollRect/Alignment.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example07 { - public enum Alignment + enum Alignment { Upper, Middle, diff --git a/Samples~/Sources/07_ScrollRect/Cell.cs b/Samples~/Sources/07_ScrollRect/Cell.cs index 55dbc93..35618c1 100644 --- a/Samples~/Sources/07_ScrollRect/Cell.cs +++ b/Samples~/Sources/07_ScrollRect/Cell.cs @@ -9,10 +9,16 @@ namespace FancyScrollView.Example07 { - public class Cell : FancyScrollRectCell + class Cell : FancyScrollRectCell { [SerializeField] Text message = default; [SerializeField] Image image = default; + [SerializeField] Button button = default; + + public override void Initialize() + { + button.onClick.AddListener(() => Context.OnCellClicked?.Invoke(Index)); + } public override void UpdateContent(ItemData itemData) { diff --git a/Samples~/Sources/07_ScrollRect/Cell.prefab b/Samples~/Sources/07_ScrollRect/Cell.prefab index 70e546c..c785295 100644 --- a/Samples~/Sources/07_ScrollRect/Cell.prefab +++ b/Samples~/Sources/07_ScrollRect/Cell.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 1865951358068953827} - component: {fileID: 1865951358068953829} - component: {fileID: 1865951358068953826} + - component: {fileID: 352471458600884356} - component: {fileID: 1865951358068953828} m_Layer: 5 m_Name: Cell @@ -75,6 +76,49 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &352471458600884356 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1865951358068953824} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 1865951358068953826} + m_OnClick: + m_PersistentCalls: + m_Calls: [] --- !u!114 &1865951358068953828 MonoBehaviour: m_ObjectHideFlags: 0 @@ -89,6 +133,7 @@ MonoBehaviour: m_EditorClassIdentifier: message: {fileID: 8720386530366365077} image: {fileID: 1865951358068953826} + button: {fileID: 352471458600884356} --- !u!1 &6700329325592271122 GameObject: m_ObjectHideFlags: 0 diff --git a/Samples~/Sources/07_ScrollRect/Context.cs b/Samples~/Sources/07_ScrollRect/Context.cs index 64eaf0e..1c44507 100644 --- a/Samples~/Sources/07_ScrollRect/Context.cs +++ b/Samples~/Sources/07_ScrollRect/Context.cs @@ -4,10 +4,13 @@ * Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE) */ +using System; + namespace FancyScrollView.Example07 { - public class Context : FancyScrollRectContext + class Context : FancyScrollRectContext { public int SelectedIndex = -1; + public Action OnCellClicked; } } diff --git a/Samples~/Sources/07_ScrollRect/Example07.cs b/Samples~/Sources/07_ScrollRect/Example07.cs index d083a30..855d2fe 100644 --- a/Samples~/Sources/07_ScrollRect/Example07.cs +++ b/Samples~/Sources/07_ScrollRect/Example07.cs @@ -12,7 +12,7 @@ namespace FancyScrollView.Example07 { - public class Example07 : MonoBehaviour + class Example07 : MonoBehaviour { [SerializeField] ScrollView scrollView = default; [SerializeField] InputField paddingTopInputField = default; @@ -24,6 +24,8 @@ public class Example07 : MonoBehaviour void Start() { + scrollView.OnCellClicked(index => selectIndexInputField.text = index.ToString()); + paddingTopInputField.onValueChanged.AddListener(_ => TryParseValue(paddingTopInputField, 0, 999, value => scrollView.PaddingTop = value)); paddingTopInputField.text = scrollView.PaddingTop.ToString(); diff --git a/Samples~/Sources/07_ScrollRect/ItemData.cs b/Samples~/Sources/07_ScrollRect/ItemData.cs index f4d6200..1e7adbd 100644 --- a/Samples~/Sources/07_ScrollRect/ItemData.cs +++ b/Samples~/Sources/07_ScrollRect/ItemData.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example07 { - public class ItemData + class ItemData { public string Message { get; } diff --git a/Samples~/Sources/07_ScrollRect/ScrollView.cs b/Samples~/Sources/07_ScrollRect/ScrollView.cs index 5435013..64b47a4 100644 --- a/Samples~/Sources/07_ScrollRect/ScrollView.cs +++ b/Samples~/Sources/07_ScrollRect/ScrollView.cs @@ -4,13 +4,14 @@ * Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE) */ +using System; using System.Collections.Generic; using UnityEngine; using EasingCore; namespace FancyScrollView.Example07 { - public class ScrollView : FancyScrollRect + class ScrollView : FancyScrollRect { [SerializeField] float cellSize = 100f; [SerializeField] GameObject cellPrefab = default; @@ -49,6 +50,11 @@ public float Spacing } } + public void OnCellClicked(Action callback) + { + Context.OnCellClicked = callback; + } + public void UpdateData(IList items) { UpdateContents(items); diff --git a/Samples~/Sources/08_GridView/Alignment.cs b/Samples~/Sources/08_GridView/Alignment.cs index 27852fc..68f6c79 100644 --- a/Samples~/Sources/08_GridView/Alignment.cs +++ b/Samples~/Sources/08_GridView/Alignment.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example08 { - public enum Alignment + enum Alignment { Upper, Middle, diff --git a/Samples~/Sources/08_GridView/Cell.cs b/Samples~/Sources/08_GridView/Cell.cs index c2b57c3..beb0a65 100644 --- a/Samples~/Sources/08_GridView/Cell.cs +++ b/Samples~/Sources/08_GridView/Cell.cs @@ -9,16 +9,22 @@ namespace FancyScrollView.Example08 { - public class Cell : FancyGridViewCell + class Cell : FancyGridViewCell { [SerializeField] Text message = default; [SerializeField] Image image = default; + [SerializeField] Button button = default; + + public override void Initialize() + { + button.onClick.AddListener(() => Context.OnCellClicked?.Invoke(Index)); + } public override void UpdateContent(ItemData itemData) { message.text = itemData.Index.ToString(); - var selected = Context.SelectedItemIndex == Index; + var selected = Context.SelectedIndex == Index; image.color = selected ? new Color32(0, 255, 255, 100) : new Color32(255, 255, 255, 77); diff --git a/Samples~/Sources/08_GridView/Cell.prefab b/Samples~/Sources/08_GridView/Cell.prefab index 53ccf63..64b8601 100644 --- a/Samples~/Sources/08_GridView/Cell.prefab +++ b/Samples~/Sources/08_GridView/Cell.prefab @@ -88,6 +88,7 @@ GameObject: - component: {fileID: 6385477052397092788} - component: {fileID: 312971720325695162} - component: {fileID: 7644133813388510625} + - component: {fileID: 1492596096607271998} - component: {fileID: 5648916080528934313} m_Layer: 5 m_Name: Cell @@ -152,6 +153,49 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!114 &1492596096607271998 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5916365937240972947} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 7644133813388510625} + m_OnClick: + m_PersistentCalls: + m_Calls: [] --- !u!114 &5648916080528934313 MonoBehaviour: m_ObjectHideFlags: 0 @@ -166,3 +210,4 @@ MonoBehaviour: m_EditorClassIdentifier: message: {fileID: 4331356980848894850} image: {fileID: 7644133813388510625} + button: {fileID: 1492596096607271998} diff --git a/Samples~/Sources/08_GridView/Context.cs b/Samples~/Sources/08_GridView/Context.cs index 1dd0a78..605717c 100644 --- a/Samples~/Sources/08_GridView/Context.cs +++ b/Samples~/Sources/08_GridView/Context.cs @@ -4,10 +4,13 @@ * Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE) */ +using System; + namespace FancyScrollView.Example08 { - public class Context : FancyGridViewContext + class Context : FancyGridViewContext { - public int SelectedItemIndex = -1; + public int SelectedIndex = -1; + public Action OnCellClicked; } } diff --git a/Samples~/Sources/08_GridView/Example08.cs b/Samples~/Sources/08_GridView/Example08.cs index ee5d2ae..3894685 100644 --- a/Samples~/Sources/08_GridView/Example08.cs +++ b/Samples~/Sources/08_GridView/Example08.cs @@ -12,7 +12,7 @@ namespace FancyScrollView.Example08 { - public class Example08 : MonoBehaviour + class Example08 : MonoBehaviour { [SerializeField] GridView gridView = default; [SerializeField] InputField paddingTopInputField = default; @@ -25,6 +25,8 @@ public class Example08 : MonoBehaviour void Start() { + gridView.OnCellClicked(index => selectIndexInputField.text = index.ToString()); + paddingTopInputField.onValueChanged.AddListener(_ => TryParseValue(paddingTopInputField, 0, 999, value => gridView.PaddingTop = value)); paddingTopInputField.text = gridView.PaddingTop.ToString(); diff --git a/Samples~/Sources/08_GridView/GridView.cs b/Samples~/Sources/08_GridView/GridView.cs index 4054ce3..38310b9 100644 --- a/Samples~/Sources/08_GridView/GridView.cs +++ b/Samples~/Sources/08_GridView/GridView.cs @@ -4,12 +4,13 @@ * Licensed under MIT (https://github.com/setchi/FancyScrollView/blob/master/LICENSE) */ +using System; using UnityEngine; using EasingCore; namespace FancyScrollView.Example08 { - public class GridView : FancyGridView + class GridView : FancyGridView { class CellGroup : DefaultCellGroup { } @@ -59,15 +60,20 @@ public float SpacingX public void UpdateSelection(int index) { - if (Context.SelectedItemIndex == index) + if (Context.SelectedIndex == index) { return; } - Context.SelectedItemIndex = index; + Context.SelectedIndex = index; Refresh(); } + public void OnCellClicked(Action callback) + { + Context.OnCellClicked = callback; + } + public void ScrollTo(int index, float duration, Ease easing, Alignment alignment = Alignment.Middle) { UpdateSelection(index); diff --git a/Samples~/Sources/08_GridView/ItemData.cs b/Samples~/Sources/08_GridView/ItemData.cs index d7380eb..0fc87a1 100644 --- a/Samples~/Sources/08_GridView/ItemData.cs +++ b/Samples~/Sources/08_GridView/ItemData.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example08 { - public class ItemData + class ItemData { public int Index { get; } diff --git a/Samples~/Sources/09_LoadTexture/Cell.cs b/Samples~/Sources/09_LoadTexture/Cell.cs index bee54af..cf83122 100644 --- a/Samples~/Sources/09_LoadTexture/Cell.cs +++ b/Samples~/Sources/09_LoadTexture/Cell.cs @@ -11,7 +11,7 @@ namespace FancyScrollView.Example09 { - public class Cell : FancyCell + class Cell : FancyCell { readonly EasingFunction alphaEasing = Easing.Get(Ease.OutQuint); diff --git a/Samples~/Sources/09_LoadTexture/Example09.cs b/Samples~/Sources/09_LoadTexture/Example09.cs index 836a2f0..b2d2f3a 100644 --- a/Samples~/Sources/09_LoadTexture/Example09.cs +++ b/Samples~/Sources/09_LoadTexture/Example09.cs @@ -8,7 +8,7 @@ namespace FancyScrollView.Example09 { - public class Example09 : MonoBehaviour + class Example09 : MonoBehaviour { readonly ItemData[] itemData = { diff --git a/Samples~/Sources/09_LoadTexture/ItemData.cs b/Samples~/Sources/09_LoadTexture/ItemData.cs index 660c8e4..74f708a 100644 --- a/Samples~/Sources/09_LoadTexture/ItemData.cs +++ b/Samples~/Sources/09_LoadTexture/ItemData.cs @@ -6,7 +6,7 @@ namespace FancyScrollView.Example09 { - public class ItemData + class ItemData { public string Title { get; } public string Description { get; } diff --git a/Samples~/Sources/09_LoadTexture/ScrollView.cs b/Samples~/Sources/09_LoadTexture/ScrollView.cs index 14cc7d9..2506b9e 100644 --- a/Samples~/Sources/09_LoadTexture/ScrollView.cs +++ b/Samples~/Sources/09_LoadTexture/ScrollView.cs @@ -9,7 +9,7 @@ namespace FancyScrollView.Example09 { - public class ScrollView : FancyScrollView + class ScrollView : FancyScrollView { [SerializeField] Scroller scroller = default; [SerializeField] GameObject cellPrefab = default; diff --git a/Samples~/Sources/09_LoadTexture/TextureLoader.cs b/Samples~/Sources/09_LoadTexture/TextureLoader.cs index 13d5193..4fa74bc 100644 --- a/Samples~/Sources/09_LoadTexture/TextureLoader.cs +++ b/Samples~/Sources/09_LoadTexture/TextureLoader.cs @@ -12,7 +12,7 @@ namespace FancyScrollView.Example09 { - public static class TextureLoader + static class TextureLoader { public static void Load(string url, Action<(string Url, Texture Texture)> onSuccess) => Loader.Instance.Load(url, onSuccess); diff --git a/Samples~/Sources/Common/ScenesDropdown.cs b/Samples~/Sources/Common/ScenesDropdown.cs index 57b01e2..5c1ce34 100644 --- a/Samples~/Sources/Common/ScenesDropdown.cs +++ b/Samples~/Sources/Common/ScenesDropdown.cs @@ -13,7 +13,7 @@ namespace FancyScrollView { [RequireComponent(typeof(Dropdown))] - public class ScenesDropdown : MonoBehaviour + class ScenesDropdown : MonoBehaviour { readonly string[] scenes = { @@ -28,12 +28,9 @@ public class ScenesDropdown : MonoBehaviour "09_LoadTexture" }; - Dropdown dropdown; - - void Awake() => dropdown = GetComponent(); - void Start() { + var dropdown = GetComponent(); dropdown.AddOptions(scenes.Select(x => new Dropdown.OptionData(x)).ToList()); dropdown.value = Mathf.Max(0, Array.IndexOf(scenes, SceneManager.GetActiveScene().name)); dropdown.onValueChanged.AddListener(value =>