Example #1
0
        public static List <LeaderSkillInfo> GetLeaderSkillInfoDefault(int leaderID)
        {
            List <LeaderSkillInfo> result = new List <LeaderSkillInfo>();
            var meta = GetLeaderPresetDataByKey(leaderID);

            if (meta != null)
            {
                var list = Utility.TryParseStringList(meta.LeaderSkillIDList, ',');
                for (int i = 0; i < list.Count; i++)
                {
                    var skill = Utility.TryParseIntList(list[i], ':');
                    if (skill.Count != 2)
                    {
                        DebugPlus.LogError("LeaderSkill FormateError!  leaderID=" + leaderID);
                        continue;
                    }
                    int skillID = skill[0];
                    if (GetLeaderSkillDataByKey(skillID) != null)
                    {
                        LeaderSkillInfo info = LeaderSkillInfo.InitSkillInfo(skillID, skill[1]);
                        result.Add(info);
                    }
                }
            }

            return(result);
        }
Example #2
0
        public void SetUpItem(GeneralInfoItemType type, object param, bool showText = true)
        {
            this.type = type;
            if (type == GeneralInfoItemType.Camp_Creed)
            {
                try
                {
                    CampCreedInfo info = (CampCreedInfo)param;
                    keyParam         = info.creedID;
                    iconTrans.sprite = Utility.LoadSprite(info.creedIconPath);
                    textTrans.text   = showText ? info.creedName : "";
                }
                catch { return; }
            }
            else if (type == GeneralInfoItemType.Camp_Attribute)
            {
                try
                {
                    CampAttributeInfo info = (CampAttributeInfo)param;
                    keyParam         = info.attributeID;
                    iconTrans.sprite = Utility.LoadSprite(info.iconPath);
                    textTrans.text   = showText ? info.attributeName : "";
                }
                catch { return; }
            }
            else if (type == GeneralInfoItemType.Leader_Skill)
            {
                try
                {
                    LeaderSkillInfo info = (LeaderSkillInfo)param;
                    keyParam         = info.skillID;
                    iconTrans.sprite = Utility.LoadSprite(info.skillIconPath);
                    textTrans.text   = showText ? info.skillName : "";
                }
                catch { return; }
            }
            else if (type == GeneralInfoItemType.Leader_Attribute)
            {
                try
                {
                    LeaderAttributeInfo info = (LeaderAttributeInfo)param;
                    keyParam         = info.attributeID;
                    iconTrans.sprite = Utility.LoadSprite(info.attributeIconPath);
                    textTrans.text   = showText ? info.attributeName : "";
                }
                catch { return; }
            }

            RefrehsContentSize();
            //FadeAnim
            var canvas = transform.SafeGetComponent <CanvasGroup>();

            canvas.alpha = 0;
            canvas.DoCanvasFade(1, 0.8f);
        }
Example #3
0
        public void SetUpItem(LeaderSkillInfo info)
        {
            if (info == null)
            {
                return;
            }
            _info           = info;
            _icon.sprite    = Utility.LoadSprite(info.skillIconPath);
            _skillName.text = info.skillName;

            _levelText.text = Utility.ParseStringParams(MultiLanguage.Instance.GetTextValue(LeaderSkill_LV_Text),
                                                        new string[] { _info.currentLevel.ToString() });

            ///Fade
            var canvas = transform.SafeGetComponent <CanvasGroup>();

            canvas.alpha = 0;
            canvas.DoCanvasFade(1, 0.8f);
        }
Example #4
0
        public static LeaderSkillInfo InitSkillInfo(int skillID, int defaultLevel)
        {
            LeaderSkillInfo info = new LeaderSkillInfo();
            var             meta = LeaderModule.GetLeaderSkillDataByKey(skillID);

            if (meta == null)
            {
                DebugPlus.LogError("Init LeaderSkill Info Error! skillID=" + skillID);
                return(null);
            }
            info.skillID       = meta.SkillID;
            info.skillName     = MultiLanguage.Instance.GetTextValue(meta.SkillName);
            info.skillDesc     = MultiLanguage.Instance.GetTextValue(meta.SkillDesc);
            info.skillIconPath = meta.SkillIcon;
            info.currentLevel  = defaultLevel;
            info.maxLevel      = meta.MaxLevel;

            if (info.currentLevel > meta.MaxLevel)
            {
                DebugPlus.Log("LeaderSkill Info SkillLevelDefault larger than MaxLevel, skillID=" + skillID);
                info.currentLevel = meta.MaxLevel;
            }
            return(info);
        }