예제 #1
0
        //状态
        public int GetSkillState(string skillName)
        {
            SkillItemDTO itemDTO;

            if (!m_Data.itemMap.TryGetValue(skillName, out itemDTO))
            {
                itemDTO = new SkillItemDTO(skillName, 0);
                m_Data.itemMap.Add(skillName, itemDTO);
                SaveData();
            }
            return(itemDTO.state);
        }
예제 #2
0
        private void FreshItem(CampBuffItem cbi, SkillItemDTO dto, bool lockBuff, CampBUFF_ItemSmall item, CampBUFF_ItemDetail itemDetail)
        {
            item.name.text.text          = Global.gApp.gGameData.GetTipsInCurLanguage(cbi.name);
            itemDetail.name.text.text    = Global.gApp.gGameData.GetTipsInCurLanguage(cbi.name);
            item.goods.image.sprite      = Global.gApp.gResMgr.LoadAssets <Sprite>(cbi.icon);
            itemDetail.icon.image.sprite = Global.gApp.gResMgr.LoadAssets <Sprite>(cbi.icon);
            item.level.text.text         = dto.level.ToString();
            itemDetail.level.text.text   = dto.level.ToString();
            CampBuff_dataItem curData;
            CampBuff_dataItem nextData;
            string            curPercent;

            float[] cost;

            float heartCost;

            if (dto.level < Global.gApp.gGameData.CampBuffDataConfig.items.Length)
            {
                itemDetail.Button.gameObject.SetActive(dto.state != WeaponStateConstVal.NONE);
                itemDetail.unlockTips.gameObject.SetActive(dto.state == WeaponStateConstVal.NONE);
                if (dto.state == WeaponStateConstVal.NONE)
                {
                    itemDetail.unlockTips.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(4378), cbi.campLevel);
                }
                //升级
                if (dto.level > 0)
                {
                    curData  = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level - 1];
                    nextData = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level];
                    float[] curVal  = ReflectionUtil.GetValueByProperty <CampBuff_dataItem, float[]>(cbi.id, curData);
                    float[] nextVal = ReflectionUtil.GetValueByProperty <CampBuff_dataItem, float[]>(cbi.id, nextData);
                    curPercent = GetPercentStr(cbi, curVal[0]);
                    string nextPercent = GetPercentStr(cbi, nextVal[0]);
                    itemDetail.desc.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(cbi.desc), curPercent, nextPercent);
                    item.text.text.text       = "+" + curPercent;

                    cost      = ReflectionUtil.GetValueByProperty <CampBuff_dataItem, float[]>(cbi.id + "_cost", curData);
                    heartCost = cost[0];
                    itemDetail.upgrade.gameObject.SetActive(true);
                    itemDetail.unlock.gameObject.SetActive(false);
                    itemDetail.cost.text.text = UiTools.FormateMoney(heartCost);
                }
                else
                {
                    //解锁
                    nextData = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level];
                    float[] nextVal     = ReflectionUtil.GetValueByProperty <CampBuff_dataItem, float[]>(cbi.id, nextData);
                    string  nextPercent = GetPercentStr(cbi, nextVal[0]);
                    itemDetail.desc.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(cbi.desc_nolearn), nextPercent);
                    itemDetail.upgrade.gameObject.SetActive(false);
                    itemDetail.unlock.gameObject.SetActive(true);
                    heartCost = cbi.unlockCost;
                    itemDetail.cost.text.text = UiTools.FormateMoney(heartCost);
                }
                bool red = GameItemFactory.GetInstance().GetItem(SpecialItemIdConstVal.RED_HEART) < heartCost;
                itemDetail.cost.text.color = ColorUtil.GetTextColor(red, ColorUtil.m_YellowColor);
                itemDetail.up.gameObject.SetActive(!lockBuff && !red);
            }
            else
            {
                //满级
                curData  = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level - 2];
                nextData = Global.gApp.gGameData.CampBuffDataConfig.items[dto.level - 1];
                float[] curVal  = ReflectionUtil.GetValueByProperty <CampBuff_dataItem, float[]>(cbi.id, curData);
                float[] nextVal = ReflectionUtil.GetValueByProperty <CampBuff_dataItem, float[]>(cbi.id, nextData);
                curPercent = GetPercentStr(cbi, nextVal[0]);
                itemDetail.desc.text.text = string.Format(Global.gApp.gGameData.GetTipsInCurLanguage(cbi.max_desc), curPercent);

                itemDetail.Button.gameObject.SetActive(false);
                itemDetail.unlockTips.gameObject.SetActive(true);
                itemDetail.unlockTips.text.text = Global.gApp.gGameData.GetTipsInCurLanguage(4383);
                itemDetail.up.gameObject.SetActive(false);
                item.text.text.text = "+" + curPercent;
            }
            item.lockIcon.gameObject.SetActive(lockBuff);
            itemDetail.lockIcon.gameObject.SetActive(lockBuff);
            item.numberBg.gameObject.SetActive(!lockBuff);
            item.text.gameObject.SetActive(!lockBuff);
            item.goods.image.color      = ColorUtil.GetSpecialColor(lockBuff, ColorUtil.m_HalfColor);
            itemDetail.icon.image.color = ColorUtil.GetSpecialColor(lockBuff, ColorUtil.m_HalfColor);
            itemDetail.lvBg.gameObject.SetActive(!lockBuff);
            item.lvBg.gameObject.SetActive(!lockBuff);
        }