diff --git a/lua/app/ui/game_setting/select_other_btn_ui.lua b/lua/app/ui/game_setting/select_other_btn_ui.lua index 4343e54b..d6adbe7e 100644 --- a/lua/app/ui/game_setting/select_other_btn_ui.lua +++ b/lua/app/ui/game_setting/select_other_btn_ui.lua @@ -1,17 +1,17 @@ local SelectOtherBtnUI = class("SelectOtherBtnUI", BaseUI) -local BTN_OFFSET = 32 -local BTN_INTERVAL = 16 +local BTN_OFFSET = -10 +local BTN_INTERVAL = 56 function SelectOtherBtnUI:ctor() end function SelectOtherBtnUI:isFullScreen() - return false + return false end function SelectOtherBtnUI:getPrefabPath() - return "assets/prefabs/ui/setting/select_other_btn_ui.prefab" + return "assets/prefabs/ui/setting/select_other_btn_ui.prefab" end function SelectOtherBtnUI:onPressBackspace() @@ -19,52 +19,84 @@ function SelectOtherBtnUI:onPressBackspace() end function SelectOtherBtnUI:onLoadRootComplete() - self.uiMap = self.root:genAllChildren() - self.uiMap["select_other_btn_ui.mask"]:addClickListener(function() - self:closeUI() - end) - self.uiMap["select_other_btn_ui.bg.mail_btn"]:addClickListener(function() - self:closeUI() - ModuleManager.MailManager:showMailUI() - end) + self.uiMap = self.root:genAllChildren() + self.root:addClickListener(function() + self:closeUI() + end) + self.uiMap["select_other_btn_ui.bg.mail_btn"]:addClickListener(function() + self:closeUI() + ModuleManager.MailManager:showMailUI() + end) - local cellHeight = self.uiMap["select_other_btn_ui.bg.setting_btn"]:getRectHeight() - local cellCount = 0 - local y = -BTN_OFFSET - if DataManager.MailData:getIsOpen() then - cellCount = cellCount + 1 - self.uiMap["select_other_btn_ui.bg.mail_btn"]:setVisible(true) - self.uiMap["select_other_btn_ui.bg.mail_btn"]:setAnchoredPositionY(y) - y = y - BTN_INTERVAL - cellHeight - local redPoint, isAdRedPoint = DataManager.MailData:getRedPoint() - if redPoint then - if isAdRedPoint then - self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 1, "common_ad_3", nil, true) - else - self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 0.8, nil, nil, true) - end - else - self.uiMap["select_other_btn_ui.bg.mail_btn"]:removeRedPoint() - end - self.uiMap["select_other_btn_ui.bg.mail_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIL_NAME)) - else - self.uiMap["select_other_btn_ui.bg.mail_btn"]:setVisible(false) - end - cellCount = cellCount + 1 - local settingBtn = self.uiMap["select_other_btn_ui.bg.setting_btn"] - if DataManager.AIHelperData:getRp() then - settingBtn:addRedPoint(124, 35, 0.8, nil, nil, true) - else - settingBtn:removeRedPoint() - end - settingBtn:setAnchoredPositionY(y) - settingBtn:addClickListener(function() - self:closeUI() - ModuleManager.GameSettingManager:showSettingUI() - end) - self.uiMap["select_other_btn_ui.bg.setting_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC)) + local cellCount = 0 + local y = -BTN_OFFSET - self.uiMap["select_other_btn_ui.bg"]:setSizeDeltaY(cellCount*cellHeight + (cellCount - 1)*BTN_INTERVAL + BTN_OFFSET*2) + cellCount = cellCount + 1 + y = y - BTN_INTERVAL + local settingBtn = self.uiMap["select_other_btn_ui.bg.setting_btn"] + if DataManager.AIHelperData:getRp() then + settingBtn:addRedPoint(124, 35, 0.8, nil, nil, true) + else + settingBtn:removeRedPoint() + end + settingBtn:setAnchoredPositionY(y) + settingBtn:addClickListener(function() + self:closeUI() + ModuleManager.GameSettingManager:showSettingUI() + end) + self.uiMap["select_other_btn_ui.bg.setting_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC)) + + if DataManager.MailData:getIsOpen() then + cellCount = cellCount + 1 + y = y - BTN_INTERVAL + self.uiMap["select_other_btn_ui.bg.mail_btn"]:setVisible(true) + self.uiMap["select_other_btn_ui.bg.mail_btn"]:setAnchoredPositionY(y) + + local redPoint, isAdRedPoint = DataManager.MailData:getRedPoint() + if redPoint then + if isAdRedPoint then + self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 1, "common_ad_3", nil, true) + else + self.uiMap["select_other_btn_ui.bg.mail_btn"]:addRedPoint(124, 35, 0.8, nil, nil, true) + end + else + self.uiMap["select_other_btn_ui.bg.mail_btn"]:removeRedPoint() + end + self.uiMap["select_other_btn_ui.bg.mail_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIL_NAME)) + else + self.uiMap["select_other_btn_ui.bg.mail_btn"]:setVisible(false) + end + + if true then + cellCount = cellCount + 1 + y = y - BTN_INTERVAL + local bagBtn = self.uiMap["select_other_btn_ui.bg.bag_btn"] + -- if DataManager.AIHelperData:getRp() then + -- bagBtn:addRedPoint(124, 35, 0.8, nil, nil, true) + -- else + -- bagBtn:removeRedPoint() + -- end + bagBtn:setAnchoredPositionY(y) + bagBtn:addClickListener(function() + self:closeUI() + ModuleManager.GameSettingManager:showSettingUI() + end) + self.uiMap["select_other_btn_ui.bg.bag_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC)) + end + + if Platform:getIsDevChannel() then + cellCount = cellCount + 1 + y = y - BTN_INTERVAL + local gmBtn = self.uiMap["select_other_btn_ui.bg.gm_btn"] + gmBtn:setAnchoredPositionY(y) + gmBtn:addClickListener(function() + self:closeUI() + ModuleManager.DevToolManager:showOrHideDevListUI() + end) + self.uiMap["select_other_btn_ui.bg.gm_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC)) + end + + self.uiMap["select_other_btn_ui.bg"]:setSizeDeltaY(cellCount*BTN_INTERVAL - BTN_OFFSET*2) end return SelectOtherBtnUI \ No newline at end of file