Пример #1
0
        public List <TechTreeNodeLockInfo> GetLockInfo()
        {
            this._lockInfoList.Clear();
            if ((this._metaData.UnlockLevel > 0) && (Singleton <IslandModule> .Instance.GetCabinDataByType((CabinType)this._metaData.Cabin).level < this._metaData.UnlockLevel))
            {
                TechTreeNodeLockInfo info = new TechTreeNodeLockInfo {
                    _lockType  = TechTreeNodeLock.CabinLevel,
                    _needLevel = this._metaData.UnlockLevel
                };
                this._lockInfoList.Add(info);
            }
            if (this._metaData.UnlockAvatarID > 0)
            {
                AvatarDataItem avatarByID = Singleton <AvatarModule> .Instance.GetAvatarByID(this._metaData.UnlockAvatarID);

                if (!avatarByID.UnLocked)
                {
                    TechTreeNodeLockInfo item = new TechTreeNodeLockInfo {
                        _lockType  = TechTreeNodeLock.AvatarUnlock,
                        _needLevel = this._metaData.UnlockAvatarLevel
                    };
                    this._lockInfoList.Add(item);
                }
                else if (avatarByID.level < this._metaData.UnlockAvatarLevel)
                {
                    TechTreeNodeLockInfo info3 = new TechTreeNodeLockInfo {
                        _lockType  = TechTreeNodeLock.AvatarLevel,
                        _needLevel = this._metaData.UnlockAvatarLevel
                    };
                    this._lockInfoList.Add(info3);
                }
            }
            return(this._lockInfoList);
        }
Пример #2
0
        public void RefreshStatus()
        {
            if (!this.Invalid())
            {
                this.ClearStatusImage();
                this.RefreshNew();
                this.RefreshBorder();
                this.Refresh_00_Flash();
                base.transform.Find("Icon").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(this._data._metaData.Icon);
                switch (this._data._status)
                {
                case TechTreeNodeStatus.Lock:
                {
                    base.transform.Find("Lock").gameObject.SetActive(true);
                    base.transform.Find("BG").GetComponent <Image>().sprite = this._grayBG;
                    this.GrayIcon();
                    TechTreeNodeLockInfo info = this._data.GetLockInfo()[0];
                    if ((info._lockType != TechTreeNodeLock.AvatarLevel) && (info._lockType != TechTreeNodeLock.AvatarUnlock))
                    {
                        if (info._lockType == TechTreeNodeLock.CabinLevel)
                        {
                            Transform transform3 = base.transform.Find("Lock/Cabin");
                            transform3.gameObject.SetActive(true);
                            string cabinName = Singleton <IslandModule> .Instance.GetCabinDataByType((CabinType)this._data._metaData.Cabin).GetCabinName();

                            transform3.GetComponent <Text>().text = cabinName;
                            Transform transform4 = base.transform.Find("Lock/Level");
                            transform4.gameObject.SetActive(true);
                            transform4.GetComponent <Text>().text = string.Format("Lv.{0}", info._needLevel);
                        }
                        break;
                    }
                    Transform transform = base.transform.Find("Lock/Avatar");
                    transform.gameObject.SetActive(true);
                    transform.GetComponent <Image>().sprite = UIUtil.GetAvatarCardIcon(this._data._metaData.UnlockAvatarID);
                    Transform transform2 = base.transform.Find("Lock/Level");
                    transform2.gameObject.SetActive(true);
                    transform2.GetComponent <Text>().text = string.Format("Lv.{0}", info._needLevel);
                    break;
                }

                case TechTreeNodeStatus.Unlock_Ban_Active:
                    base.transform.Find("BG").GetComponent <Image>().sprite = this._grayBG;
                    this.GrayIcon();
                    break;

                case TechTreeNodeStatus.Unlock_Ready_Active:
                    base.transform.Find("BG").GetComponent <Image>().sprite = this._halfBG;
                    break;

                case TechTreeNodeStatus.Active:
                    base.transform.Find("BG").GetComponent <Image>().sprite = this._brightBG;
                    break;
                }
            }
        }
Пример #3
0
        protected override bool SetupView()
        {
            this.InitView();
            base.view.transform.Find("Dialog/Content/Info/Title").GetComponent <Text>().text = LocalizationGeneralLogic.GetText(this._data._metaData.Title, new object[0]);
            this.SetupDesc();
            base.view.transform.Find("Dialog/Content/NodeIcon/Image").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(this._data._metaData.Icon);
            Transform transform  = base.view.transform.Find("Dialog/Content/Info/Error/BG/Line1");
            Transform transform2 = base.view.transform.Find("Dialog/Content/Info/Error/BG/Line2");

            if (this._data._status == TechTreeNodeStatus.Lock)
            {
                base.view.transform.Find("Dialog/Content/Info/Error").gameObject.SetActive(true);
                List <TechTreeNodeLockInfo> lockInfo = this._data.GetLockInfo();
                for (int i = 0; i < lockInfo.Count; i++)
                {
                    Transform transform3 = (i != 0) ? transform2 : transform;
                    transform3.gameObject.SetActive(true);
                    TechTreeNodeLockInfo info = lockInfo[i];
                    if (info._lockType == TechTreeNodeLock.CabinLevel)
                    {
                        string cabinName = Singleton <IslandModule> .Instance.GetCabinDataByType((CabinType)this._data._metaData.Cabin).GetCabinName();

                        object[] replaceParams = new object[] { cabinName, info._needLevel.ToString() };
                        transform3.GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_Desc_TechTreeNodeLevelLack", replaceParams);
                    }
                    else if ((info._lockType == TechTreeNodeLock.AvatarLevel) || (info._lockType == TechTreeNodeLock.AvatarUnlock))
                    {
                        AvatarDataItem avatarByID = Singleton <AvatarModule> .Instance.GetAvatarByID(this._data._metaData.UnlockAvatarID);

                        object[] objArray2 = new object[] { avatarByID.ShortName, info._needLevel.ToString() };
                        transform3.GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_Desc_TechTreeNodeLevelLack", objArray2);
                        base.view.transform.Find("Dialog/Content/AvatarIcon").gameObject.SetActive(true);
                        base.view.transform.Find("Dialog/Content/AvatarIcon/Text").GetComponent <Text>().text     = LocalizationGeneralLogic.GetText("Menu_Desc_AvatarLevelLack", new object[0]);
                        base.view.transform.Find("Dialog/Content/AvatarIcon/Image").GetComponent <Image>().sprite = UIUtil.GetAvatarCardIcon(this._data._metaData.UnlockAvatarID);
                    }
                }
            }
            else if (this._data._status == TechTreeNodeStatus.Unlock_Ban_Active)
            {
                base.view.transform.Find("Dialog/Content/Info/Error").gameObject.SetActive(true);
                transform.gameObject.SetActive(true);
                transform.GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_Desc_NeedActiveNeibour", new object[0]);
            }
            else if (this._data._status == TechTreeNodeStatus.Unlock_Ready_Active)
            {
                int leftPowerCost = Singleton <IslandModule> .Instance.GetLeftPowerCost();

                if (this._data._metaData.PowerCost > leftPowerCost)
                {
                    base.view.transform.Find("Dialog/Content/Info/Error").gameObject.SetActive(true);
                    transform.gameObject.SetActive(true);
                    transform.GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_Desc_PowerLack", new object[0]);
                }
                else
                {
                    base.view.transform.Find("Dialog/Content/ActivateBtn").GetComponent <Button>().interactable = true;
                }
            }
            else if (this._data._status == TechTreeNodeStatus.Active)
            {
                base.view.transform.Find("Dialog/Content/LabelActive").gameObject.SetActive(true);
                base.view.transform.Find("Dialog/Content/ActivateBtn").gameObject.SetActive(false);
            }
            base.view.transform.Find("Dialog/Content/PowerInfo/Num").GetComponent <Text>().text = this._data._metaData.PowerCost.ToString();
            return(false);
        }