Example #1
0
    IEnumerator ExecuteEvent(string script)
    {
        var interpreter = new LuaInterpreter(script); // スクリプトを渡して初期化

        interpreter.AddHandler("player", player);     // メッセージ制御のハンドラを登録
        interpreter.AddHandler("event", eventData);   // メッセージ制御のハンドラを登録
        while (interpreter.HasNextScript())
        {
            interpreter.Resume();
            yield return(interpreter.WaitCoroutine());
        }
    }
    IEnumerator ExecuteEvent(string script)
    {
        var interpreter = new LuaInterpreter(script); // スクリプトを渡して初期化

        interpreter.AddHandler("player", player);
        interpreter.AddHandler("npcGirl", npcGirl);
        interpreter.AddHandler("npcBoy", npcBoy);
        interpreter.AddHandler("message", messagePanel);
        interpreter.AddHandler("camera", camera);
        interpreter.AddHandler("fadePanel", fadePanel);
        interpreter.AddHandler("oldPlayer", oldPlayer);
        interpreter.AddHandler("sound", sound);
        interpreter.AddHandler("chocolate", chocolate);
        yield return(new WaitForSeconds(2));

        while (interpreter.HasNextScript())
        {
            interpreter.Resume();
            yield return(interpreter.WaitCoroutine());
        }
    }
    IEnumerator ExecuteEvent(string script)
    {
        var interpreter = new LuaInterpreter(script); // スクリプトを渡して初期化

        interpreter.AddHandler("player", player);
        interpreter.AddHandler("npcGirl", npcGirl);
        interpreter.AddHandler("npcBoy", npcBoy);
        interpreter.AddHandler("message", messagePanel);
        interpreter.AddHandler("camera", camera);
        interpreter.AddHandler("fadePanel", fadePanel);
        interpreter.AddHandler("oldPlayer", oldPlayer);
        interpreter.AddHandler("sound", sound);
        interpreter.AddHandler("chocolate", chocolate);
        interpreter.AddHandler("select", select);
        interpreter.AddHandler("flag", flag);
        interpreter.AddHandler("sceneLoader", SceneLoader.instance);
        yield return(new WaitForSeconds(2));

        int?result = null;

        while (interpreter.HasNextScript())
        {
            if (SceneLoader.instance.currentScene != "MainStory")
            {
                yield return(null);
            }
            interpreter.Resume(result);
            yield return(interpreter.WaitCoroutine());

            if (interpreter.resultValue != null)
            {
                result = interpreter.resultValue.Value;
            }
            else
            {
                result = null;
            }
        }
        yield return(null);

        yield return(new WaitUntil(() => Input.GetKeyDown(KeyCode.Space)));

        PlayerPrefs.SetInt("CLEAR", 1);
        UnityEngine.SceneManagement.SceneManager.LoadScene("MainStory");
    }