public void StartScenario(LuaTextAsset lua, GameObject owner, string displayOwnername = "") { #if !ENABLE_MoonSharp Debug.Assert(false, "Plugin [MoonSharp] is disabled. set symbol `ENABLE_MoonSharp` to scripting define symbols on Player Settings.. > Other settings > Scripting Define Symbols"); #else if (coroutine != null || isMonoRunning) { return; } UserData.RegisterAssembly(typeof(EventData).Assembly); Script script = new Script(); currentEventData = new EventData(owner, displayOwnername); script.Globals["scene"] = currentEventData; //var scenario = LoadScenario(); var scenario = LoadScenario(lua); //Debug.Log(scenario); DynValue function = script.DoString(scenario); coroutine = script.CreateCoroutine(function); OnMessageStart?.Invoke(currentEventData); coroutine?.Coroutine.Resume(); #endif }
private string LoadScenario(LuaTextAsset luaTextAsset) { return(luaTextAsset.text); }