Esempio n. 1
0
    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());
        }
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
 private void Update()
 {
     if (open && (Input.GetMouseButtonDown(0) || Input.GetAxis("Mouse ScrollWheel") != 0f))
     {
         float   canvasScale = canvasScaler.GetCanvasScale();
         Vector3 position    = scrollRect.rectTransform().GetPosition();
         float   x           = position.x;
         Vector2 sizeDelta   = scrollRect.rectTransform().sizeDelta;
         float   num         = x + sizeDelta.x * canvasScale;
         Vector3 mousePos    = KInputManager.GetMousePos();
         if (!(num < mousePos.x))
         {
             Vector3 position2 = scrollRect.rectTransform().GetPosition();
             float   x2        = position2.x;
             Vector3 mousePos2 = KInputManager.GetMousePos();
             if (!(x2 > mousePos2.x))
             {
                 Vector3 position3  = scrollRect.rectTransform().GetPosition();
                 float   y          = position3.y;
                 Vector2 sizeDelta2 = scrollRect.rectTransform().sizeDelta;
                 float   num2       = y - sizeDelta2.y * canvasScale;
                 Vector3 mousePos3  = KInputManager.GetMousePos();
                 if (!(num2 > mousePos3.y))
                 {
                     Vector3 position4 = scrollRect.rectTransform().GetPosition();
                     float   y2        = position4.y;
                     Vector3 mousePos4 = KInputManager.GetMousePos();
                     if (!(y2 < mousePos4.y))
                     {
                         return;
                     }
                 }
             }
         }
         Close();
     }
 }
    private void OnResize()
    {
        KCanvasScaler kCanvasScaler = UnityEngine.Object.FindObjectOfType <KCanvasScaler>();

        animController.animScale = baseCharacterScale * (1f / kCanvasScaler.GetCanvasScale());
    }
Esempio n. 5
0
 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);
     }
 }