/*------------------------------------------------- * Event Handlers * --------------------------------------------------*/ public void OnCompleteTeamMemberAction(TeamEventData teamEventData) { if (this.team == teamEventData.team) { CompleteTeamMemberAction(teamEventData.character); } }
/// <summary> /// 更新車隊公告資料 /// </summary> /// <param name="teamEventData">teamEventData</param> /// <returns>bool</returns> public async Task <bool> UpdateTeamEventData(TeamEventData teamEventData) { try { FilterDefinition <TeamEventData> filter = Builders <TeamEventData> .Filter.Eq("_id", teamEventData.Id); ReplaceOneResult result = await this.teamEventDatas.ReplaceOneAsync(filter, teamEventData); if (!result.IsAcknowledged) { this.logger.LogError($"Update Team Event Data Fail For IsAcknowledged >>> Data:{JsonConvert.SerializeObject(teamEventData)}"); return(false); } if (result.ModifiedCount == 0) { this.logger.LogError($"Update Team Event Data Fail For ModifiedCount >>> Data:{JsonConvert.SerializeObject(teamEventData)}"); return(false); } return(true); } catch (Exception ex) { this.logger.LogError($"Update Team Event Data Error >>> Data:{JsonConvert.SerializeObject(teamEventData)}\n{ex}"); return(false); } }
private void RaiseCompleteActionTeamEvent(Character character) { TeamEventData teamEventData = new TeamEventData(); teamEventData.character = character; teamEventData.team = character.team; this.completeTeamMemberAction.Raise(teamEventData); }
/// <summary> /// 建立車隊活動資料 /// </summary> /// <param name="teamEventData">teamEventData</param> /// <returns>bool</returns> public async Task <bool> CreateTeamEventData(TeamEventData teamEventData) { try { await this.teamEventDatas.InsertOneAsync(teamEventData); return(true); } catch (Exception ex) { this.logger.LogError($"Create Team Event Data Error >>> Data:{JsonConvert.SerializeObject(teamEventData)}\n{ex}"); return(false); } }