コード例 #1
0
 public TreatyEditDialog(App game, int OpposingPlayerId, string template = "TreatyConfigurationPopup")
     : base(game, template)
 {
     this._editedTreaty = (TreatyInfo) new LimitationTreatyInfo();
     this._editedTreaty.InitiatingPlayerId = this._app.Game.LocalPlayer.ID;
     this._editedTreaty.ReceivingPlayerId  = OpposingPlayerId;
     this._editedTreaty.Type         = TreatyType.Armistice;
     this._editedTreaty.StartingTurn = this._app.GameDatabase.GetTurnCount() + 1;
 }
コード例 #2
0
ファイル: Reference.cs プロジェクト: mazurov/BRS-MFiles
        public static TreatyInfo CreateTreatyInfo(string ID, global::System.DateTime dateAdoption, global::System.DateTime dateSignature, global::System.DateTime dateEntryIntoForce)
        {
            TreatyInfo treatyInfo = new TreatyInfo();

            treatyInfo.id                 = ID;
            treatyInfo.dateAdoption       = dateAdoption;
            treatyInfo.dateSignature      = dateSignature;
            treatyInfo.dateEntryIntoForce = dateEntryIntoForce;
            return(treatyInfo);
        }
コード例 #3
0
 public TreatyBrokenDialog(App game, int treatyId, bool isVictim)
     : base(game, "dialogTreatyBroken")
 {
     this._treatyInfo = game.GameDatabase.GetTreatyInfos().ToList <TreatyInfo>().FirstOrDefault <TreatyInfo>((Func <TreatyInfo, bool>)(x => x.ID == treatyId));
     this._isVictim   = isVictim;
     if (this._treatyInfo != null)
     {
         return;
     }
     this._app.UI.CloseDialog((Dialog)this, true);
 }
コード例 #4
0
        private void SyncRDPCost(TreatyInfo ti)
        {
            int treatyRdpCost = this._app.Game.GetTreatyRdpCost(ti);

            this._app.UI.SetButtonText("btnDone", string.Format("{0} ({1}: {2})", (object)App.Localize("@UI_GENERAL_DONE"), (object)App.Localize("@DIPLOMACY_RDP"), (object)treatyRdpCost));
            bool flag = true;

            if (this._editedTreaty.Type == TreatyType.Armistice)
            {
                flag = ((ArmisticeTreatyInfo)this._editedTreaty).SuggestedDiplomacyState >= DiplomacyState.CEASE_FIRE;
            }
            this._app.UI.SetEnabled("btnDone", treatyRdpCost <= this._app.GameDatabase.GetPlayerInfo(this._app.LocalPlayer.ID).GetTotalDiplomacyPoints(this._app.GameDatabase.GetPlayerFactionID(ti.ReceivingPlayerId)) && this.hasTreaty && flag);
        }
コード例 #5
0
 public LimitationTreatyRequestedDialog(App game, int treatyId)
     : base(game, "dialogTreatyRequest_Limitation")
 {
     this._treatyInfo = game.GameDatabase.GetTreatyInfos().ToList <TreatyInfo>().First <TreatyInfo>((Func <TreatyInfo, bool>)(x => x.ID == treatyId));
 }
コード例 #6
0
ファイル: Reference.cs プロジェクト: mazurov/BRS-MFiles
 public void AddToTreatiesInfo(TreatyInfo treatyInfo)
 {
     base.AddObject("TreatiesInfo", treatyInfo);
 }
コード例 #7
0
 public void SyncTreatyTypePanels()
 {
     if (this._editedTreaty.Type == TreatyType.Armistice)
     {
         this._app.UI.SetVisible("pnlArmisticePanel", true);
         this._app.UI.SetVisible("pnlDurationPanel", false);
         int receivingPlayerId = this._editedTreaty.ReceivingPlayerId;
         int id = this._editedTreaty.ID;
         if (!typeof(ArmisticeTreatyInfo).IsAssignableFrom(this._editedTreaty.GetType()))
         {
             this._editedTreaty    = (TreatyInfo) new ArmisticeTreatyInfo();
             this._editedTreaty.ID = id;
             this._editedTreaty.InitiatingPlayerId = this._app.Game.LocalPlayer.ID;
             this._editedTreaty.ReceivingPlayerId  = receivingPlayerId;
             this._editedTreaty.Type         = TreatyType.Armistice;
             this._editedTreaty.StartingTurn = this._app.GameDatabase.GetTurnCount() + 1;
         }
         ArmisticeTreatyInfo editedTreaty = (ArmisticeTreatyInfo)this._editedTreaty;
         this._app.UI.SetEnabled("btnDone", editedTreaty.SuggestedDiplomacyState >= DiplomacyState.CEASE_FIRE);
         this._app.UI.SetSelection("lstArmisticeType", (int)editedTreaty.SuggestedDiplomacyState);
     }
     else
     {
         this._app.UI.SetVisible("pnlArmisticePanel", false);
         this._app.UI.SetVisible("pnlDurationPanel", true);
         if (this._durationSpinner != null)
         {
             this._durationSpinner.SetValue((double)this._editedTreaty.Duration);
         }
         this._app.UI.SetPropertyString("txtDuration", "text", this._editedTreaty.Duration.ToString());
         bool flag = this._editedTreaty.Type == TreatyType.Limitation;
         this._app.UI.SetVisible("pnlLimitationPanel", flag);
         if (!flag)
         {
             return;
         }
         int receivingPlayerId = this._editedTreaty.ReceivingPlayerId;
         int id = this._editedTreaty.ID;
         if (!typeof(LimitationTreatyInfo).IsAssignableFrom(this._editedTreaty.GetType()))
         {
             this._editedTreaty    = (TreatyInfo) new LimitationTreatyInfo();
             this._editedTreaty.ID = id;
             this._editedTreaty.InitiatingPlayerId = this._app.Game.LocalPlayer.ID;
             this._editedTreaty.ReceivingPlayerId  = receivingPlayerId;
             this._editedTreaty.Type         = TreatyType.Limitation;
             this._editedTreaty.StartingTurn = this._app.GameDatabase.GetTurnCount() + 1;
         }
         LimitationTreatyInfo editedTreaty = (LimitationTreatyInfo)this._editedTreaty;
         this._app.UI.SetSelection("lstLimitationType", (int)editedTreaty.LimitationType);
         this._app.UI.SetEnabled("txtLimitationValue", TreatyEditDialog.EnableValueList.Contains(editedTreaty.LimitationType));
         this._app.UI.SetEnabled("lstLimitationGroup", TreatyEditDialog.EnableGroupList.Contains(editedTreaty.LimitationType));
         if (TreatyEditDialog.LimitationTypeSpinnerDescriptors.ContainsKey(editedTreaty.LimitationType))
         {
             this._limitationValueSpinner.SetValue((double)editedTreaty.LimitationAmount);
             this._limitationValueSpinner.SetValueDescriptor(TreatyEditDialog.LimitationTypeSpinnerDescriptors[editedTreaty.LimitationType]);
             editedTreaty.LimitationAmount = (float)this._limitationValueSpinner.Value;
             this._app.UI.SetPropertyString("txtLimitationValue", "text", editedTreaty.LimitationAmount.ToString());
         }
         this.SyncConsequences();
         this.SyncLimitationGroup(editedTreaty.LimitationType);
     }
 }
コード例 #8
0
 public TreatyEditDialog(App game, TreatyInfo treaty, string template = "TreatyConfigurationPopup")
     : base(game, template)
 {
     this._editedTreaty = treaty;
 }