public override void ParseDefinition(string definitionKey, JsonData jsonData) { choiceText = ContentHelper.ParseString(jsonData, D.TEXT, "Continue..."); var keys = jsonData.Keys; if (keys.Contains(D.CONDITIONS)) { _conditionDefinitions = ConditionDefinition.ParseDefinitions(jsonData[D.CONDITIONS], definitionKey); } else { _conditionDefinitions = new Definition <Condition> [0]; } if (keys.Contains(D.ENABLED_CONDITIONS)) { _disabledConditionDefinitions = ConditionDefinition.ParseDefinitions(jsonData[D.ENABLED_CONDITIONS], definitionKey); } else { _disabledConditionDefinitions = new Definition <Condition> [0]; } if (keys.Contains(D.REWARDS)) { _rewardDefinitions = EffectDefinition.ParseDefinitions(jsonData[D.REWARDS], definitionKey); } else { _rewardDefinitions = new Definition <Effect> [0]; } factionKey = ContentHelper.ParseString(jsonData, D.FACTION_KEY, ""); }
protected void _ParseChildCondition(JsonData parameters) { ContentHelper.VerifyKey(parameters, D.CONDITIONS, definition.definitionKey); var conditions = ConditionDefinition.ParseDefinitions(parameters[D.CONDITIONS], definition.definitionKey); ContentHelper.VerifyMaxArrayLength(conditions, 1, definition.definitionKey); if (conditions.Length == 1) { _childConditionDefinition = conditions[0]; } }
public override void ParseParams(JsonData parameters) { var keys = parameters.Keys; if (keys.Contains(D.CONDITIONS)) { _conditionDefinitions = ConditionDefinition.ParseDefinitions(parameters[D.CONDITIONS], definition.definitionKey); } else { _conditionDefinitions = new Definition <Condition> [0]; } if (keys.Contains(D.EFFECTS)) { _effectDefinitions = EffectDefinition.ParseDefinitions(parameters[D.EFFECTS], definition.definitionKey); } else { _effectDefinitions = new Definition <Effect> [0]; } }
public override void ParseParams(JsonData parameters) { var keys = parameters.Keys; if (!keys.Contains(D.STATEMENTS)) { _type = ConditionalType.SinglePair; _effectDefinitions = EffectDefinition.ParseDefinitions(parameters[D.EFFECTS], definition.definitionKey); _conditionDefinitions = ConditionDefinition.ParseDefinitions(parameters[D.CONDITIONS], definition.definitionKey); if (parameters.Keys.Contains("elseEffects")) { _elseEffectDefinitions = EffectDefinition.ParseDefinitions(parameters["elseEffects"], definition.definitionKey); } else { _elseEffectDefinitions = new Definition <Effect> [0]; } } else { _type = ConditionalType.MultiplePairs; var conditionEffectData = parameters[D.STATEMENTS]; var numConditionEffects = conditionEffectData.Count; _conditionEffectPairsDefinition = new KeyValuePair <Definition <Condition>[], Definition <Effect>[]> [numConditionEffects]; for (int i = 0; i < numConditionEffects; i++) { _conditionEffectPairsDefinition[i] = new KeyValuePair <Definition <Condition>[], Definition <Effect>[]>( ConditionDefinition.ParseDefinitions(conditionEffectData[i][D.CONDITIONS], definition.definitionKey), EffectDefinition.ParseDefinitions(conditionEffectData[i][D.EFFECTS], definition.definitionKey) ); } } }
public override void ParseParams(JsonData parameters) { _childConditionDefinitions = ConditionDefinition.ParseDefinitions(parameters[D.CONDITIONS], definition.definitionKey); }