private void VoteForSeasonEffect_TicketRaised(object sender, TicketRaisedEventArgs e) { OrderVoteForSeasonEffect orderVoteForSeasonEffect = e.Order as OrderVoteForSeasonEffect; Diagnostics.Assert(orderVoteForSeasonEffect != null); List <EvaluableMessage_VoteForSeasonEffect> list = new List <EvaluableMessage_VoteForSeasonEffect>(base.AIEntity.AIPlayer.Blackboard.GetMessages <EvaluableMessage_VoteForSeasonEffect>(BlackboardLayerID.Empire, (EvaluableMessage_VoteForSeasonEffect message) => message.SeasonEffectReference == orderVoteForSeasonEffect.SeasonEffectName)); if (list.Count == 0) { return; } if (list.Count > 1) { AILayer.LogWarning("There should not be several PopulationBuyout EvaluableMessages for the same city"); } EvaluableMessage_VoteForSeasonEffect evaluableMessage_VoteForSeasonEffect = list[0]; if (e.Result == PostOrderResponse.Processed) { evaluableMessage_VoteForSeasonEffect.SetObtained(); } else { evaluableMessage_VoteForSeasonEffect.SetFailedToObtain(); } }
private SynchronousJobState SynchronousJob_VoteForSeasonEffect() { List <EvaluableMessage_VoteForSeasonEffect> list = new List <EvaluableMessage_VoteForSeasonEffect>(base.AIEntity.AIPlayer.Blackboard.GetMessages <EvaluableMessage_VoteForSeasonEffect>(BlackboardLayerID.Empire, (EvaluableMessage_VoteForSeasonEffect match) => match.State == BlackboardMessage.StateValue.Message_InProgress)); if (list.Count != 0) { if (list.Count > 1) { AILayer.LogWarning("There should not be several VoteForSeasonEffect EvaluableMessages for the same empire ({0})", new object[] { base.AIEntity.Empire.Index }); } EvaluableMessage_VoteForSeasonEffect evaluableMessage_VoteForSeasonEffect = list[0]; if (evaluableMessage_VoteForSeasonEffect.EvaluationState == EvaluableMessage.EvaluableMessageState.Validate) { OrderVoteForSeasonEffect order = new OrderVoteForSeasonEffect(base.AIEntity.Empire.Index, evaluableMessage_VoteForSeasonEffect.SeasonEffectReference, evaluableMessage_VoteForSeasonEffect.VoteCount); Ticket ticket; base.AIEntity.Empire.PlayerControllers.AI.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.VoteForSeasonEffect_TicketRaised)); return(SynchronousJobState.Success); } } return(SynchronousJobState.Success); }