public void Refresh() { if ((Object)schedulable != (Object)null) { int blockIdx = Schedule.GetBlockIdx(); scheduleBlock = schedulable.GetSchedule().GetBlock(blockIdx); } }
private void CopyMinion(MinionIdentity src_id, StoredMinionIdentity dest_id) { dest_id.storedName = src_id.name; dest_id.nameStringKey = src_id.nameStringKey; dest_id.gender = src_id.gender; dest_id.genderStringKey = src_id.genderStringKey; dest_id.arrivalTime = src_id.arrivalTime; dest_id.voiceIdx = src_id.voiceIdx; dest_id.bodyData = src_id.bodyData; Traits component = src_id.GetComponent <Traits>(); dest_id.traitIDs = new List <string>(component.GetTraitIds()); dest_id.assignableProxy.Set(src_id.assignableProxy.Get()); dest_id.assignableProxy.Get().SetTarget(dest_id, dest_id.gameObject); Accessorizer component2 = src_id.GetComponent <Accessorizer>(); dest_id.accessories = component2.GetAccessories(); ConsumableConsumer component3 = src_id.GetComponent <ConsumableConsumer>(); if (component3.forbiddenTags != null) { dest_id.forbiddenTags = new List <Tag>(component3.forbiddenTags); } MinionResume component4 = src_id.GetComponent <MinionResume>(); dest_id.MasteryBySkillID = component4.MasteryBySkillID; dest_id.AptitudeBySkillGroup = component4.AptitudeBySkillGroup; dest_id.TotalExperienceGained = component4.TotalExperienceGained; dest_id.currentHat = component4.CurrentHat; dest_id.targetHat = component4.TargetHat; ChoreConsumer component5 = src_id.GetComponent <ChoreConsumer>(); dest_id.choreGroupPriorities = component5.GetChoreGroupPriorities(); AttributeLevels component6 = src_id.GetComponent <AttributeLevels>(); component6.OnSerializing(); dest_id.attributeLevels = new List <AttributeLevels.LevelSaveLoad>(component6.SaveLoadLevels); StoreModifiers(src_id, dest_id); Schedulable component7 = src_id.GetComponent <Schedulable>(); Schedule schedule = component7.GetSchedule(); if (schedule != null) { schedule.Unassign(component7); Schedulable component8 = dest_id.GetComponent <Schedulable>(); schedule.Assign(component8); } }
private void DropEntryRefreshAction(DropDownEntry entry, object obj) { Schedule schedule = (Schedule)entry.entryData; Schedulable schedulable = (Schedulable)obj; if (schedulable.GetSchedule() == schedule) { entry.label.text = string.Format(UI.SCHEDULESCREEN.SCHEDULE_DROPDOWN_ASSIGNED, schedule.name); entry.button.isInteractable = false; } else { entry.label.text = schedule.name; entry.button.isInteractable = true; } }
public ChoreConsumerState(ChoreConsumer consumer) { this.consumer = consumer; navigator = consumer.GetComponent <Navigator>(); prefabid = consumer.GetComponent <KPrefabID>(); ownable = consumer.GetComponent <Ownable>(); gameObject = consumer.gameObject; solidTransferArm = consumer.GetComponent <SolidTransferArm>(); hasSolidTransferArm = ((Object)solidTransferArm != (Object)null); resume = consumer.GetComponent <MinionResume>(); choreDriver = consumer.GetComponent <ChoreDriver>(); schedulable = consumer.GetComponent <Schedulable>(); traits = consumer.GetComponent <Traits>(); choreProvider = consumer.GetComponent <ChoreProvider>(); MinionIdentity component = consumer.GetComponent <MinionIdentity>(); if ((Object)component != (Object)null) { if (component.assignableProxy == null) { component.assignableProxy = MinionAssignablesProxy.InitAssignableProxy(component.assignableProxy, component); } assignables = component.GetSoleOwner(); equipment = component.GetEquipment(); } else { assignables = consumer.GetComponent <Assignables>(); equipment = consumer.GetComponent <Equipment>(); } storage = consumer.GetComponent <Storage>(); consumableConsumer = consumer.GetComponent <ConsumableConsumer>(); worker = consumer.GetComponent <Worker>(); selectable = consumer.GetComponent <KSelectable>(); if ((Object)schedulable != (Object)null) { int blockIdx = Schedule.GetBlockIdx(); scheduleBlock = schedulable.GetSchedule().GetBlock(blockIdx); } }
private static void CopyMinion(StoredMinionIdentity src_id, MinionIdentity dest_id) { dest_id.SetName(src_id.storedName); dest_id.nameStringKey = src_id.nameStringKey; dest_id.gender = src_id.gender; dest_id.genderStringKey = src_id.genderStringKey; dest_id.arrivalTime = src_id.arrivalTime; dest_id.voiceIdx = src_id.voiceIdx; dest_id.bodyData = src_id.bodyData; if (src_id.traitIDs != null) { Traits component = dest_id.GetComponent <Traits>(); component.SetTraitIds(src_id.traitIDs); } if (src_id.accessories != null) { Accessorizer component2 = dest_id.GetComponent <Accessorizer>(); component2.SetAccessories(src_id.accessories); } ConsumableConsumer component3 = dest_id.GetComponent <ConsumableConsumer>(); if (src_id.forbiddenTags != null) { component3.forbiddenTags = src_id.forbiddenTags.ToArray(); } if (src_id.MasteryBySkillID != null) { MinionResume component4 = dest_id.GetComponent <MinionResume>(); component4.RestoreResume(src_id.MasteryBySkillID, src_id.AptitudeBySkillGroup, src_id.TotalExperienceGained); component4.SetHats(src_id.currentHat, src_id.targetHat); } if (src_id.choreGroupPriorities != null) { ChoreConsumer component5 = dest_id.GetComponent <ChoreConsumer>(); component5.SetChoreGroupPriorities(src_id.choreGroupPriorities); } AttributeLevels component6 = dest_id.GetComponent <AttributeLevels>(); if (src_id.attributeLevels != null) { component6.SaveLoadLevels = src_id.attributeLevels.ToArray(); component6.OnDeserialized(); } dest_id.GetComponent <Accessorizer>().ApplyAccessories(); dest_id.assignableProxy = new Ref <MinionAssignablesProxy>(); dest_id.assignableProxy.Set(src_id.assignableProxy.Get()); dest_id.assignableProxy.Get().SetTarget(dest_id, dest_id.gameObject); Equipment equipment = dest_id.GetEquipment(); foreach (AssignableSlotInstance slot in equipment.Slots) { Equippable equippable = slot.assignable as Equippable; if ((UnityEngine.Object)equippable != (UnityEngine.Object)null) { equipment.Equip(equippable); } } Schedulable component7 = src_id.GetComponent <Schedulable>(); Schedule schedule = component7.GetSchedule(); if (schedule != null) { schedule.Unassign(component7); Schedulable component8 = dest_id.GetComponent <Schedulable>(); schedule.Assign(component8); } }
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); } }