Ejemplo n.º 1
0
        /// <summary>
        /// 从数据项(配置、本地缓存等)转换为字段数据
        /// </summary>
        /// <param name="heroItem"></param>
        public void InitFormItem(ref HeroItem heroItem)
        {
            "error".Log(heroItem == default, "Hero item is null");

            mHeroItem = heroItem;

            mStringFieldSource = new List <string> {
                heroItem.name,
            };

            mIntFieldSource = new List <int> {
                heroItem.id,
                Consts.CAMP_PLAYER,
                heroItem.level,
                heroItem.troops,
            };

            mFloatFieldSource = new List <float> {
                (float)heroItem.hp,
                (float)heroItem.atk,
                (float)heroItem.def,
                (float)heroItem.intellect,
                (float)heroItem.aow,
            };

            FillValues();
            LogFields();

            SkillCIC        = heroItem.skillCIC;
            SkillCounsellor = heroItem.skillCounsellor;
            SkillGeneral    = heroItem.skillGeneral;

            mSkillCIC = new SkillFields();
        }
Ejemplo n.º 2
0
        public override void FillFromDataRaw(ref string source)
        {
            JsonData jsonData = JsonMapper.ToObject(source);

            SkillItem data;
            JsonData  item;
            int       count = jsonData.Count;

            for (int i = 0; i < count; i++)
            {
                item = jsonData[i];
                SkillFields.FillFromJSON(ref item, out data);
                m_Collections.Add(data);
            }
        }