Exemple #1
0
        public void PopulateFromJson(JObject jsonObject)
        {
            JArray val = Serialization.JsonArray(jsonObject, "positions");

            m_positions = new List <SpawnPos>((val != null) ? val.get_Count() : 0);
            if (val != null)
            {
                foreach (JToken item in val)
                {
                    m_positions.Add(SpawnPos.FromJsonToken(item));
                }
            }
        }
Exemple #2
0
        public static SpawnPos 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);
            SpawnPos spawnPos   = new SpawnPos();

            spawnPos.PopulateFromJson(jsonObject);
            return(spawnPos);
        }
Exemple #3
0
        public static SpawnPos FromJsonProperty(JObject jsonObject, string propertyName, SpawnPos 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()));
        }