예제 #1
0
파일: frmGame.cs 프로젝트: sakseichek/homm
        private bool EnqueueBattleCommand(int playerId, frmBattle.CommandIssuedEventArg e)
        {
            BattleCommand cmd = new BattleCommand(e._x, e._y, (int)e._button, e._doubleClick, e._cmdType);

            Remoting.Game adp = null;
            if (Remoting.GameSetting._isServer)
            {
                adp = new Heroes.Remoting.Game();
            }
            else
            {
                Heroes.Remoting.RegisterServer register = new Heroes.Remoting.RegisterServer();
                register._hostName = Remoting.GameSetting._serverHostName;

                adp = (Heroes.Remoting.Game)register.GetObject(
                    typeof(Heroes.Remoting.Game),
                    Heroes.Remoting.Game.CLASSNAME);

                if (adp == null)
                {
                    MessageBox.Show("Error");
                    return false;
                }
            }

            try
            {
                adp.EnqueueBattleCommand(playerId, cmd);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }

            return true;
        }
예제 #2
0
파일: frmGame.cs 프로젝트: sakseichek/homm
        private bool ExecuteBattleCommand(BattleCommand cmd)
        {
            lock (_lockToken)
            {
                //Remoting.GameSetting._frmBattle.ExecuteCommand(cmd);
            }

            return true;
        }
예제 #3
0
파일: frmGame.cs 프로젝트: sakseichek/homm
        private bool DequeueBattleCommand(int playerId, out BattleCommand cmd)
        {
            cmd = null;

            Remoting.Game adp = null;
            if (Remoting.GameSetting._isServer)
            {
                adp = new Heroes.Remoting.Game();
            }
            else
            {
                Heroes.Remoting.RegisterServer register = new Heroes.Remoting.RegisterServer();
                register._hostName = Remoting.GameSetting._serverHostName;

                adp = (Heroes.Remoting.Game)register.GetObject(
                    typeof(Heroes.Remoting.Game),
                    Heroes.Remoting.Game.CLASSNAME);

                if (adp == null)
                {
                    MessageBox.Show("Error");
                    return false;
                }
            }

            try
            {
                adp.DequeueBattleCommand(playerId, out cmd);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }

            return true;
        }