예제 #1
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            tw.WriteLine("\tpop({0}, second_person);", Location.Line);
            return(this);
        }
예제 #2
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            tw.WriteLine("\t\tCharacter\t{0} = InitializeCharacter({2},\"{0}\");\t\t{1}", AstNode1.ToString(thread), AstNode2.ToString(thread), Location.Line);
            return(this);
        }
예제 #3
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            if (AstNode1 is CharacterNode)
            {
                return((AstNode1.Evaluate(thread) as string) + "->value");
            }
            else if (AstNode1 is ConstantNode)
            {
                return(AstNode1.Evaluate(thread));
            }
            else if (AstNode1 is PronounNode)
            {
                return(String.Format("value_of({0},{1})", Location.Line, AstNode1.Evaluate(thread) as string));
            }
            else if (AstNode1 is BinaryOperatorNode)
            {
                return(string.Format(AstNode1.ToString(), Location.Line, AstNode2.Evaluate(thread) as string, AstNode3.Evaluate(thread) as string));
            }
            else if (AstNode1 is UnaryOperatorNode)
            {
                AstNode1.Evaluate(thread);
                return(string.Format((AstNode1 as UnaryOperatorNode).FormatString, AstNode2.Evaluate(thread) as string));
            }
            else
            {
                // error
            }
            return(this);
        }
예제 #4
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            tw.Write(format, Location.Line, AstNode2, AstNode3);
            return(this);
        }
예제 #5
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            if (AstNode1 is OpenYourNode)
            {
                if (String2 == "heart (Keyword)")
                {
                    tw.WriteLine("\tint_output({0}, second_person);", Location.Line);
                }
                else  // Open Your Mind
                {
                    tw.WriteLine("\tchar_input({0}, second_person);", Location.Line);
                }
            }
            else if (String1 == "speak")
            {
                tw.WriteLine("\tchar_output({0}, second_person);", Location.Line);
            }
            else if (String1 == "listen to")
            {
                tw.WriteLine("\tint_input({0}, second_person);", Location.Line);
            }
            return(base.ReallyDoEvaluate(thread));
        }
예제 #6
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            var charList = new List <CharacterNode>();

            if (Exist1)
            {
                if (AstNode1 is CharacterNode)
                {
                    charList.Add(AstNode1 as CharacterNode);
                }
                else
                {
                    (AstNode1 as CharacterListNode).Fill(charList);
                }

                foreach (var chr in charList)
                {
                    tw.WriteLine("\texit_scene({0}, {1});", Location.Line, chr);
                    Context.ActiveCharacters.Remove(chr);
                }
            }
            else
            {
                tw.WriteLine("\texit_scene_all({0});", Location.Line);
                Context.ActiveCharacters.Clear();
            }

            return(this);
        }
예제 #7
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            Context.CurrentScene = Context.CurrentAct + "_" + scenenumber;
            tw.WriteLine("{0}{1}", (Context.CurrentScene + ":").PadRight(Constant.COMMENT_COLUMN), AstNode2.ToString(thread));
            return(this);
        }
예제 #8
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            tw.WriteLine("\tpush({0}, second_person, {1});", Location.Line, AstNode2.ToString(thread));

            return(this);
        }
예제 #9
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            tw.WriteLine();
            tw.WriteLine("\tactivate_character({0}, {1});", Location.Line, AstNode1.ToString(thread));
            AstNode2.Evaluate(thread);
            return(this);
        }
예제 #10
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            tw.WriteLine("\tcomp1 = {0};", AstNode2.ToString(thread));
            tw.WriteLine("\tcomp2 = {0};", AstNode4.ToString(thread));
            tw.WriteLine("\ttruth_flag = {0};", AstNode3.ToString(thread));

            return(base.ReallyDoEvaluate(thread));
        }
예제 #11
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            tw.WriteLine("/********************************************************************");
            tw.WriteLine("*");
            tw.WriteLine("{0,64}", Child1.Token.Text.ToUpper());
            tw.WriteLine("*");
            tw.WriteLine("*********************************************************************/");
            return(this);
        }
예제 #12
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            Context.CurrentAct = actnumber;

            var tw = thread.tc().Writer;

            tw.WriteLine();
            tw.Write((Context.CurrentAct + ":").PadRight(Constant.COMMENT_COLUMN));
            tw.WriteLine(AstNode2.ToString(thread));

            return(this);
        }
예제 #13
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            if (AstNode1 is NegativeNounNode)
            {
                return("(-1)");
            }
            else // astnode1 is NegativeAdjective or astnode1 is neutralAdjective
            {
                return(string.Format("2*{0}", AstNode2.ToString(thread)));
            }
        }
예제 #14
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            if (AstNode1 is NothingNode)
            {
                return("0");
            }
            else  // astNode1 is Article, FirstPErson, SecondPerson, thirdPerson
            {
                return(AstNode2.Evaluate(thread));
            }
        }
예제 #15
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var tw = thread.tc().Writer;

            if (AstNode2 is SceneRomanNode)
            {
                tw.WriteLine("\tgoto {0}_{1};", Context.CurrentAct, AstNode2.ToString().str2varname());
            }
            else
            {
                tw.WriteLine("\tgoto {0};", AstNode2.ToString().str2varname());
            }

            return(this);
        }
예제 #16
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            if (AstNode1 is UnconditionalSentenceNode)
            {
                AstNode1.Evaluate(thread);
            }
            else
            {
                var tw = thread.tc().Writer;
                tw.WriteLine("\t\tif({0}) {{", AstNode1.ToString(thread));
                AstNode2.Evaluate(thread);
                tw.WriteLine("\t}");
            }

            return(base.ReallyDoEvaluate(thread));
        }
예제 #17
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            var cn = TreeNode.ChildNodes;

            if (Child1.AstNode is CharacterListNode)
            {
                cn = Child1.ChildNodes;
            }
            var tw = thread.tc().Writer;

            foreach (var ch in cn)
            {
                tw.WriteLine("\tenter_scene({0}, {1});", Location.Line, ch.AstNode.ToString().str2varname());
                Context.ActiveCharacters.Add(ch.AstNode as CharacterNode);
            }
            return(base.ReallyDoEvaluate(thread));
        }
예제 #18
0
        protected override object ReallyDoEvaluate(ScriptThread thread)
        {
            if (AstNode1 is SecondPersonNode)
            {
                var tw = thread.tc().Writer;
                if (AstNode2 is BeNode)
                {
                    if (AstNode3 is ConstantNode)
                    {
                        tw.WriteLine("\tassign({0}, second_person, {1});", Location.Line, AstNode3.ToString(thread));
                    }
                    else    // SECOND_PERSON BE Equality Value StatementSymbol
                    {
                        tw.WriteLine("\tassign({0}, second_person, {1});", Location.Line, AstNode4.ToString(thread));
                    }
                }
                else if (AstNode2 is UnarticulatedConstantNode)
                {
                    tw.WriteLine("\tassign({0}, second_person, {1});", Location.Line, AstNode2.ToString(thread));
                }
            }

            return(base.ReallyDoEvaluate(thread));
        }