private void UpdateBases() { Debug.Log ("Updating Bases"); InstanceData GameInstance = StateFundingGlobal.fetch.GameInstance; Vessel[] _Bases = VesselHelper.GetBases (); Bases = new BaseReport[_Bases.Length]; for (int i = 0; i < _Bases.Length; i++) { Vessel Base = _Bases [i]; BaseReport _BaseReport = new BaseReport (); _BaseReport.name = Base.vesselName; _BaseReport.crew = VesselHelper.GetCrew (Base).Length; _BaseReport.crewCapacity = VesselHelper.GetCrewCapactiy (Base); _BaseReport.dockedVessels = VesselHelper.GetDockedVesselsCount (Base); _BaseReport.dockingPorts = VesselHelper.GetDockingPorts (Base).Length; _BaseReport.drill = VesselHelper.VesselHasModuleAlias (Base, "Drill"); _BaseReport.scienceLab = VesselHelper.VesselHasModuleAlias (Base, "ScienceLab"); _BaseReport.fuel = VesselHelper.GetResourceCount (Base, "LiquidFuel"); _BaseReport.ore = VesselHelper.GetResourceCount (Base, "Ore"); _BaseReport.entity = Base.mainBody.name; _BaseReport.po = 0; _BaseReport.sc = 0; _BaseReport.po += (int)(5 * _BaseReport.crew * GameInstance.Gov.poModifier); _BaseReport.po += (int)(5 * _BaseReport.dockedVessels * GameInstance.Gov.poModifier); _BaseReport.po += (int)((Base.mainBody.Radius / refRadius) * (_BaseReport.dockedVessels + 1) * GameInstance.Gov.poModifier); _BaseReport.sc += (int)(2 * _BaseReport.crewCapacity * GameInstance.Gov.scModifier); _BaseReport.sc += (int)(_BaseReport.fuel / 200f * GameInstance.Gov.scModifier); _BaseReport.sc += (int)(_BaseReport.ore / 200f * GameInstance.Gov.scModifier); _BaseReport.sc += (int)(2 * _BaseReport.dockingPorts * GameInstance.Gov.scModifier); _BaseReport.sc += (int)(2 * _BaseReport.crewCapacity * GameInstance.Gov.scModifier); if (_BaseReport.scienceLab) { _BaseReport.po += (int)(10 * GameInstance.Gov.poModifier); _BaseReport.sc += (int)(10 * GameInstance.Gov.poModifier); } if (_BaseReport.drill) { _BaseReport.po += (int)(10 * GameInstance.Gov.poModifier); _BaseReport.sc += (int)(10 * GameInstance.Gov.poModifier); } Bases [i] = _BaseReport; } }
public static void drawItem(BaseReport Base, ViewScroll parent, int offset) { int boxHeight = 110; ViewBox Box = new ViewBox (); Box.setRelativeTo (parent); Box.setWidth (parent.getWidth () - 20); Box.setHeight (boxHeight); Box.setLeft (0); Box.setTop ((boxHeight + 10) * offset); Box.setColor (Color.white); parent.Components.Add (Box); string label = "[" + Base.name + " is Landed At " + Base.entity + "]"; ViewLabel BaseLabel = new ViewLabel (label); BaseLabel.setRelativeTo (Box); BaseLabel.setTop (5); BaseLabel.setLeft (5); BaseLabel.setHeight (15); BaseLabel.setPercentWidth (100); BaseLabel.setColor (Color.green); parent.Components.Add (BaseLabel); ViewLabel FuelLabel = new ViewLabel ("Fuel: " + Base.fuel); FuelLabel.setRelativeTo (Box); FuelLabel.setTop (25); FuelLabel.setLeft (5); FuelLabel.setHeight (15); FuelLabel.setWidth (150); FuelLabel.setColor (Color.white); parent.Components.Add (FuelLabel); ViewLabel OreLabel = new ViewLabel ("Ore: " + Base.ore); OreLabel.setRelativeTo (Box); OreLabel.setTop (45); OreLabel.setLeft (5); OreLabel.setHeight (20); OreLabel.setWidth (150); OreLabel.setColor (Color.white); parent.Components.Add (OreLabel); ViewLabel CrewLabel = new ViewLabel ("Crew: " + Base.crew); CrewLabel.setRelativeTo (Box); CrewLabel.setTop (65); CrewLabel.setLeft (5); CrewLabel.setHeight (20); CrewLabel.setWidth (150); CrewLabel.setColor (Color.white); parent.Components.Add (CrewLabel); ViewLabel CrewCapacityLabel = new ViewLabel ("Crew Capacity: " + Base.crewCapacity); CrewCapacityLabel.setRelativeTo (Box); CrewCapacityLabel.setTop (85); CrewCapacityLabel.setLeft (5); CrewCapacityLabel.setHeight (20); CrewCapacityLabel.setWidth (150); CrewCapacityLabel.setColor (Color.white); parent.Components.Add (CrewCapacityLabel); ViewLabel DockingPortsLabel = new ViewLabel ("Docking Ports: " + Base.dockingPorts); DockingPortsLabel.setRelativeTo (Box); DockingPortsLabel.setTop (25); DockingPortsLabel.setLeft (155); DockingPortsLabel.setHeight (15); DockingPortsLabel.setWidth (150); DockingPortsLabel.setColor (Color.white); parent.Components.Add (DockingPortsLabel); ViewLabel DockedVesselsLabel = new ViewLabel ("Docked Vessels: " + Base.dockedVessels); DockedVesselsLabel.setRelativeTo (Box); DockedVesselsLabel.setTop (45); DockedVesselsLabel.setLeft (155); DockedVesselsLabel.setHeight (15); DockedVesselsLabel.setWidth (150); DockedVesselsLabel.setColor (Color.white); parent.Components.Add (DockedVesselsLabel); ViewLabel ScienceLabLabel = new ViewLabel ("Science Lab: " + Base.scienceLab); ScienceLabLabel.setRelativeTo (Box); ScienceLabLabel.setTop (65); ScienceLabLabel.setLeft (155); ScienceLabLabel.setHeight (15); ScienceLabLabel.setWidth (150); ScienceLabLabel.setColor (Color.white); parent.Components.Add (ScienceLabLabel); ViewLabel HasDrillLabel = new ViewLabel ("Has Drill: " + Base.drill); HasDrillLabel.setRelativeTo (Box); HasDrillLabel.setTop (85); HasDrillLabel.setLeft (155); HasDrillLabel.setHeight (15); HasDrillLabel.setWidth (150); HasDrillLabel.setColor (Color.white); parent.Components.Add (HasDrillLabel); ViewLabel SCLabel = new ViewLabel ("PO: " + Base.po); SCLabel.setRelativeTo (Box); SCLabel.setTop (25); SCLabel.setLeft (310); SCLabel.setHeight (15); SCLabel.setWidth (150); SCLabel.setColor (Color.white); parent.Components.Add (SCLabel); ViewLabel POLabel = new ViewLabel ("SC: " + Base.sc); POLabel.setRelativeTo (Box); POLabel.setTop (45); POLabel.setLeft (310); POLabel.setHeight (15); POLabel.setWidth (150); POLabel.setColor (Color.white); parent.Components.Add (POLabel); }
public string GetText() { Instance Inst = StateFundingGlobal.fetch.GameInstance; string returnText = "# Review for Quarter: " + year + "\n\n" + "Funding: " + funds + "\n\n" + "Public Opinion: " + po + "\n" + "State Confidence: " + sc + "\n" + "Public Opinion After Modifiers & Decay: " + finalPO + "\n" + "State Confidence After Modifiers & Decay: " + finalSC + "\n\n" + "Active Kerbals: " + activeKerbals + "\n" + "Satellite Coverage: " + Math.Round(satelliteCoverage * 100) + "%\n" + "Active Mining Rigs: " + miningRigs + "\n" + "Rovers: " + rovers + "\n" + "Obital Science Stations: " + orbitalScienceStations + "\n" + "Planetary Science Stations: " + planetaryScienceStations + "\n" + "Govt. Contracts Completed: " + contractsCompleted + "\n" + "Govt. Contracts Failed: " + contractsFailed + "\n" + "Kerbal \"Accidents\": " + kerbalDeaths + "\n" + "Stranded Kerbals: " + strandedKerbals + "\n" + "Vessels Destroyed: " + vesselsDestroyed; if (SpaceStations.Length > 0) { returnText += "\n\n== Space Stations ==\n\n"; for (int i = 0; i < SpaceStations.Length; i++) { SpaceStationReport StationReport = SpaceStations [i]; returnText += "[" + StationReport.name + " Orbiting " + StationReport.entity + "]\n"; returnText += "Fuel: " + StationReport.fuel + "\n"; returnText += "Ore: " + StationReport.ore + "\n"; returnText += "Crew: " + StationReport.crew + "\n"; returnText += "Crew Capacity: " + StationReport.crewCapacity + "\n"; returnText += "Docked Vessels: " + StationReport.dockedVessels + "\n"; returnText += "Docking Ports: " + StationReport.dockingPorts + "\n"; returnText += "Has Drill: " + StationReport.drill + "\n"; returnText += "Science Lab: " + StationReport.scienceLab + "\n"; returnText += "On Astroid: " + StationReport.onAstroid + "\n"; returnText += "PO: " + StationReport.po + "\n"; returnText += "SC: " + StationReport.sc + "\n\n"; } } if (Bases.Length > 0) { returnText += "\n\n== Bases ==\n\n"; for (int i = 0; i < Bases.Length; i++) { BaseReport Base = Bases [i]; returnText += "[" + Base.name + " Landed At " + Base.entity + "]\n"; returnText += "Fuel: " + Base.fuel + "\n"; returnText += "Ore: " + Base.ore + "\n"; returnText += "Crew: " + Base.crew + "\n"; returnText += "Crew Capacity: " + Base.crewCapacity + "\n"; returnText += "Docked Vessels: " + Base.dockedVessels + "\n"; returnText += "Docking Ports: " + Base.dockingPorts + "\n"; returnText += "Has Drill: " + Base.drill + "\n"; returnText += "Science Lab: " + Base.scienceLab + "\n"; returnText += "PO: " + Base.po + "\n"; returnText += "SC: " + Base.sc + "\n\n"; } } return(returnText); }