protected override void OnEnter() { base.OnEnter(); this.App.UI.SetScreen("StarSystem"); this._piechart = new BudgetPiechart(this.App.UI, "piechart", this.App.AssetDatabase); EmpireBarUI.SyncTitleBar(this.App, "gameEmpireBar", this._piechart); EmpireBarUI.SyncTitleFrame(this.App); this.InitializeClimateSlider(this.App.UI.Path("colonyControl", "partClimateSlider")); this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partTradeSlider"), "only_user_events", true); this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partTerraSlider"), "only_user_events", true); this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partInfraSlider"), "only_user_events", true); this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partShipConSlider"), "only_user_events", true); this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partCivSlider"), "only_user_events", true); this.App.UI.SetPropertyBool(this.App.UI.Path("colonyControl", "partOverDevelopment"), "only_user_events", true); this.App.UI.SetPropertyBool("gameSystemContentsList", "only_user_events", true); this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partCivSlider"), 0, 100, 50); this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partTerraSlider"), 0, 100, 50); this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partInfraSlider"), 0, 100, 50); this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partShipConSlider"), 0, 100, 50); this.App.UI.InitializeSlider(this.App.UI.Path("colonyControl", "partOverDevelopment"), 0, 100, 50); this.InitializeClimateSlider(this.App.UI.Path("gamePlanetDetails", "partClimateSlider")); StarSystemUI.SyncSystemDetailsWidget(this.App, "systemDetailsWidget", this.CurrentSystem, false, true); StarSystemUI.SyncPlanetListWidget(this.App.Game, "planetListWidget", this.App.GameDatabase.GetStarSystemPlanets(this.CurrentSystem)); StarSystemUI.SyncColonyDetailsWidget(this.App.Game, "colonyDetailsWidget", this.SelectedObject, ""); StarSystemUI.SyncPlanetDetailsWidget(this.App.Game, "planetDetailsWidget", this.CurrentSystem, this.SelectedObject, this.GetPlanetViewGameObject(this.CurrentSystem, this.SelectedObject), this._planetView); this.App.HotKeyManager.AddListener((IKeyBindListener)this); }
protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams) { if (msgType == "list_sel_changed") { if (panelName == "filterDropdown") { this._currentFilterMode = (PlanetManagerDialog.PlanetFilterMode) int.Parse(msgParams[0]); this.SyncPlanetList(); } else if (panelName == "orderDropdown") { this._currentOrderMode = (PlanetManagerDialog.PlanetOrderMode) int.Parse(msgParams[0]); if (this._selectedSystem != (StarSystemInfo)null) { this.SetSyncedSystem(this._selectedSystem); } } else if (panelName == "sys_list_left") { StarSystemInfo starSystemInfo = this.App.GameDatabase.GetStarSystemInfo(int.Parse(msgParams[0])); if (starSystemInfo != (StarSystemInfo)null) { this.SetSyncedSystem(starSystemInfo); } } } if (msgType == "button_clicked") { if (panelName == PlanetManagerDialog.UIExitButton) { this.App.UI.CloseDialog((Dialog)this, true); } else if (panelName.StartsWith("btnColoninzePlanet")) { string[] strArray = panelName.Split('|'); int targetSystem = int.Parse(strArray[1]); int targetPlanet = int.Parse(strArray[2]); if (this.App.CurrentState.GetType() == typeof(StarMapState)) { ((StarMapState)this.App.CurrentState).ShowColonizePlanetOverlay(targetSystem, targetPlanet); } this.App.UI.CloseDialog((Dialog)this, true); } } if (!(msgType == "mouse_enter") || !panelName.StartsWith("MoraleRow")) { return; } int orbitalObjectID = int.Parse(panelName.Split('|')[0]); int x = int.Parse(msgParams[0]); int y = int.Parse(msgParams[1]); ColonyInfo colonyInfoForPlanet = this.App.GameDatabase.GetColonyInfoForPlanet(orbitalObjectID); if (colonyInfoForPlanet == null || this.App.LocalPlayer.ID != colonyInfoForPlanet.PlayerID) { return; } StarSystemUI.ShowMoraleEventToolTip(this.App.Game, colonyInfoForPlanet.ID, x, y); }
protected override void OnEnter() { base.OnEnter(); StarSystemUI.SyncSystemDetailsWidget(this.App, "systemDetailsWidget", this.TargetSystem, false, true); this._currentslider = 0; this._GatePoints.Clear(); this.gatecost = this.App.GameDatabase.GetDesignInfosForPlayer(this.App.LocalPlayer.ID).FirstOrDefault <DesignInfo>((Func <DesignInfo, bool>)(x => x.IsAccelerator())).ProductionCost; }
public void Sync(int planetID, bool PopulationSliders = false, bool ShowColonizebuttons = false) { StarSystemUI.ClearColonyDetailsControl(this.App.Game, this._rootPanel); PlanetInfo planetInfo = this.App.GameDatabase.GetPlanetInfo(planetID); if (planetInfo == null) { return; } this._planetID = planetID; this.CachePlanet(planetInfo); StarSystemUI.SyncPlanetDetailsControlNew(this.App.Game, this._rootPanel, planetID); this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "systemName"), "text", this.App.GameDatabase.GetStarSystemInfo(this.App.GameDatabase.GetOrbitalObjectInfo(planetInfo.ID).StarSystemID).Name); ColonyInfo colonyInfoForPlanet = this.App.GameDatabase.GetColonyInfoForPlanet(planetID); this.App.UI.SetVisible(this.App.UI.Path(this._rootPanel, "rebellionActive"), (colonyInfoForPlanet != null ? (colonyInfoForPlanet.PlayerID != this.App.LocalPlayer.ID ? 0 : (colonyInfoForPlanet.RebellionType != RebellionType.None ? 1 : 0)) : 0) != 0); int num1 = 0; if (colonyInfoForPlanet != null && colonyInfoForPlanet.PlayerID == this.App.LocalPlayer.ID) { this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partOverharvestSlider"), "id", "__partOverharvestSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString()); this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partTradeSlider"), "id", "__partTradeSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString()); this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partTerraSlider"), "id", "__partTerraSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString()); this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partInfraSlider"), "id", "__partInfraSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString()); this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partShipConSlider"), "id", "__partShipConSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString()); this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "partCivSlider"), "id", "__partCivSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString()); StarSystemUI.SyncColonyDetailsControlNew(this.App.Game, this._rootPanel, colonyInfoForPlanet.ID, this._widgetID, ""); this.App.UI.SetPropertyBool(this._rootPanel, "expanded", true); if (!PopulationSliders) { return; } foreach (ColonyFactionInfo faction1 in colonyInfoForPlanet.Factions) { this.App.UI.AddItem(this.App.UI.Path(this._rootPanel, "MoraleRow"), "", faction1.FactionID, "", "popItem"); string itemGlobalId = this.App.UI.GetItemGlobalID(this.App.UI.Path(this._rootPanel, "MoraleRow"), "", faction1.FactionID, ""); this.App.UI.SetPropertyString(this.App.UI.Path(itemGlobalId, "partPopSlider"), "id", "__partPopSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString() + "|" + (object)faction1.FactionID); Faction faction2 = this.App.AssetDatabase.GetFaction(faction1.FactionID); this.App.UI.SetPropertyString(this.App.UI.Path(itemGlobalId, "factionicon"), "sprite", "logo_" + faction2.Name.ToLower()); this.App.UI.SetSliderValue(this.App.UI.Path(itemGlobalId, "__partPopSlider|" + this._widgetID.ToString() + "|" + colonyInfoForPlanet.ID.ToString() + "|" + (object)faction1.FactionID), (int)((double)faction1.CivPopWeight * 100.0)); this.App.UI.SetText(this.App.UI.Path(itemGlobalId, "gameMorale_human"), faction1.Morale.ToString()); double num2 = (colonyInfoForPlanet.CurrentStage == Kerberos.Sots.Data.ColonyStage.GemWorld ? Colony.GetMaxCivilianPop(this.App.GameDatabase, planetInfo) * (double)this.App.AssetDatabase.GemWorldCivMaxBonus : Colony.GetMaxCivilianPop(this.App.GameDatabase, planetInfo)) * (double)colonyInfoForPlanet.CivilianWeight * (double)faction1.CivPopWeight * (double)this.App.AssetDatabase.GetFaction(this.App.GameDatabase.GetPlayerFactionID(colonyInfoForPlanet.PlayerID)).GetImmigrationPopBonusValueForFaction(this.App.AssetDatabase.GetFaction(faction1.FactionID)); this.App.UI.SetText(this.App.UI.Path(itemGlobalId, "popRatio"), (faction1.CivilianPop / 1000000.0).ToString("0.0") + "M / " + (num2 / 1000000.0).ToString("0.0") + "M"); ++num1; } this.App.UI.SetShape(this._rootPanel, 0, 0, 360, 90 + 22 * (((IEnumerable <ColonyFactionInfo>)colonyInfoForPlanet.Factions).Count <ColonyFactionInfo>() > 1 ? ((IEnumerable <ColonyFactionInfo>)colonyInfoForPlanet.Factions).Count <ColonyFactionInfo>() : 0)); } else { if (colonyInfoForPlanet != null || !ShowColonizebuttons || !(this.App.CurrentState.GetType() == typeof(StarMapState))) { return; } StarSystemInfo starSystemInfo = this.App.GameDatabase.GetStarSystemInfo(this.App.GameDatabase.GetOrbitalObjectInfo(planetInfo.ID).StarSystemID); this.App.UI.SetVisible(this.App.UI.Path(this._rootPanel, "btnColoninzePlanet"), (Kerberos.Sots.StarFleet.StarFleet.CollectAvailableFleets(this.App.Game, this.App.LocalPlayer.ID, starSystemInfo.ID, MissionType.COLONIZATION, false).Any <FleetInfo>() && StarSystemDetailsUI.CollectPlanetListItemsForColonizeMission(this.App, starSystemInfo.ID, this.App.LocalPlayer.ID).Contains <int>(planetID) ? 1 : 0) != 0); this.App.UI.SetPropertyString(this.App.UI.Path(this._rootPanel, "btnColoninzePlanet"), "id", "btnColoninzePlanet|" + starSystemInfo.ID.ToString() + "|" + planetInfo.ID.ToString()); } }
private void SetSelectedPlanet(int value, string trigger) { if (this._selectedPlanetToEvacuate == value) { return; } this._selectedPlanetToEvacuate = value; this._planetWidget.Sync(this._selectedPlanetToEvacuate, false, false); StarSystemUI.SyncPlanetDetailsWidget(this.App.Game, "planetDetailsWidget", this.TargetSystem, this._selectedPlanetToEvacuate, this.GetPlanetViewGameObject(this.TargetSystem, this._selectedPlanetToEvacuate), this._planetView); this.RefreshMissionDetails(StationType.INVALID_TYPE, 1); this.UpdateCanConfirmMission(); }
public override void Initialize() { this._systemWidget = new SystemWidget(this.App, this.App.UI.Path(this.ID, "starDetailsCard")); StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(this._systemID); this._app.UI.SetText(this._app.UI.Path(this.ID, "intel_desc"), this._descriptor); this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "playerAvatar"), "sprite", Path.GetFileNameWithoutExtension(this._targetPlayer.AvatarAssetPath)); this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "playerBadge"), "sprite", Path.GetFileNameWithoutExtension(this._targetPlayer.BadgeAssetPath)); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "system_map"), true); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarSystemViewport"), false); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 0, App.Localize("@SYSTEMDETAILS_SYS_MAP")); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 1, "System"); this._app.UI.SetSelection(this._app.UI.Path(this.ID, "gameViewportList"), 0); this._crits = new GameObjectSet(this._app); this._camera = new OrbitCameraController(this._app); this._sky = new Sky(this._app, SkyUsage.InSystem, this._systemID); this._starsystem = new Kerberos.Sots.GameStates.StarSystem(this.App, 1f, this._systemID, Vector3.Zero, true, (CombatSensor)null, false, 0, false, true); this._starsystem.SetAutoDrawEnabled(false); this._starsystem.SetCamera(this._camera); this._starsystem.SetInputEnabled(true); this._starsystem.PostObjectAddObjects((IGameObject)this._sky); foreach (IGameObject state in this._starsystem.Crits.Objects.Where<IGameObject>((Func<IGameObject, bool>)(x => { if (!(x is StellarBody)) return x is StarModel; return true; }))) state.PostSetProp("AutoDrawEnabled", false); this._crits.Add((IEnumerable<IGameObject>)new IGameObject[3] { (IGameObject) this._camera, (IGameObject) this._sky, (IGameObject) this._starsystem }); this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "gameStarSystemViewport"), (object)this._starsystem.ObjectID); this._critsInitialized = false; this._camera.PostSetLook(new Vector3(0.0f, 0.0f, 0.0f)); this._camera.PostSetPosition(new Vector3(0.0f, 100000f, 0.0f)); this._camera.MaxDistance = 500000f; this._camera.MinDistance = 100000f; StarSystemUI.SyncSystemDetailsWidget(this._app, this._app.UI.Path(this.ID, "system_details"), this._systemID, false, true); StarSystemMapUI.Sync(this._app, this._systemID, this._app.UI.Path(this.ID, "system_map"), true); this._currentFilterMode = DialogSystemIntel.PlanetFilterMode.AllPlanets; this._planetWidgets = new List<PlanetWidget>(); this.SetSyncedSystem(starSystemInfo); this._systemWidget.Sync(this._systemID); }
public void Sync(int systemID) { StarSystemInfo starSystemInfo = this.App.GameDatabase.GetStarSystemInfo(systemID); if (starSystemInfo == (StarSystemInfo)null) { return; } this._systemID = systemID; this.CacheStar(starSystemInfo); StarSystemUI.SyncStarDetailsControl(this.App.Game, this._rootPanel, systemID); StarSystemUI.SyncStarDetailsStations(this.App.Game, this._rootPanel, systemID, this.App.LocalPlayer.ID); Vector4 vector4 = StarHelper.CalcModelColor(new StellarClass(starSystemInfo.StellarClass)); this.App.UI.SetPropertyColorNormalized(this.App.UI.Path(this._rootPanel, "colorGradient"), "color", vector4.X, vector4.Y, vector4.Z, 0.5f); this._initialized = false; }
public override void Initialize() { this._sky = new Sky(this._app, SkyUsage.StarMap, 0); this._crits = new GameObjectSet(this._app); this._planetView = this._crits.Add <PlanetView>(); this._crits.Add((IGameObject)this._sky); OrbitalObjectInfo orbitalObjectInfo = this._app.GameDatabase.GetOrbitalObjectInfo(this._planetID); StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(orbitalObjectInfo.StarSystemID); this._app.UI.SetText("gameColonyName", orbitalObjectInfo.Name); this._enteredColonyName = orbitalObjectInfo.Name; this._app.UI.SetVisible(this._app.UI.Path(this.ID, "btnAbandon"), false); this._app.UI.SetText(this._app.UI.Path("colonyCreateTitle"), (this._homeworld ? App.Localize("@UI_STARMAP_HOMEWORLD_ESTABLISHED") : App.Localize("@UI_STARMAP_COLONY_ESTABLISHED")) + " - " + starSystemInfo.Name); this._cameraReduced = new OrbitCameraController(this._app); this._cameraReduced.MinDistance = 2.5f; this._cameraReduced.MaxDistance = 100f; this._cameraReduced.DesiredDistance = 50f; this._cameraReduced.DesiredYaw = MathHelper.DegreesToRadians(45f); this._cameraReduced.DesiredPitch = -MathHelper.DegreesToRadians(25f); this._cameraReduced.SnapToDesiredPosition(); this._starmapReduced = new StarMap(this._app, this._app.Game, this._sky); this._starmapReduced.Initialize(this._crits); this._starmapReduced.SetCamera(this._cameraReduced); this._starmapReduced.FocusEnabled = false; this._starmapReduced.SetFocus((IGameObject)this._starmapReduced.Systems.Reverse[starSystemInfo.ID]); this._starmapReduced.Select((IGameObject)this._starmapReduced.Systems.Reverse[starSystemInfo.ID]); this._starmapReduced.SelectEnabled = false; this._starmapReduced.PostSetProp("MissionTarget", (object)this._starmapReduced.Systems.Reverse[starSystemInfo.ID].ObjectID, (object)true); this._starmapReduced.PostSetProp("CullCenter", this._app.GameDatabase.GetStarSystemInfo(starSystemInfo.ID).Origin); this._starmapReduced.PostSetProp("CullRadius", 15f); this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "gameStarMapViewport"), (object)this._starmapReduced.ObjectID); this.CachePlanet(this._app.GameDatabase.GetPlanetInfo(this._planetID)); this._planetView.PostSetProp("Planet", this._cachedPlanet != null ? this._cachedPlanet.ObjectID : 0); this._app.UI.Send((object)"SetGameObject", (object)this._app.UI.Path(this.ID, "system_details.Planet_panel"), (object)this._planetView.ObjectID); StarSystemMapUI.Sync(this._app, orbitalObjectInfo.StarSystemID, this._app.UI.Path(this.ID, "system_map"), true); StarSystemUI.SyncSystemDetailsWidget(this._app, "colony_event_dialog.system_details", orbitalObjectInfo.StarSystemID, true, true); StarSystemUI.SyncPlanetDetailsControl(this._app.Game, this._app.UI.Path(this.ID, "system_details"), this._planetID); StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), orbitalObjectInfo.ID, ""); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "system_map"), true); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarMapViewport"), false); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 0, App.Localize("@SYSTEMDETAILS_SYS_MAP")); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 1, App.Localize("@SYSTEMDETAILS_STAR_MAP")); this._app.UI.SetSelection(this._app.UI.Path(this.ID, "gameViewportList"), 0); this._crits.Activate(); }
public override void Initialize() { this._systemWidget = new SystemWidget(this.App, this.App.UI.Path(this.ID, "starDetailsCard")); StarSystemInfo starSystemInfo = this._app.GameDatabase.GetStarSystemInfo(this._systemID); this._app.UI.SetPropertyString(this._app.UI.Path(this.ID, "system_title"), "text", App.Localize("@SURVEY_OF") + " " + string.Format(App.Localize("@SURVEY_SYSTEM_THINGY"), (object)starSystemInfo.Name).ToUpperInvariant()); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "system_map"), true); this._app.UI.SetVisible(this._app.UI.Path(this.ID, "gameStarSystemViewport"), false); this._app.UI.AddItem(this._app.UI.Path(this.ID, "gameViewportList"), "", 0, App.Localize("@SYSTEMDETAILS_SYS_MAP")); this._app.UI.SetSelection(this._app.UI.Path(this.ID, "gameViewportList"), 0); StarSystemUI.SyncSystemDetailsWidget(this._app, this._app.UI.Path(this.ID, "system_details"), this._systemID, false, true); StarSystemMapUI.Sync(this._app, this._systemID, this._app.UI.Path(this.ID, "system_map"), true); this._currentFilterMode = SystemSurveyDialog.PlanetFilterMode.AllPlanets; this._planetWidgets = new List <PlanetWidget>(); this.SetSyncedSystem(starSystemInfo); this._systemWidget.Sync(this._systemID); this.UpdateCanPlaceTraps(); }
protected void SetSelectedObject(int orbitalId, string trigger) { this.SelectedObject = orbitalId; if (trigger != "gameSystemContentsList") { if (this.SelectedObject == 0) { this.App.UI.ClearSelection("gameSystemContentsList"); } else if (this.SelectedObject == StarSystemDetailsUI.StarItemID) { this.App.UI.SetSelection("gameSystemContentsList", this.SelectedObject); } else { OrbitalObjectInfo orbitalObjectInfo = this.App.GameDatabase.GetOrbitalObjectInfo(this.SelectedObject); if (!orbitalObjectInfo.ParentID.HasValue) { this.App.UI.SetSelection("gameSystemContentsList", this.SelectedObject); } else { IGameObject planetViewObject; this._starsystem.PlanetMap.Reverse.TryGetValue(orbitalObjectInfo.ParentID.Value, out planetViewObject); StarSystemUI.SyncPlanetDetailsWidget(this.App.Game, "planetDetailsWidget", this._currentSystem, orbitalId, planetViewObject, this._planetView); if (planetViewObject != null) { this.App.UI.SetSelection("gameSystemContentsList", orbitalObjectInfo.ParentID.Value); } else { this.App.UI.ClearSelection("gameSystemContentsList"); } } } this.Focus(this.SelectedObject); } StarSystemUI.SyncPlanetDetailsWidget(this.App.Game, "planetDetailsWidget", this.CurrentSystem, this.SelectedObject, this.GetPlanetViewGameObject(this.CurrentSystem, this.SelectedObject), this._planetView); StarSystemUI.SyncColonyDetailsWidget(this.App.Game, "colonyDetailsWidget", this.SelectedObject, ""); }
protected override void OnEnter() { base.OnEnter(); StarSystemUI.SyncSystemDetailsWidget(this.App, "systemDetailsWidget", this.TargetSystem, false, true); if (this.MissionType == MissionType.RELOCATION) { this._RelocatefleetWidget = new FleetWidget(this.App, this.App.UI.Path(this.ID, "gameRelocateFleet")); } if (this.MissionType == MissionType.RELOCATION) { this._RelocatefleetWidget.MissionMode = MissionType.NO_MISSION; this._fleetWidget.LinkWidget(this._RelocatefleetWidget); this._RelocatefleetWidget.LinkWidget(this._fleetWidget); this._RelocatefleetWidget.OnFleetsModified += new FleetWidget.FleetsModifiedDelegate(this.FleetsModified); } this.CaravanMode = false; this.CaravanFleet = new int?(); this.SelectedCaravanSourceSystem = new int?(); if (this._app.AssetDatabase.GetFaction(this._app.GameDatabase.GetPlayerInfo(this._app.LocalPlayer.ID).FactionID).Name == "loa" || this._fleetCentric) { this._app.UI.SetVisible(this.UI.Path(this.ID, "RelocateAssetsBTN"), false); this._app.UI.SetEnabled(this.UI.Path(this.ID, "RelocateAssetsBTN"), false); } else { this._app.UI.SetVisible(this.UI.Path(this.ID, "RelocateAssetsBTN"), true); if (this.CanDoCaravan()) { this._app.UI.SetEnabled(this.UI.Path(this.ID, "RelocateAssetsBTN"), true); } else { this._app.UI.SetEnabled(this.UI.Path(this.ID, "RelocateAssetsBTN"), false); } } this._app.UI.SetVisible(this.UI.Path(this.ID, "caravanFade"), false); }
protected override void OnEnter() { base.OnEnter(); StarSystemUI.SyncSystemDetailsWidget(this.App, "systemDetailsWidget", this.TargetSystem, false, true); }
protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams) { if (msgType == "edit_confirmed") { this.Confirm(); } if (msgType == "button_clicked") { if (!(panelName == "event_dialog_close")) { return; } this.Confirm(); } else if (msgType == "text_changed") { if (!(panelName == "gameColonyName")) { return; } this._enteredColonyName = msgParams[0]; } else if (msgType == "slider_value") { if (StarSystemDetailsUI.IsOutputRateSlider(panelName)) { StarSystemDetailsUI.SetOutputRate(this._app, this._planetID, panelName, msgParams[0]); StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), this._planetID, panelName); } else if (panelName == "partOverharvestSlider") { ColonyInfo colonyInfoForPlanet = this._app.GameDatabase.GetColonyInfoForPlanet(this._planetID); colonyInfoForPlanet.OverharvestRate = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0])); this._app.GameDatabase.UpdateColony(colonyInfoForPlanet); StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), this._planetID, panelName); } else if (panelName == "partCivSlider") { ColonyInfo colonyInfoForPlanet = this._app.GameDatabase.GetColonyInfoForPlanet(this._planetID); colonyInfoForPlanet.CivilianWeight = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0])); this._app.GameDatabase.UpdateColony(colonyInfoForPlanet); StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), this._planetID, panelName); } else { if (!(panelName == "partWorkRate")) { return; } ColonyInfo colonyInfoForPlanet = this._app.GameDatabase.GetColonyInfoForPlanet(this._planetID); colonyInfoForPlanet.SlaveWorkRate = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0])); this._app.GameDatabase.UpdateColony(colonyInfoForPlanet); StarSystemUI.SyncColonyDetailsWidget(this._app.Game, this._app.UI.Path(this.ID, "colony_details"), this._planetID, panelName); } } else { if (!(msgType == "list_sel_changed") || !(panelName == "gameViewportList")) { return; } this.SetColonyViewMode(int.Parse(msgParams[0])); } }
protected void UICommChannel_OnPanelMessage( string panelName, string msgType, string[] msgParams) { if (msgType == "slider_value") { if (!panelName.StartsWith("__")) { return; } string[] strArray = panelName.Split('|'); if (int.Parse(strArray[1]) != this._widgetID) { return; } ColonyInfo colonyInfo = this.App.GameDatabase.GetColonyInfo(int.Parse(strArray[2])); if (colonyInfo == null) { return; } if (PlanetWidget.IsOutputRateSlider(panelName)) { StarSystemDetailsUI.SetOutputRateNew(this.App, colonyInfo.OrbitalObjectID, panelName, msgParams[0]); StarSystemUI.SyncColonyDetailsControlNew(this.App.Game, this._rootPanel, colonyInfo.ID, this._widgetID, panelName); } if (strArray[0].Contains("partOverharvestSlider")) { colonyInfo.OverharvestRate = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0])); this.App.GameDatabase.UpdateColony(colonyInfo); StarSystemUI.SyncColonyDetailsControlNew(this.App.Game, this._rootPanel, colonyInfo.ID, this._widgetID, panelName); } else if (strArray[0].Contains("partCivSlider")) { colonyInfo.CivilianWeight = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0])); this.App.GameDatabase.UpdateColony(colonyInfo); StarSystemUI.SyncColonyDetailsControlNew(this.App.Game, this._rootPanel, colonyInfo.ID, this._widgetID, panelName); } else { if (!strArray[0].Contains("partPopSlider")) { return; } int lockedVar = int.Parse(strArray[3]); Dictionary <int, float> ratios = new Dictionary <int, float>(); foreach (ColonyFactionInfo faction in colonyInfo.Factions) { ratios.Add(faction.FactionID, faction.CivPopWeight); } AlgorithmExtensions.DistributePercentages <int>(ref ratios, lockedVar, StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0]))); foreach (ColonyFactionInfo faction in colonyInfo.Factions) { faction.CivPopWeight = ratios[faction.FactionID]; this.App.GameDatabase.UpdateCivilianPopulation(faction); } this.App.GameDatabase.UpdateColony(colonyInfo); StarSystemUI.SyncColonyDetailsControlNew(this.App.Game, this._rootPanel, colonyInfo.ID, this._widgetID, panelName); } } else { if (!(msgType == "slider_notched") || !panelName.StartsWith("__")) { return; } string[] strArray = panelName.Split('|'); if (int.Parse(strArray[1]) != this._widgetID) { return; } ColonyInfo colonyInfo = this.App.GameDatabase.GetColonyInfo(int.Parse(strArray[2])); if (colonyInfo == null || !panelName.Contains("partTradeSlider")) { return; } PlanetWidget.UpdateTradeSliderNotchInfo(this.App, colonyInfo.ID, int.Parse(msgParams[0])); } }
protected override void OnPanelMessage(string panelName, string msgType, string[] msgParams) { if (this._piechart.TryPanelMessage(panelName, msgType, msgParams, PanelBinding.PanelMessageTargetFlags.Self)) { return; } if (msgType == "slider_value") { if (this.SelectedObject == StarSystemDetailsUI.StarItemID) { return; } if (StarSystemDetailsUI.IsOutputRateSlider(panelName)) { StarSystemDetailsUI.SetOutputRate(this.App, this.SelectedObject, panelName, msgParams[0]); StarSystemUI.SyncColonyDetailsWidget(this.App.Game, "colonyDetailsWidget", this.SelectedObject, ""); } else if (panelName == "partOverharvestSlider") { ColonyInfo colonyInfoForPlanet = this.App.GameDatabase.GetColonyInfoForPlanet(this.SelectedObject); colonyInfoForPlanet.OverharvestRate = StarSystemDetailsUI.SliderValueToOutputRate(int.Parse(msgParams[0])); this.App.GameDatabase.UpdateColony(colonyInfoForPlanet); StarSystemUI.SyncColonyDetailsWidget(this.App.Game, "colonyDetailsWidget", this.SelectedObject, ""); } else { if (!(panelName == "gameEmpireResearchSlider")) { return; } StarMapState.SetEmpireResearchRate(this.App.Game, msgParams[0], this._piechart); } } else if (msgType == "button_clicked") { if (panelName == "gameEmpireSummaryButton") { this.App.SwitchGameState <EmpireSummaryState>(); } else if (panelName == "btnAbandon") { this._confirmAbandon = this.App.UI.CreateDialog((Dialog) new GenericQuestionDialog(this.App, "@UI_DIALOGCONFIRMABANDON_TITLE", "@UI_DIALOGCONFIRMABANDON_DESC", "dialogGenericQuestion"), null); } else { if (!(panelName == "btnSystemOpen")) { return; } bool isOpen = !this.App.GameDatabase.GetStarSystemInfo(this.CurrentSystem).IsOpen; this.App.GameDatabase.UpdateStarSystemOpen(this.CurrentSystem, isOpen); this.App.UI.SetVisible("SystemDetailsWidget.ClosedSystem", !isOpen); this.App.Game.OCSystemToggleData.SystemToggled(this.App.LocalPlayer.ID, this.CurrentSystem, isOpen); } } else { if (!(msgType == "dialog_closed") || !(panelName == this._confirmAbandon) || !bool.Parse(msgParams[0])) { return; } PlanetInfo planetInfo = this.App.GameDatabase.GetPlanetInfo(this.SelectedObject); if (planetInfo == null) { return; } GameSession.AbandonColony(this.App, this.App.GameDatabase.GetColonyInfoForPlanet(planetInfo.ID).ID); } }