Beispiel #1
0
        private SubGame GetSubGameInstance(ESubGame type)
        {
            SubGame subGame = null;

            switch (type)
            {
            case ESubGame.SplashScreen:
                subGame = new Splash();
                break;

            case ESubGame.Login:
                subGame = new Login();
                break;

            case ESubGame.Match:
                subGame = new Match();
                break;

            case ESubGame.Battle:
                subGame = new Battle();
                break;

            case ESubGame.SelectLevel:
                subGame = new SelectLevel();
                break;

            default:
                Debug.LogError("Unsupported SubGame Type!");
                break;
            }

            return(subGame);
        }
Beispiel #2
0
 virtual public void Destroy()
 {
     if (m_ui != null)
     {
         m_ui.Destroy();
     }
     m_ui      = null;
     m_subGame = null;
 }
Beispiel #3
0
        public void UpdateGame(float fDeltaTime)
        {
            // FPS temp code
            {
                ++m_fpsCount;
                m_fpsTimer += Time.deltaTime;
                if (m_fpsTimer >= 0.5f)
                {
                    TestScene.ShowLabel("FPS", (m_fpsCount / m_fpsTimer).ToString("f2"));
                    m_fpsCount = 0;
                    m_fpsTimer = 0f;
                }
            }

            // switch subgame
            if (m_newSubGameType != m_curSubGameType &&
                m_newSubGameType != ESubGame.None)
            {
                if (m_curSubGame != null)
                {
                    m_curSubGame.Destroy();
                    m_curSubGame = null;
                }

                m_curSubGame = GetSubGameInstance(m_newSubGameType);
                m_curSubGame.Init();
                m_curSubGameType = m_newSubGameType;
            }

            // update subgame
            if (m_curSubGame != null && !m_gamePause)
            {
                m_curSubGame.Update(fDeltaTime);
            }
            if (m_curSubGameType != ESubGame.SplashScreen)
            {
                NetworkMgr.Instance.Update(fDeltaTime);
                //EducationServer.Instance.Update(fDeltaTime);
                //AntiAddiction.Instance.Update(fDeltaTime);
            }
        }
Beispiel #4
0
 public void RestartBattle()
 {
     SubGame.RestartBattle();
 }
Beispiel #5
0
 public void NextLevel()
 {
     SubGame.NextLevel();
 }
Beispiel #6
0
 public void LeaveBattle()
 {
     SubGame.LeaveBattle();
 }
 public void OfflineMode()
 {
     SubGame.OfflineMode();
 }
 public void JoinRoom(string roomId)
 {
     SubGame.JoinRoom(roomId);
 }
 public void SetSelectLevel(int levelNum)
 {
     SubGame.SetSelectLevel(levelNum);
 }
 public void StartGame()
 {
     SubGame.StartGame();
 }
Beispiel #11
0
 public UIBridge(SubGame subGame, UIBase ui)
 {
     m_subGame = subGame;
     m_ui      = ui;
 }
Beispiel #12
0
 public void ResetServer()
 {
     SubGame.ResetServer();
 }
Beispiel #13
0
 public void OnlineMode()
 {
     SubGame.OnlineMode();
 }