Esempio n. 1
0
 private Form HandleBuildBattleAgentFormEvent(AgentBattleInfo battleInfo)
 {
     if (this.OnBuildBattleAgentForm != null)
     {
         return(this.OnBuildBattleAgentForm(battleInfo));
     }
     return(null);
 }
Esempio n. 2
0
        private void BuildBattleAgentForm(int identity, byte myPosition, BattleMode battleMode)
        {
            VoidFunctionDelegate method = null;

            if (!base.InvokeRequired)
            {
                AgentBattleInfo battleInfo = new AgentBattleInfo();
                battleInfo.AgentID       = identity;
                battleInfo.BattleMode    = battleMode;
                battleInfo.Position      = myPosition;
                battleInfo.ServerAddress = this._serverIP;
                battleInfo.UserName      = this._myInfo.Name;
                battleInfo.MoveInterval  = this._roomSetting.MoveInterval;
                Form form = this.HandleBuildBattleAgentFormEvent(battleInfo);
                if (form != null)
                {
                    this.SetUserState(UserState.Battling);
                    form.FormClosed += new FormClosedEventHandler(this.BattleFormClosed);
                    form.Show();
                }
                else
                {
                    MessageBox.Show("please build battle agent form");
                    this.SetUserState(UserState.Free);
                }
            }
            else
            {
                if (method == null)
                {
                    method = delegate {
                        this.BuildBattleAgentForm(identity, myPosition, battleMode);
                    };
                }
                base.Invoke(method);
            }
        }