示例#1
0
        public static void ResetAll()
        {
            if (_frmBattle != null)
            {
                _frmBattle.Close();
                _frmBattle = null;
            }

            if (_frmMap != null)
            {
                _frmMap.Close();
                _frmMap = null;
            }

            if (_frmGame != null)
            {
                _frmGame.Close();
                _frmGame = null;
            }

            _isServer = false;
            _me = null;
            _server = null;
            _players.Clear();
            _currentPlayer = null;

            _isNeedToStartGame = false;
            _isGameStarted = false;
            _isInitialized = false;
            _isAllPlayerInitialized = false;
            _needToRunNextPlayer = false;

            _isNeedToStartBattle = false;
            _amIBattle = false;
            _isBattleStarted = false;
            _attackPlayer = null;
            _attackHero = null;
            _attackArmies = null;
            _defendPlayer = null;
            _defendHero = null;
            _defendCastle = null;
            _defendArmies = null;
            _victory = 0;
            _isBattleEnded = false;

            _attackCommands.Clear();
            _defendCommands.Clear();
        }
示例#2
0
        private void cmdSinglePlayer_Click(object sender, EventArgs e)
        {
            try
            {
                this.Hide();

                using (Heroes.Core.Map.frmMap f = new Heroes.Core.Map.frmMap())
                {
                    f.IsMultiPlayer = false;
                    f.ReadOnly = false;
                    f.Initialize(4);

                    f.VisitingCastle += new Heroes.Core.Map.frmMap.VisitingCastleEventHandler(f_VisitingCastle);
                    f.StartingBattle += new Heroes.Core.Map.frmMap.StartingBattleEventHandler(f_StartingBattle);
                    f.ShowDialog();
                }
            }
            finally
            {
                this.Show();
            }
        }
示例#3
0
        public void StartGame(int playerCount)
        {
            this.Hide();

            Heroes.Core.Map.frmMap f = new Heroes.Core.Map.frmMap();
            Remoting.GameSetting._frmMap = f;
            f.IsMultiPlayer = true;
            f.ReadOnly = true;
            //f.Initialize(playerCount);
            f.Initialize(2);

            if (Remoting.GameSetting._isServer) f.Text = "Server";
            else f.Text = "Client";

            f.VisitingCastle += new Heroes.Core.Map.frmMap.VisitingCastleEventHandler(frmMap_VisitingCastle);
            f.StartingBattle += new Heroes.Core.Map.frmMap.StartingBattleEventHandler(frmMap_StartingBattle);
            f.EndTurnPressed += new Heroes.Core.Map.frmMap.EndTurnPressedEventHandler(frmMap_EndTurnPressed);
            f.FormTerminated += new Heroes.Core.Map.frmMap.FormTerminatedEventHandler(frmMap_FormTerminated);

            lock (_lockToken)
            {
                Remoting.GameSetting._isGameStarted = true;
            }

            f.ShowDialog();

            this.Close();
        }