예제 #1
0
파일: frmGame2.cs 프로젝트: sakseichek/homm
        public frmGame2()
        {
            InitializeComponent();

            _playerIdMe = 0;
            _playerMe = null;
            _playerKIds = new Hashtable();
            _startingHeroId = 0;
            _isDoingTurn = false;
            _isBattleStarted = false;

            _attackHero = null;
            _defendHero = null;

            _isExit = false;

            _frmDuel = null;
            _frmBattle = null;

            // thread
            ThreadStart entryPoint = new ThreadStart(StartProcess);
            _processThread = new Thread(entryPoint);
            _processThread.Name = "Processing Thread";

            // timer to start game
            _timerGame = new System.Windows.Forms.Timer();
            _timerGame.Interval = 500;
            _timerGame.Tick += new EventHandler(_timerGame_Tick);
            _timerGame.Stop();

            // timer to start battle
            _timerBattle = new System.Windows.Forms.Timer();
            _timerBattle.Interval = 500;
            _timerBattle.Tick += new EventHandler(_timerBattle_Tick);
            _timerBattle.Stop();

            this.FormClosing += new FormClosingEventHandler(frmGame_FormClosing);
            this.FormClosed += new FormClosedEventHandler(frmGame_FormClosed);
        }
예제 #2
0
파일: frmGame2.cs 프로젝트: sakseichek/homm
        void f_GettingArtifact(frmDuelNetwork.GettingArtifactEventArg e)
        {
            int id = 0;
            if (!RemoteGetArtifact(e._level, out id))
            {
                Debug.WriteLine("RemoteGetArtifact failed.");
                return;
            }

            if (Heroes.Core.Setting._artifacts.ContainsKey(id))
                e._artifact = (Heroes.Core.Heros.Artifact)Heroes.Core.Setting._artifacts[id];
            else
                e._artifact = null;
        }
예제 #3
0
파일: frmGame2.cs 프로젝트: sakseichek/homm
 void f_StartingBattle(frmDuelNetwork.StartingBattleEventArg e)
 {
     if (e._monster != null)
     {
         e._success = Battle(e._attackHero, null, e._monster);
     }
     else
     {
         if (!RemoteSetStartingBattle(e._attackHero, e._defendHero))
         {
             Debug.WriteLine("RemoteSetStartingBattle failed.");
             return;
         }
     }
 }
예제 #4
0
파일: frmGame2.cs 프로젝트: sakseichek/homm
        private void StartGame()
        {
            try
            {
                this.Hide();

                Debug.WriteLine("Start frmDuelNetwork");
                using (frmDuelNetwork f = new frmDuelNetwork())
                {
                    _frmDuel = f;
                    f.GameStarted += new frmDuelNetwork.GameStartedEventHandler(f_GameStarted);
                    f.NextTurnClick += new frmDuelNetwork.NextTurnClickEventHandler(f_NextTurnClick);
                    f.StartingBattle += new frmDuelNetwork.StartingBattleEventHandler(f_StartingBattle);
                    f.GettingArtifact += new frmDuelNetwork.GettingArtifactEventHandler(f_GettingArtifact);
                    f.ShowDialog(this._playerMe, this._startingHeroId, this._playerIds);
                }
            }
            finally
            {
                this.Close();
            }
        }