From 8000e22eb858c7ca898f57db7b2dba17a7e809a5 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Sun, 26 Nov 2023 00:52:56 +0100 Subject: [PATCH] fixed some bugs with the switch system --- .../EventSelector/EventParameterManager.cs | 5 ++++ .../EventSelector/GridGameSelector.cs | 28 +++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs b/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs index be47e122c..11a483ca9 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs @@ -50,6 +50,7 @@ namespace HeavenStudio.Editor if (canDisable && active) { Disable(); + GridGameSelector.instance.Enable(); } } canDisable = true; @@ -66,6 +67,10 @@ namespace HeavenStudio.Editor public void StartParams(RiqEntity entity) { + var minigame = EventCaller.instance.GetMinigame(entity.datamodel.Split(0)); + int actionIndex = minigame.actions.IndexOf(minigame.actions.Find(c => c.actionName == entity.datamodel.Split(1))); + Minigames.GameAction action = minigame.actions[actionIndex]; + if (action.parameters != null) GridGameSelector.instance.Disable(); active = true; AddParams(entity); } diff --git a/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs b/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs index 598f4e007..83a1863f0 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs @@ -37,7 +37,7 @@ namespace HeavenStudio.Editor public float posDif; public int ignoreSelectCount; private int dragTimes; - private bool gameOpen; + private bool gameOpen = true; private float selectorHeight; private float eventSize; private float timeSinceUpdateIndex = 0.0f; @@ -52,15 +52,15 @@ namespace HeavenStudio.Editor eventSize = EventRef.GetComponent().rect.height; eventsParent = EventRef.transform.parent.GetChild(2).GetComponent(); - SelectedMinigame = EventCaller.instance.GetMinigame("gameManager"); + SelectedMinigame = EventCaller.instance.GetMinigame(fxActive[0].name); SwitchGameSelectionType(PersistentDataManager.gameSettings.useOldGameEventSelectionSystem); EditorSettings.onUseOldChanged += SwitchGameSelectionType; } private void Update() { - GameEventSelector.SetActive(_usingOld); - _newGameEventSelector.SetActive(!_usingOld); + GameEventSelector.SetActive(_usingOld && gameOpen); + _newGameEventSelector.SetActive(!_usingOld && gameOpen); if (_usingOld) { if (!EventParameterManager.instance.active && !IsPointerOverUIElement() && _usingOld) @@ -158,7 +158,6 @@ namespace HeavenStudio.Editor } EventParameterManager.instance.Disable(); - gameOpen = true; if (_usingOld) SelectGameOld(gameName, index); else SelectGameNew(gameName, index); @@ -491,6 +490,25 @@ namespace HeavenStudio.Editor } + public void Disable() + { + if (_usingOld) + { + DestroyEvents(); + } + else + { + + } + gameOpen = false; + } + + public void Enable() + { + gameOpen = true; + SelectGame(SelectedMinigame.name); + } + #endregion } } \ No newline at end of file