Exemplo n.º 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);
            }
        }
Exemplo n.º 2
0
        protected override void OnOpen()
        {
            base.OnOpen();
            this.BindUntilDisable <EventGameData>(OnEventGameData);
            mVirus.Clear();
            foreach (var v in TableVirus.GetAll())
            {
                if (v.collectable <= 0)
                {
                    continue;
                }
                var _data = new VirusData();
                _data.SetData(v.id);
                mVirus.Add(_data);
            }
            mVirus.Sort((a, b) => b.isUnlock.CompareTo(a.isUnlock));

            Refresh();

            fadeGroup.FadeIn(() =>
            {
                NavigationView.BlackSetting(true);
            });
        }