private void OnChangeContractTermLineThirdEmpire(ContractTermLine contractTermLine) { if (this.DiplomaticContract == null) { Diagnostics.LogWarning("Diplomatic contract is null"); return; } if (contractTermLine.SelectedEmpire == null) { return; } DiplomaticTermProposal diplomaticTermProposal = contractTermLine.ContractTerm as DiplomaticTermProposal; if (diplomaticTermProposal == null) { return; } DiplomaticTermProposal diplomaticTermProposal2 = diplomaticTermProposal.Clone(); diplomaticTermProposal2.ChangeEmpire(this.DiplomaticContract, contractTermLine.SelectedEmpire); DiplomaticTermChange[] diplomaticTermChanges = new DiplomaticTermChange[] { DiplomaticTermChange.Refresh(diplomaticTermProposal2, contractTermLine.ContractTerm.Index) }; OrderChangeDiplomaticContractTermsCollection order = new OrderChangeDiplomaticContractTermsCollection(this.DiplomaticContract, diplomaticTermChanges); Ticket ticket; base.PlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderChangeDiplomaticContractTermsCollectionResponse)); }
private void OnChangeContractTermLineQuantity(ContractTermLine contractTermLine) { if (this.DiplomaticContract == null) { Diagnostics.LogWarning("Diplomatic contract is null"); return; } if (contractTermLine.ContractTerm is DiplomaticTermResourceExchange) { DiplomaticTermResourceExchange diplomaticTermResourceExchange = contractTermLine.ContractTerm as DiplomaticTermResourceExchange; DiplomaticTermResourceExchange term = new DiplomaticTermResourceExchange((DiplomaticTermResourceExchangeDefinition)diplomaticTermResourceExchange.Definition, diplomaticTermResourceExchange.EmpireWhichProposes, diplomaticTermResourceExchange.EmpireWhichProvides, diplomaticTermResourceExchange.EmpireWhichReceives, diplomaticTermResourceExchange.ResourceName, contractTermLine.CurrentQuantity); DiplomaticTermChange[] diplomaticTermChanges = new DiplomaticTermChange[] { DiplomaticTermChange.Refresh(term, contractTermLine.ContractTerm.Index) }; OrderChangeDiplomaticContractTermsCollection order = new OrderChangeDiplomaticContractTermsCollection(this.DiplomaticContract, diplomaticTermChanges); Ticket ticket; base.PlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderChangeDiplomaticContractTermsCollectionResponse)); } else { if (!(contractTermLine.ContractTerm is DiplomaticTermBoosterExchange)) { Diagnostics.LogError("Trying to change quantity on a term that doesn't have any quantity."); return; } DiplomaticTermBoosterExchange termBoosterExchange = contractTermLine.ContractTerm as DiplomaticTermBoosterExchange; DepartmentOfEducation agency = termBoosterExchange.EmpireWhichProvides.GetAgency <DepartmentOfEducation>(); List <GameEntityGUID> list = (from match in agency where match.Constructible.Name == termBoosterExchange.BoosterDefinitionName select match into selectedBooster select selectedBooster.GUID).ToList <GameEntityGUID>(); int num = (int)contractTermLine.CurrentQuantity; if (num < list.Count) { list.RemoveRange(num, list.Count - num); list.TrimExcess(); } GameEntityGUID[] boosterGUIDs = list.ToArray(); DiplomaticTermBoosterExchange term2 = new DiplomaticTermBoosterExchange((DiplomaticTermBoosterExchangeDefinition)termBoosterExchange.Definition, termBoosterExchange.EmpireWhichProposes, termBoosterExchange.EmpireWhichProvides, termBoosterExchange.EmpireWhichReceives, boosterGUIDs, termBoosterExchange.BoosterDefinitionName); DiplomaticTermChange[] diplomaticTermChanges2 = new DiplomaticTermChange[] { DiplomaticTermChange.Refresh(term2, contractTermLine.ContractTerm.Index) }; OrderChangeDiplomaticContractTermsCollection order2 = new OrderChangeDiplomaticContractTermsCollection(this.DiplomaticContract, diplomaticTermChanges2); Ticket ticket2; base.PlayerController.PostOrder(order2, out ticket2, new EventHandler <TicketRaisedEventArgs>(this.OnOrderChangeDiplomaticContractTermsCollectionResponse)); } }
private void OnClickContractTermLine(ContractTermLine contractTermLine) { if (this.DiplomaticContract == null) { Diagnostics.LogWarning("Diplomatic contract is null"); return; } DiplomaticTermChange[] diplomaticTermChanges = new DiplomaticTermChange[] { DiplomaticTermChange.Remove(contractTermLine.ContractTerm.Index) }; OrderChangeDiplomaticContractTermsCollection order = new OrderChangeDiplomaticContractTermsCollection(this.DiplomaticContract, diplomaticTermChanges); Ticket ticket; base.PlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderChangeDiplomaticContractTermsCollectionResponse)); }
private void OnClickTermOptionLine(TermOptionLine termOptionLine) { if (this.DiplomaticContract == null) { Diagnostics.LogWarning("Diplomatic contract is null"); return; } DiplomaticTermChange[] diplomaticTermChanges = new DiplomaticTermChange[] { DiplomaticTermChange.Add(termOptionLine.GuiDiplomaticTerm.Term) }; OrderChangeDiplomaticContractTermsCollection order = new OrderChangeDiplomaticContractTermsCollection(this.DiplomaticContract, diplomaticTermChanges); Ticket ticket; base.PlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderChangeDiplomaticContractTermsCollectionResponse)); this.OnLeaveTermOptionLine(termOptionLine); }
private void OnResetCB(GameObject obj) { if (this.DiplomaticContract == null) { Diagnostics.LogWarning("Diplomatic contract is null"); return; } Diagnostics.Assert(this.DiplomaticContract.Terms != null); if (this.DiplomaticContract.Terms.Count == 0) { return; } DiplomaticTermChange[] array = new DiplomaticTermChange[this.DiplomaticContract.Terms.Count]; for (int i = 0; i < this.DiplomaticContract.Terms.Count; i++) { DiplomaticTerm diplomaticTerm = this.DiplomaticContract.Terms[i]; Diagnostics.Assert(diplomaticTerm != null); array[i] = DiplomaticTermChange.Remove(diplomaticTerm.Index); } OrderChangeDiplomaticContractTermsCollection order = new OrderChangeDiplomaticContractTermsCollection(this.DiplomaticContract, array); Ticket ticket; base.PlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderChangeDiplomaticContractTermsCollectionResponse)); }