/// <summary> /// 初始化 /// </summary> public void GameApplicationInit() { _isOnApplicationQuit = false; GameEventCenter.EventCenterInit(); _gameManagers = FindObjectsOfType <MonoBehaviour>().OfType <IGameManager>().ToList().OrderBy(m => m.Weight).ToList(); _gameManagers.ForEach(p => { p.ManagerInit(); }); }
private void Start() { // 回到UI時開啟鼠標 Cursor.lockState = CursorLockMode.None; Cursor.visible = true; StartButton.onClick.AddListener(delegate { if (CubeDropdown.captionText.text != "--") { // 生成一個UIData來儲存所需資料 UIData data = new UIData(); data.UserID = IdField.text; data.TargetCube = CubeDropdown.captionText.text; // 存放在GameData讓其他場景存取 GameData.instance.Data = data; // 初始化EventCenter GameEventCenter.EventCenterInit(); SceneManager.LoadScene("GameScene"); } }); QuitButton.onClick.AddListener(delegate { Application.Quit(); }); CubeDropdown.onValueChanged.AddListener(delegate { if (CubeDropdown.captionText.text != "--") { LoadCube(CubeDropdown.captionText.text); } else { if (cube) { Destroy(cube); } if (rotate != null) { StopCoroutine(rotate); } } }); }