From 343992cfacd03acbbd351613b0f54ac0cd84d30a Mon Sep 17 00:00:00 2001 From: Saplonily Date: Fri, 8 Dec 2023 20:24:23 +0800 Subject: [PATCH] fix postcard encoding issue construct the postcard on c# side --- Helpers/MethodWrappers.cs | 6 ++++++ LuaCutscenes/Assets/LuaCutscenes/helper_functions.lua | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Helpers/MethodWrappers.cs b/Helpers/MethodWrappers.cs index cca24eb..ac90b97 100644 --- a/Helpers/MethodWrappers.cs +++ b/Helpers/MethodWrappers.cs @@ -202,5 +202,11 @@ public static void InstantTeleport(Scene scene, Player player, string room, bool }; } } + + public static Postcard CreatePostcard(string dialog, string sfxIn, string sfxOut) + => new Postcard(Dialog.Get(dialog) ?? dialog, sfxIn, sfxOut); + + public static Postcard CreatePostcard(string dialog, int area) + => new Postcard(Dialog.Get(dialog) ?? dialog, area); } } diff --git a/LuaCutscenes/Assets/LuaCutscenes/helper_functions.lua b/LuaCutscenes/Assets/LuaCutscenes/helper_functions.lua index 283ffe3..0da1728 100644 --- a/LuaCutscenes/Assets/LuaCutscenes/helper_functions.lua +++ b/LuaCutscenes/Assets/LuaCutscenes/helper_functions.lua @@ -261,14 +261,12 @@ end -- @tparam any sfxIn effect when opening the postcard or area ID. -- @string[opt=nil] sfxOut Sound effect when closing the postcard. If not used then second argument is assumed to be area ID. function helpers.postcard(dialog, sfxIn, sfxOut) - local message = celeste.Dialog.Get(dialog) or dialog local postcard if sfxOut then - postcard = celeste.Postcard(message, sfxIn, sfxOut) - + postcard = celeste.Mod[modName].MethodWrappers.CreatePostcard(dialog, sfxIn, sfxOut) else - postcard = celeste.Postcard(message, sfxIn) + postcard = celeste.Mod[modName].MethodWrappers.CreatePostcard(dialog, sfxIn) end getRoom():add(postcard)