From e8f4b244906209ca749f14e0d947ab04fd3fadc1 Mon Sep 17 00:00:00 2001 From: Braedon Date: Mon, 10 Jan 2022 21:06:13 -0500 Subject: [PATCH] Better game selection --- Assets/Scenes/Editor.unity | 249 +++++++++++++++--- Assets/Scripts/LevelEditor/Editor.cs | 2 + .../Scripts/LevelEditor/GridGameSelector.cs | 22 +- .../LevelEditor/GridGameSelectorGame.cs | 2 +- 4 files changed, 235 insertions(+), 40 deletions(-) diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 4ab6b32b..c8d3ae1d 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -750,7 +750,6 @@ GameObject: m_Component: - component: {fileID: 358789044} - component: {fileID: 358789045} - - component: {fileID: 358789046} m_Layer: 5 m_Name: Content m_TagString: Untagged @@ -770,13 +769,13 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1149103345} - m_Father: {fileID: 1056099132} - m_RootOrder: 0 + m_Father: {fileID: 590210126} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_SizeDelta: {x: 382.99, y: 290} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &358789045 MonoBehaviour: @@ -804,20 +803,6 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 1 m_ReverseArrangement: 0 ---- !u!114 &358789046 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 358789043} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Padding: {x: 0, y: 0, z: 0, w: 0} - m_Softness: {x: 0, y: 0} --- !u!1 &424396916 GameObject: m_ObjectHideFlags: 0 @@ -1554,6 +1539,43 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 580861937} m_CullTransparentMesh: 1 +--- !u!1 &590210125 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 590210126} + m_Layer: 5 + m_Name: Holder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &590210126 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 590210125} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 841081096} + - {fileID: 358789044} + m_Father: {fileID: 1056099132} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &608588497 GameObject: m_ObjectHideFlags: 0 @@ -2128,7 +2150,8 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] + m_Children: + - {fileID: 1038760565} m_Father: {fileID: 1154875943} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2346,22 +2369,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - - eventID: 3 - callback: - m_PersistentCalls: - m_Calls: - - m_Target: {fileID: 798021450} - m_TargetAssemblyTypeName: RhythmHeavenMania.Editor.TimelineEventObj, Assembly-CSharp - m_MethodName: OnUp - m_Mode: 1 - m_Arguments: - m_ObjectArgument: {fileID: 0} - m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine - m_IntArgument: 0 - m_FloatArgument: 0 - m_StringArgument: - m_BoolArgument: 0 - m_CallState: 2 --- !u!1 &820032004 GameObject: m_ObjectHideFlags: 0 @@ -2437,6 +2444,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 820032004} m_CullTransparentMesh: 1 +--- !u!1 &841081095 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 841081096} + - component: {fileID: 841081098} + - component: {fileID: 841081097} + m_Layer: 5 + m_Name: Current + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &841081096 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 841081095} + m_LocalRotation: {x: -0, y: -0, z: -0.7071068, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 590210126} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: -90} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 24.85, y: -42.51} + m_SizeDelta: {x: 15, y: 15} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &841081097 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 841081095} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: e3b85a6fda50d2343a8dfb2fc70c2b32, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &841081098 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 841081095} + m_CullTransparentMesh: 1 --- !u!1 &908855313 GameObject: m_ObjectHideFlags: 0 @@ -2712,6 +2794,81 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 994602714} m_CullTransparentMesh: 1 +--- !u!1 &1038760564 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1038760565} + - component: {fileID: 1038760567} + - component: {fileID: 1038760566} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1038760565 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038760564} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 781200686} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 4, y: 4} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1038760566 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038760564} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: f9232c079e126cd48a7344b23eaf42a5, type: 3} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1038760567 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1038760564} + m_CullTransparentMesh: 1 --- !u!1 &1047406298 GameObject: m_ObjectHideFlags: 0 @@ -2854,6 +3011,7 @@ GameObject: - component: {fileID: 1056099134} - component: {fileID: 1056099133} - component: {fileID: 1056099135} + - component: {fileID: 1056099136} m_Layer: 5 m_Name: GameEventSelector m_TagString: Untagged @@ -2872,7 +3030,7 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 358789044} + - {fileID: 590210126} m_Father: {fileID: 1050802356} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2964,6 +3122,20 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 +--- !u!114 &1056099136 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1056099131} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3312d7739989d2b4e91e6319e9a96d76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: {x: 0, y: 0, z: 0, w: 0} + m_Softness: {x: 0, y: 0} --- !u!1 &1110073994 GameObject: m_ObjectHideFlags: 0 @@ -3252,6 +3424,7 @@ MonoBehaviour: SelectedMinigame: GameEventSelector: {fileID: 1056099131} EventRef: {fileID: 1149103344} + CurrentSelected: {fileID: 841081095} currentEventIndex: 0 --- !u!1 &1196204502 GameObject: diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index 3a3d68c0..3ed56ca8 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -45,6 +45,8 @@ namespace RhythmHeavenMania.Editor GameIcon_.gameObject.SetActive(true); GameIcon_.name = EventCaller.instance.minigames[i].displayName; } + + GridGameSelector.GetComponent().SelectGame("Game Manager", 1); } public static Sprite GameIcon(string name) diff --git a/Assets/Scripts/LevelEditor/GridGameSelector.cs b/Assets/Scripts/LevelEditor/GridGameSelector.cs index 2011d2c6..8f7bf280 100644 --- a/Assets/Scripts/LevelEditor/GridGameSelector.cs +++ b/Assets/Scripts/LevelEditor/GridGameSelector.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using UnityEngine; using TMPro; +using DG.Tweening; namespace RhythmHeavenMania.Editor { @@ -13,6 +14,7 @@ namespace RhythmHeavenMania.Editor [Header("Components")] public GameObject GameEventSelector; public GameObject EventRef; + public GameObject CurrentSelected; [Header("Properties")] private EventCaller.MiniGame mg; @@ -72,13 +74,26 @@ namespace RhythmHeavenMania.Editor currentEventIndex = 0; } + if (currentEventIndex > 2) + { + EventRef.transform.parent.parent.transform.DOLocalMoveY((EventRef.GetComponent().sizeDelta.y + 5) * (currentEventIndex - 2), 0.35f).SetEase(Ease.OutExpo); + } + else + { + EventRef.transform.parent.parent.transform.DOLocalMoveY(0, 0.35f).SetEase(Ease.OutExpo); + } + + CurrentSelected.transform.DOLocalMoveY(EventRef.transform.parent.GetChild(currentEventIndex + 1).transform.localPosition.y, 0.35f).SetEase(Ease.OutExpo); + SetColor(currentEventIndex); } - public void SelectGame(string gameName) + public void SelectGame(string gameName, int index) { DestroyEvents(); + transform.GetChild(index).GetChild(0).gameObject.SetActive(true); + SelectedMinigame = gameName; mg = EventCaller.instance.minigames.Find(c => c.displayName == gameName); @@ -104,6 +119,11 @@ namespace RhythmHeavenMania.Editor private void DestroyEvents() { + for (int i = 0; i < transform.childCount; i++) + { + transform.GetChild(i).GetChild(0).gameObject.SetActive(false); + } + for (int i = 1; i < EventRef.transform.parent.childCount; i++) { Destroy(EventRef.transform.parent.GetChild(i).gameObject); diff --git a/Assets/Scripts/LevelEditor/GridGameSelectorGame.cs b/Assets/Scripts/LevelEditor/GridGameSelectorGame.cs index e46e9879..2ec7ee41 100644 --- a/Assets/Scripts/LevelEditor/GridGameSelectorGame.cs +++ b/Assets/Scripts/LevelEditor/GridGameSelectorGame.cs @@ -11,7 +11,7 @@ namespace RhythmHeavenMania.Editor public void OnClick() { - GridGameSelector.SelectGame(this.gameObject.name); + GridGameSelector.SelectGame(this.gameObject.name, this.transform.GetSiblingIndex()); } public void OnEnter()