private static string TooltipForChore(Chore.Precondition.Context context, ChoreConsumer choreConsumer) { bool flag = context.chore.masterPriority.priority_class == PriorityScreen.PriorityClass.basic || context.chore.masterPriority.priority_class == PriorityScreen.PriorityClass.high; string text; switch (context.chore.masterPriority.priority_class) { case PriorityScreen.PriorityClass.idle: text = UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_IDLE; break; case PriorityScreen.PriorityClass.personalNeeds: text = UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_PERSONAL; break; case PriorityScreen.PriorityClass.topPriority: text = UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_EMERGENCY; break; case PriorityScreen.PriorityClass.compulsory: text = UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_COMPULSORY; break; default: text = UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_NORMAL; break; } float num = 0f; int num2 = (int)context.chore.masterPriority.priority_class * 100; num += (float)num2; int num3 = flag ? choreConsumer.GetPersonalPriority(context.chore.choreType) : 0; num += (float)(num3 * 10); int num4 = flag ? context.chore.masterPriority.priority_value : 0; num += (float)num4; float num5 = (float)context.priority / 10000f; num += num5; text = text.Replace("{Description}", (!((Object)context.chore.driver == (Object)choreConsumer.choreDriver)) ? UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_DESC_INACTIVE : UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_DESC_ACTIVE); text = text.Replace("{IdleDescription}", (!((Object)context.chore.driver == (Object)choreConsumer.choreDriver)) ? UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_IDLEDESC_INACTIVE : UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_IDLEDESC_ACTIVE); string newValue = GameUtil.ChoreGroupsForChoreType(context.chore.choreType); ChoreGroup choreGroup = BestPriorityGroup(context, choreConsumer); text = text.Replace("{Name}", choreConsumer.name); text = text.Replace("{Errand}", GameUtil.GetChoreName(context.chore, context.data)); text = text.Replace("{Groups}", newValue); text = text.Replace("{BestGroup}", (choreGroup == null) ? context.chore.choreType.Name : choreGroup.Name); text = text.Replace("{ClassPriority}", num2.ToString()); string text2 = text; JobsTableScreen.PriorityInfo priorityInfo = JobsTableScreen.priorityInfo[num3]; text = text2.Replace("{PersonalPriority}", priorityInfo.name.text); text = text.Replace("{PersonalPriorityValue}", (num3 * 10).ToString()); text = text.Replace("{Building}", context.chore.gameObject.GetProperName()); text = text.Replace("{BuildingPriority}", num4.ToString()); text = text.Replace("{TypePriority}", num5.ToString()); return(text.Replace("{TotalPriority}", num.ToString())); }
protected override void OnPrefabInit() { base.OnPrefabInit(); foreach (JobsTableScreen.PriorityInfo item in MinionTodoSideScreen.priorityInfo) { JobsTableScreen.PriorityInfo current = item; PriorityScreen.PriorityClass priority = (PriorityScreen.PriorityClass)current.priority; if (priority == PriorityScreen.PriorityClass.basic) { for (int num = 5; num >= 0; num--) { Tuple <PriorityScreen.PriorityClass, int, HierarchyReferences> tuple = new Tuple <PriorityScreen.PriorityClass, int, HierarchyReferences>(priority, num, Util.KInstantiateUI <HierarchyReferences>(priorityGroupPrefab, taskEntryContainer, false)); tuple.third.name = "PriorityGroup_" + (string)current.name + "_" + num; tuple.third.gameObject.SetActive(true); JobsTableScreen.PriorityInfo priorityInfo = JobsTableScreen.priorityInfo[num]; tuple.third.GetReference <LocText>("Title").text = priorityInfo.name.text.ToUpper(); tuple.third.GetReference <Image>("PriorityIcon").sprite = priorityInfo.sprite; priorityGroups.Add(tuple); } } else { Tuple <PriorityScreen.PriorityClass, int, HierarchyReferences> tuple2 = new Tuple <PriorityScreen.PriorityClass, int, HierarchyReferences>(priority, 3, Util.KInstantiateUI <HierarchyReferences>(priorityGroupPrefab, taskEntryContainer, false)); tuple2.third.name = "PriorityGroup_" + current.name; tuple2.third.gameObject.SetActive(true); tuple2.third.GetReference <LocText>("Title").text = current.name.text.ToUpper(); tuple2.third.GetReference <Image>("PriorityIcon").sprite = current.sprite; priorityGroups.Add(tuple2); } } }
public void Init(BuildingChoresPanel.DupeEntryData data) { choreConsumer = data.consumer; if (data.context.IsPotentialSuccess()) { string newValue = (!((Object)data.context.chore.driver == (Object)data.consumer.choreDriver)) ? string.Format(DUPLICANTS.CHORES.PRECONDITIONS.RANK_FORMAT.text, data.rank) : DUPLICANTS.CHORES.PRECONDITIONS.CURRENT_ERRAND.text; label.text = DUPLICANTS.CHORES.PRECONDITIONS.SUCCESS_ROW.Replace("{Duplicant}", data.consumer.name).Replace("{Rank}", newValue); } else { Chore.PreconditionInstance preconditionInstance = data.context.chore.GetPreconditions()[data.context.failedPreconditionId]; string text = preconditionInstance.description; bool test = text != null; Chore.PreconditionInstance preconditionInstance2 = data.context.chore.GetPreconditions()[data.context.failedPreconditionId]; DebugUtil.Assert(test, "Chore requires description!", preconditionInstance2.id); if ((Object)data.context.chore.driver != (Object)null) { text = text.Replace("{Assignee}", data.context.chore.driver.GetProperName()); } text = text.Replace("{Selected}", data.context.chore.gameObject.GetProperName()); label.text = DUPLICANTS.CHORES.PRECONDITIONS.FAILURE_ROW.Replace("{Duplicant}", data.consumer.name).Replace("{Reason}", text); } Image image = icon; JobsTableScreen.PriorityInfo priorityInfo = JobsTableScreen.priorityInfo[data.personalPriority]; image.sprite = priorityInfo.sprite; toolTip.toolTip = TooltipForDupe(data.context, data.consumer, data.rank); }
private static string TooltipForDupe(Chore.Precondition.Context context, ChoreConsumer choreConsumer, int rank) { bool flag = context.IsPotentialSuccess(); string text = (!flag) ? UI.DETAILTABS.BUILDING_CHORES.DUPE_TOOLTIP_FAILED : UI.DETAILTABS.BUILDING_CHORES.DUPE_TOOLTIP_SUCCEEDED; float num = 0f; int personalPriority = choreConsumer.GetPersonalPriority(context.chore.choreType); num += (float)(personalPriority * 10); int priority_value = context.chore.masterPriority.priority_value; num += (float)priority_value; float num2 = (float)context.priority / 10000f; num += num2; text = text.Replace("{Description}", (!((Object)context.chore.driver == (Object)choreConsumer.choreDriver)) ? UI.DETAILTABS.BUILDING_CHORES.DUPE_TOOLTIP_DESC_INACTIVE : UI.DETAILTABS.BUILDING_CHORES.DUPE_TOOLTIP_DESC_ACTIVE); string newValue = GameUtil.ChoreGroupsForChoreType(context.chore.choreType); string newValue2 = UI.UISIDESCREENS.MINIONTODOSIDESCREEN.TOOLTIP_NA.text; if (flag && context.chore.choreType.groups.Length > 0) { ChoreGroup choreGroup = context.chore.choreType.groups[0]; for (int i = 1; i < context.chore.choreType.groups.Length; i++) { if (choreConsumer.GetPersonalPriority(choreGroup) < choreConsumer.GetPersonalPriority(context.chore.choreType.groups[i])) { choreGroup = context.chore.choreType.groups[i]; } } newValue2 = choreGroup.Name; } text = text.Replace("{Name}", choreConsumer.name); text = text.Replace("{Errand}", GameUtil.GetChoreName(context.chore, context.data)); if (flag) { text = text.Replace("{Rank}", rank.ToString()); text = text.Replace("{Groups}", newValue); text = text.Replace("{BestGroup}", newValue2); string text2 = text; JobsTableScreen.PriorityInfo priorityInfo = JobsTableScreen.priorityInfo[personalPriority]; text = text2.Replace("{PersonalPriority}", priorityInfo.name.text); text = text.Replace("{PersonalPriorityValue}", (personalPriority * 10).ToString()); text = text.Replace("{Building}", context.chore.gameObject.GetProperName()); text = text.Replace("{BuildingPriority}", priority_value.ToString()); text = text.Replace("{TypePriority}", num2.ToString()); return(text.Replace("{TotalPriority}", num.ToString())); } string text3 = text; Chore.PreconditionInstance preconditionInstance = context.chore.GetPreconditions()[context.failedPreconditionId]; return(text3.Replace("{FailedPrecondition}", preconditionInstance.description)); }