예제 #1
0
 public ChoiceNode(string next, string text, Conditional showCondition, Conditional hideCondition, MicroscriptNode[] nextMicroscript, ConditionNode[] nextConditional, SkillCheckNode skillCheck)
     : this(next, text)
 {
     ShowCondition   = showCondition;
     HideCondition   = hideCondition;
     NextMicroscript = nextMicroscript;
     NextConditional = nextConditional;
     SkillCheck      = skillCheck;
 }
예제 #2
0
 public ChoiceNode(string next, string text, Conditional showCondition, Conditional hideCondition, MicroscriptNode[] nextMicroscript, ConditionNode[] nextConditional, SkillCheckNode skillCheck, string traceSpeaker, string traceText, bool traceIgnore, bool traceShow)
     : this(next, text)
 {
     ShowCondition   = showCondition;
     HideCondition   = hideCondition;
     NextMicroscript = nextMicroscript;
     NextConditional = nextConditional;
     SkillCheck      = skillCheck;
     TraceSpeaker    = traceSpeaker;
     TraceText       = traceText;
     TraceIgnore     = traceIgnore;
     TraceShow       = traceShow;
 }
예제 #3
0
        public static ChoiceNode ParseChoiceNode(JToken jt)
        {
            string text = jt["text"].Value <string>();
            string next = jt["next"].Value <string>();

            MicroscriptNode[] microscripts = null;
            if (jt["microscript"] != null)
            {
                //parse microscripts
                List <MicroscriptNode> nList = new List <MicroscriptNode>();
                JArray ja = (JArray)jt["microscript"];
                foreach (var x in ja)
                {
                    try
                    {
                        nList.Add(ParseMicroscript(x));
                    }
                    catch (Exception e)
                    {
                        Debug.LogWarning(e);
                    }
                }
                microscripts = nList.ToArray();
            }

            ConditionNode[] conditionals = null;
            if (jt["conditional"] != null)
            {
                List <ConditionNode> cList = new List <ConditionNode>();
                JArray ja = (JArray)jt["conditional"];
                foreach (var x in ja)
                {
                    try
                    {
                        cList.Add(ParseConditionNode(x));
                    }
                    catch (Exception e)
                    {
                        Debug.LogWarning(e);
                    }
                }
                conditionals = cList.ToArray();
            }

            Conditional showCondition = null;

            if (jt["showCondition"] != null)
            {
                showCondition = ParseSingleCondition(jt["showCondition"]);
            }

            Conditional hideCondition = null;

            if (jt["hideCondition"] != null)
            {
                hideCondition = ParseSingleCondition(jt["hideCondition"]);
            }

            SkillCheckNode skillCheck = null;

            if (jt["skillCheck"] != null)
            {
                skillCheck = ParseSkillCheck(jt["skillCheck"]);
            }

            return(new ChoiceNode(next, text, showCondition, hideCondition, microscripts, conditionals, skillCheck));
        }