public static ISingleCoordSelector 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 val  = Extensions.Value <JObject>((IEnumerable <JToken>)token);
            JToken  val2 = default(JToken);

            if (!val.TryGetValue("type", ref val2))
            {
                Debug.LogWarning((object)"Malformed json: no 'type' property in object of class ISingleCoordSelector");
                return(null);
            }
            string text = Extensions.Value <string>((IEnumerable <JToken>)val2);
            ISingleCoordSelector singleCoordSelector;

            switch (text)
            {
            case "FirstCastTargetSelector":
                singleCoordSelector = new FirstCastTargetSelector();
                break;

            case "SecondCastTargetSelector":
                singleCoordSelector = new SecondCastTargetSelector();
                break;

            case "IndexedCastTargetSelector":
                singleCoordSelector = new IndexedCastTargetSelector();
                break;

            case "TriggeringEventFirstCastTargetSelector":
                singleCoordSelector = new TriggeringEventFirstCastTargetSelector();
                break;

            case "SingleCoordWithConditionSelector":
                singleCoordSelector = new SingleCoordWithConditionSelector();
                break;

            case "CentralSymmetryCoordSelector":
                singleCoordSelector = new CentralSymmetryCoordSelector();
                break;

            case "EntityPositionSelector":
                singleCoordSelector = new EntityPositionSelector();
                break;

            default:
                Debug.LogWarning((object)("Unknown type: " + text));
                return(null);
            }
            singleCoordSelector.PopulateFromJson(val);
            return(singleCoordSelector);
        }
Exemple #2
0
        public static FirstCastTargetSelector 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);
            FirstCastTargetSelector firstCastTargetSelector = new FirstCastTargetSelector();

            firstCastTargetSelector.PopulateFromJson(jsonObject);
            return(firstCastTargetSelector);
        }
Exemple #3
0
        public static FirstCastTargetSelector FromJsonProperty(JObject jsonObject, string propertyName, FirstCastTargetSelector 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()));
        }
Exemple #4
0
        public static IEntitySelector 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 val  = Extensions.Value <JObject>((IEnumerable <JToken>)token);
            JToken  val2 = default(JToken);

            if (!val.TryGetValue("type", ref val2))
            {
                Debug.LogWarning((object)"Malformed json: no 'type' property in object of class IEntitySelector");
                return(null);
            }
            string          text = Extensions.Value <string>((IEnumerable <JToken>)val2);
            IEntitySelector entitySelector;

            switch (text)
            {
            case "BounceEntitiesSelector":
                entitySelector = new BounceEntitiesSelector();
                break;

            case "FirstCastTargetSelector":
                entitySelector = new FirstCastTargetSelector();
                break;

            case "SecondCastTargetSelector":
                entitySelector = new SecondCastTargetSelector();
                break;

            case "IndexedCastTargetSelector":
                entitySelector = new IndexedCastTargetSelector();
                break;

            case "TriggeringEventFirstCastTargetSelector":
                entitySelector = new TriggeringEventFirstCastTargetSelector();
                break;

            case "EffectHolderSelector":
                entitySelector = new EffectHolderSelector();
                break;

            case "OwnerOfEffectHolderSelector":
                entitySelector = new OwnerOfEffectHolderSelector();
                break;

            case "ApplicationHolderSelector":
                entitySelector = new ApplicationHolderSelector();
                break;

            case "TriggeringEventTargetSelector":
                entitySelector = new TriggeringEventTargetSelector();
                break;

            case "ActionedEntitySelector":
                entitySelector = new ActionedEntitySelector();
                break;

            case "MechanismActivatorSelector":
                entitySelector = new MechanismActivatorSelector();
                break;

            case "CasterSelector":
                entitySelector = new CasterSelector();
                break;

            case "CasterHeroSelector":
                entitySelector = new CasterHeroSelector();
                break;

            case "SingleEntityWithConditionSelector":
                entitySelector = new SingleEntityWithConditionSelector();
                break;

            case "InvokedEntityTargetSelector":
                entitySelector = new InvokedEntityTargetSelector();
                break;

            case "CasterSpecificCompanionSelector":
                entitySelector = new CasterSpecificCompanionSelector();
                break;

            case "UnionOfEntitiesSelector":
                entitySelector = new UnionOfEntitiesSelector();
                break;

            case "FilteredEntitySelector":
                entitySelector = new FilteredEntitySelector();
                break;

            case "AllEntitiesSelector":
                entitySelector = new AllEntitiesSelector();
                break;

            case "OwnerOfSelector":
                entitySelector = new OwnerOfSelector();
                break;

            default:
                Debug.LogWarning((object)("Unknown type: " + text));
                return(null);
            }
            entitySelector.PopulateFromJson(val);
            return(entitySelector);
        }