From bd21a12b984e0c30b448ff474d1ac251599e8c6a Mon Sep 17 00:00:00 2001 From: JieLing Date: Mon, 28 Sep 2020 15:08:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A9=E8=BE=95commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Carbon/XuanYuanMirrorPanel.lua | 68 ++++++++++++++++--- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Carbon/XuanYuanMirrorPanel.lua b/Assets/ManagedResources/~Lua/Modules/Carbon/XuanYuanMirrorPanel.lua index 0813ccc51a..01ee584bd1 100644 --- a/Assets/ManagedResources/~Lua/Modules/Carbon/XuanYuanMirrorPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Carbon/XuanYuanMirrorPanel.lua @@ -5,7 +5,7 @@ local this = XuanYuanMirrorPanel local hasFresh = false local orginLayer = 0 -local type = { +local activityType = { [1] = { bg = "ui_fb_btn_jy", name = Language[12299], @@ -26,7 +26,6 @@ local type = { name = Language[12302], gameObject = "daoxuanbaojing" , }, - } local NumConvertWeek = {[1]=Language[10005],[2]=Language[10006],[3]=Language[10007],[4]=Language[10008],[5]=Language[10009],[6]=Language[10010],[7]=Language[12303]} --初始化组件(用于子类重写) @@ -46,6 +45,29 @@ function this:InitComponent() this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform) this.AnimRoot = Util.GetGameObject(self.gameObject, "btnRoot/circle/root") + -- NumConvertWeek = {[1]=Language[10005],[2]=Language[10006],[3]=Language[10007],[4]=Language[10008],[5]=Language[10009],[6]=Language[10010],[7]=Language[12303]} + -- activityType = { + -- [1] = { + -- bg = "ui_fb_btn_jy", + -- name = Language[12299], + -- gameObject = "renjiebaojing" , + -- }, + -- [2] = { + -- bg = "ui_fb_btn_gh", + -- name = Language[12300], + -- gameObject = "fuochanbaojing" , + -- }, + -- [3] = { + -- bg = "ui_fb_btn_sl", + -- name = Language[12301], + -- gameObject = "yaolingbaojing" , + -- }, + -- [4] = { + -- bg = "ui_fb_btn_jq", + -- name = Language[12302], + -- gameObject = "daoxuanbaojing" , + -- }, + -- } end local index = 1 @@ -112,26 +134,50 @@ function this:GetOpenTime(id) end end end + LogBlue(str.." 宝镜开启时间") return str end this.UpdateCarbonContent = function(...) - if not type then - return + LogBlue("type长度: "..LengthOfTable(activityType)) + if not activityType then + activityType = { + [1] = { + bg = "ui_fb_btn_jy", + name = Language[12299], + gameObject = "renjiebaojing" , + }, + [2] = { + bg = "ui_fb_btn_gh", + name = Language[12300], + gameObject = "fuochanbaojing" , + }, + [3] = { + bg = "ui_fb_btn_sl", + name = Language[12301], + gameObject = "yaolingbaojing" , + }, + [4] = { + bg = "ui_fb_btn_jq", + name = Language[12302], + gameObject = "daoxuanbaojing" , + }, + } end local temp = {...} local temp = temp[1] if index and index >= 0 then Timer.New(function() local openFunctions = {} - for k,v in pairs(type) do + for k,v in pairs(activityType) do local go = Util.GetGameObject(this.AnimRoot, v.gameObject) go:GetComponent("Image").sprite = Util.LoadSprite(v.bg) Util.GetGameObject(go, "titileBg/Text"):GetComponent("Text").text =v.name - local state = XuanYuanMirrorManager.GetMirrorState(k) == 1 - if not state then + local state = XuanYuanMirrorManager.GetMirrorState(k) == 1 + LogGreen(k.." 宝镜state:"..XuanYuanMirrorManager.GetMirrorState(k)) + if not state or state == 0 then local timeStr = this:GetOpenTime(k) Util.GetGameObject(go, "timeBg/Text"):GetComponent("Text").text = timeStr..Language[10357] Util.GetGameObject(go, "redPoint").gameObject:SetActive(false) @@ -144,12 +190,14 @@ this.UpdateCarbonContent = function(...) Util.GetGameObject(go, "redPoint").gameObject:SetActive(false) end end - Util.SetGray(go, not state) + Util.SetGray(go,not state) Util.AddOnceClick(go ,function() if state then + LogBlue("宝镜状态:"..activityType[k].name..XuanYuanMirrorManager.GetMirrorState(k)) UIManager.OpenPanel(UIName.XuanYuanMirrorPanelList,k) else - PopupTipPanel.ShowTip(type[k].name..Language[12306]) + LogBlue("宝镜未开启提示:"..activityType[k].name..Language[12306]) + PopupTipPanel.ShowTip(activityType[k].name..Language[12306]) end end) end @@ -203,7 +251,7 @@ function this:OnDestroy() self.timer:Stop() self.timer = nil end - type = {} + SubUIManager.Close(this.UpView) end --刷新时间