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; }
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); }
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); }
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); }
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)); }
public void AddToTreatiesInfo(TreatyInfo treatyInfo) { base.AddObject("TreatiesInfo", treatyInfo); }
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); } }
public TreatyEditDialog(App game, TreatyInfo treaty, string template = "TreatyConfigurationPopup") : base(game, template) { this._editedTreaty = treaty; }