private void OnResize() { KCanvasScaler kCanvasScaler = UnityEngine.Object.FindObjectOfType <KCanvasScaler>(); animController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale()); Transform transform = animController.transform.parent.gameObject.transform.Find("BG"); KBatchedAnimController kBatchedAnimController = (!((UnityEngine.Object)transform != (UnityEngine.Object)null)) ? null : transform.gameObject.GetComponent <KBatchedAnimController>(); if ((UnityEngine.Object)kBatchedAnimController != (UnityEngine.Object)null) { kBatchedAnimController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale()); } }
public void Initialize(IEnumerable <IListableOption> contentKeys, Action <IListableOption, object> onEntrySelectedAction, Func <IListableOption, IListableOption, object, int> sortFunction = null, Action <DropDownEntry, object> refreshAction = null, bool displaySelectedValueWhenClosed = true, object targetData = null) { this.targetData = targetData; this.sortFunction = sortFunction; this.onEntrySelectedAction = onEntrySelectedAction; this.displaySelectedValueWhenClosed = displaySelectedValueWhenClosed; rowRefreshAction = refreshAction; ChangeContent(contentKeys); openButton.ClearOnClick(); openButton.onClick += delegate { OnClick(); }; canvasScaler = GameScreenManager.Instance.ssOverlayCanvas.GetComponent <KCanvasScaler>(); }
private void SetAnimator() { if ((UnityEngine.Object)animController == (UnityEngine.Object)null) { animController = Util.KInstantiateUI(Assets.GetPrefab(new Tag("MinionSelectPreview")), contentBody.gameObject, false).GetComponent <KBatchedAnimController>(); animController.gameObject.SetActive(true); KCanvasScaler kCanvasScaler = UnityEngine.Object.FindObjectOfType <KCanvasScaler>(); animController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale()); ScreenResize instance = ScreenResize.Instance; instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize)); Transform transform = animController.transform.parent.gameObject.transform.Find("BG"); KBatchedAnimController kBatchedAnimController = (!((UnityEngine.Object)transform != (UnityEngine.Object)null)) ? null : transform.gameObject.GetComponent <KBatchedAnimController>(); if ((UnityEngine.Object)kBatchedAnimController != (UnityEngine.Object)null) { kBatchedAnimController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale()); } } stats.ApplyTraits(animController.gameObject); stats.ApplyRace(animController.gameObject); stats.ApplyAccessories(animController.gameObject); stats.ApplyExperience(animController.gameObject); HashedString name = idleAnims[UnityEngine.Random.Range(0, idleAnims.Length)]; idle_anim = Assets.GetAnim(name); if ((UnityEngine.Object)idle_anim != (UnityEngine.Object)null) { animController.AddAnimOverrides(idle_anim, 0f); } HashedString name2 = new HashedString("crewSelect_fx_kanim"); KAnimFile anim = Assets.GetAnim(name2); if ((UnityEngine.Object)anim != (UnityEngine.Object)null) { animController.AddAnimOverrides(anim, 0f); } animController.Queue("idle_default", KAnim.PlayMode.Loop, 1f, 0f); }
private void OnResize() { KCanvasScaler kCanvasScaler = UnityEngine.Object.FindObjectOfType <KCanvasScaler>(); animController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale()); }
private void SetPortraitAnimator(IAssignableIdentity identity) { if (identity != null && !identity.IsNull()) { if ((UnityEngine.Object)animController == (UnityEngine.Object)null) { animController = Util.KInstantiateUI(Assets.GetPrefab(new Tag("FullMinionUIPortrait")), duplicantAnimAnchor.gameObject, false).GetComponent <KBatchedAnimController>(); animController.gameObject.SetActive(true); KCanvasScaler kCanvasScaler = UnityEngine.Object.FindObjectOfType <KCanvasScaler>(); animController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale()); ScreenResize instance = ScreenResize.Instance; instance.OnResize = (System.Action)Delegate.Combine(instance.OnResize, new System.Action(OnResize)); } string value = string.Empty; Accessorizer component = animController.GetComponent <Accessorizer>(); for (int num = component.GetAccessories().Count - 1; num >= 0; num--) { component.RemoveAccessory(component.GetAccessories()[num].Get()); } MinionIdentity minionIdentity = identity as MinionIdentity; StoredMinionIdentity storedMinionIdentity = identity as StoredMinionIdentity; Accessorizer accessorizer = null; if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null) { accessorizer = minionIdentity.GetComponent <Accessorizer>(); foreach (ResourceRef <Accessory> accessory in accessorizer.GetAccessories()) { component.AddAccessory(accessory.Get()); } value = minionIdentity.GetComponent <MinionResume>().CurrentHat; } else if ((UnityEngine.Object)storedMinionIdentity != (UnityEngine.Object)null) { foreach (ResourceRef <Accessory> accessory2 in storedMinionIdentity.accessories) { component.AddAccessory(accessory2.Get()); } value = storedMinionIdentity.currentHat; } HashedString name = "anim_idle_healthy_kanim"; idle_anim = Assets.GetAnim(name); if ((UnityEngine.Object)idle_anim != (UnityEngine.Object)null) { animController.AddAnimOverrides(idle_anim, 0f); } animController.Queue("idle_default", KAnim.PlayMode.Loop, 1f, 0f); AccessorySlot hat = Db.Get().AccessorySlots.Hat; animController.SetSymbolVisiblity(hat.targetSymbolId, (!string.IsNullOrEmpty(value)) ? true : false); animController.SetSymbolVisiblity(Db.Get().AccessorySlots.Hair.targetSymbolId, string.IsNullOrEmpty(value) ? true : false); animController.SetSymbolVisiblity(Db.Get().AccessorySlots.HatHair.targetSymbolId, (!string.IsNullOrEmpty(value)) ? true : false); KAnim.Build.Symbol source_symbol = null; KAnim.Build.Symbol source_symbol2 = null; if ((bool)accessorizer) { source_symbol = accessorizer.GetAccessory(Db.Get().AccessorySlots.Hair).symbol; source_symbol2 = Db.Get().AccessorySlots.HatHair.Lookup("hat_" + HashCache.Get().Get(accessorizer.GetAccessory(Db.Get().AccessorySlots.Hair).symbol.hash)).symbol; } else if ((UnityEngine.Object)storedMinionIdentity != (UnityEngine.Object)null) { source_symbol = storedMinionIdentity.GetAccessory(Db.Get().AccessorySlots.Hair).symbol; source_symbol2 = Db.Get().AccessorySlots.HatHair.Lookup("hat_" + HashCache.Get().Get(storedMinionIdentity.GetAccessory(Db.Get().AccessorySlots.Hair).symbol.hash)).symbol; } animController.GetComponent <SymbolOverrideController>().AddSymbolOverride(Db.Get().AccessorySlots.HairAlways.targetSymbolId, source_symbol, 1); animController.GetComponent <SymbolOverrideController>().AddSymbolOverride(Db.Get().AccessorySlots.HatHair.targetSymbolId, source_symbol2, 1); } }