From 268b8df801e147b177d506c9a5f8ffc7a9e6ff40 Mon Sep 17 00:00:00 2001 From: vurtne14 Date: Mon, 26 May 2025 11:57:06 +0800 Subject: [PATCH] 1 --- .../~Lua/Modules/WanYuan/LevelMoney.lua | 64 +++++++++---------- .../~Lua/Modules/WanYuan/LoginMoney.lua | 63 +++++++++--------- 2 files changed, 63 insertions(+), 64 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/WanYuan/LevelMoney.lua b/Assets/ManagedResources/~Lua/Modules/WanYuan/LevelMoney.lua index 38c6b6385..c0db8663a 100644 --- a/Assets/ManagedResources/~Lua/Modules/WanYuan/LevelMoney.lua +++ b/Assets/ManagedResources/~Lua/Modules/WanYuan/LevelMoney.lua @@ -2,13 +2,13 @@ local LevelMoney = quick_class("WeekCard") local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local EncourageTaskConfig = ConfigManager.GetConfig(ConfigName.EncourageTaskConfig) local EncouragePlanConfig = ConfigManager.GetConfig(ConfigName.EncouragePlanConfig) -local allData={} +local allData = {} local bannerImg = { - [15] = {GetPictureFont("X1_zhanling_pata_bg"), "", 131},--爬塔 - [16] = {GetPictureFont("X1_zhanling_mota_bg"), "X1_zhanling_mota_icon", 132},--魔之塔 - [17] = {GetPictureFont("X1_zhanling_yiduan_bg"),"X1_zhanling_yiduan_icon", 133},--异端 - [18] = {GetPictureFont("X1_zhanling_miwu_bg"), "X1_zhanling_miwu_icon", 134},--迷雾 - [19] = {GetPictureFont("X1_zhanling_shenyuan_bg"), "X1_zhanling_shenyuan_icon", 135},--深渊 + [15] = { GetPictureFont("X1_zhanling_pata_bg"), "", 131 }, --爬塔 + [16] = { GetPictureFont("X1_zhanling_mota_bg"), "X1_zhanling_mota_icon", 132 }, --魔之塔 + [17] = { GetPictureFont("X1_zhanling_yiduan_bg"), "X1_zhanling_yiduan_icon", 133 }, --异端 + [18] = { GetPictureFont("X1_zhanling_miwu_bg"), "X1_zhanling_miwu_icon", 134 }, --迷雾 + [19] = { GetPictureFont("X1_zhanling_shenyuan_bg"), "X1_zhanling_shenyuan_icon", 135 }, --深渊 } local curIndex local lastGlobalSystemId @@ -16,9 +16,9 @@ local lastwarOrders local allMoney = 0 local rewardMoney = 0 local taskState = { - [0] = 1, --未完成 - [1] = 0, --完成未领取 - [2] = 2, --已领取 + [0] = 1, --未完成 + [1] = 0, --完成未领取 + [2] = 2, --已领取 } function LevelMoney:ctor(mainPanel, gameObject) self.mainPanel = mainPanel @@ -41,12 +41,12 @@ function LevelMoney:InitComponent(gameObject) local rootHight = self.scroll.transform.rect.height local width = self.scroll.transform.rect.width self.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scroll.transform, - self.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 5)) + self.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 5)) self.scrollView.moveTween.MomentumAmount = 1 self.scrollView.moveTween.Strength = 2 - self.level = Util.GetGameObject(gameObject, "banner/level"):GetComponent("Text") - self.rewardMoney = Util.GetGameObject(gameObject, "banner/money2"):GetComponent("Text") - self.shengYuMoney = Util.GetGameObject(gameObject, "banner/money1"):GetComponent("Text") + self.level = Util.GetGameObject(gameObject, "banner/level"):GetComponent("Text") + self.rewardMoney = Util.GetGameObject(gameObject, "banner/money2"):GetComponent("Text") + self.shengYuMoney = Util.GetGameObject(gameObject, "banner/money1"):GetComponent("Text") end function LevelMoney:BindEvent() @@ -60,13 +60,13 @@ function LevelMoney:RemoveEvent() end function LevelMoney:OnShow() - self.gameObject:SetActive(true) - + self.gameObject:SetActive(true) + -- OperatingManager.GetAllWarOrderData(function () -- end) self:SetData() self:SetBanner() - -- self:SetWarOrdersBtn() + -- self:SetWarOrdersBtn() end function LevelMoney:OnHide() @@ -81,27 +81,27 @@ function LevelMoney:SetData() return end local setTop = false - table.sort(allData,function(a, b) + table.sort(allData, function(a, b) if a.state == b.state then return a.value < b.value else return taskState[a.state] > taskState[b.state] end end) - + for index, data in ipairs(allData) do allMoney = allMoney + data.money if data.state == 1 then rewardMoney = rewardMoney + data.money end end - table.insert(allData,{}) + table.insert(allData, {}) if not curIndex then curIndex = #allData setTop = true end - self.scrollView:SetData(allData, function (index, go) + self.scrollView:SetData(allData, function(index, go) self:SetItem(go, allData[index], index, #allData) end) if setTop then @@ -110,9 +110,9 @@ function LevelMoney:SetData() end function LevelMoney:SetBanner() - self.level.text = PlayerManager.level - self.rewardMoney.text = rewardMoney.."元" - self.shengYuMoney.text = allMoney - rewardMoney.."元" + self.level.text = PlayerManager.level + self.rewardMoney.text = rewardMoney .. GetLanguageStrById("钻石") + self.shengYuMoney.text = allMoney - rewardMoney .. GetLanguageStrById("钻石") end function LevelMoney:SetItem(go, data, index, max) @@ -134,7 +134,7 @@ function LevelMoney:SetItem(go, data, index, max) local redpoint = Util.GetGameObject(go, "btn/redpoint") upLine:SetActive(index ~= 1) - downLine:SetActive(index ~= max-1) + downLine:SetActive(index ~= max - 1) if not self.itemList then self.itemList = {} @@ -145,7 +145,7 @@ function LevelMoney:SetItem(go, data, index, max) if not self.itemList[go][freeGrid] then self.itemList[go][freeGrid] = {} end - + for i = 1, #self.itemList[go][freeGrid] do self.itemList[go][freeGrid][i].gameObject:SetActive(false) end @@ -159,8 +159,8 @@ function LevelMoney:SetItem(go, data, index, max) self.itemList[go][freeGrid][i].gameObject:SetActive(true) end - - + + progress.text = data.value received:SetActive(state == 1) @@ -172,18 +172,18 @@ function LevelMoney:SetItem(go, data, index, max) elseif state == 0 then btnTxt.text = GetLanguageStrById(50536) end - - Util.AddOnceClick(btn, function () + + Util.AddOnceClick(btn, function() if state == 2 then local curActivityId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.LevelLiJin) - NetManager.GetActivityRewardRequest(sConFigData.id, curActivityId,function(drop) + NetManager.GetActivityRewardRequest(sConFigData.id, curActivityId, function(drop) UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1) self:OnShow() Game.GlobalEvent:DispatchEvent(GameEvent.WanYuan.Refresh) CheckRedPointStatus(RedPointType.WanYuan) --万元礼金 end) - end + end end) end -return LevelMoney \ No newline at end of file +return LevelMoney diff --git a/Assets/ManagedResources/~Lua/Modules/WanYuan/LoginMoney.lua b/Assets/ManagedResources/~Lua/Modules/WanYuan/LoginMoney.lua index bf4ed1e09..34373c75d 100644 --- a/Assets/ManagedResources/~Lua/Modules/WanYuan/LoginMoney.lua +++ b/Assets/ManagedResources/~Lua/Modules/WanYuan/LoginMoney.lua @@ -1,7 +1,7 @@ local LoginMoney = quick_class("WeekCard") local EncouragePlanConfig = ConfigManager.GetConfig(ConfigName.EncouragePlanConfig) -local allData={} +local allData = {} local this = LoginMoney local curIndex local lastGlobalSystemId @@ -10,9 +10,9 @@ local allMoney = 0 local rewardMoney = 0 local loginDay = 0 local taskState = { - [0] = 1, --未完成 - [1] = 0, --完成未领取 - [2] = 2, --已领取 + [0] = 1, --未完成 + [1] = 0, --完成未领取 + [2] = 2, --已领取 } function LoginMoney:ctor(mainPanel, gameObject) self.mainPanel = mainPanel @@ -35,12 +35,12 @@ function LoginMoney:InitComponent(gameObject) local rootHight = self.scroll.transform.rect.height local width = self.scroll.transform.rect.width self.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scroll.transform, - self.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 5)) + self.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 5)) self.scrollView.moveTween.MomentumAmount = 1 self.scrollView.moveTween.Strength = 2 - self.loginDay = Util.GetGameObject(gameObject, "banner/Day"):GetComponent("Text") - self.rewardMoney = Util.GetGameObject(gameObject, "banner/money2"):GetComponent("Text") - self.shengYuMoney = Util.GetGameObject(gameObject, "banner/money1"):GetComponent("Text") + self.loginDay = Util.GetGameObject(gameObject, "banner/Day"):GetComponent("Text") + self.rewardMoney = Util.GetGameObject(gameObject, "banner/money2"):GetComponent("Text") + self.shengYuMoney = Util.GetGameObject(gameObject, "banner/money1"):GetComponent("Text") end function LoginMoney:BindEvent() @@ -54,32 +54,32 @@ function LoginMoney:RemoveEvent() end function LoginMoney:OnShow() - self.gameObject:SetActive(true) - + self.gameObject:SetActive(true) + -- OperatingManager.GetAllWarOrderData(function () -- end) self:SetData() self:SetBanner() --self:SetWarOrdersBtn() end + -- function LoginMoney:Refresh() -- self:SetData() -- self:SetBanner() -- end function LoginMoney:OnHide() - self.gameObject:SetActive(false) end function LoginMoney:SetData() - allMoney = 0 - rewardMoney = 0 - PrivilegeTurnManager.RefreShWanYuanRedPoint(ActivityTypeDef.LoginLiJin) + allMoney = 0 + rewardMoney = 0 + PrivilegeTurnManager.RefreShWanYuanRedPoint(ActivityTypeDef.LoginLiJin) allData = OperatingManager.GetWanYuanLiBao(ActivityTypeDef.LoginLiJin) if allData == nil then - return + return end - table.sort(allData,function(a, b) + table.sort(allData, function(a, b) if a.state == b.state then return a.value < b.value else @@ -93,16 +93,16 @@ function LoginMoney:SetData() rewardMoney = rewardMoney + data.money end end - table.insert(allData,{}) - + table.insert(allData, {}) + local setTop = false if not curIndex then curIndex = #allData setTop = true end - - self.scrollView:SetData(allData, function (index, go) + + self.scrollView:SetData(allData, function(index, go) self:SetItem(go, allData[index], index, #allData) end) if setTop then @@ -111,12 +111,11 @@ function LoginMoney:SetData() end function LoginMoney:SetBanner() - self.loginDay.text = loginDay - self.rewardMoney.text = rewardMoney.."元" - self.shengYuMoney.text = allMoney - rewardMoney.."元" + self.loginDay.text = loginDay + self.rewardMoney.text = rewardMoney .. GetLanguageStrById("钻石") + self.shengYuMoney.text = allMoney - rewardMoney .. GetLanguageStrById("钻石") end - function LoginMoney:SetItem(go, data, index, max) if index == max then go:SetActive(false) @@ -136,7 +135,7 @@ function LoginMoney:SetItem(go, data, index, max) local redpoint = Util.GetGameObject(go, "btn/redpoint") upLine:SetActive(index ~= 1) - downLine:SetActive(index ~= max-1) + downLine:SetActive(index ~= max - 1) if not self.itemList then self.itemList = {} @@ -147,7 +146,7 @@ function LoginMoney:SetItem(go, data, index, max) if not self.itemList[go][freeGrid] then self.itemList[go][freeGrid] = {} end - + for i = 1, #self.itemList[go][freeGrid] do self.itemList[go][freeGrid][i].gameObject:SetActive(false) end @@ -160,7 +159,7 @@ function LoginMoney:SetItem(go, data, index, max) -- self.itemList[go][freeGrid][i]:SetCorner(4, taskData.freeObtained) self.itemList[go][freeGrid][i].gameObject:SetActive(true) end - + progress.text = data.value received:SetActive(state == 1) btn:SetActive(state == 0 or state == 2) @@ -170,18 +169,18 @@ function LoginMoney:SetItem(go, data, index, max) elseif state == 0 then btnTxt.text = GetLanguageStrById(50536) end - Util.AddOnceClick(btn, function () + Util.AddOnceClick(btn, function() if state == 2 then local curActivityId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.LoginLiJin) - Log("curActivityId login "..curActivityId) - NetManager.GetActivityRewardRequest(sConFigData.id, curActivityId,function(drop) + Log("curActivityId login " .. curActivityId) + NetManager.GetActivityRewardRequest(sConFigData.id, curActivityId, function(drop) UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1) self:OnShow() CheckRedPointStatus(RedPointType.WanYuan) --万元礼金 Game.GlobalEvent:DispatchEvent(GameEvent.WanYuan.Refresh) end) - end + end end) end -return LoginMoney \ No newline at end of file +return LoginMoney