static void Postfix(StaffJobToggle __instance, Staff ____staff) { if (!Main.enabled) { return; } try { StaffMenu staffMenu = ____staff.Level.HUD.FindMenu <StaffMenu>(true); if (staffMenu != null) { MethodInfo method = staffMenu.GetType().GetMethod("CreateJobIcons", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(staffMenu, new object[] { ____staff.Definition._type }); } } } catch (Exception ex) { Main.Logger.Error(ex.ToString() + ": " + ex.StackTrace.ToString()); } }
static void Postfix(StaffMenu __instance, StaffDefinition.Type staffType, StaffMenu.StaffMenuSettings ____staffMenuSettings, WorldState ____worldState, List <JobDescription>[] ____jobs) { if (!Main.enabled) { return; } if (staffType != StaffDefinition.Type.Doctor && staffType != StaffDefinition.Type.Nurse) { return; } try { int i = 0; foreach (Transform t in ____staffMenuSettings.JobsListContainer) { var job = (JobRoomDescription)____jobs[(int)staffType][i]; TMP_Text obj = UnityEngine.Object.Instantiate(____staffMenuSettings.TitleText.gameObject).GetComponent <TMP_Text>(); obj.rectTransform.SetParent(t); obj.text = ____worldState.AllRooms.Count(x => x.Definition == job.Room).ToString(); obj.enableAutoSizing = false; obj.fontSize = 24f; obj.enableWordWrapping = false; obj.overflowMode = TextOverflowModes.Overflow; obj.alignment = TextAlignmentOptions.Midline; obj.color = Color.white; obj.rectTransform.anchorMin = new Vector2(0.5f, 0f); obj.rectTransform.anchorMax = new Vector2(0.5f, 1f); obj.rectTransform.anchoredPosition = new Vector2(0f, -15f); obj.rectTransform.sizeDelta = t.GetComponent <RectTransform>().sizeDelta; i++; } } catch (Exception e) { Main.Logger.Error(e.ToString()); } }
static void Postfix(StaffMenu __instance, Staff staff) { if (!Main.enabled) { return; } try { MethodInfo method = __instance.GetType().GetMethod("CreateJobIcons", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(__instance, new object[] { staff.Definition._type }); } } catch (Exception ex) { Main.Logger.Error(ex.ToString() + ": " + ex.StackTrace.ToString()); } }
void Awake() { refurbishmentTab = controller.transform.FindChild ("RefurbishmentCTR").gameObject.GetComponent<Refurbishment>(); staffMenu = GameObject.FindGameObjectWithTag ("StaffingController").GetComponent<StaffMenu> (); bankingTab = controller.transform.FindChild ("BankingController").gameObject.GetComponent<BankingReport>(); emsTab = controller.transform.FindChild("EMSController").gameObject.GetComponent<EMSReport>(); revenueManagementTab = controller.transform.FindChild("RevenueManagerCTR").GetComponent<RevenueManagement>(); randomEvent = controller.transform.FindChild("EventController").GetComponent<RandomEvent>(); rateSetup = controller.transform.FindChild("RatesSetUp").GetComponent<RatesSetup>(); groupController = controller.transform.FindChild("GroupBooking").GetComponent<GroupBookController>(); calendarController = controller.transform.FindChild("CalendarController").GetComponent<CalendarController>(); feedbackController = controller.transform.FindChild("FeedBackController").GetComponent<FeedbackController>(); dataProcessor = GameObject.Find("DataCollection").GetComponent<Serializer_Deserializer>(); assetSwapper = controller.transform.FindChild("AssetController").GetComponent<AssetSwapper>(); toolbar = GameObject.FindGameObjectWithTag("UI").transform.FindChild("OverWorld").GetComponent<ToolbarOptions>(); adController = controller.transform.FindChild("AdvertController").gameObject.GetComponent<Advertisment>(); SingletonCheck(); if(monthlyReports == null){ monthlyReports = new List<MonthlyReport>();//create list on first run. } //Ensure there's a log for this week (special case for 1st time run) if (receptionLogs == null) { receptionLogs = new List<ReceptionLog> (); } if(restaurantBooks == null){ restaurantBooks = new List<RestaurantBook>();//create a new list on first run. } //Ensure there's a log for this week (special case for 1st time run) if (staffingLogs == null) { staffingLogs = new List<StaffingLog> (); } //create the log once. if(balanceSheets == null){ balanceSheets = new List<BalanceSheet>();//create new balance sheet list on first run. } GenerateNewMonthReports (); firstGeneration = true; medianRoomCostWD = rateSetup.medianRoomCostWD; medianRoomCostWE = rateSetup.medianRoomCostWE; }
static void Postfix(StaffMenu __instance, StaffDefinition.Type staffType, StaffMenu.StaffMenuSettings ____staffMenuSettings, WorldState ____worldState, List <JobDescription>[] ____jobs, CharacterManager ____characterManager) { if (!Main.enabled) { return; } try { int num = 0; foreach (object obj in ____staffMenuSettings.JobsListContainer) { Transform transform = (Transform)obj; JobDescription job = ____jobs[(int)staffType][num]; TMP_Text component = UnityEngine.Object.Instantiate <GameObject>(____staffMenuSettings.TitleText.gameObject).GetComponent <TMP_Text>(); component.rectTransform.SetParent(transform); int staffCount = ____characterManager.StaffMembers.Count((Staff s) => !s.HasResigned() && !s.HasBeenFired() && job.IsSuitable(s) && !s.JobExclusions.Contains(job)); int roomCount = 0; if (job is JobRoomDescription) { roomCount = ____worldState.AllRooms.Count((Room x) => x.Definition == ((JobRoomDescription)job).Room); component.text = staffCount.ToString() + "/" + roomCount.ToString(); StaffJobIcon[] componentsInChildren = ____staffMenuSettings.JobsListContainer.gameObject.GetComponentsInChildren <StaffJobIcon>(); if (componentsInChildren != null && num < componentsInChildren.Length) { componentsInChildren[num].Tooltip.SetDataProvider(delegate(Tooltip tooltip) { tooltip.Text = string.Concat(new string[] { job.GetJobAssignmentTooltipString(), "\n\nSatff Assigned: ", staffCount.ToString(), "\nRooms Built: ", roomCount.ToString() }); }); } } else if (job is JobItemDescription) { component.text = staffCount.ToString(); StaffJobIcon[] componentsInChildren2 = ____staffMenuSettings.JobsListContainer.gameObject.GetComponentsInChildren <StaffJobIcon>(); if (componentsInChildren2 != null && num < componentsInChildren2.Length) { componentsInChildren2[num].Tooltip.SetDataProvider(delegate(Tooltip tooltip) { tooltip.Text = job.GetJobAssignmentTooltipString() + "\n\nSatff Assigned: " + staffCount.ToString(); }); } } else if (job is JobMaintenanceDescription) { string text = staffCount.ToString(); int itemCount = (from mj in ____worldState.GetRoomItemsWithMaintenanceDescription(((JobMaintenanceDescription)job).Description) where mj.Definition.Interactions.Count((InteractionDefinition inter) => inter.Type == InteractionAttributeModifier.Type.Maintain) > 0 select mj).Count <RoomItem>(); text = text + "/" + itemCount.ToString(); component.text = text; StaffJobIcon[] componentsInChildren3 = ____staffMenuSettings.JobsListContainer.gameObject.GetComponentsInChildren <StaffJobIcon>(); if (componentsInChildren3 != null && num < componentsInChildren3.Length) { componentsInChildren3[num].Tooltip.SetDataProvider(delegate(Tooltip tooltip) { tooltip.Text = string.Concat(new string[] { job.GetJobAssignmentTooltipString(), "\n\nSatff Assigned: ", staffCount.ToString(), "\nMaintenance Items: ", itemCount.ToString() }); }); } } else if (job is JobUpgradeDescription) { int upgradeCount = 0; string machinesForUpgarde = ""; foreach (Room room in ____worldState.AllRooms) { foreach (RoomItem roomItem in room.FloorPlan.Items) { RoomItemUpgradeDefinition nextUpgrade = roomItem.Definition.GetNextUpgrade(roomItem.UpgradeLevel); if (nextUpgrade != null && roomItem.Level.Metagame.HasUnlocked(nextUpgrade) && roomItem.GetComponent <RoomItemUpgradeComponent>() == null) { upgradeCount++; machinesForUpgarde = machinesForUpgarde + "\n" + roomItem.Name; } } } if (!string.IsNullOrEmpty(machinesForUpgarde)) { StaffJobIcon[] componentsInChildren4 = ____staffMenuSettings.JobsListContainer.gameObject.GetComponentsInChildren <StaffJobIcon>(); if (componentsInChildren4 != null && num < componentsInChildren4.Length) { componentsInChildren4[num].Tooltip.SetDataProvider(delegate(Tooltip tooltip) { tooltip.Text = string.Concat(new string[] { job.GetJobAssignmentTooltipString(), "\n\nSatff Assigned: ", staffCount.ToString(), "\n", machinesForUpgarde }); }); } } component.text = staffCount.ToString() + "/" + upgradeCount; } else { if (!(job is JobGhostDescription) && !(job is JobFireDescription)) { continue; } component.text = staffCount.ToString(); } component.enableAutoSizing = false; component.fontSize = 18f; component.enableWordWrapping = false; component.overflowMode = 0; component.alignment = TextAlignmentOptions.Midline; component.color = Color.white; component.outlineColor = Color.black; component.outlineWidth = 1f; component.rectTransform.anchorMin = new Vector2(0.5f, 0f); component.rectTransform.anchorMax = new Vector2(0.5f, 1f); component.rectTransform.anchoredPosition = new Vector2(0f, -15f); component.rectTransform.sizeDelta = transform.GetComponent <RectTransform>().sizeDelta; num++; } } catch (Exception ex) { Main.Logger.Error(ex.ToString() + ": " + ex.StackTrace.ToString()); } }
static bool Prefix(StaffMenuJobAssignRow __instance, Staff staff, List <JobDescription> jobs, StaffMenu staffMenu, GameObject ____jobTogglePrefab, QualificationIcons ___QualificationIcons) { if (!Main.enabled) { return(true); } if (staff == null) { return(true); } try { var icons = Traverse.Create(___QualificationIcons).Field("_qualificationImages").GetValue <Image[]>(); for (int i = 0; i < icons.Length; i++) { var button = icons[i].gameObject.GetOrAddComponent <Button>(); button.enabled = true; var obj = icons[i].gameObject.GetOrAddComponent <JobAssignQualificationToggle>(); obj.staff = staff; obj.staffMenu = staffMenu; obj.id = i; } } catch (Exception e) { Main.Logger.Error(e.ToString()); } return(true); }