static void Postfix(SG_HiringHall_Screen __instance, Pilot ___selectedPilot, LocalizableText ___MWInitialCostText, UIColorRefTracker ___MWCostColor, HBSDOTweenButton ___HireButton) { Mod.Log.Debug?.Write("Updating UpdateMoneySpot"); if (___selectedPilot != null) { Mod.Log.Debug?.Write(" -- pilot is selected"); // Account for the salary CrewDetails details = ModState.GetCrewDetails(___selectedPilot.pilotDef); int modifiedBonus = (int)Mathf.RoundToInt(details.AdjustedBonus); string bonus = new Text(Mod.LocalizedText.Labels[ModText.LT_Crew_Bonus_Label], new string[] { SimGameState.GetCBillString(Mathf.RoundToInt(modifiedBonus)) }) .ToString(); Mod.Log.Debug?.Write($" -- bonus will be: {bonus}"); ___MWInitialCostText.SetText(bonus); if (modifiedBonus > ModState.SimGameState.Funds) { Mod.Log.Debug?.Write(" -- Disabling hire."); ___MWCostColor.SetUIColor(UIColor.Red); ___HireButton.SetState(ButtonState.Disabled); } else { Mod.Log.Debug?.Write(" -- Enabling hire."); ___MWCostColor.SetUIColor(UIColor.White); ___HireButton.SetState(ButtonState.Enabled); } } }
static void Postfix(SimGameOptionsMenu __instance, HBSDOTweenButton ___saveGame, HBSTooltipHBSButton ___saveTooltip, HBSDOTweenButton ___restartMission, HBSTooltipHBSButton ___restartTooltip) { CombatGameState combatGameState = SharedState.Combat; if (combatGameState != null && !combatGameState.TurnDirector.IsMissionOver && combatGameState.TurnDirector.GameHasBegun) { Mod.Log.Trace?.Write("SGOM:CS - in combat."); if (Mod.Config.Fixes.DisableCombatRestarts) { Mod.Log.Debug?.Write("Disabling combat restarts."); ___restartMission.SetState(ButtonState.Disabled); string title = new Text(Mod.LocalizedText.Tooltips[ModText.TT_CombatRestartMission_Title]).ToString(); string details = new Text(Mod.LocalizedText.Tooltips[ModText.TT_CombatRestartMission_Details]).ToString(); BaseDescriptionDef def = new BaseDescriptionDef("SGMTipData", title, details, null); ___restartTooltip.SetStateDataForButtonState(ButtonState.Disabled, TooltipUtilities.GetStateDataFromObject(def)); } if (Mod.Config.Fixes.DisableCombatSaves && ___saveGame.State != ButtonState.Disabled) { Mod.Log.Debug?.Write("Disabling combat saves."); ___saveGame.SetState(ButtonState.Disabled); string title = new Text(Mod.LocalizedText.Tooltips[ModText.TT_CombatSave_Title]).ToString(); string details = new Text(Mod.LocalizedText.Tooltips[ModText.TT_CombatSave_Details]).ToString(); BaseDescriptionDef def = new BaseDescriptionDef("SGMTipData", title, details, null); ___saveTooltip.SetStateDataForButtonState(ButtonState.Disabled, TooltipUtilities.GetStateDataFromObject(def)); } } }
static bool Prefix(SGLocationWidget __instance, SimGameState ___simState, HBSDOTweenButton ___storeButton, StarSystem currSystem, GameObject ___NothingToBuyStoreOverlay, GameObject ___LowRepStoreOverlay) { try { Faction owner = currSystem.Owner; SimGameReputation reputation = ___simState.GetReputation(owner); if (reputation <= SimGameReputation.LOATHED) { ___LowRepStoreOverlay.SetActive(true); ___NothingToBuyStoreOverlay.SetActive(false); ___storeButton.SetState(ButtonState.Disabled, false); } else { ___LowRepStoreOverlay.SetActive(false); ___NothingToBuyStoreOverlay.SetActive(false); ___storeButton.SetState(ButtonState.Enabled, false); } return(false); } catch (Exception e) { Logger.LogError(e); return(true); } }