示例#1
0
 private void CloseGame()
 {
     if (m_game != null)
     {
         m_game.Close();
         m_game = null;
     }
 }
示例#2
0
        private void StartGame(GameParam gameParam)
        {
            m_game = new PveGame();
            m_game.Start(gameParam);

            m_game.onGameEnd += () =>
            {
                CloseGame();
            };

            m_game.onMainPlayerArriveEnd += () =>
            {
                m_game.Pause();
                // TODO 根据不同模式有不同的结算
                UIAPI.ShowUIWindow(UIDef.UIPveGameWinWindow, new FinalScore(this.GameScore, this.PuzzleCount));

                // 解锁下一关卡
                ChapterMapConfigData chapterMapData = MapModule.Instance.GetChapterModeConfig(m_lastGameParam.mapData.no);;
                if (chapterMapData != null)
                {
                    UserModule.Instance.UnlockChapter(chapterMapData.unlockedChapterNo, chapterMapData.unlockedSmallChapterNo);
                }
            };

            m_game.onMainPlayerDie += () =>
            {
                m_game.Pause();
                this.Log("玩家死亡");
                // TODO 根据不同模式有不同的结算
                UIAPI.ShowUIWindow(UIDef.UIPveGameFailWindow, new FinalScore(this.GameScore, this.PuzzleCount));
            };

            // 创建玩家
            m_game.CreatePlayer();
            // 手动暂停游戏,等玩家点击ready
            //m_game.Pause();
        }