[MoonSharpHidden] public LuaPlayerOW() { TPHandler tp = Resources.Load <TPHandler>("Prefabs/TP On-the-fly"); if (tp != null && tp.ToString().ToLower() != "null") { tpOnTheFlyPrefab = tp; } }
// Use this for initialization void Start() { TPHandler tp = Resources.Load <TPHandler>("Prefabs/TP On-the-fly"); if (tp != null && tp.ToString().ToLower() != "null") { tpOnTheFlyPrefab = tp; } FindObjectOfType <Fading>().BeginFade(-1); tmMain = GameObject.Find("TextManager Main").GetComponent <TextManager>(); tmChoice = GameObject.Find("TextManager Choice").GetComponent <TextManager>(); tmInfo = GameObject.Find("TextManager Info").GetComponent <TextManager>(); tmBigTalk = GameObject.Find("TextManager BigTalk").GetComponent <TextManager>(); tmGold = GameObject.Find("TextManager Gold").GetComponent <TextManager>(); tmItem = GameObject.Find("TextManager Item").GetComponent <TextManager>(); tmInfoParent = tmInfo.transform.parent.parent.gameObject; tmBigTalk.SetTextQueue(new TextMessage[] { new TextMessage("[noskipatall][novoice]", false, true) }); utHeart = GameObject.Find("utHeart"); EnableBigText(false); if (scriptName == null) { UnitaleUtil.DisplayLuaError("Creating the shop menu", "You must give a valid script name to the function General.EnterShop()"); return; } script = new ScriptWrapper() { scriptname = scriptName }; string scriptText = ScriptRegistry.Get(ScriptRegistry.SHOP_PREFIX + scriptName); if (scriptText == null) { UnitaleUtil.DisplayLuaError("Creating the shop menu", "You must give a valid script name to the function General.EnterShop()"); return; } script.DoString(scriptText); script.SetVar("background", UserData.Create(new LuaSpriteController(GameObject.Find("Background").GetComponent <Image>()))); script.script.Globals["Interrupt"] = ((Action <DynValue, string>)Interrupt); script.script.Globals["CreateSprite"] = (Func <string, string, int, DynValue>)SpriteUtil.MakeIngameSprite; script.script.Globals["CreateLayer"] = (Action <string, string, bool>)SpriteUtil.CreateLayer; script.script.Globals["CreateText"] = (Func <Script, DynValue, DynValue, int, string, int, LuaTextManager>)LuaScriptBinder.CreateText; script.Call("Start"); tmMain.SetCaller(script); tmChoice.SetCaller(script); tmInfo.SetCaller(script); tmBigTalk.SetCaller(script); tmMain.SetTextQueue(new TextMessage[] { new TextMessage("[noskipatall][linespacing:11]" + script.GetVar("maintalk").String, true, false) }); tmChoice.SetTextQueue(new TextMessage[] { new TextMessage("[noskipatall][novoice][font:uidialoglilspace][linespacing:9] Buy\n Sell\n Talk\n Exit", false, true) }); tmGold.SetTextQueue(new TextMessage[] { new TextMessage("[noskipatall][novoice]" + PlayerCharacter.instance.Gold + "G", false, true) }); tmItem.SetTextQueue(new TextMessage[] { new TextMessage("[noskipatall][novoice]" + Inventory.inventory.Count + "/8", false, true) }); tmInfo.SetTextQueue(new TextMessage[] { new TextMessage("[noskipatall][novoice]", false, true) }); Camera.main.GetComponent <AudioSource>().clip = AudioClipRegistry.GetMusic(script.GetVar("music").String); Camera.main.GetComponent <AudioSource>().Play(); }