private Entry ManifestEntry <UpdateInterface>(string name, bool load_balance) { if (bucketTable.TryGetValue(name, out Entry value)) { DebugUtil.DevAssertArgs(value.buckets.Length == ((!load_balance) ? 1 : Singleton <StateMachineUpdater> .Instance.GetFrameCount(GetUpdateRate <UpdateInterface>())), "load_balance doesn't match previous registration...maybe load_balance erroneously on for a BatchUpdate type ", name, "?"); return(value); } value = default(Entry); UpdateRate updateRate = GetUpdateRate <UpdateInterface>(); int num = (!load_balance) ? 1 : Singleton <StateMachineUpdater> .Instance.GetFrameCount(updateRate); value.buckets = new StateMachineUpdater.BaseUpdateBucket[num]; for (int i = 0; i < num; i++) { value.buckets[i] = new UpdateBucketWithUpdater <UpdateInterface>(name); Singleton <StateMachineUpdater> .Instance.AddBucket(updateRate, value.buckets[i]); } return(value); }
private void NextStep(HashedString finishedAnim) { if (currentStep >= 0 && emoteSteps[currentStep].timeout <= 0f) { kbac.onAnimComplete -= NextStep; if (emoteSteps[currentStep].finishcb != null) { emoteSteps[currentStep].finishcb(reactor); } } currentStep++; if (currentStep >= emoteSteps.Count || (UnityEngine.Object)kbac == (UnityEngine.Object)null) { End(); } else { if (emoteSteps[currentStep].anim != HashedString.Invalid) { kbac.Play(emoteSteps[currentStep].anim, emoteSteps[currentStep].mode, 1f, 0f); if (kbac.IsStopped()) { DebugUtil.DevAssertArgs(false, "Emote is missing anim:", emoteSteps[currentStep].anim); emoteSteps[currentStep].timeout = 0.25f; } } if (emoteSteps[currentStep].timeout <= 0f) { kbac.onAnimComplete += NextStep; } else { elapsed = 0f; } if (emoteSteps[currentStep].startcb != null) { emoteSteps[currentStep].startcb(reactor); } } }
public static Tuple <Sprite, Color> GetUISprite(object item, string animName = "ui", bool centered = false) { if (item is Substance) { return(GetUISprite(ElementLoader.FindElementByHash((item as Substance).elementID), animName, centered)); } if (item is Element) { if ((item as Element).IsSolid) { return(new Tuple <Sprite, Color>(GetUISpriteFromMultiObjectAnim((item as Element).substance.anim, animName, centered, string.Empty), Color.white)); } if ((item as Element).IsLiquid) { return(new Tuple <Sprite, Color>(Assets.GetSprite("element_liquid"), (item as Element).substance.uiColour)); } if ((item as Element).IsGas) { return(new Tuple <Sprite, Color>(Assets.GetSprite("element_gas"), (item as Element).substance.uiColour)); } return(new Tuple <Sprite, Color>(null, Color.clear)); } if (item is GameObject) { GameObject gameObject = item as GameObject; if (ElementLoader.GetElement(gameObject.PrefabID()) != null) { return(GetUISprite(ElementLoader.GetElement(gameObject.PrefabID()), animName, centered)); } CreatureBrain component = gameObject.GetComponent <CreatureBrain>(); if ((UnityEngine.Object)component != (UnityEngine.Object)null) { animName = component.symbolPrefix + "ui"; } SpaceArtifact component2 = gameObject.GetComponent <SpaceArtifact>(); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null) { animName = component2.GetUIAnim(); } if (gameObject.HasTag(GameTags.Egg)) { IncubationMonitor.Def def = gameObject.GetDef <IncubationMonitor.Def>(); if (def != null) { GameObject prefab = Assets.GetPrefab(def.spawnedCreature); if ((bool)prefab) { component = prefab.GetComponent <CreatureBrain>(); if ((bool)component && !string.IsNullOrEmpty(component.symbolPrefix)) { animName = component.symbolPrefix + animName; } } } } KBatchedAnimController component3 = gameObject.GetComponent <KBatchedAnimController>(); if ((bool)component3) { Sprite uISpriteFromMultiObjectAnim = GetUISpriteFromMultiObjectAnim(component3.AnimFiles[0], animName, centered, string.Empty); return(new Tuple <Sprite, Color>(uISpriteFromMultiObjectAnim, (!((UnityEngine.Object)uISpriteFromMultiObjectAnim != (UnityEngine.Object)null)) ? Color.clear : Color.white)); } if ((UnityEngine.Object)gameObject.GetComponent <Building>() != (UnityEngine.Object)null) { Sprite uISprite = gameObject.GetComponent <Building>().Def.GetUISprite(animName, centered); return(new Tuple <Sprite, Color>(uISprite, (!((UnityEngine.Object)uISprite != (UnityEngine.Object)null)) ? Color.clear : Color.white)); } Debug.LogWarningFormat("Can't get sprite for type {0} (no KBatchedAnimController)", item.ToString()); return(null); } if (item is string) { if (Db.Get().Amounts.Exists(item as string)) { Amount amount = Db.Get().Amounts.Get(item as string); return(new Tuple <Sprite, Color>(Assets.GetSprite(amount.uiSprite), Color.white)); } if (Db.Get().Attributes.Exists(item as string)) { Klei.AI.Attribute attribute = Db.Get().Attributes.Get(item as string); return(new Tuple <Sprite, Color>(Assets.GetSprite(attribute.uiSprite), Color.white)); } return(GetUISprite((item as string).ToTag(), animName, centered)); } if (item is Tag) { if (ElementLoader.GetElement((Tag)item) != null) { return(GetUISprite(ElementLoader.GetElement((Tag)item), animName, centered)); } if ((UnityEngine.Object)Assets.GetPrefab((Tag)item) != (UnityEngine.Object)null) { return(GetUISprite(Assets.GetPrefab((Tag)item), animName, centered)); } if ((UnityEngine.Object)Assets.GetSprite(((Tag)item).Name) != (UnityEngine.Object)null) { return(new Tuple <Sprite, Color>(Assets.GetSprite(((Tag)item).Name), Color.white)); } } DebugUtil.DevAssertArgs(false, "Can't get sprite for type ", item.ToString()); return(null); }