Example #1
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 #2
0
        public static CampAttributeInfo InitInfo(int attributeID)
        {
            CampAttributeInfo info = new CampAttributeInfo();
            var meta = CampModule.GetCampAttributeDataByKey(attributeID);

            if (meta != null)
            {
                info.attributeID   = meta.AttributeID;
                info.attributeName = MultiLanguage.Instance.GetTextValue(meta.Name);
                info.attributeDesc = MultiLanguage.Instance.GetTextValue(meta.Desc);
                info.iconPath      = meta.Icon;
                return(info);
            }
            DebugPlus.LogError("[CampAttributeInfo] : Init Fail!  attributeID=" + attributeID);
            return(null);
        }
Example #3
0
        public static List <CampAttributeInfo> GetCampAttribueInfoList(int campID)
        {
            List <CampAttributeInfo> result = new List <CampAttributeInfo>();
            var meta = GetCampDataByKey(campID);

            if (meta != null)
            {
                var list = Utility.TryParseIntList(meta.AttributeIDList, ',');
                for (int i = 0; i < list.Count; i++)
                {
                    CampAttributeInfo info = CampAttributeInfo.InitInfo(list[i]);
                    if (info != null)
                    {
                        result.Add(info);
                    }
                }
            }
            return(result);
        }