public void CompleteReview() { InstanceData Inst = StateFundingGlobal.fetch.GameInstance; if (Inst == null) { Log.Error("ReviewManager.CompleteReview, Inst is null"); return; } Review Rev = Inst.ActiveReview; Rev.touch(); // Closed for business Rev.closeReview(); // Move review to past review Inst.addReview(Rev); // Start a new review Inst.ActiveReview = new Review(); // Apply funds from Review Log.Info("Adding Funds: " + Rev.funds); Funding.Instance.AddFunds(Rev.funds, TransactionReasons.None); // Notify player that a review is available ReviewToastView Toast = new ReviewToastView(Rev); Log.Info("Generated Review"); }
public void CompleteReview() { Instance Inst = StateFundingGlobal.fetch.GameInstance; Review Rev = Inst.ActiveReview; Rev.touch(); // Closed for business Rev.pastReview = true; // Move review to past review Inst.addReview(Rev); // Start a new review Inst.ActiveReview = new Review(); // Apply PO/SC decay on instance ApplyDecay(); // Apply funds from Review Debug.Log("Adding Funds: " + Rev.funds); Funding.Instance.AddFunds(Rev.funds, TransactionReasons.None); // Notify player that a review is available ReviewToastView Toast = new ReviewToastView(Rev); // Save the instance and game StateFundingGlobal.fetch.InstanceConf.saveInstance(Inst); GamePersistence.SaveGame("persistent", HighLogic.SaveFolder, SaveMode.OVERWRITE); Debug.Log("Generated Review"); }
private void LoadMiningRigs() { reloadBase(); Window.title = "Mining Rigs"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); string Description = "Below is a list of existing Mining Rigs. Having more Mining Rigs increases State " + "Confidence. To have a qualified Mining Rig is must have an antenna, drill, be able to generate power, " + "and be Landed on a body other than Kerbin."; ViewLabel DescriptionLabel = new ViewLabel(Description); DescriptionLabel.setRelativeTo(Window); DescriptionLabel.setLeft(140); DescriptionLabel.setTop(20); DescriptionLabel.setColor(Color.white); DescriptionLabel.setHeight(100); DescriptionLabel.setWidth(Window.getWidth() - 140); this.addComponent(DescriptionLabel); ViewLabel TotalCoverage = new ViewLabel("Mining Rigs: " + Rev.miningRigs); TotalCoverage.setRelativeTo(Window); TotalCoverage.setLeft(140); TotalCoverage.setTop(130); TotalCoverage.setColor(Color.white); TotalCoverage.setHeight(30); TotalCoverage.setWidth(Window.getWidth() - 140); this.addComponent(TotalCoverage); Vessel[] MiningRigs = VesselHelper.GetMiningRigs(); int offsetY = 150; int labelHeight = 20; for (int i = 0; i < MiningRigs.Length; i++) { Vessel MiningRig = MiningRigs [i]; string label = MiningRig.GetName() + " is Landed At " + MiningRig.mainBody.GetName();; ViewLabel MiningLabel = new ViewLabel(label); MiningLabel.setRelativeTo(Window); MiningLabel.setTop(offsetY + labelHeight + (labelHeight + 5) * i); MiningLabel.setLeft(140); MiningLabel.setHeight(labelHeight); MiningLabel.setWidth(Window.getWidth() - 140); MiningLabel.setColor(Color.white); this.addComponent(MiningLabel); } }
private void createWindow() { Window = new ViewWindow("Review"); Window.setMargins(300, 100); Image = new ViewImage("assets/kerbalfunding.jpg"); Image.setRelativeTo(Window); Image.setPercentWidth(100); Label = new ViewLabel("Could be worse."); Label.setRelativeTo(Image); Label.setPercentWidth(80); Label.setPercentHeight(20); Label.setPercentLeft(10); Label.setPercentTop(80); Label.setFontSize(18); Label.setColor(Color.white); Confirm = new ViewButton("Ok", OnConfirm); Confirm.setRelativeTo(Window); Confirm.setWidth(100); Confirm.setHeight(30); Confirm.setRight(5); Confirm.setBottom(5); if (!Rev.pastReview) { Rev.touch(); } ReviewText = new ViewTextArea(Rev.GetSummaryText()); ReviewText.setRelativeTo(Image); ReviewText.setPercentWidth(100); ReviewText.setTop(Image.getHeight() + 10); ReviewText.setHeight(Window.getHeight() - Image.getHeight() - Confirm.getHeight() - 20); ReviewText.setColor(Color.white); this.addComponent(Window); this.addComponent(Image); this.addComponent(Label); this.addComponent(Confirm); this.addComponent(ReviewText); List <ViewSummaryRow> summaryRows = Rev.GetText(); for (int i = 0; i < summaryRows.Count; i++) { ViewSummaryRow row = summaryRows[i]; row.setRelativeTo(ReviewText); row.setHeight(30); row.setPercentWidth(100); row.setTop(15 * i + 10); row.setLeft(300); row.setColor(Color.white); this.addComponent(row); } }
public static void draw(View Vw, ViewWindow Window) { Window.title = "Space Stations"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); string Description = "Below is a list of existing Space Stations. Vessels that are Space Stations should be labeled as " + "such, be in orbit, and must be able to generate their own power. Space Stations increase State Confidence as well as Public Opinion." + "Space Stations are scored by the following criteria: Total Fuel (SC), Total Ore (SC), Crew (PO), Crew Capacity (SC), Docking " + "Port Count (SC), Docked Vessels (PO) and if it has a science lab (SC/PO). If the Station is landed on an astroid it will also " + "get a bonus (PO). If you are on an astroid you will also get a bonus for having a drill (SC/PO)."; ViewLabel DescriptionLabel = new ViewLabel(Description); DescriptionLabel.setRelativeTo(Window); DescriptionLabel.setLeft(140); DescriptionLabel.setTop(20); DescriptionLabel.setColor(Color.white); DescriptionLabel.setHeight(100); DescriptionLabel.setWidth(Window.getWidth() - 140); Vw.addComponent(DescriptionLabel); ViewLabel TotalStations = new ViewLabel("Total Stations: " + Rev.SpaceStations.Length); TotalStations.setRelativeTo(Window); TotalStations.setLeft(140); TotalStations.setTop(130); TotalStations.setColor(Color.white); TotalStations.setHeight(30); TotalStations.setWidth(Window.getWidth() - 140); Vw.addComponent(TotalStations); ViewScroll StationsScroll = new ViewScroll(); StationsScroll.setRelativeTo(Window); StationsScroll.setWidth(Window.getWidth() - 140); StationsScroll.setHeight(Window.getHeight() - 160); StationsScroll.setLeft(140); StationsScroll.setTop(150); Vw.addComponent(StationsScroll); SpaceStationReport[] Stations = Rev.SpaceStations; for (int i = 0; i < Stations.Length; i++) { drawItem(Stations [i], StationsScroll, i); } }
public static void draw(View Vw, ViewWindow Window) { Window.title = "Bases"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); string Description = "Below is a list of existing Bases. Vessels that are Bases should be labeled as " + "such, be landed on a body other than the home planet, and be able to generate power. Bases increase State Confidence " + "as well as Public Opinion. Bases are scored by the following criteria: Total Fuel (SC), Total Ore (SC), Crew (PO), Crew Capacity " + "(SC), Docking Port Count (SC), Docked Vessels (PO), if it has a science lab (SC/PO), and if it has a drill (SC/PO)."; ViewLabel DescriptionLabel = new ViewLabel(Description); DescriptionLabel.setRelativeTo(Window); DescriptionLabel.setLeft(140); DescriptionLabel.setTop(20); DescriptionLabel.setColor(Color.white); DescriptionLabel.setHeight(100); DescriptionLabel.setWidth(Window.getWidth() - 140); Vw.addComponent(DescriptionLabel); ViewLabel TotalBases = new ViewLabel("Total Bases: " + Rev.Bases.Length); TotalBases.setRelativeTo(Window); TotalBases.setLeft(140); TotalBases.setTop(130); TotalBases.setColor(Color.white); TotalBases.setHeight(30); TotalBases.setWidth(Window.getWidth() - 140); Vw.addComponent(TotalBases); ViewScroll BasesScroll = new ViewScroll(); BasesScroll.setRelativeTo(Window); BasesScroll.setWidth(Window.getWidth() - 140); BasesScroll.setHeight(Window.getHeight() - 160); BasesScroll.setLeft(140); BasesScroll.setTop(150); Vw.addComponent(BasesScroll); BaseReport[] Bases = Rev.Bases; for (int i = 0; i < Bases.Length; i++) { drawItem(Bases [i], BasesScroll, i); } }
public static void draw(View Vw, ViewWindow Window) { Window.title = "Current State"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); ViewTextArea TextArea = new ViewTextArea(GameInstance.ActiveReview.GetText()); TextArea.setRelativeTo(Window); TextArea.setTop(40); TextArea.setLeft(130); TextArea.setWidth(Window.getWidth() - 140); TextArea.setHeight(Window.getHeight() - 40); TextArea.setColor(Color.white); Vw.addComponent(TextArea); }
private void LoadCurrentState() { reloadBase(); Window.title = "Current State"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); ViewTextArea TextArea = new ViewTextArea(GameInstance.ActiveReview.GetText()); TextArea.setRelativeTo(Window); TextArea.setTop(40); TextArea.setLeft(130); TextArea.setWidth(Window.getWidth() - 140); TextArea.setHeight(Window.getHeight() - 40); TextArea.setColor(Color.white); this.addComponent(TextArea); }
public static void draw(View Vw, ViewWindow Window) { Window.title = "Current State"; InstanceData GameInstance = StateFundingGlobal.fetch.GameInstance; if (GameInstance == null) { Log.Error("StateFundingHubCurrentView.draw, Inst is null"); return; } Review Rev = GameInstance.ActiveReview; Rev.touch(); ViewTextArea TextArea = new ViewTextArea(GameInstance.ActiveReview.GetSummaryText()); TextArea.setRelativeTo(Window); TextArea.setTop(40); TextArea.setLeft(130); TextArea.setWidth(Window.getWidth() - 140); TextArea.setHeight(Window.getHeight() - 40); TextArea.setColor(Color.white); Vw.addComponent(TextArea); List <ViewSummaryRow> summaryRows = Rev.GetText(); for (int i = 0; i < summaryRows.Count; i++) { ViewSummaryRow row = summaryRows[i]; row.setRelativeTo(TextArea); row.setHeight(30); row.setPercentWidth(100); row.setTop(200 + 20 * i + 10); row.setColor(Color.white); Vw.addComponent(row); } }
public static void draw(View Vw, ViewWindow Window) { Window.title = "Satellite Coverage"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); string Description = "Below is your space programs satellite coverage. Satellite coverage increases State Confidence. " + "The number of satellites needed to provide full coverage veries depending on the size of the " + "celestial body. Kerbin needs 10 satelites to be fully covered while a small moon like Pol only " + "needs 1 and the massive Jool needs 100. Your total coverage is calculated on the coverage provided " + "to all celestial bodies. So even though Jool needs so many you can still get a high coverage " + "rating by covering the smaller bodies. So start with Kerbin, moons, and the near planets. To have " + "a qualified \"Surveyor Satellite\" it must have an antenna, an autonomous control system, and be " + "able to generate power."; ViewLabel DescriptionLabel = new ViewLabel(Description); DescriptionLabel.setRelativeTo(Window); DescriptionLabel.setLeft(140); DescriptionLabel.setTop(20); DescriptionLabel.setColor(Color.white); DescriptionLabel.setHeight(100); DescriptionLabel.setWidth(Window.getWidth() - 140); Vw.addComponent(DescriptionLabel); ViewLabel TotalCoverage = new ViewLabel("Total Coverage: " + Math.Round((double)Rev.satelliteCoverage * 100) + "%"); TotalCoverage.setRelativeTo(Window); TotalCoverage.setLeft(140); TotalCoverage.setTop(130); TotalCoverage.setColor(Color.white); TotalCoverage.setHeight(30); TotalCoverage.setWidth(Window.getWidth() - 140); Vw.addComponent(TotalCoverage); ViewScroll CoverageScroll = new ViewScroll(); CoverageScroll.setRelativeTo(Window); CoverageScroll.setWidth(Window.getWidth() - 140); CoverageScroll.setHeight(Window.getHeight() - 160); CoverageScroll.setLeft(140); CoverageScroll.setTop(150); Vw.addComponent(CoverageScroll); CoverageReport[] Coverages = Rev.Coverages; int labelHeight = 20; for (int i = 0; i < Coverages.Length; i++) { CoverageReport Coverage = Coverages [i]; string label = Coverage.entity + " : (" + Coverage.satCount + "/" + Coverage.satCountForFullCoverage + ") " + Math.Round(Coverage.coverage * 100) + "%"; ViewLabel CoverageLabel = new ViewLabel(label); CoverageLabel.setRelativeTo(CoverageScroll); CoverageLabel.setTop(labelHeight + (labelHeight + 5) * i); CoverageLabel.setLeft(0); CoverageLabel.setHeight(labelHeight); CoverageLabel.setWidth(CoverageScroll.getWidth() - 20); if (Coverage.coverage <= 0.25) { CoverageLabel.setColor(Color.white); } else if (Coverage.coverage <= .75) { CoverageLabel.setColor(Color.yellow); } else { CoverageLabel.setColor(Color.green); } CoverageScroll.Components.Add(CoverageLabel); } }
public static void draw(View Vw, ViewWindow Window) { Window.title = "Kerbals"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); string Description = "You Love Kerbals, I Love Kerbals, Kerbals Love Kerbals. Just one of those facts of life. " + "So it goes without saying, having Kerbals actively on missions increases Public Opinion. " + "The more Kerbals you have in flight the more Public Opinion you will garner, but be careful, " + "a stranded Kerbal is as bad as a dead Kerbal and will hurt public opinion until they are " + "rescued. A qualified \"Stranded Kerbal\" is one that is in a vessel without fuel/energy, a science lab, " + "or a mining rig. They are floating without reason to be there. A kerbal will not be considered stranded unless it's " + "been on the current mission for at least 2 years."; ViewLabel DescriptionLabel = new ViewLabel(Description); DescriptionLabel.setRelativeTo(Window); DescriptionLabel.setLeft(140); DescriptionLabel.setTop(20); DescriptionLabel.setColor(Color.white); DescriptionLabel.setHeight(100); DescriptionLabel.setWidth(Window.getWidth() - 140); Vw.addComponent(DescriptionLabel); ViewLabel ActiveKerbals = new ViewLabel("Active Kerbals: " + Rev.activeKerbals + ". Stranded Kerbals: " + Rev.strandedKerbals + "."); ActiveKerbals.setRelativeTo(Window); ActiveKerbals.setLeft(140); ActiveKerbals.setTop(130); ActiveKerbals.setColor(Color.white); ActiveKerbals.setHeight(30); ActiveKerbals.setWidth(Window.getWidth() - 140); Vw.addComponent(ActiveKerbals); ViewScroll KerbalsScroll = new ViewScroll(); KerbalsScroll.setRelativeTo(Window); KerbalsScroll.setWidth(Window.getWidth() - 140); KerbalsScroll.setHeight(Window.getHeight() - 160); KerbalsScroll.setLeft(140); KerbalsScroll.setTop(150); Vw.addComponent(KerbalsScroll); ProtoCrewMember[] Kerbals = KerbalHelper.GetKerbals(); int labelHeight = 20; for (int i = 0; i < Kerbals.Length; i++) { ProtoCrewMember Kerb = Kerbals [i]; string state = "Active"; Color color = Color.green; if (KerbalHelper.IsStranded(Kerb)) { state = "Stranded"; color = Color.white; } else if (KerbalHelper.QualifiedStranded(Kerb)) { state = "Active [Will be Stranded In " + KerbalHelper.TimeToStranded(Kerb) + " Days!]"; color = Color.yellow; } string label = Kerb.name + " (" + state + ")"; ViewLabel KerbalLabel = new ViewLabel(label); KerbalLabel.setRelativeTo(KerbalsScroll); KerbalLabel.setTop(labelHeight + (labelHeight + 5) * i); KerbalLabel.setLeft(0); KerbalLabel.setHeight(labelHeight); KerbalLabel.setWidth(KerbalsScroll.getWidth() - 20); KerbalLabel.setColor(color); KerbalsScroll.Components.Add(KerbalLabel); } }
public static void draw(View Vw, ViewWindow Window) { Window.title = "Rovers"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); string Description = "Below is a list of existing Rovers. Having more Rovers increases Public Opinion." + "Vessels that are rovers should be labeled as a Rover. They should have at least 4 wheels but can have more." + "If any wheels on the rover are broken they must be repaired. Rovers must has energy and be landed on a body other " + "than the home planet (Kerbin in most cases) to count."; ViewLabel DescriptionLabel = new ViewLabel(Description); DescriptionLabel.setRelativeTo(Window); DescriptionLabel.setLeft(140); DescriptionLabel.setTop(20); DescriptionLabel.setColor(Color.white); DescriptionLabel.setHeight(100); DescriptionLabel.setWidth(Window.getWidth() - 140); Vw.addComponent(DescriptionLabel); ViewLabel TotalRovers = new ViewLabel("Total Rovers: " + Rev.rovers); TotalRovers.setRelativeTo(Window); TotalRovers.setLeft(140); TotalRovers.setTop(130); TotalRovers.setColor(Color.white); TotalRovers.setHeight(30); TotalRovers.setWidth(Window.getWidth() - 140); Vw.addComponent(TotalRovers); ViewScroll RoversScroll = new ViewScroll(); RoversScroll.setRelativeTo(Window); RoversScroll.setWidth(Window.getWidth() - 140); RoversScroll.setHeight(Window.getHeight() - 160); RoversScroll.setLeft(140); RoversScroll.setTop(150); Vw.addComponent(RoversScroll); Vessel[] Rovers = VesselHelper.GetRovers(); int labelHeight = 20; for (int i = 0; i < Rovers.Length; i++) { Vessel Rover = Rovers [i]; string target; string label = Rover.GetName() + " is Landed at " + Rover.mainBody.GetName(); ViewLabel RoverLabel = new ViewLabel(label); RoverLabel.setRelativeTo(RoversScroll); RoverLabel.setTop(labelHeight + (labelHeight + 5) * i); RoverLabel.setLeft(0); RoverLabel.setHeight(labelHeight); RoverLabel.setWidth(RoversScroll.getWidth() - 20); RoverLabel.setColor(Color.white); RoversScroll.Components.Add(RoverLabel); } }
public static void draw(View Vw, ViewWindow Window) { Window.title = "Science Stations"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); string Description = "Below is a list of existing Science Sations. Having more Science Stations increases State " + "Confidence. Landed stations on other Celestial Bodies counts higher than Orbiting Stations. " + "To have a qualified Science Station you must have an antenna, a science lab, be able to generate " + "power, and have at least one Kerbal on board."; ViewLabel DescriptionLabel = new ViewLabel(Description); DescriptionLabel.setRelativeTo(Window); DescriptionLabel.setLeft(140); DescriptionLabel.setTop(20); DescriptionLabel.setColor(Color.white); DescriptionLabel.setHeight(100); DescriptionLabel.setWidth(Window.getWidth() - 140); Vw.addComponent(DescriptionLabel); ViewLabel TotalCoverage = new ViewLabel("Orbiting Stations: " + Rev.orbitalScienceStations + ". " + "Landed Stations: " + Rev.planetaryScienceStations + "."); TotalCoverage.setRelativeTo(Window); TotalCoverage.setLeft(140); TotalCoverage.setTop(130); TotalCoverage.setColor(Color.white); TotalCoverage.setHeight(30); TotalCoverage.setWidth(Window.getWidth() - 140); Vw.addComponent(TotalCoverage); ViewScroll StationsScroll = new ViewScroll(); StationsScroll.setRelativeTo(Window); StationsScroll.setWidth(Window.getWidth() - 140); StationsScroll.setHeight(Window.getHeight() - 160); StationsScroll.setLeft(140); StationsScroll.setTop(150); Vw.addComponent(StationsScroll); Vessel[] ScienceStations = VesselHelper.GetScienceStations(); int labelHeight = 20; for (int i = 0; i < ScienceStations.Length; i++) { Vessel ScienceStation = ScienceStations [i]; string action; string target; if (ScienceStation.Landed) { action = "Landed At"; target = ScienceStation.mainBody.GetName(); } else { action = "Orbiting"; target = ScienceStation.GetOrbit().referenceBody.GetName(); } string label = ScienceStation.GetName() + " is " + action + " " + target; ViewLabel StationLabel = new ViewLabel(label); StationLabel.setRelativeTo(StationsScroll); StationLabel.setTop(labelHeight + (labelHeight + 5) * i); StationLabel.setLeft(0); StationLabel.setHeight(labelHeight); StationLabel.setWidth(StationsScroll.getWidth() - 20); StationLabel.setColor(Color.white); StationsScroll.Components.Add(StationLabel); } }
private void LoadKerbals() { reloadBase(); Window.title = "Kerbals"; Instance GameInstance = StateFundingGlobal.fetch.GameInstance; Review Rev = GameInstance.ActiveReview; Rev.touch(); string Description = "You Love Kerbals, I Love Kerbals, Kerbals Love Kerbals. Just one of those facts of life. " + "So it goes without saying, having Kerbals actively on missions increases Public Opinion. " + "The more Kerbals you have in flight the more Public Opinion you will garner, but be careful, " + "a stranded Kerbal is as bad as a dead Kerbal and will hurt public opinion until they are " + "rescued. A qualified \"Stranded Kerbal\" is one that is in a vessel without fuel, a science lab, " + "or a mining rig. They are floating without reason to be there."; ViewLabel DescriptionLabel = new ViewLabel(Description); DescriptionLabel.setRelativeTo(Window); DescriptionLabel.setLeft(140); DescriptionLabel.setTop(20); DescriptionLabel.setColor(Color.white); DescriptionLabel.setHeight(100); DescriptionLabel.setWidth(Window.getWidth() - 140); this.addComponent(DescriptionLabel); ViewLabel TotalCoverage = new ViewLabel("Active Kerbals: " + Rev.activeKerbals + ". Stranded Kerbals: " + Rev.strandedKerbals + "."); TotalCoverage.setRelativeTo(Window); TotalCoverage.setLeft(140); TotalCoverage.setTop(130); TotalCoverage.setColor(Color.white); TotalCoverage.setHeight(30); TotalCoverage.setWidth(Window.getWidth() - 140); this.addComponent(TotalCoverage); ProtoCrewMember[] Kerbals = KerbalHelper.GetKerbals(); int offsetY = 150; int labelHeight = 20; for (int i = 0; i < Kerbals.Length; i++) { ProtoCrewMember Kerb = Kerbals [i]; string state = "Active"; Color color = Color.green; if (KerbalHelper.IsStranded(Kerb)) { state = "Stranded"; color = Color.white; } string label = Kerb.name + " (" + state + ")"; ViewLabel KerbalLabel = new ViewLabel(label); KerbalLabel.setRelativeTo(Window); KerbalLabel.setTop(offsetY + labelHeight + (labelHeight + 5) * i); KerbalLabel.setLeft(140); KerbalLabel.setHeight(labelHeight); KerbalLabel.setWidth(Window.getWidth() - 140); KerbalLabel.setColor(color); this.addComponent(KerbalLabel); } }