From e897c75af84c8419b7410947702cf57ee2ccb27a Mon Sep 17 00:00:00 2001 From: "DESKTOP-MMO982B\\User" <752966621@qq.com> Date: Fri, 10 Apr 2026 18:13:29 +0800 Subject: [PATCH] 1 --- .../~Lua/Common/GlobalDefine.lua | 3 +- .../Modules/GeneralPanel/GeneralBigPopup.lua | 3 +- .../View/GeneralBigPopup_WishJulingDraw.lua | 240 ++++++++++++++++++ .../GeneralBigPopup_WishJulingDraw.lua.meta | 7 + .../~Lua/Modules/Net/NetManager.lua | 4 + .../~Lua/Modules/Recruit/RecruitManager.lua | 73 ++++++ 6 files changed, 328 insertions(+), 2 deletions(-) create mode 100644 Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_WishJulingDraw.lua create mode 100644 Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_WishJulingDraw.lua.meta diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index f19796cff0..25be5f5a28 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -2647,6 +2647,7 @@ GENERAL_POPUP_TYPE = { GiveLikeHotHero = 72, --英雄热度排行 WishEquipDraw = 73, --心愿法宝抽卡 IncarnationDes2 = 74, + WishJulingDraw = 75, --心愿巨灵抽奖 } --通用信息弹窗类型 @@ -2662,7 +2663,7 @@ GENERALINFO_TYPE = { HomeLandUpgrade = 9, --家园建筑升级 HomeLandPrivilege = 10, --家园特权 ExploreMapTip = 11, - + } --通用信息弹窗类型 diff --git a/Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralBigPopup.lua b/Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralBigPopup.lua index 46cc67712e..640f9c76a7 100644 --- a/Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralBigPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/GeneralPanel/GeneralBigPopup.lua @@ -52,7 +52,8 @@ local contentScripts = { [GENERAL_POPUP_TYPE.WishEquipDraw] = {view = require("Modules/GeneralPanel/View/GeneralBigPopup_WishEquipDraw"), panelName = "GeneralBigPopup_WishEquipDraw"}, --英雄热度排行榜 [GENERAL_POPUP_TYPE.GiveLikeHotHero ] = {view = require("Modules/Popup/View/GeneralBigPopup_GiveLikeHotHero"), panelName = "GeneralBigPopup_GiveLikeHotHero"}, - + --选择心愿法宝巨灵 + [GENERAL_POPUP_TYPE.WishJulingDraw] = { view = require("Modules/GeneralPanel/View/GeneralBigPopup_WishJulingDraw"), panelName = "GeneralBigPopup_WishJulingDraw" }, } --子模块预设 local contentPrefabs={} diff --git a/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_WishJulingDraw.lua b/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_WishJulingDraw.lua new file mode 100644 index 0000000000..61e44e0abc --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_WishJulingDraw.lua @@ -0,0 +1,240 @@ +----- 心愿抽卡弹窗 ----- +local this = {} +local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) +local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig) +local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig) + +function this:InitComponent(gameObject) + self.spLoader = SpriteLoader.New() + self.okBtn = Util.GetGameObject(gameObject, "okBtn") + self.helpBtn = Util.GetGameObject(gameObject, "helpBtn") + self.helpBtn:SetActive(false) + self.scroll = Util.GetGameObject(gameObject, "selectList") + self.itemPre = Util.GetGameObject(gameObject, "itemPre") + -- 设置循环滚动,万一内容不停地加 + local rootHight = self.scroll.transform.rect.height + local width = self.scroll.transform.rect.width + self.infoTxt = Util.GetGameObject(gameObject, "Bg/tiao1/Text (1)"):GetComponent("Text") + self.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scroll.transform, + self.itemPre, nil, Vector2.New(width, rootHight), 1, 5, Vector2.New(20, 60)) + self.scrollView.moveTween.MomentumAmount = 1 + self.scrollView.moveTween.Strength = 2 + + self.itemList = {} + self.maskList = {} + --wishList + self.wishListObj = {} + self.bgObjlist = {} + for i = 1, 3 do + self.wishListObj[i] = Util.GetGameObject(gameObject, "wishList/hero (" .. i .. ")") + self.bgObjlist[i] = Util.GetGameObject(gameObject, "Bg/bglist/obj" .. i) + Util.GetGameObject(self.bgObjlist[i], "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite( + "r_characterbg_goden") + --心愿神将现在只显示一个 + if i > 1 then + self.wishListObj[i]:SetActive(false) + self.bgObjlist[i]:SetActive(false) + else + self.wishListObj[i]:SetActive(true) + self.bgObjlist[i]:SetActive(true) + end + end + --tabList + self.tabListObj = {} + self.selectBtn = Util.GetGameObject(gameObject, "Tabs/grid/selectBtn") + for j = 1, 4 do + self.maskList[j] = {} + self.itemList[j] = {} + self.tabListObj[j] = Util.GetGameObject(gameObject, "Tabs/grid/Btn" .. j) + end + Util.GetGameObject(gameObject, "Tabs"):SetActive(false) + + self.helpPosition = self.helpBtn:GetComponent("RectTransform").localPosition +end + +function this:BindEvent() + for i = 1, 4 do + Util.AddOnceClick(self.tabListObj[i], function() + self.curSelect = i + this:Refresh(true, false) + end) + end + for i = 1, 3 do + Util.AddOnceClick(self.bgObjlist[i], function() + --心愿只能选一个神将 + if i > 1 then + return + end + self.curSelect = RecruitManager.CheckIndex() + this:Refresh(true, false) + end) + end + + Util.AddOnceClick(self.okBtn, function() + LogError("点击确定按钮") + self.parent:ClosePanel() + end) + + --帮助按钮 + Util.AddClick(self.helpBtn, function() + LogError("点击帮助按钮") + UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.WishCard, self.helpPosition.x, self.helpPosition.y) + end) +end + +function this:AddListener() +end + +function this:RemoveListener() +end + +function this:OnShow(_parent, _Data) + self.parent = _parent + self.sortingOrder = _parent.sortingOrder + local args = _Data + --NetManager.ChoiceWishHeroRequest(nil,function () + if args[1] then + self.curSelect = args[1] + else + self.curSelect = 1 -- RecruitManager.CheckIndex() + end + this:Refresh(true, false) + --end) +end + +function this:Refresh(isTop, isAni) + local data = tonumber(specialConfig[119].Value) + if not RecruitManager.drawTimes[15] or RecruitManager.drawTimes[15] < data then + self.parent:ClosePanel() + return + end + --local aaa = string.format(Language[11085], RecruitManager.GetWishPro(), "%") + --self.infoTxt.text = aaa + self.infoTxt.text = "每次抽中整50法灵碎片时,100%概率替换为选中的心愿法灵碎片*50" + self.selectBtn:SetActive(false) + --self.selectBtn:GetComponent("RectTransform").localPosition = self.tabListObj[self.curSelect]:GetComponent("RectTransform").localPosition + this:SetHeroList(isTop, isAni) + this:SetUpHero() +end + +function this:SetUpHero() + for i = 1, 1 do + local go = self.wishListObj[i] + + local frame = Util.GetGameObject(go, "frame"):GetComponent("Image") + local icon = Util.GetGameObject(go, "icon"):GetComponent("Image") + local proIcon = Util.GetGameObject(go, "proIcon"):GetComponent("Image") + local starGrid = Util.GetGameObject(go, "star") + local choosed = Util.GetGameObject(go, "choosed") + local heroId = 0 + if RecruitManager.WishJulingData[i] then + heroId = RecruitManager.WishJulingData[i].heroTid + end + choosed:SetActive(false) + if heroId > 0 then + go:SetActive(true) + local heroData = itemConfig[heroId] + frame.sprite = self.spLoader:LoadSprite(GetBgByHeroNatural(heroData.Quantity)) + icon.sprite = self.spLoader:LoadSprite(GetResourcePath(heroData.ResourceID)) + proIcon.gameObject:SetActive(false) + --proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.Name)) + --SetHeroStars(self.spLoader,starGrid, heroData.Star) + choosed:SetActive(RecruitManager.WishJulingData[i].status == 1) + Util.AddOnceClick(go, function() + if RecruitManager.WishJulingData[i].status == 1 then + PopupTipPanel.ShowTip(Language[11082]) + elseif RecruitManager.WishJulingData[i].status == 0 then + RecruitManager.ChangeJuling(2, heroId, function() + this:Refresh(false, false) + end) --英雄变更:1增加、2卸下 + end + end) + else + go:SetActive(false) + end + --LogError("i===================" .. i) + if i > 1 then + self.wishListObj[i]:SetActive(false) + --LogError("false false") + end + Util.AddLongPressClick(go, function() + UIManager.OpenPanel(UIName.RoleGetInfoPopup, false, heroId, 5) + end, 0.5) + end +end + +function this:SetHeroList(isTop, isAni) + local heroList = RecruitManager.allTailsMansJuling --RecruitManager.GetCurHeroTalismanaList(0) + self.scrollView:SetData(heroList, function(index, item) + this:ShowSingleHero(item, heroList[index], index) + end, not isTop, not isAni) +end + +function this:ShowSingleHero(go, data, index) + local equipId = data + local heroData = itemConfig[equipId] + self.itemList[self.curSelect][index] = go + Util.GetGameObject(go, "frame"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetBgByHeroNatural(heroData + .Quantity)) + Util.GetGameObject(go, "icon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetResourcePath(heroData + .ResourceID)) + --Util.GetGameObject(go, "proIcon"):GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.PropertyName)) + Util.GetGameObject(go, "proIcon"):SetActive(false) + Util.GetGameObject(go, "name"):GetComponent("Text").text = GetLanguageStrById(heroData.Name) + Util.GetGameObject(go, "heroName"):GetComponent("Text").text = GetLanguageStrById(itemConfig[data].Name) + Util.GetGameObject(go, "name").gameObject:SetActive(false) + local starGrid = Util.GetGameObject(go, "star") + -- SetHeroStars(self.spLoader,starGrid, heroData.Star) + self.maskList[self.curSelect][index] = Util.GetGameObject(go, "choosed") + self.maskList[self.curSelect][index]:SetActive(false) + Util.SetGray(self.itemList[self.curSelect][index], false) + + local value = RecruitManager.CheckCurJulingmanaState(equipId) + if value == 0 then --上方存在相同阵营 + Util.SetGray(self.itemList[self.curSelect][index], true) + Util.AddOnceClick(go, function() + --PopupTipPanel.ShowTip("同系法宝只可选择一位~") + PopupTipPanel.ShowTip(Language[11086]) + end) + elseif value == 2 then --上方选满 + Util.SetGray(self.itemList[self.curSelect][index], true) + Util.AddOnceClick(go, function() + PopupTipPanel.ShowTip(Language[11086]) + end) + elseif value == 1 then --上方存在自己 + self.maskList[self.curSelect][index]:SetActive(true) + Util.AddOnceClick(go, function() + RecruitManager.ChangeJuling(2, equipId, function() + this:Refresh(false, false) + end) --英雄变更:1增加、2卸下 + end) + elseif value == 4 then --上方存在自己,但已经出过该英雄了 + self.maskList[self.curSelect][index]:SetActive(true) + Util.AddOnceClick(go, function() + PopupTipPanel.ShowTip(Language[11082]) + end) + elseif value == 3 then --可选 + Util.AddOnceClick(go, function() + RecruitManager.ChangeJuling(1, equipId, function() + this:Refresh(false, false) + end) --英雄变更:1增加、2卸下 + end) + end + Util.AddLongPressClick(go, function() + UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, heroData.Id) + --UIManager.OpenPanel(UIName.RoleGetInfoPopup, false, data, 5) + end, 0.5) +end + +function this:OnClose() +end + +function this:OnDestroy() + self.itemList = {} + self.maskList = {} + self.wishListObj = {} + self.tabListObj = {} + self.spLoader:Destroy() +end + +return this diff --git a/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_WishJulingDraw.lua.meta b/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_WishJulingDraw.lua.meta new file mode 100644 index 0000000000..394b2d8318 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/GeneralPanel/View/GeneralBigPopup_WishJulingDraw.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d1ef7223534378247af51e73fdc9a896 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index 7cac3ee0bd..011c435134 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -5862,6 +5862,10 @@ function NetManager.ChoiceWishHeroRequest(_type,func) for i=1, #msg.newList do LogError(" newlist [i]================"..msg.newList[i]) end + elseif _type == 15 then + LogError("設置心願裝備----------------------------") + RecruitManager.SetWishJulingData(list) + RecruitManager.allTailsMansJuling = msg.newList end RecruitManager.newWishList = msg.newList--新增的心愿神将list --RecruitManager.openTime = msg.serverOpenTime--开服时间戳或是0(用于判断心愿神将是否加入卡池) diff --git a/Assets/ManagedResources/~Lua/Modules/Recruit/RecruitManager.lua b/Assets/ManagedResources/~Lua/Modules/Recruit/RecruitManager.lua index f42695202a..ad09101a1d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Recruit/RecruitManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Recruit/RecruitManager.lua @@ -44,6 +44,7 @@ function this.Initialize() this.isTenRecruit = 0 --首次十连 this.WishCardData = {} this.WishEquipData = {} + this.WishJulingData = {} this.wishSoulData={} this.isFirstEnterElementScroll=true this.isFirstEnterHeroScroll=true @@ -574,6 +575,78 @@ function this.SetWishEquipData(infoList) table.insert(this.wishSoulData,infoList[i].equip) end end +function this.SetWishJulingData(infoList) + this.WishJulingData = {} + for i = 1, #infoList do + this.WishJulingData[i] = {} + this.WishJulingData[i].id = infoList[i].id + this.WishJulingData[i].heroTid = infoList[i].heroTid + this.WishJulingData[i].status = infoList[i].status + LogPink("Id:" .. + tostring(infoList[i].id) .. " heroIid:" .. + tostring(infoList[i].heroTid) .. " status:" .. tostring(infoList[i].status)) + this.WishJulingData[i].PropertyName = infoList[i].heroTid > 0 and heroConfig[infoList[i].heroTid] and + heroConfig[infoList[i].heroTid].PropertyName or nil + end +end +--检测当前法宝聚灵状态 +function this.CheckCurJulingmanaState(_heroTid) + for i = 1, #this.WishJulingData do + if this.WishJulingData[i].heroTid == _heroTid then + --如果上方存在自己就✔ + if this.WishJulingData[i].status == 0 then + return 1 + elseif this.WishJulingData[i].status == 1 then + return 4 + end + end + end + for i = 1, #this.WishJulingData do + if this.WishJulingData[i].heroTid > 0 then + --如果上方存在和当前英雄相同阵营的就置灰 + return 0 + end + end + + local num = 0 + for i = 1, #this.WishJulingData do + if this.WishJulingData[i].heroTid > 0 then + num = num + 1 + end + end + if num == 1 then + --如果上方神将满则其他全部置灰 + return 2 + end + --都没有就亮着 + return 3 +end +--添加和卸下法宝巨灵 +function this.ChangeJuling(type, _heroTid, func) + if type == 1 then --增加神将 + for i = 1, #this.WishEquipData do + if this.WishJulingData[i].heroTid == 0 then + this.WishJulingData[i].heroTid = _heroTid + break + end + end + elseif type == 2 then --卸下神将 + for i = 1, #this.WishJulingData do + if this.WishJulingData[i].heroTid == _heroTid then + this.WishJulingData[i].heroTid = 0 + _heroTid = 0 + break + end + end + end + --LogError("RecruitManager.curWishType=="..RecruitManager.curWishType.." _heroid==".._heroTid) + NetManager.DesireDrawCardRequest(RecruitManager.curWishType, _heroTid, function() + Game.GlobalEvent:DispatchEvent(GameEvent.Recruit.OnRecruitRefreshData) + if func then + func() + end + end) +end function this.SetAllWishEquipData(data) if not data then return