From e7d35d45e82401387c8dd6bd627fa1aae543809f Mon Sep 17 00:00:00 2001 From: Braedon Date: Sun, 16 Jan 2022 18:29:45 -0500 Subject: [PATCH] Game event selector needs to be rewritten, will do that soon --- Assets/Resources/DOTweenSettings.asset | 2 +- Assets/Scenes/Editor.unity | 3 +- Assets/Scripts/LevelEditor/Editor.cs | 7 ++ .../Scripts/LevelEditor/GridGameSelector.cs | 101 +----------------- 4 files changed, 11 insertions(+), 102 deletions(-) diff --git a/Assets/Resources/DOTweenSettings.asset b/Assets/Resources/DOTweenSettings.asset index 0363153b..e5560c4f 100644 --- a/Assets/Resources/DOTweenSettings.asset +++ b/Assets/Resources/DOTweenSettings.asset @@ -27,7 +27,7 @@ MonoBehaviour: defaultAutoPlay: 3 defaultUpdateType: 0 defaultTimeScaleIndependent: 0 - defaultEaseType: 6 + defaultEaseType: 1 defaultEaseOvershootOrAmplitude: 1.70158 defaultEasePeriod: 0 defaultAutoKill: 1 diff --git a/Assets/Scenes/Editor.unity b/Assets/Scenes/Editor.unity index 4dc61a00..a083d028 100644 --- a/Assets/Scenes/Editor.unity +++ b/Assets/Scenes/Editor.unity @@ -1117,7 +1117,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: Select events for "Game Manager" + m_text: Title m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 35949c950a936b744936efd75ae436ea, type: 2} m_sharedMaterial: {fileID: -212896991529246517, guid: 35949c950a936b744936efd75ae436ea, type: 2} @@ -6867,6 +6867,7 @@ MonoBehaviour: Screen: {fileID: 558010761} GridGameSelector: {fileID: 1154875943} Timeline: {fileID: 1861169747} + GameEventSelectorTitle: {fileID: 246861490} NewBTN: {fileID: 1683100750} OpenBTN: {fileID: 1665554291} SaveBTN: {fileID: 678553526} diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index ee6dd35c..108f731b 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -5,6 +5,7 @@ using UnityEngine; using UnityEngine.UI; using Newtonsoft.Json; +using TMPro; namespace RhythmHeavenMania.Editor { @@ -22,6 +23,7 @@ namespace RhythmHeavenMania.Editor [Header("Components")] [SerializeField] private Timeline Timeline; + [SerializeField] private TMP_Text GameEventSelectorTitle; [Header("Toolbar")] [SerializeField] private Button NewBTN; @@ -91,5 +93,10 @@ namespace RhythmHeavenMania.Editor Debug.Log(json); } + + public void SetGameEventTitle(string txt) + { + GameEventSelectorTitle.text = txt; + } } } \ No newline at end of file diff --git a/Assets/Scripts/LevelEditor/GridGameSelector.cs b/Assets/Scripts/LevelEditor/GridGameSelector.cs index 2384a6ef..52fb1b23 100644 --- a/Assets/Scripts/LevelEditor/GridGameSelector.cs +++ b/Assets/Scripts/LevelEditor/GridGameSelector.cs @@ -79,69 +79,6 @@ namespace RhythmHeavenMania.Editor public void UpdateIndex(int amount) { - currentEventIndex = amount; - - EventRef.transform.parent.parent.DOKill(); - CurrentSelected.transform.DOKill(); - - if (currentEventIndex < 0) - { - currentEventIndex = EventRef.transform.parent.childCount - (ignoreSelectCount + 1); - } - else if (currentEventIndex > EventRef.transform.parent.childCount - (ignoreSelectCount + 1)) - { - currentEventIndex = 0; - } - - if (currentEventIndex > 2) - { - if (EventRef.transform.parent.childCount - ignoreSelectCount - 4 > currentEventIndex) - { - EventRef.transform.parent.parent.DOLocalMoveY((EventRef.GetComponent().sizeDelta.y + 5) * (currentEventIndex - 2), 0.35f).SetEase(Ease.OutExpo); - } - else - { - EventRef.transform.parent.parent.DOLocalMoveY((EventRef.GetComponent().sizeDelta.y + 5) * (EventRef.transform.parent.childCount - 9), 0.35f).SetEase(Ease.OutExpo); - } - } - else - { - EventRef.transform.parent.parent.transform.DOLocalMoveY(0, 0.35f).SetEase(Ease.OutExpo); - } - - for (int i = ignoreSelectCount; i < EventRef.transform.parent.childCount; i++) - { - float easeTime = 0.35f; - Ease ease = Ease.OutCirc; - int curIndex = currentEventIndex + ignoreSelectCount; - - EventRef.transform.parent.GetChild(i).DOKill(); - - EventRef.transform.parent.GetChild(i).localPosition = new Vector3(EventRef.transform.parent.GetChild(i).localPosition.x, EventRef.transform.localPosition.y - ((i - ignoreSelectCount) * EventRef.GetComponent().sizeDelta.y)); - - if (i < curIndex) - { - EventRef.transform.parent.GetChild(i).transform.DOLocalMove(new Vector3 - (EventRef.transform.localPosition.x + (posDif), - EventRef.transform.parent.GetChild(i).transform.localPosition.y), easeTime).SetEase(ease); - } - else if (i > curIndex) - { - EventRef.transform.parent.GetChild(i).transform.DOLocalMove(new Vector3 - (EventRef.transform.localPosition.x + (posDif), - EventRef.transform.parent.GetChild(i).transform.localPosition.y), easeTime).SetEase(ease); - } - else if (i == curIndex) - { - EventRef.transform.parent.GetChild(i).transform.DOLocalMove(new Vector3 - (EventRef.transform.localPosition.x, - EventRef.transform.parent.GetChild(i).transform.localPosition.y), easeTime).SetEase(ease); - } - } - - CurrentSelected.transform.DOLocalMoveY(EventRef.transform.parent.GetChild(currentEventIndex + ignoreSelectCount).transform.localPosition.y, 0.35f).SetEase(Ease.OutExpo); - - SetColor(currentEventIndex); } public void SelectGame(string gameName, int index) @@ -160,53 +97,17 @@ namespace RhythmHeavenMania.Editor currentEventIndex = 0; - UpdateIndex(0); + Editor.instance.SetGameEventTitle($"Select game event for {gameName}"); } private void AddEvents() { - if (mg.name != "gameManager") - { - GameObject sg = Instantiate(EventRef, EventRef.transform.parent); - sg.GetComponent().text = "switchGame"; - sg.SetActive(true); - } - for (int i = 0; i < mg.actions.Count; i++) - { - if (mg.actions[i].actionName != "switchGame") - { - GameObject e = Instantiate(EventRef, EventRef.transform.parent); - e.GetComponent().text = mg.actions[i].actionName; - e.SetActive(true); - } - } - } - - private void SetColor(int ind) - { - for (int i = ignoreSelectCount; i < EventRef.transform.parent.childCount; i++) - { - EventRef.transform.parent.GetChild(i).GetComponent().color = EditorTheme.theme.properties.EventNormalCol.Hex2RGB(); - } - - EventRef.transform.parent.GetChild(ind + ignoreSelectCount).GetComponent().color = EditorTheme.theme.properties.EventSelectedCol.Hex2RGB(); - CurrentSelected.GetComponent().color = EditorTheme.theme.properties.EventSelectedCol.Hex2RGB(); } private void DestroyEvents() { - for (int i = 0; i < transform.childCount; i++) - { - transform.GetChild(i).GetChild(0).gameObject.SetActive(false); - } - for (int i = ignoreSelectCount; i < EventRef.transform.parent.childCount; i++) - { - Destroy(EventRef.transform.parent.GetChild(i).gameObject); - } - - gameOpen = false; } #endregion