Beispiel #1
0
        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, "");
        }
Beispiel #2
0
        public override void ParseDefinition(string definitionKey, JsonData jsonData)
        {
            var keys = jsonData.Keys;

            nodeText = ContentHelper.ParseString(jsonData, D.TEXT, "No Conversation Text");

            if (keys.Contains(D.EFFECTS))
            {
                this._effectDefinitions = EffectDefinition.ParseDefinitions(jsonData[D.EFFECTS], definitionKey);
            }
            else
            {
                this._effectDefinitions = new Definition <Effect> [0];
            }

            if (keys.Contains(D.STORYCHOICES))
            {
                this._storyTriggerDefinitions = StoryChoiceDefinition.ParseDefinitions(jsonData[D.STORYCHOICES], definitionKey);
            }
            else
            {
                var fallbackDefinition = new StoryChoiceDefinition();
                fallbackDefinition.ParseDefinition(definitionKey + "Dummy", new JsonData());
                this._storyTriggerDefinitions = new Definition <StoryChoice>[1] {
                    fallbackDefinition
                };
            }


            if (keys.Contains(D.REWARDS_ON_START))
            {
                this._onStartRewardDefinitions = EffectDefinition.ParseDefinitions(jsonData[D.REWARDS_ON_START], definitionKey);
            }
            else
            {
                this._onStartRewardDefinitions = new Definition <Effect> [0];
            }

            if (keys.Contains(D.REWARDS_ON_COMPLETE))
            {
                this._onCompleteRewardDefinitions = EffectDefinition.ParseDefinitions(jsonData[D.REWARDS_ON_COMPLETE], definitionKey);
            }
            else
            {
                this._onCompleteRewardDefinitions = new Definition <Effect> [0];
            }
        }
Beispiel #3
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];
            }
        }
Beispiel #4
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)
                        );
                }
            }
        }
Beispiel #5
0
 public override void ParseParams(JsonData parameters)
 {
     _effectDefinitions = EffectDefinition.ParseDefinitions(parameters[D.EFFECTS], definition.definitionKey);
 }