From 5cbeb0097edd69e8205b65d345b77e493c8d13de Mon Sep 17 00:00:00 2001 From: YangHua <1475658476@qq.com> Date: Thu, 29 Feb 2024 22:48:53 +0800 Subject: [PATCH] ewe --- Assets/Zion/Scripts/Adam/FormationManager.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Assets/Zion/Scripts/Adam/FormationManager.cs b/Assets/Zion/Scripts/Adam/FormationManager.cs index a401019c..7cb1201f 100644 --- a/Assets/Zion/Scripts/Adam/FormationManager.cs +++ b/Assets/Zion/Scripts/Adam/FormationManager.cs @@ -27,10 +27,13 @@ public class FormationManager : MonoSingleton public FormationInfo formationInfo; public List allUavms = new List(); public List formationIDs = new List(); + void Awake() + { + SyncCreateRoom.send2roomRequset += OnReciveMsg; + } // Start is called before the first frame update void Start() { - startFormationBtn.onClick.AddListener(OnStartFormation); submitFormationBtn.onClick.AddListener(OnSubmit); cancelFormationBtn.onClick.AddListener(OnCancel); @@ -42,10 +45,6 @@ public class FormationManager : MonoSingleton startFormationBtn.gameObject.SetActive(index == 0); submitFormationBtn.gameObject.SetActive(index == 1); cancelFormationBtn.gameObject.SetActive(index == 1); - if(index == 0) - { - SyncCreateRoom.send2roomRequset -= OnReciveMsg; - } } // Update is called once per frame @@ -180,7 +179,6 @@ public class FormationManager : MonoSingleton public void OnStartFormation() { isStartFormation = true; - SyncCreateRoom.send2roomRequset += OnReciveMsg; CheckBtns(1); }