Ejemplo n.º 1
0
 public static void LoadAtlasAll()
 {
     if (sSpriteAtlasDict == null)
     {
         sSpriteAtlasDict = new Dictionary <string, SpriteAtlas>();
         foreach (var atlasName in PathUtil.GetSpriteAtlasNames())
         {
             var atlas = ResourceUtil.Load <SpriteAtlas>(PathUtil.SpriteAtlas(atlasName));
             if (atlas == null)
             {
                 return;
             }
             Sprite[] sprites = new Sprite[atlas.spriteCount];
             atlas.GetSprites(sprites);
             foreach (var sprite in sprites)
             {
                 var spriteName = sprite.name.Substring(0, sprite.name.Length - 7);
                 if (!sSpriteAtlasDict.ContainsKey(spriteName))
                 {
                     sSpriteAtlasDict.Add(spriteName, atlas);
                 }
             }
             sprites = null;
         }
     }
 }
Ejemplo n.º 2
0
 protected virtual void OnColorChanged(int index)
 {
     if (animator != null)
     {
         animator.GetComponentInChildren <SkinnedMeshRenderer>().material.mainTexture
             = ResourceUtil.Load <Texture2D>(PathUtil.Texture($"{GetType().Name}Texture_{index + 1}"));
     }
 }
Ejemplo n.º 3
0
        public void SetData(VirusData v)
        {
            this.v     = v;
            title.text = v.name;

            if (v.prefabPath != mLastPrefabPath)
            {
                if (mVirus != null)
                {
                    DestroyImmediate(mVirus.gameObject);
                }

                var prefab = ResourceUtil.Load <VirusBase>(v.prefabPath);
                if (mVirus == null && prefab != null)
                {
                    mVirus = Instantiate(prefab);
                    if (mVirus != null)
                    {
                        mVirus.rectTransform.SetParent(modelRoot, false);
                        mVirus.GetComponent <Collider2D>().enabled = false;
                        mVirus.stunEffect.gameObject.SetActive(false);
                        mVirus.cureEffect.gameObject.SetActive(false);
                        mColorIndex = UnityEngine.Random.Range(0, 6);
                        mVirus.SetColor(mColorIndex);
                    }
                }

                mLastPrefabPath = v.prefabPath;
            }

            if (mVirus != null)
            {
                mVirus.stunEffect.Stop(true);
            }
            if (v.isMax)
            {
                fill.value = 1f;
            }
            else
            {
                fill.value = v.progress;
            }
            if (v.isUnlock)
            {
                if (v.isReceivable)
                {
                    radioState.Radio(2);
                }
                else
                {
                    radioState.Radio(1);
                }
            }
            else
            {
                radioState.Radio(0);
            }
        }
Ejemplo n.º 4
0
 private AudioClip GetClip(string clipName)
 {
     if (!mCached.TryGetValue(clipName, out AudioClip clip))
     {
         clip = ResourceUtil.Load <AudioClip>(PathUtil.Sound(clipName));
         mCached.Add(clipName, clip);
     }
     return(clip);
 }
Ejemplo n.º 5
0
        private void Refresh()
        {
            if (v.prefabPath != mLastPrefabPath)
            {
                if (mVirus != null)
                {
                    DestroyImmediate(mVirus.gameObject);
                }

                var prefab = ResourceUtil.Load <VirusBase>(v.prefabPath);
                if (mVirus == null && prefab != null)
                {
                    mVirus = Instantiate(prefab);
                    if (mVirus != null)
                    {
                        mVirus.rectTransform.SetParent(modelRoot, false);
                        mVirus.SetColor(ColorIndex);
                    }
                }
                mLastPrefabPath = v.prefabPath;
            }

            if (mVirus != null)
            {
                mVirus.stunEffect.Stop(true);
            }
            if (v.isMax)
            {
                fill.value    = 1f;
                fillText.text = "";
                receiveBtn.SetData(LTKey.COLLECT_FINISH.LT(), true, false);
            }
            else
            {
                fill.value    = v.progress;
                fillText.text = $"{v.collectCount - v.startCount}/{v.endCount - v.startCount}";
                receiveBtn.SetData(LTKey.RECEIVE.LT(), !v.isReceivable, false);
            }
            diamondCount.text = "x" + D.I.GetBookDiamond(v.id);
            title.text        = v.name;
            tips.text         = v.tips;
            description.text  = v.description;
            adReceiveRadio.Radio(!D.I.noAd && v.needPlayAd);
        }
Ejemplo n.º 6
0
        public void Reset()
        {
            var weaponType = D.I.weaponId <= 0 ? "WeaponNone" : TableWeapon.Get(D.I.weaponId).type;

            if (mLastWeaponType != weaponType)
            {
                if (mWeapon != null)
                {
                    DestroyImmediate(mWeapon.gameObject);
                }
                var prefab = ResourceUtil.Load <WeaponBase>(PathUtil.Entity(weaponType));
                if (prefab != null)
                {
                    mWeapon = Instantiate(prefab);
                    mWeapon.rectTransform.SetParent(mWeaponRoot, false);
                }
                mLastWeaponType = weaponType;
            }

            mWeapon.Reset(D.I.weaponId, D.I.weaponPowerLevel, D.I.weaponSpeedLevel);
        }
Ejemplo n.º 7
0
        private static void Load()
        {
            var bytes = ResourceUtil.Load <TextAsset>(PathUtil.Table("TableLanguage")).bytes;

            Load(bytes);
        }
Ejemplo n.º 8
0
        private static void Load()
        {
            var bytes = ResourceUtil.Load <TextAsset>(PathUtil.Table("TableBuffKillGen")).bytes;

            Load(bytes);
        }
Ejemplo n.º 9
0
 static ViewBase LoadViewFunc(string panelName)
 {
     return(ResourceUtil.Load <ViewBase>(PathUtil.Panel(panelName)));
 }
Ejemplo n.º 10
0
        private static void Load()
        {
            var bytes = ResourceUtil.Load <TextAsset>(PathUtil.Table("TableWeaponPowerLevel")).bytes;

            Load(bytes);
        }