private void ScheduleUpdate() { updateHandle = UIScheduler.Instance.Schedule("RefreshCommandModuleSideScreen", 1f, delegate { RefreshConditions(); ScheduleUpdate(); }, null, null); }
private void ScheduleUpdate() { updateHandle = UIScheduler.Instance.Schedule("RefreshMinionPersonalityPanel", 1f, delegate { Refresh(); ScheduleUpdate(); }, null, null); }
public SchedulerHandle Schedule(string name, float time, Action <object> callback, object callback_data = null, SchedulerGroup group = null) { if (group != null && group.scheduler != this) { Debug.LogError("Scheduler group mismatch!"); } SchedulerHandle schedulerHandle = Schedule(name, time, -1f, callback, callback_data, null); group?.Add(schedulerHandle); return(schedulerHandle); }
private void Refresh() { if (!IsThereLiquid()) { if (!destroyHandle.IsValid) { destroyHandle = GameScheduler.Instance.Schedule("DestroyMoppable", 1f, delegate { TryDestroy(); }, this, null); } } else if (destroyHandle.IsValid) { destroyHandle.ClearScheduler(); } }
public void Clear(SchedulerHandle handle) { handle.entry.Clear(); }
public void StartSmallSnore() { snoreHandle = GameScheduler.Instance.Schedule("snorelines", 2f, StartSmallSnoreInternal, null, null); }
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); } }
public void Equip(Equippable equippable) { AssignableSlotInstance slot = GetSlot(equippable.slot); slot.Assign(equippable); GameObject targetGameObject = GetTargetGameObject(); Debug.Assert(targetGameObject, "GetTargetGameObject returned null in Equip"); targetGameObject.Trigger(-448952673, equippable.GetComponent <KPrefabID>()); equippable.Trigger(-1617557748, this); Attributes attributes = targetGameObject.GetAttributes(); if (attributes != null) { foreach (AttributeModifier attributeModifier in equippable.def.AttributeModifiers) { attributes.Add(attributeModifier); } } SnapOn component = targetGameObject.GetComponent <SnapOn>(); if ((Object)component != (Object)null) { component.AttachSnapOnByName(equippable.def.SnapOn); if (equippable.def.SnapOn1 != null) { component.AttachSnapOnByName(equippable.def.SnapOn1); } } KBatchedAnimController component2 = targetGameObject.GetComponent <KBatchedAnimController>(); if ((Object)component2 != (Object)null && (Object)equippable.def.BuildOverride != (Object)null) { component2.GetComponent <SymbolOverrideController>().AddBuildOverride(equippable.def.BuildOverride.GetData(), equippable.def.BuildOverridePriority); } if ((bool)equippable.transform.parent) { Storage component3 = equippable.transform.parent.GetComponent <Storage>(); if ((bool)component3) { component3.Drop(equippable.gameObject, true); } } equippable.transform.parent = slot.gameObject.transform; equippable.transform.SetLocalPosition(Vector3.zero); SetEquippableStoredModifiers(equippable, true); equippable.OnEquip(slot); if (refreshHandle.TimeRemaining > 0f) { Debug.LogWarning(targetGameObject.GetProperName() + " is already in the process of changing equipment (equip)"); refreshHandle.ClearScheduler(); } CreatureSimTemperatureTransfer transferer = targetGameObject.GetComponent <CreatureSimTemperatureTransfer>(); if (!((Object)component2 == (Object)null)) { refreshHandle = GameScheduler.Instance.Schedule("ChangeEquipment", 2f, delegate { if ((Object)transferer != (Object)null) { transferer.RefreshRegistration(); } }, null, null); } Game.Instance.Trigger(-2146166042, null); }
public void Unequip(Equippable equippable) { AssignableSlotInstance slot = GetSlot(equippable.slot); slot.Unassign(true); equippable.Trigger(-170173755, this); GameObject targetGameObject = GetTargetGameObject(); if ((bool)targetGameObject) { targetGameObject.Trigger(-1285462312, equippable.GetComponent <KPrefabID>()); KBatchedAnimController component = targetGameObject.GetComponent <KBatchedAnimController>(); if (!destroyed) { if ((Object)equippable.def.BuildOverride != (Object)null && (Object)component != (Object)null) { component.GetComponent <SymbolOverrideController>().TryRemoveBuildOverride(equippable.def.BuildOverride.GetData(), equippable.def.BuildOverridePriority); } Attributes attributes = targetGameObject.GetAttributes(); if (attributes != null) { foreach (AttributeModifier attributeModifier in equippable.def.AttributeModifiers) { attributes.Remove(attributeModifier); } } if (!equippable.def.IsBody) { SnapOn component2 = targetGameObject.GetComponent <SnapOn>(); component2.DetachSnapOnByName(equippable.def.SnapOn); if (equippable.def.SnapOn1 != null) { component2.DetachSnapOnByName(equippable.def.SnapOn1); } } if ((bool)equippable.transform.parent) { Storage component3 = equippable.transform.parent.GetComponent <Storage>(); if ((bool)component3) { component3.Drop(equippable.gameObject, true); } } SetEquippableStoredModifiers(equippable, false); equippable.transform.parent = null; equippable.transform.SetPosition(targetGameObject.transform.GetPosition() + Vector3.up / 2f); KBatchedAnimController component4 = equippable.GetComponent <KBatchedAnimController>(); if ((bool)component4) { component4.SetSceneLayer(Grid.SceneLayer.Ore); } if (!((Object)component == (Object)null)) { if (refreshHandle.TimeRemaining > 0f) { refreshHandle.ClearScheduler(); } refreshHandle = GameScheduler.Instance.Schedule("ChangeEquipment", 1f, delegate { GameObject gameObject = (!((Object)this != (Object)null)) ? null : GetTargetGameObject(); if ((bool)gameObject) { CreatureSimTemperatureTransfer component5 = gameObject.GetComponent <CreatureSimTemperatureTransfer>(); if ((Object)component5 != (Object)null) { component5.RefreshRegistration(); } } }, null, null); } } Game.Instance.Trigger(-2146166042, null); } }
public void Add(SchedulerHandle handle) { handles.Add(handle); }