Пример #1
0
        public static FightAvailability FromJsonToken(JToken token)
        {
            //IL_0001: Unknown result type (might be due to invalid IL or missing references)
            //IL_0007: Invalid comparison between Unknown and I4
            //IL_000f: Unknown result type (might be due to invalid IL or missing references)
            if ((int)token.get_Type() != 1)
            {
                Debug.LogWarning((object)("Malformed token : type Object expected, but " + token.get_Type() + " found"));
                return(null);
            }
            JObject           jsonObject        = Extensions.Value <JObject>((IEnumerable <JToken>)token);
            FightAvailability fightAvailability = new FightAvailability();

            fightAvailability.PopulateFromJson(jsonObject);
            return(fightAvailability);
        }
        public override void PopulateFromJson(JObject jsonObject)
        {
            this.PopulateFromJson(jsonObject);
            JArray val = Serialization.JsonArray(jsonObject, "gods");

            m_gods = new List <GodAvailability>((val != null) ? val.get_Count() : 0);
            if (val != null)
            {
                foreach (JToken item in val)
                {
                    m_gods.Add(GodAvailability.FromJsonToken(item));
                }
            }
            JArray val2 = Serialization.JsonArray(jsonObject, "fights");

            m_fights = new List <FightAvailability>((val2 != null) ? val2.get_Count() : 0);
            if (val2 != null)
            {
                foreach (JToken item2 in val2)
                {
                    m_fights.Add(FightAvailability.FromJsonToken(item2));
                }
            }
            JArray val3 = Serialization.JsonArray(jsonObject, "squads");

            m_squads = new List <SquadAvailability>((val3 != null) ? val3.get_Count() : 0);
            if (val3 != null)
            {
                foreach (JToken item3 in val3)
                {
                    m_squads.Add(SquadAvailability.FromJsonToken(item3));
                }
            }
            JArray val4 = Serialization.JsonArray(jsonObject, "companions");

            m_companions = new List <CompanionAvailability>((val4 != null) ? val4.get_Count() : 0);
            if (val4 != null)
            {
                foreach (JToken item4 in val4)
                {
                    m_companions.Add(CompanionAvailability.FromJsonToken(item4));
                }
            }
        }
Пример #3
0
        public static FightAvailability FromJsonProperty(JObject jsonObject, string propertyName, FightAvailability defaultValue = null)
        {
            //IL_0011: Unknown result type (might be due to invalid IL or missing references)
            //IL_0018: Invalid comparison between Unknown and I4
            JProperty val = jsonObject.Property(propertyName);

            if (val == null || (int)val.get_Value().get_Type() == 10)
            {
                return(defaultValue);
            }
            return(FromJsonToken(val.get_Value()));
        }