public static void SyncSupplies(App game, DesignInfo design) { int propertyValue1 = (int)((double)design.SupplyAvailable * (double)game.GetStratModifier <float>(StratModifiers.ShipSupplyModifier, design.PlayerID)); int supplyRequired = design.SupplyRequired; int propertyValue2 = propertyValue1; int crewAvailable = design.CrewAvailable; int crewRequired = design.CrewRequired; int propertyValue3 = crewAvailable; int powerAvailable = design.PowerAvailable; int powerRequired = design.PowerRequired; int propertyValue4 = powerAvailable; int endurance = design.GetEndurance(game.Game); float num = 1f; PlayerInfo pi = game.GameDatabase.GetPlayerInfo(design.PlayerID); if (pi != null) { Faction faction = game.AssetDatabase.Factions.FirstOrDefault <Faction>((Func <Faction, bool>)(x => x.ID == pi.FactionID)); if (faction != null) { num = faction.CrewEfficiencyValue; } } game.UI.SetPropertyInt("gameShipSupply", "max", propertyValue1); game.UI.SetPropertyInt("gameShipSupply", "req", supplyRequired); game.UI.SetPropertyInt("gameShipSupply", "cur", propertyValue2); game.UI.SetPropertyInt("gameShipCrew", "max", crewAvailable); game.UI.SetPropertyInt("gameShipCrew", "req", (int)((double)crewRequired / (double)num)); game.UI.SetPropertyInt("gameShipCrew", "cur", propertyValue3); game.UI.SetPropertyInt("gameShipEnergy", "max", powerAvailable); game.UI.SetPropertyInt("gameShipEnergy", "req", powerRequired); game.UI.SetPropertyInt("gameShipEnergy", "cur", propertyValue4); game.UI.SetPropertyString("gameShipEnduranceVal", "text", string.Format("{0}T", (object)endurance)); if (design.Role == ShipRole.DRONE || design.Role == ShipRole.ASSAULTSHUTTLE) { game.UI.SetVisible("gameShipEnduranceVal", false); game.UI.SetVisible("gameShipEnduranceLab", false); } else { game.UI.SetVisible("gameShipEnduranceVal", true); game.UI.SetVisible("gameShipEnduranceLab", true); } if (game.AssetDatabase.GetFaction(game.GameDatabase.GetPlayerFactionID(design.PlayerID)).Name == "loa" || design.Role == ShipRole.DRONE || design.Role == ShipRole.ASSAULTSHUTTLE) { game.UI.SetVisible("gameShipCrew", false); game.UI.SetVisible("gameShipCrewIcon", false); } else { game.UI.SetVisible("gameShipCrew", true); game.UI.SetVisible("gameShipCrewIcon", true); } }
private void SyncDesignTooltipByDesign(string panelId, int designID) { DesignInfo designInfo = this._game.GameDatabase.GetDesignInfo(designID); List <SectionEnumerations.DesignAttribute> list = this._game.GameDatabase.GetDesignAttributesForDesign(designInfo.ID).ToList <SectionEnumerations.DesignAttribute>(); List <int> intList = new List <int>(); foreach (DesignSectionInfo designSection in designInfo.DesignSections) { foreach (WeaponBankInfo weaponBank in designSection.WeaponBanks) { if (weaponBank.WeaponID.HasValue && !intList.Contains(weaponBank.WeaponID.Value)) { intList.Add(weaponBank.WeaponID.Value); } } } this.App.UI.SetText(this.App.UI.Path(panelId, "lblDesignName"), designInfo.Name); this.App.UI.SetText(this.App.UI.Path(panelId, "lblShipName"), ""); this.App.UI.SetText(this.App.UI.Path(panelId, "lblFirstSection"), ((IEnumerable <DesignSectionInfo>)designInfo.DesignSections).Count <DesignSectionInfo>() > 0 ? designInfo.DesignSections[0].ShipSectionAsset.Title : ""); this.App.UI.SetText(this.App.UI.Path(panelId, "lblSecondSection"), ((IEnumerable <DesignSectionInfo>)designInfo.DesignSections).Count <DesignSectionInfo>() > 1 ? designInfo.DesignSections[1].ShipSectionAsset.Title : ""); this.App.UI.SetText(this.App.UI.Path(panelId, "lblThirdSection"), ((IEnumerable <DesignSectionInfo>)designInfo.DesignSections).Count <DesignSectionInfo>() > 2 ? designInfo.DesignSections[2].ShipSectionAsset.Title : ""); this.App.UI.SetText(this.App.UI.Path(panelId, "lblAttributeName"), !designInfo.isAttributesDiscovered || list.Count <= 0 ? "" : App.Localize("@UI_" + list.First <SectionEnumerations.DesignAttribute>().ToString())); this.App.UI.SetText(this.App.UI.Path(panelId, "lblUpkeep"), GameSession.CalculateShipUpkeepCost(this._game.AssetDatabase, designInfo, 1f, false).ToString()); this.App.UI.SetText(this.App.UI.Path(panelId, "lblShipAge"), ""); this.App.UI.SetText(this.App.UI.Path(panelId, "lblSupply"), string.Format("{0}/{1}", (object)designInfo.SupplyRequired, (object)designInfo.SupplyAvailable)); this.App.UI.SetText(this.App.UI.Path(panelId, "lblPower"), string.Format("{0}/{1}", (object)designInfo.PowerRequired, (object)designInfo.PowerAvailable)); this.App.UI.SetText(this.App.UI.Path(panelId, "lblCrew"), string.Format("{0}/{1}", (object)designInfo.CrewRequired, (object)designInfo.CrewAvailable)); this.App.UI.SetText(this.App.UI.Path(panelId, "lblEndurance"), designInfo.GetEndurance(this._game.Game).ToString()); this.App.UI.ClearItems("lstWeaponIcons"); foreach (int num in intList) { string asset = this.App.GameDatabase.GetWeaponAsset(num); LogicalWeapon logicalWeapon = this.App.AssetDatabase.Weapons.FirstOrDefault <LogicalWeapon>((Func <LogicalWeapon, bool>)(x => x.FileName == asset)); if (logicalWeapon != null) { this.App.UI.AddItem("lstWeaponIcons", string.Empty, num, ""); this.App.UI.SetPropertyString(this.App.UI.Path(this.App.UI.GetItemGlobalID("lstWeaponIcons", string.Empty, num, ""), "imgWeaponIcon"), "sprite", logicalWeapon.IconSpriteName); } } float num1 = ShipTooltip.ArmorPanelShape.W / 2f; this.App.UI.SetShape("top_armor", 0, 0, (int)ShipTooltip.ArmorPanelShape.W, (int)num1); this.App.UI.SetShape("bottom_armor", 0, (int)num1, (int)ShipTooltip.ArmorPanelShape.W, (int)num1); this.App.UI.SetShape("left_armor", 0, 0, (int)num1, (int)ShipTooltip.ArmorPanelShape.H); this.App.UI.SetShape("right_armor", (int)num1, 0, (int)num1, (int)ShipTooltip.ArmorPanelShape.H); this._builder.New(this.App.GetPlayer(designInfo.PlayerID), designInfo, "The Ship You Wish your Ship was", 0, false); this._ready = false; this._activated = false; }