コード例 #1
0
        public override void Deserialize(JSONObject obj)
        {
            mClassLevel = (int)obj.GetNumber(LEVEL);
            DeserializeKnownSpells(obj);
            DeserializeMainSpells(obj);
            DeserializeExtraSpells(obj);
            mSkills = new DnDSkillModel();
            mSkills.Deserialize(obj.GetObject(SKILLS));
            // spec:
            JSONArray tempArray = obj.GetArray(SPECIALIZATION);

            for (int i = 0; i < tempArray.Length; ++i)
            {
                if (i == 0)                 // first item is the specialization
                {
                    mSpecialization = (DnDMagicSchool)((int)tempArray[i].Number);
                }
                else                 // the other items are the forbidden schools
                {
                    mForbiddenSchools.Add((DnDMagicSchool)((int)tempArray[i].Number));
                }
            }
        }
コード例 #2
0
		public override void Deserialize(JSONObject obj)
		{
			mClassLevel = (int)obj.GetNumber(LEVEL);
			DeserializeKnownSpells(obj);
			DeserializeMainSpells(obj);
			DeserializeExtraSpells(obj);
			mSkills = new DnDSkillModel();
			mSkills.Deserialize(obj.GetObject(SKILLS));
			// spec:
			JSONArray tempArray = obj.GetArray(SPECIALIZATION);
			for (int i = 0; i < tempArray.Length; ++i)
			{
				if (i == 0) // first item is the specialization
				{
					mSpecialization = (DnDMagicSchool)((int)tempArray[i].Number);
				}
				else // the other items are the forbidden schools
				{
					mForbiddenSchools.Add((DnDMagicSchool)((int)tempArray[i].Number));
				}
			}
		}