Exemple #1
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);
            }
        }
        public void SetData(int id)
        {
            mId = id;
            var table = TableWeapon.Get(id);

            icon.SetSprite(table.icon);
            icon.SetGrey(D.I.unlockedGameLevel < table.unlockLevel);
            title.text = LT.Get(table.nameID);
            selectedObj.SetActive(id == D.I.weaponId);
            radioState.Radio(D.I.unlockedGameLevel < table.unlockLevel ? 0 : D.I.weaponId == id ? 2 : 1);
            unlockText.text = LTKey.WEAPON_UNLOCK_ON_GAME_LEVEL_X.LT(table.unlockLevel - 1);
            trialTag.SetActive(!D.I.noAd && D.I.GetTrialWeaponID() == id && !D.I.IsInTrial());
        }