示例#1
0
        public bool Deserialize(JSON_AbilityParam json)
        {
            if (json == null)
            {
                return(false);
            }
            this.iname    = json.iname;
            this.name     = json.name;
            this.expr     = json.expr;
            this.icon     = json.icon;
            this.type     = (EAbilityType)json.type;
            this.slot     = (EAbilitySlot)json.slot;
            this.lvcap    = (OInt)Math.Max(json.cap, 1);
            this.is_fixed = json.fix != 0;
            int length = 0;

            string[] strArray = new string[10]
            {
                json.skl1,
                json.skl2,
                json.skl3,
                json.skl4,
                json.skl5,
                json.skl6,
                json.skl7,
                json.skl8,
                json.skl9,
                json.skl10
            };
            for (int index = 0; index < strArray.Length && !string.IsNullOrEmpty(strArray[index]); ++index)
            {
                ++length;
            }
            if (length > 0)
            {
                int[] numArray = new int[10]
                {
                    json.lv1,
                    json.lv2,
                    json.lv3,
                    json.lv4,
                    json.lv5,
                    json.lv6,
                    json.lv7,
                    json.lv8,
                    json.lv9,
                    json.lv10
                };
                this.skills = new LearningSkill[length];
                for (int index = 0; index < length; ++index)
                {
                    this.skills[index]        = new LearningSkill();
                    this.skills[index].iname  = strArray[index];
                    this.skills[index].locklv = numArray[index];
                }
            }
            this.condition_units = (string[])null;
            if (json.units != null && json.units.Length > 0)
            {
                this.condition_units = new string[json.units.Length];
                for (int index = 0; index < json.units.Length; ++index)
                {
                    this.condition_units[index] = json.units[index];
                }
            }
            this.condition_jobs = (string[])null;
            if (json.jobs != null && json.jobs.Length > 0)
            {
                this.condition_jobs = new string[json.jobs.Length];
                for (int index = 0; index < json.jobs.Length; ++index)
                {
                    this.condition_jobs[index] = json.jobs[index];
                }
            }
            this.condition_birth   = json.birth;
            this.condition_sex     = (ESex)json.sex;
            this.condition_element = (EElement)json.elem;
            this.condition_raremin = (OInt)json.rmin;
            this.condition_raremax = (OInt)json.rmax;
            return(true);
        }
示例#2
0
 public void Deserialize(string language, JSON_AbilityParam json)
 {
     this.Deserialize(json);
     this.localizeFields(language);
 }