Ejemplo n.º 1
0
    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));
    }
Ejemplo n.º 2
0
 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));
     }
 }
Ejemplo n.º 3
0
    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));
    }