private Form HandleBuildBattleAgentFormEvent(AgentBattleInfo battleInfo) { if (this.OnBuildBattleAgentForm != null) { return(this.OnBuildBattleAgentForm(battleInfo)); } return(null); }
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); } }