static string Postfix(string __result, PartDesc __instance) { if (__instance.m_id != null) { int i = 0; // check against all inventory parts foreach (PartInstance part in CareerStatus.Get().GetInventory()) { if (part.GetPartId() != null && __instance.m_id.Equals(part.GetPartId())) { i++; } } // check against all stored computers SaveLoadSystem slsys = WorkshopController.Get().slsys; foreach (ComputerSave computer in slsys.localSaveGame.computersInStorage) { if (computer.caseID != null && __instance.m_id.Equals(computer.caseID.GetPartId())) { i++; } } // check against all bench computers foreach (ComputerSave computer in slsys.localSaveGame.computersOnBenches) { if (computer.caseID != null && __instance.m_id.Equals(computer.caseID.GetPartId())) { i++; } } float max = 10f; if (File.Exists(ModloaderMod.Instance.Modpath + "/Show Inventory Stock In Shop.conf")) { string[] config = File.ReadAllLines(ModloaderMod.Instance.Modpath + "/Show Inventory Stock In Shop.conf"); max = float.Parse(config[0].Split('=')[1]); } Color32 color = Color.Lerp(Color.red, Color.green, (Convert.ToSingle(i) / max) > 1f ? 1f : Convert.ToSingle(i) / max); string colorString = "#" + color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2") + color.a.ToString("X2"); return("<b><color=" + colorString + ">[ " + i + " in inventory ]</color></b>\n" + __result); } return(__result); }
public override void Update() { if (ProgramConstants.s_max3DMarkTestDuration != 3) { ProgramConstants.s_max3DMarkTestDuration = 3; } CareerStatus status = CareerStatus.Get(); CareerStatus.State state = CareerStatus.GetState(); WorkshopController workshopController = WorkshopController.Get(); ModdedJob moddedjobs = new ModdedJob(); if (!moddedjobs.IsInitialized()) { moddedjobs.OnInit(); } if (Input.GetKeyDown(KeyCode.F)) { if (state.m_cash > 999999) { return; } status.AddCash(999999); } if (Input.GetKeyDown(KeyCode.G)) { status.AddKudos(150); } if (Input.GetKeyDown(KeyCode.V)) { this.AddReview(status, state, new ReviewModded()); } if (Input.GetKeyDown(KeyCode.K) || Input.GetKeyDown(KeyCode.LeftShift)) { GameObject obj = GameObject.Find("Player"); if (obj) { Walk w = obj.GetComponent <Walk>(); if (w.walkSpeed <= this.walkSpeed) { w.walkSpeed = 3.7f; } else { w.walkSpeed = this.walkSpeed; } } } if (Input.GetKeyUp(KeyCode.LeftShift)) { GameObject obj = GameObject.Find("Player"); if (obj) { Walk w = obj.GetComponent <Walk>(); if (w.walkSpeed == 3.7f) { w.walkSpeed = this.walkSpeed; } } } if (Input.GetKeyDown(KeyCode.J)) { if (!multipleJobs) { multipleJobs = true; return; } multipleJobs = false; } if (state.m_calendar.GetToday() != atualDay && multipleJobs) { atualDay = state.m_calendar.GetToday(); for (int i = 0; i < UnityEngine.Random.Range(1, 9); i++) { if (i == UnityEngine.Random.Range(0, 9)) { moddedjobs.GeneratePreviewJob(status, state); continue; } moddedjobs.GenerateJob(status, state); } } }