示例#1
0
 static int GetFlowChartTree(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Nova.ScriptLoader  obj = (Nova.ScriptLoader)ToLua.CheckObject <Nova.ScriptLoader>(L, 1);
         Nova.FlowChartTree o   = obj.GetFlowChartTree();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
示例#2
0
        private void Awake()
        {
            try
            {
                scriptLoader.Init(scriptPath);
                flowChartTree = scriptLoader.GetFlowChartTree();
            }
            catch (Exception ex)
            {
                Debug.LogError(ex);
                Utils.Exit();
            }

            checkpointManager = GetComponent <CheckpointManager>();
            LuaRuntime.Instance.BindObject("variables", variables);
            LuaRuntime.Instance.BindObject("advancedDialogueHelper", advancedDialogueHelper);
        }
示例#3
0
        public void ForceInit(string path)
        {
            flowChartTree    = new FlowChartTree();
            currentNode      = null;
            stateLocale      = I18n.DefaultLocale;
            lazyBindingLinks = new List <LazyBindingEntry>();

            // requires.lua is executed and ScriptDialogueEntryParser.PatternToActionGenerator is filled before calling ParseScript()
            LuaRuntime.Instance.BindObject("scriptLoader", this);

            foreach (var locale in I18n.SupportedLocales)
            {
                stateLocale = locale;

                string localizedPath = path;
                if (locale != I18n.DefaultLocale)
                {
                    localizedPath = I18n.LocalePath + locale + "/" + path;
                }

                var scripts = Resources.LoadAll(localizedPath, typeof(TextAsset)).Cast <TextAsset>().ToArray();
                foreach (var script in scripts)
                {
                    ParseScript(script.text);
                }
            }

            // Bind all lazy binding entries
            BindAllLazyBindingEntries();

            // Perform sanity check
            flowChartTree.SanityCheck();

            // Construction finished, freeze the tree status
            flowChartTree.Freeze();
        }
示例#4
0
 /// <summary>
 /// dirty force reload, simply reload all scripts, does not take too much in consideration.
 /// this method is only used for faster iteration during development, like preview changes in scripts without
 /// restart the game
 /// </summary>
 public void ReloadScripts()
 {
     scriptLoader.ForceInit(scriptPath);
     flowChartTree = scriptLoader.GetFlowChartTree();
     UpdateGameState(true, true, false, false);
 }
示例#5
0
 private void Awake()
 {
     scriptLoader.Init(scriptPath);
     flowChartTree = scriptLoader.GetFlowChartTree();
 }
示例#6
0
 /// <summary>
 /// Used for faster iterations during the development, like to modify scripts without restarting the game
 /// </summary>
 public void ReloadScripts()
 {
     LuaRuntime.Instance.Reset();
     scriptLoader.ForceInit(scriptPath);
     flowChartTree = scriptLoader.GetFlowChartTree();
 }
示例#7
0
 private void Awake()
 {
     scriptLoader.Init(scriptPath);
     flowChartTree     = scriptLoader.GetFlowChartTree();
     checkpointManager = GetComponent <CheckpointManager>();
 }