Пример #1
0
        private void OnBattleType(Tuple <PlayerType, BattleType> data)
        {
            this.playerType = data.Item1;
            this.battleType = data.Item2;

            MenuParamGameLocal paramGame = new MenuParamGameLocal(playerType, battleType);

            paramGame.OnParamGameLocalEvent += OnParamLocal;

            pageTransitionControl.ShowPage(paramGame);
        }
Пример #2
0
        public void OnParamLocal(MenuParamGameLocal menuParam)
        {
            string pseudo1 = "";
            string pseudo2 = "";

            if (playerType == PlayerType.Human)
            {
                pseudo1 = (menuParam.player1 as PlayerName).Pseudo;
            }
            else
            {
                //TODO Implement param AI
                throw new Exception("AI not supported yet");

                //string pseudo = (menuParam.player1 as PlayerAI);

                // Create the player
                //player1 = new Client(playerType, pseudo);
            }

            if (battleType == BattleType.AgainstPlayer)
            {
                pseudo2 = (menuParam.player2 as PlayerName).Pseudo;
            }
            else
            {
                //TODO Implement param AI
                throw new Exception("AI not supported yet");

                //string pseudo = (menuParam.player2 as PlayerAI);

                // Create the player
                //player2 = new Client(playerType, pseudo);
            }

            new Thread(() =>
            {
                // Register clients to applicationManager
                ApplicationManager.Instance.JoinGameLocal(
                    playerType,
                    pseudo1,
                    battleType == BattleType.AgainstPlayer ? PlayerType.Human:PlayerType.AI,
                    pseudo2
                    );
            }).Start();
        }