示例#1
0
        public void SetGameState(GameState state)
        {
            if (menuNode != null)
            {
                menuNode.RemoveFromParent();
            }
            if (pauseNode != null)
            {
                pauseNode.RemoveFromParent();
            }
            if (postGameNode != null)
            {
                postGameNode.RemoveFromParent();
            }

            if (state == GameState.PreGame)
            {
                menuNode = new MainMenu(Frame.Size);
                AddChild(menuNode);
            }
            else if (state == GameState.InGame)
            {
                HideInGameUI(false);
            }
            else if (state == GameState.Paused)
            {
                pauseNode = new PauseMenu(Frame.Size);
                AddChild(pauseNode);
            }
            else if (state == GameState.PostGame)
            {
                InvokeOnMainThread(() => {
                    postGameNode = new PostGameMenu(Frame.Size, GameStateDelegate);
                    AddChild(postGameNode);
                    HideInGameUI(true);
                });
            }

            gameState = state;
        }
示例#2
0
		public void SetGameState (GameState state)
		{
			if (menuNode != null)
				menuNode.RemoveFromParent ();
			if (pauseNode != null)
				pauseNode.RemoveFromParent ();
			if (postGameNode != null)
				postGameNode.RemoveFromParent ();

			if (state == GameState.PreGame) {
				menuNode = new MainMenu (Frame.Size);
				AddChild (menuNode);
			} else if (state == GameState.InGame) {
				HideInGameUI (false);
			} else if (state == GameState.Paused) {
				pauseNode = new PauseMenu (Frame.Size);
				AddChild (pauseNode);
			} else if (state == GameState.PostGame) {
				InvokeOnMainThread (() => {
					postGameNode = new PostGameMenu (Frame.Size, GameStateDelegate);
					AddChild (postGameNode);
					HideInGameUI (true);
				});
			}

			gameState = state;
		}