コード例 #1
0
        private bool NextSecondSentence()
        {
            if (IsSecondOver())
            {
                UnloadSecondSentence();
                return(false);
            }
            ScriptSentenceContext context = secondScriptSentenceList[secondScriptPointerLineNumber];

            secondScriptPointerLineNumber = secondScriptPointerLineNumber + 1;
            ExpressionRootNode rootNode = new ExpressionRootNode();

            Debug.Log("从翻译器 开始翻译 :");
            context.ShowSelfAll();
            Debug.Log("从翻译器 开始翻译结束");
            rootNode.Interpret(context);
            Debug.Log("从翻译器 开始执行");
            rootNode.Execute();
            Debug.Log("从翻译器 开始执行结束");
            return(true);
        }
コード例 #2
0
        private bool NextFirstSentence()
        {
            if (IsOver())
            {
                if (pointerScriptNameStack.Count == 0)
                {
                    return(false);
                }
                else
                {
                    // 恢复脚本上下文
                    ScriptPointerScriptName = pointerScriptNameStack.Pop();
                    ScriptPointerLineNumber = pointerLineNumberStack.Pop();
                    string scriptIndex   = PachiGrimoire.I.constData.ScriptIndexPrefix + "_" + ScriptPointerScriptName;
                    string scriptContext = PachiGrimoire.I.ResourceManager.Get <string>(scriptIndex);
                    scriptSentenceList = ProcessScriptContext(scriptContext);
                }
            }
            // 得到当前语句
            ScriptSentenceContext context = scriptSentenceList[ScriptPointerLineNumber];

            // 更新已读文本
            pastScriptManager.UpdatePastScript(ScriptPointerScriptName, ScriptPointerLineNumber);
            // 更新指针
            ScriptPointerLineNumber = ScriptPointerLineNumber + 1;
            // 开始翻译
            ExpressionRootNode rootNode = new ExpressionRootNode();

            Debug.Log("主翻译器 开始翻译 :");
            context.ShowSelfAll();
            Debug.Log("主翻译器 开始翻译结束");
            rootNode.Interpret(context);
            Debug.Log("主翻译器 开始执行");
            rootNode.Execute();
            Debug.Log("主翻译器 开始执行结束");
            return(true);
        }