Exemplo n.º 1
0
        internal static MonsterList GetUserMonsterListFromJson(JObject jObject, int number = -1)
        {
            if (jObject == null)
            {
                return(NewListUser(number));
            }

            MonsterList ret = new MonsterList();

            try
            {
                JArray Array = jObject["monsters"].ToObject <JArray>();

                int i = 0;
                foreach (JObject monster in Array)
                {
                    if (i == number)
                    {
                        break;
                    }
                    ret.Add(Monster.GetUserMonster(monster));
                    i++;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("GetMonsterListFromJson :" + ex.ToString());
            }
            return(ret);
        }
Exemplo n.º 2
0
        private static MonsterList NewListUser(int number)
        {
            MonsterList list = new MonsterList();

            for (int i = 0; i < number; i++)
            {
                list.Add(Monster.GetUserMonster(i));
            }
            return(list);
        }
Exemplo n.º 3
0
        internal static MonsterList GetMonsterListFromJson(JObject jObject, int number = -1)
        {
            if (jObject == null)
                return NewList(number);

            MonsterList ret = new MonsterList();
            try
            {
                JArray Array = jObject["monsters"].ToObject<JArray>();

                int i = 0;
                foreach (JObject monster in Array)
                {
                    if (i == number)
                        break;
                    ret.Add(Monster.GetMonster(monster));
                    i++;
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("GetMonsterListFromJson :" + ex.ToString());
            }
            return ret;
        }
Exemplo n.º 4
0
 private static MonsterList NewListUser(int number)
 {
     MonsterList list = new MonsterList();
     for (int i = 0; i < number; i++)
     {
         list.Add(Monster.GetUserMonster(i));
     }
     return list;
 }