From 4624ad7a492952c0e46a189cb92e6dc6246c60d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=AE=B6=E7=82=9C?= <2029049582@qq.com> Date: Fri, 11 Jul 2025 19:45:09 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E8=BF=870.8=E7=A7=92=E7=9A=84?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=89=8D=E4=BC=9A=E6=98=BE=E7=A4=BA=E8=BD=AC?= =?UTF-8?q?=E5=9C=88=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua_probject/base_project/Game/View/LoginView.lua | 8 ++++---- lua_probject/base_project/Game/View/ViewUtil.lua | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lua_probject/base_project/Game/View/LoginView.lua b/lua_probject/base_project/Game/View/LoginView.lua index d970fe90..efc32378 100644 --- a/lua_probject/base_project/Game/View/LoginView.lua +++ b/lua_probject/base_project/Game/View/LoginView.lua @@ -41,7 +41,7 @@ function M:init() local _btn_login = view:GetChild("btn_wx") _btn_login.onClick:Add(function() - ViewUtil.ShowModalWait(self._root_view, "正在登录游戏...") + ViewUtil.ShowModalWait(true, "正在登录游戏...") coroutine.start(function() coroutine.wait(8) if self.isWXCallBackMark then @@ -149,7 +149,7 @@ local function __login_response(self, response) local roomid = user.room_id if (string.len(roomid) > 1) then if user.group_id == 0 then - ViewUtil.ShowModalWait(self._root_view, "正在加入房间...") + ViewUtil.ShowModalWait(true, "正在加入房间...") __join_room(roomid, response) return end @@ -198,7 +198,7 @@ function M:QuickLogin() local session_id = PlayerPrefs.GetString("session_id") print("session_id:" .. session_id) if session_id and string.len(session_id) > 3 then - ViewUtil.ShowModalWait(self._root_view, "正在登录游戏...") + ViewUtil.ShowModalWait(true, "正在登录游戏...") local loginCtr = ControllerManager.GetController(LoginController) loginCtr:QuickLogin(session_id, function(response) __login_response(self, response) @@ -214,7 +214,7 @@ function M:LoginCallBack(result, data) --pt(data) if (not result) or result ~= 0 then if result == 10 then - ViewUtil.ShowModalWait(self._root_view) + ViewUtil.ShowModalWait(true) return end ViewUtil.CloseModalWait() diff --git a/lua_probject/base_project/Game/View/ViewUtil.lua b/lua_probject/base_project/Game/View/ViewUtil.lua index c9022325..1eeaedb0 100644 --- a/lua_probject/base_project/Game/View/ViewUtil.lua +++ b/lua_probject/base_project/Game/View/ViewUtil.lua @@ -43,11 +43,21 @@ end local modal_wait_win = nil -- local modal_wait_win_url = "ui://Common/GlobalModalWaiting" function ViewUtil.ShowModalWait(blur_view, title) + local flag = type(blur_view) == "boolean" ViewUtil.CloseModalWait() - ModalWaitingWindow.ShowModal(title) + ViewUtil.continue = coroutine.start( + function() + coroutine.wait(flag and 0.01 or 0.8) + ModalWaitingWindow.ShowModal(title) + end + ) end function ViewUtil.CloseModalWait() + if ViewUtil.continue then + coroutine.stop(ViewUtil.continue) + ViewUtil.continue = nil + end ModalWaitingWindow.CloseModal() end