public override bool OnUIDialogClosed(string panelName, string[] msgParams) { if (!(panelName == this._provinceNameDialog)) { return(false); } if (bool.Parse(msgParams[0])) { if (this.Sim.GameDatabase.GetProvinceInfos().ToList <ProvinceInfo>().Any <ProvinceInfo>((Func <ProvinceInfo, bool>)(x => x.Name == msgParams[1]))) { this._provinceNameDialog = this.App.UI.CreateDialog((Dialog) new GenericTextEntryDialog(this.App, App.Localize("@UI_PROVINCE_EDIT_NAME_PROVINCE_TITLE"), App.Localize("@UI_PROVINCE_EDIT_NAME_PROVINCE_DESC"), this.Sim.NamesPool.GetProvinceName(this.Sim.LocalPlayer.Faction.Name), 1024, 2, true, EditBoxFilterMode.None), null); this.App.UI.CreateDialog((Dialog) new GenericTextDialog(this.App, App.Localize("@UI_DIALOGDUPLICATEPROVINCE_TITLE"), string.Format(App.Localize("@UI_DIALOGDUPLICATEPROVINCE_DESC"), (object)msgParams[1]), "dialogGenericMessage"), null); return(false); } this.Sim.GameDatabase.InsertProvince(msgParams[1], this.Sim.LocalPlayer.ID, this.Systems.Select <StarSystemInfo, int>((Func <StarSystemInfo, int>)(x => x.ID)), this.Capital.ID); GameSession.ApplyMoralEvent(this.App, MoralEvent.ME_PROVINCE_FORMED, this.Sim.LocalPlayer.ID, new int?(), new int?(), new int?()); this._starmap.Sync(this._state.GetCrits()); this._state.SetProvinceMode(false); } else { this.App.UI.SetVisible("pnlProvinceEditWindow", true); this._stage = ProvinceEditStarMapStateMode.ProvinceEditStage.CapitalSelect; } return(true); }
public override void Initialize() { this.MaxProvinceDistance = this.App.GetStratModifier <float>(StratModifiers.MaxProvincePlanetRange, this.Sim.LocalPlayer.ID); this.MaxSystemsInProvince = this.App.GetStratModifier <int>(StratModifiers.MaxProvincePlanets, this.Sim.LocalPlayer.ID); this.MinSystemsInProvince = this.App.GetStratModifier <int>(StratModifiers.MinProvincePlanets, this.Sim.LocalPlayer.ID); this._starmap.Select((IGameObject)null); this._starmap.SelectEnabled = true; this.SystemPool = this.GetProvinceableSystems().ToList <int>(); this.UpdateProvincePool(); this._stage = ProvinceEditStarMapStateMode.ProvinceEditStage.SystemSelect; this.App.UI.SetText(this.App.UI.Path("pnlProvinceEditWindow", "lblDescription"), string.Format(App.Localize("@UI_PROVINCE_EDIT_SYSTEM_SELECT"), (object)(this.MinSystemsInProvince - this.Systems.Count))); this.App.UI.SetEnabled(this.App.UI.Path("pnlProvinceEditWindow", "btnNextStage"), false); this.App.UI.SetVisible("pnlProvinceEditWindow", true); }
public override bool OnUIButtonPressed(string panelName) { if (this._stage == ProvinceEditStarMapStateMode.ProvinceEditStage.SystemSelect && panelName == "btnNextStage") { this._stage = ProvinceEditStarMapStateMode.ProvinceEditStage.CapitalSelect; this.App.UI.SetText(this.App.UI.Path("pnlProvinceEditWindow", "lblDescription"), App.Localize("@UI_PROVINCE_EDIT_CAPITAL_SELECT")); this.App.UI.SetEnabled(this.App.UI.Path("pnlProvinceEditWindow", "btnNextStage"), false); return(true); } if (this._stage != ProvinceEditStarMapStateMode.ProvinceEditStage.CapitalSelect || !(panelName == "btnNextStage")) { return(false); } this._stage = ProvinceEditStarMapStateMode.ProvinceEditStage.ProvinceName; this._provinceNameDialog = this.App.UI.CreateDialog((Dialog) new GenericTextEntryDialog(this.App, App.Localize("@UI_PROVINCE_EDIT_NAME_PROVINCE_TITLE"), App.Localize("@UI_PROVINCE_EDIT_NAME_PROVINCE_DESC"), this.Sim.NamesPool.GetProvinceName(this.Sim.LocalPlayer.Faction.Name), 1024, 2, true, EditBoxFilterMode.None), null); this.App.UI.SetVisible("pnlProvinceEditWindow", false); return(true); }