This commit is contained in:
YangHua 2024-02-29 22:44:46 +08:00
parent 92932a10e1
commit 8f41ba628e
1 changed files with 11 additions and 2 deletions

View File

@ -30,7 +30,7 @@ public class FormationManager : MonoSingleton<FormationManager>
// Start is called before the first frame update
void Start()
{
SyncCreateRoom.send2roomRequset += OnReciveMsg;
startFormationBtn.onClick.AddListener(OnStartFormation);
submitFormationBtn.onClick.AddListener(OnSubmit);
cancelFormationBtn.onClick.AddListener(OnCancel);
@ -42,6 +42,10 @@ public class FormationManager : MonoSingleton<FormationManager>
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
@ -176,6 +180,7 @@ public class FormationManager : MonoSingleton<FormationManager>
public void OnStartFormation()
{
isStartFormation = true;
SyncCreateRoom.send2roomRequset += OnReciveMsg;
CheckBtns(1);
}
@ -292,7 +297,11 @@ public class FormationManager : MonoSingleton<FormationManager>
}
}
private void OnDisable()
{
Debug.Log("OnDisable FormationManager");
SyncCreateRoom.send2roomRequset -= OnReciveMsg;
}
}