Skip to content

Commit

Permalink
Merge pull request #2 from Haruma-K/feature/progressview_interaction
Browse files Browse the repository at this point in the history
Add ProgressView Interaction.
  • Loading branch information
Haruma-K authored Jun 30, 2022
2 parents 78b1c5a + 5f7b4e8 commit a213f44
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 148 deletions.
71 changes: 36 additions & 35 deletions Assets/Demo/Scenes/CarouselDemo.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641275, b: 0.5748172, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -488,107 +488,107 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalPosition.y
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_RootOrder
value: 1
propertyPath: m_SizeDelta.x
value: 750
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
propertyPath: m_SizeDelta.y
value: 30
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_AnchoredPosition.x
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_SizeDelta.x
value: 750
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_SizeDelta.y
value: 30
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_AnchorMin.y
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_AnchorMax.x
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_AnchorMax.y
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890578, guid: 4e95dd339e71b40aa8e0269426c1dd21,
type: 3}
propertyPath: m_Pivot.y
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5609355829170890581, guid: 4e95dd339e71b40aa8e0269426c1dd21,
Expand Down Expand Up @@ -651,6 +651,7 @@ MonoBehaviour:
_autoScrollingIntervalSec: 3
_inverseAutoScrollingDirection: 0
_progressView: {fileID: 446624512}
_progressViewInteraction: 1
--- !u!114 &1539422974
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public override void OnInspectorGUI()
var autoScrollingIntervalSecProp = serializedObject.FindProperty("_autoScrollingIntervalSec");
var inverseAutoScrollingDirectionProp = serializedObject.FindProperty("_inverseAutoScrollingDirection");
var progressView = serializedObject.FindProperty("_progressView");
var progressViewInteraction = serializedObject.FindProperty("_progressViewInteraction");
var csMovementTypeProp = carouselScrollerSo.FindProperty("movementType");
var csScrollDirectionProp = carouselScrollerSo.FindProperty("scrollDirection");
var csDraggableProp = carouselScrollerSo.FindProperty("draggable");
Expand Down Expand Up @@ -84,10 +85,14 @@ public override void OnInspectorGUI()

EditorGUILayout.PropertyField(csDraggableProp);
EditorGUILayout.PropertyField(progressView);
using (new EditorGUI.IndentLevelScope())
{
EditorGUILayout.PropertyField(progressViewInteraction, new GUIContent("Clickable"));
}

carouselScrollerSo.ApplyModifiedProperties();
carouselScrollerSo.Dispose();
serializedObject.ApplyModifiedProperties();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ GameObject:
- component: {fileID: 7864125402320758684}
- component: {fileID: 5558453293591899642}
- component: {fileID: 8322769320186498922}
- component: {fileID: -4403850070855006380}
m_Layer: 5
m_Name: pfb_carousel_dot
m_Name: pfb_default_carousel_progress_element
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down Expand Up @@ -60,7 +61,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
Expand Down Expand Up @@ -90,3 +91,47 @@ MonoBehaviour:
_image: {fileID: 5558453293591899642}
_activeColor: {r: 0, g: 0, b: 0, a: 1}
_deactiveColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
_button: {fileID: -4403850070855006380}
--- !u!114 &-4403850070855006380
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4104172994114863044}
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: 0
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_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: 5558453293591899642}
m_OnClick:
m_PersistentCalls:
m_Calls: []
13 changes: 11 additions & 2 deletions Assets/FancyCarouselView/Runtime/Scripts/CarouselProgressView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
using System;
using UnityEngine;

namespace FancyCarouselView.Runtime.Scripts
{
Expand All @@ -19,4 +20,12 @@ public abstract class CarouselProgressView : MonoBehaviour
/// <param name="elementIndex"></param>
public abstract void SetActiveIndex(int elementIndex);
}
}

public abstract class ClickableCarouselProgressView : CarouselProgressView
{
/// <summary>
/// Event called when the element of the carousel is clicked.
/// </summary>
public abstract event Action<int> ElementClicked;
}
}
Loading

0 comments on commit a213f44

Please sign in to comment.