private void AddChoreEntry(Chore chore) { HierarchyReferences choreEntry = GetChoreEntry(GameUtil.GetChoreName(chore, null), chore.choreType, choreGroup.GetReference <RectTransform>("EntriesContainer")); FetchChore fetchChore = chore as FetchChore; ListPool <Chore.Precondition.Context, BuildingChoresPanel> .PooledList pooledList = ListPool <Chore.Precondition.Context, BuildingChoresPanel> .Allocate(); foreach (MinionIdentity item in Components.LiveMinionIdentities.Items) { pooledList.Clear(); ChoreConsumer component = item.GetComponent <ChoreConsumer>(); Chore.Precondition.Context context = default(Chore.Precondition.Context); ChoreConsumer.PreconditionSnapshot lastPreconditionSnapshot = component.GetLastPreconditionSnapshot(); if (lastPreconditionSnapshot.doFailedContextsNeedSorting) { lastPreconditionSnapshot.failedContexts.Sort(); lastPreconditionSnapshot.doFailedContextsNeedSorting = false; } pooledList.AddRange(lastPreconditionSnapshot.failedContexts); pooledList.AddRange(lastPreconditionSnapshot.succeededContexts); int num = -1; int num2 = 0; for (int num3 = pooledList.Count - 1; num3 >= 0; num3--) { Chore.Precondition.Context context2 = pooledList[num3]; if ((UnityEngine.Object)context2.chore.driver != (UnityEngine.Object)null) { Chore.Precondition.Context context3 = pooledList[num3]; if ((UnityEngine.Object)context3.chore.driver != (UnityEngine.Object)component.choreDriver) { continue; } } bool flag = pooledList[num3].IsPotentialSuccess(); if (flag) { num2++; } Chore.Precondition.Context context4 = pooledList[num3]; FetchAreaChore fetchAreaChore = context4.chore as FetchAreaChore; Chore.Precondition.Context context5 = pooledList[num3]; if (context5.chore == chore || (fetchChore != null && fetchAreaChore != null && fetchAreaChore.smi.SameDestination(fetchChore))) { num = ((!flag) ? 2147483647 : num2); context = pooledList[num3]; break; } } if (num >= 0) { DupeEntryDatas.Add(new DupeEntryData { consumer = component, context = context, personalPriority = component.GetPersonalPriority(chore.choreType), rank = num }); } } pooledList.Recycle(); DupeEntryDatas.Sort(); foreach (DupeEntryData dupeEntryData in DupeEntryDatas) { GetDupeEntry(dupeEntryData, choreEntry.GetReference <RectTransform>("DupeContainer")); } DupeEntryDatas.Clear(); }
private void PopulateElements(object data = null) { refreshHandle.ClearScheduler(); refreshHandle = UIScheduler.Instance.Schedule("RefreshToDoList", 0.1f, PopulateElements, null, null); ListPool <Chore.Precondition.Context, BuildingChoresPanel> .PooledList pooledList = ListPool <Chore.Precondition.Context, BuildingChoresPanel> .Allocate(); ChoreConsumer.PreconditionSnapshot lastPreconditionSnapshot = choreConsumer.GetLastPreconditionSnapshot(); if (lastPreconditionSnapshot.doFailedContextsNeedSorting) { lastPreconditionSnapshot.failedContexts.Sort(); lastPreconditionSnapshot.doFailedContextsNeedSorting = false; } pooledList.AddRange(lastPreconditionSnapshot.failedContexts); pooledList.AddRange(lastPreconditionSnapshot.succeededContexts); Chore.Precondition.Context choreB = default(Chore.Precondition.Context); MinionTodoChoreEntry minionTodoChoreEntry = null; int num = 0; Schedulable component = DetailsScreen.Instance.target.GetComponent <Schedulable>(); string arg = string.Empty; Schedule schedule = component.GetSchedule(); if (schedule != null) { ScheduleBlock block = schedule.GetBlock(Schedule.GetBlockIdx()); arg = block.name; } currentScheduleBlockLabel.SetText(string.Format(UI.UISIDESCREENS.MINIONTODOSIDESCREEN.CURRENT_SCHEDULE_BLOCK, arg)); choreTargets.Clear(); bool flag = false; activeChoreEntries = 0; for (int num2 = pooledList.Count - 1; num2 >= 0; num2--) { Chore.Precondition.Context context = pooledList[num2]; if (context.chore != null) { Chore.Precondition.Context context2 = pooledList[num2]; if (!context2.chore.target.isNull) { Chore.Precondition.Context context3 = pooledList[num2]; if (!((UnityEngine.Object)context3.chore.target.gameObject == (UnityEngine.Object)null) && pooledList[num2].IsPotentialSuccess()) { Chore.Precondition.Context context4 = pooledList[num2]; if ((UnityEngine.Object)context4.chore.driver == (UnityEngine.Object)choreConsumer.choreDriver) { currentTask.Apply(pooledList[num2]); minionTodoChoreEntry = currentTask; choreB = pooledList[num2]; num = 0; flag = true; } else if (!flag && activeChoreEntries != 0 && GameUtil.AreChoresUIMergeable(pooledList[num2], choreB)) { num++; minionTodoChoreEntry.SetMoreAmount(num); } else { ChoreConsumer obj = choreConsumer; Chore.Precondition.Context context5 = pooledList[num2]; HierarchyReferences hierarchyReferences = PriorityGroupForPriority(obj, context5.chore); MinionTodoChoreEntry choreEntry = GetChoreEntry(hierarchyReferences.GetReference <RectTransform>("EntriesContainer")); choreEntry.Apply(pooledList[num2]); minionTodoChoreEntry = choreEntry; choreB = pooledList[num2]; num = 0; flag = false; } } } } } pooledList.Recycle(); for (int num3 = choreEntries.Count - 1; num3 >= activeChoreEntries; num3--) { choreEntries[num3].gameObject.SetActive(false); } foreach (Tuple <PriorityScreen.PriorityClass, int, HierarchyReferences> priorityGroup in priorityGroups) { RectTransform reference = priorityGroup.third.GetReference <RectTransform>("EntriesContainer"); priorityGroup.third.gameObject.SetActive(reference.childCount > 0); } }