From 2b64929a7042dd9dd1113702628ba410b1a82816 Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 16 May 2023 19:41:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E7=AA=97=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/common/message_box.lua | 42 ++++++++++++++++--------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/lua/app/ui/common/message_box.lua b/lua/app/ui/common/message_box.lua index 8898dcc5..e1d3dae7 100644 --- a/lua/app/ui/common/message_box.lua +++ b/lua/app/ui/common/message_box.lua @@ -53,34 +53,34 @@ function MessageBox:showMessageBox(params) if costId then local itemInfo = ConfigManager:getConfig("item")[costId] if itemInfo then - uiMap["message_box.title_bg_img.ok_btn.icon"]:setSprite(GConst.ATLAS_PATH.ICON_ITEM, itemInfo.icon) - uiMap["message_box.title_bg_img.ok_btn.text"]:setText(tostring(costNum)) - GFunc.centerImgAndTx(uiMap["message_box.title_bg_img.ok_btn.icon"], uiMap["message_box.title_bg_img.ok_btn.text"]) + uiMap["message_box.title_bg_img.btn.ok_btn.icon"]:setSprite(GConst.ATLAS_PATH.ICON_ITEM, itemInfo.icon) + uiMap["message_box.title_bg_img.btn.ok_btn.text"]:setText(tostring(costNum)) + GFunc.centerImgAndTx(uiMap["message_box.title_bg_img.btn.ok_btn.icon"], uiMap["message_box.title_bg_img.btn.ok_btn.text"]) else - uiMap["message_box.title_bg_img.ok_btn.text"]:setAnchoredPositionX(0) - uiMap["message_box.title_bg_img.ok_btn.text"]:setText(okText or I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK)) + uiMap["message_box.title_bg_img.btn.ok_btn.text"]:setAnchoredPositionX(0) + uiMap["message_box.title_bg_img.btn.ok_btn.text"]:setText(okText or I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK)) end else - uiMap["message_box.title_bg_img.ok_btn.text"]:setAnchoredPositionX(0) - uiMap["message_box.title_bg_img.ok_btn.text"]:setText(okText or I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK)) + uiMap["message_box.title_bg_img.btn.ok_btn.text"]:setAnchoredPositionX(0) + uiMap["message_box.title_bg_img.btn.ok_btn.text"]:setText(okText or I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK)) end uiMap["message_box.title_bg_img.title_text"]:setText(titleTx) uiMap["message_box.title_bg_img.bg.content_tx"]:setText(content) - uiMap["message_box.title_bg_img.cancel_btn.text"]:setText(cancelText or I18N:getGlobalText(I18N.GlobalConst.CANCEL_1)) + uiMap["message_box.title_bg_img.btn.cancel_btn.text"]:setText(cancelText or I18N:getGlobalText(I18N.GlobalConst.CANCEL_1)) if boxType == GConst.MESSAGE_BOX_TYPE.MB_OK then - uiMap["message_box.title_bg_img.cancel_btn"]:setVisible(false) - uiMap["message_box.title_bg_img.ok_btn"]:setVisible(true) - uiMap["message_box.title_bg_img.ok_btn"]:setAnchoredPositionX(0) + uiMap["message_box.title_bg_img.btn.cancel_btn"]:setVisible(false) + uiMap["message_box.title_bg_img.btn.ok_btn"]:setVisible(true) + uiMap["message_box.title_bg_img.btn.ok_btn"]:setAnchoredPositionX(0) elseif boxType == GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL then if cancelFunc == nil then prefabObject._closeByAndroidBackspace = true end - uiMap["message_box.title_bg_img.ok_btn"]:setVisible(true) - uiMap["message_box.title_bg_img.ok_btn"]:setAnchoredPositionX(-124) - uiMap["message_box.title_bg_img.cancel_btn"]:setVisible(true) - uiMap["message_box.title_bg_img.cancel_btn"]:addClickListener(function() + uiMap["message_box.title_bg_img.btn.ok_btn"]:setVisible(true) + uiMap["message_box.title_bg_img.btn.ok_btn"]:setAnchoredPositionX(-124) + uiMap["message_box.title_bg_img.btn.cancel_btn"]:setVisible(true) + uiMap["message_box.title_bg_img.btn.cancel_btn"]:addClickListener(function() self:closeAndClear(prefabObject, uiMap) if cancelFunc then cancelFunc() @@ -88,7 +88,7 @@ function MessageBox:showMessageBox(params) end) end - uiMap["message_box.title_bg_img.ok_btn"]:addClickListener(function() + uiMap["message_box.title_bg_img.btn.ok_btn"]:addClickListener(function() if showToday and selected then local todayTime = Time:getBeginningOfServerToday() LocalData:setMessageBoxShowTodayTime(showToday, todayTime) @@ -100,6 +100,7 @@ function MessageBox:showMessageBox(params) end) if showToday then -- 今天内不在提示 + uiMap["message_box.title_bg_img.btn"]:setAnchoredPositionY(-136) uiMap["message_box.title_bg_img.bg"]:setSizeDeltaY(153) uiMap["message_box.title_bg_img.today"]:setVisible(true) uiMap["message_box.title_bg_img.today.check.select"]:setVisible(false) @@ -116,6 +117,7 @@ function MessageBox:showMessageBox(params) GFunc.centerImgAndTx(checkUI, textUI, 5) else + uiMap["message_box.title_bg_img.btn"]:setAnchoredPositionY(-95) uiMap["message_box.title_bg_img.bg"]:setSizeDeltaY(210) uiMap["message_box.title_bg_img.today"]:setVisible(false) end @@ -133,13 +135,13 @@ function MessageBox:refreshText(isTop) local uiMap = gameObject:genAllChildren() uiMap["message_box.title_bg_img.title_text"]:setText("") uiMap["message_box.title_bg_img.bg.content_tx"]:setText("") - uiMap["message_box.title_bg_img.ok_btn.text"]:setText("") - uiMap["message_box.title_bg_img.cancel_btn.text"]:setText("") + uiMap["message_box.title_bg_img.btn.ok_btn.text"]:setText("") + uiMap["message_box.title_bg_img.btn.cancel_btn.text"]:setText("") end function MessageBox:closeAndClear(prefabObject, uiMap) - uiMap["message_box.title_bg_img.ok_btn"]:removeClickListener() - uiMap["message_box.title_bg_img.cancel_btn"]:removeClickListener() + uiMap["message_box.title_bg_img.btn.ok_btn"]:removeClickListener() + uiMap["message_box.title_bg_img.btn.cancel_btn"]:removeClickListener() uiMap["message_box.title_bg_img.today.check"]:removeClickListener() prefabObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS).enabled = false end