diff --git a/excel/Rune.xlsx b/excel/Rune.xlsx index 70236d8..3b325eb 100644 Binary files a/excel/Rune.xlsx and b/excel/Rune.xlsx differ diff --git a/excel/language.xlsx b/excel/language.xlsx index 593768c..d5b1da5 100644 Binary files a/excel/language.xlsx and b/excel/language.xlsx differ diff --git a/src/ReplicatedStorage/Base/UIList.luau b/src/ReplicatedStorage/Base/UIList.luau index bac759e..5aa9c5a 100644 --- a/src/ReplicatedStorage/Base/UIList.luau +++ b/src/ReplicatedStorage/Base/UIList.luau @@ -101,11 +101,19 @@ end function UIList:SetLayoutOrder(keyName: string, reverse: boolean?) self.LayoutOrderKey = keyName if reverse then self.reverse = true else self.reverse = false end + self:ApplyLayoutOrder() +end + +function UIList:ApplyLayoutOrder() + if not self.LayoutOrderKey then return end + for _, ui in pairs(self.Instances) do - if self.reverse then - ui.UIRoot.LayoutOrder = 1000 - tonumber(ui.Data[keyName]) - else - ui.UIRoot.LayoutOrder = tonumber(ui.Data[keyName]) + if ui.Data and ui.Data[self.LayoutOrderKey] then + if self.reverse then + ui.UIRoot.LayoutOrder = 1000 - tonumber(ui.Data[self.LayoutOrderKey]) + else + ui.UIRoot.LayoutOrder = tonumber(ui.Data[self.LayoutOrderKey]) + end end end end diff --git a/src/ReplicatedStorage/Json/Language_En_US.json b/src/ReplicatedStorage/Json/Language_En_US.json index 64793e2..cdc948c 100644 --- a/src/ReplicatedStorage/Json/Language_En_US.json +++ b/src/ReplicatedStorage/Json/Language_En_US.json @@ -65,6 +65,56 @@ {"id":40014,"text":"测试装备15"}, {"id":40015,"text":"测试装备16"}, {"id":60000,"text":"火焰伤害符文"}, -{"id":61000,"text":"冰棺符文"}, -{"id":62000,"text":"测试符文"} +{"id":60001,"text":"冰冻伤害符文"}, +{"id":60002,"text":"雷电伤害符文"}, +{"id":60003,"text":"暗影伤害符文"}, +{"id":60004,"text":"紫色符文"}, +{"id":60005,"text":"匕首符文"}, +{"id":60006,"text":"单手剑符文"}, +{"id":60007,"text":"长枪符文"}, +{"id":60008,"text":"双手剑符文"}, +{"id":60009,"text":"火焰暴伤符文"}, +{"id":60010,"text":"寒冰暴伤符文"}, +{"id":60011,"text":"雷电暴伤符文"}, +{"id":60012,"text":"暗影爆伤符文"}, +{"id":60013,"text":"空槽位符文"}, +{"id":60014,"text":"穿戴槽位符文"}, +{"id":60015,"text":"混合符文"}, +{"id":60016,"text":"爆发符文"}, +{"id":60017,"text":"回收符文"}, +{"id":60018,"text":"词条符文"}, +{"id":60019,"text":"挑战boss符文"}, +{"id":60020,"text":"防御boss符文"}, +{"id":60021,"text":"重量打击符文"}, +{"id":60022,"text":"快攻符文"}, +{"id":60023,"text":"雷暴符文"}, +{"id":60024,"text":"元素快攻符文"}, +{"id":61000,"text":"连电符文"}, +{"id":61001,"text":"金色符文"}, +{"id":61002,"text":"朴实符文"}, +{"id":61003,"text":"万能符文"}, +{"id":61004,"text":"物理暴击符文"}, +{"id":61005,"text":"单槽位符文"}, +{"id":61006,"text":"牺牲符文"}, +{"id":61007,"text":"物理符文"}, +{"id":61008,"text":"爆金币符文"}, +{"id":61009,"text":"禁魔符文"}, +{"id":61010,"text":"首位元素符文"}, +{"id":61011,"text":"末位元素符文"}, +{"id":61012,"text":"冰霜攻击符文"}, +{"id":61013,"text":"吸血符文"}, +{"id":61014,"text":"掠夺铁矿符文"}, +{"id":61015,"text":"主动技能符文"}, +{"id":61016,"text":"被动技能符文"}, +{"id":61017,"text":"左侧复制符文"}, +{"id":61018,"text":"右侧复制符文"}, +{"id":61019,"text":"全部主动符文"}, +{"id":61020,"text":"攻击符文"}, +{"id":61021,"text":"血量符文"}, +{"id":61022,"text":"冰棺符文"}, +{"id":61023,"text":"损血符文"}, +{"id":61024,"text":"会心治疗符文"}, +{"id":61025,"text":"暴击翻倍符文"}, +{"id":61026,"text":"一板一眼符文"}, +{"id":62000,"text":"测试符文3"} ] \ No newline at end of file diff --git a/src/ReplicatedStorage/Json/Language_Zh_CN.json b/src/ReplicatedStorage/Json/Language_Zh_CN.json index 64793e2..cdc948c 100644 --- a/src/ReplicatedStorage/Json/Language_Zh_CN.json +++ b/src/ReplicatedStorage/Json/Language_Zh_CN.json @@ -65,6 +65,56 @@ {"id":40014,"text":"测试装备15"}, {"id":40015,"text":"测试装备16"}, {"id":60000,"text":"火焰伤害符文"}, -{"id":61000,"text":"冰棺符文"}, -{"id":62000,"text":"测试符文"} +{"id":60001,"text":"冰冻伤害符文"}, +{"id":60002,"text":"雷电伤害符文"}, +{"id":60003,"text":"暗影伤害符文"}, +{"id":60004,"text":"紫色符文"}, +{"id":60005,"text":"匕首符文"}, +{"id":60006,"text":"单手剑符文"}, +{"id":60007,"text":"长枪符文"}, +{"id":60008,"text":"双手剑符文"}, +{"id":60009,"text":"火焰暴伤符文"}, +{"id":60010,"text":"寒冰暴伤符文"}, +{"id":60011,"text":"雷电暴伤符文"}, +{"id":60012,"text":"暗影爆伤符文"}, +{"id":60013,"text":"空槽位符文"}, +{"id":60014,"text":"穿戴槽位符文"}, +{"id":60015,"text":"混合符文"}, +{"id":60016,"text":"爆发符文"}, +{"id":60017,"text":"回收符文"}, +{"id":60018,"text":"词条符文"}, +{"id":60019,"text":"挑战boss符文"}, +{"id":60020,"text":"防御boss符文"}, +{"id":60021,"text":"重量打击符文"}, +{"id":60022,"text":"快攻符文"}, +{"id":60023,"text":"雷暴符文"}, +{"id":60024,"text":"元素快攻符文"}, +{"id":61000,"text":"连电符文"}, +{"id":61001,"text":"金色符文"}, +{"id":61002,"text":"朴实符文"}, +{"id":61003,"text":"万能符文"}, +{"id":61004,"text":"物理暴击符文"}, +{"id":61005,"text":"单槽位符文"}, +{"id":61006,"text":"牺牲符文"}, +{"id":61007,"text":"物理符文"}, +{"id":61008,"text":"爆金币符文"}, +{"id":61009,"text":"禁魔符文"}, +{"id":61010,"text":"首位元素符文"}, +{"id":61011,"text":"末位元素符文"}, +{"id":61012,"text":"冰霜攻击符文"}, +{"id":61013,"text":"吸血符文"}, +{"id":61014,"text":"掠夺铁矿符文"}, +{"id":61015,"text":"主动技能符文"}, +{"id":61016,"text":"被动技能符文"}, +{"id":61017,"text":"左侧复制符文"}, +{"id":61018,"text":"右侧复制符文"}, +{"id":61019,"text":"全部主动符文"}, +{"id":61020,"text":"攻击符文"}, +{"id":61021,"text":"血量符文"}, +{"id":61022,"text":"冰棺符文"}, +{"id":61023,"text":"损血符文"}, +{"id":61024,"text":"会心治疗符文"}, +{"id":61025,"text":"暴击翻倍符文"}, +{"id":61026,"text":"一板一眼符文"}, +{"id":62000,"text":"测试符文3"} ] \ No newline at end of file diff --git a/src/ReplicatedStorage/Json/Rune.json b/src/ReplicatedStorage/Json/Rune.json index 5dd1789..5817767 100644 --- a/src/ReplicatedStorage/Json/Rune.json +++ b/src/ReplicatedStorage/Json/Rune.json @@ -41,15 +41,15 @@ {"id":61014,"quality":2,"type":null,"icon":1,"nameId":61014,"runeName":"RuneIronBonus","behaviorName":null,"recycle":[],"isInPool":1}, {"id":61015,"quality":2,"type":null,"icon":1,"nameId":61015,"runeName":"RuneActiveAbilityAttackRate","behaviorName":null,"recycle":[],"isInPool":1}, {"id":61016,"quality":2,"type":null,"icon":1,"nameId":61016,"runeName":"RunePassiveAbilityAttackRate","behaviorName":null,"recycle":[],"isInPool":1}, -{"id":61017,"quality":2,"type":null,"icon":1,"nameId":61018,"runeName":"RuneLeftTrigger","behaviorName":null,"recycle":[],"isInPool":1}, -{"id":61018,"quality":2,"type":null,"icon":1,"nameId":61019,"runeName":"RuneRightTrigger","behaviorName":null,"recycle":[],"isInPool":1}, -{"id":61019,"quality":2,"type":null,"icon":1,"nameId":61020,"runeName":"RuneAllActiveAbility","behaviorName":null,"recycle":[],"isInPool":1}, -{"id":61020,"quality":2,"type":null,"icon":1,"nameId":61021,"runeName":"RuneAttack","behaviorName":null,"recycle":[],"isInPool":1}, -{"id":61021,"quality":2,"type":null,"icon":1,"nameId":61022,"runeName":"RuneHp","behaviorName":null,"recycle":[],"isInPool":1}, -{"id":61022,"quality":2,"type":null,"icon":1,"nameId":61023,"runeName":"RuneIceCoffin","behaviorName":"IceCoffine","recycle":[],"isInPool":1}, -{"id":61023,"quality":2,"type":null,"icon":1,"nameId":61024,"runeName":"RuneFirstHpDamage","behaviorName":null,"recycle":[],"isInPool":1}, -{"id":61024,"quality":2,"type":null,"icon":1,"nameId":61025,"runeName":"RuneHealCrit","behaviorName":null,"recycle":[],"isInPool":1}, -{"id":61025,"quality":2,"type":null,"icon":1,"nameId":61026,"runeName":"RuneCritRateDouble","behaviorName":null,"recycle":[],"isInPool":1}, -{"id":61026,"quality":2,"type":null,"icon":1,"nameId":61027,"runeName":"RuneAtkSpeedToAtkRate","behaviorName":null,"recycle":[],"isInPool":1}, +{"id":61017,"quality":2,"type":null,"icon":1,"nameId":61017,"runeName":"RuneLeftTrigger","behaviorName":null,"recycle":[],"isInPool":1}, +{"id":61018,"quality":2,"type":null,"icon":1,"nameId":61018,"runeName":"RuneRightTrigger","behaviorName":null,"recycle":[],"isInPool":1}, +{"id":61019,"quality":2,"type":null,"icon":1,"nameId":61019,"runeName":"RuneAllActiveAbility","behaviorName":null,"recycle":[],"isInPool":1}, +{"id":61020,"quality":2,"type":null,"icon":1,"nameId":61020,"runeName":"RuneAttack","behaviorName":null,"recycle":[],"isInPool":1}, +{"id":61021,"quality":2,"type":null,"icon":1,"nameId":61021,"runeName":"RuneHp","behaviorName":null,"recycle":[],"isInPool":1}, +{"id":61022,"quality":2,"type":null,"icon":1,"nameId":61022,"runeName":"RuneIceCoffin","behaviorName":"IceCoffine","recycle":[],"isInPool":1}, +{"id":61023,"quality":2,"type":null,"icon":1,"nameId":61023,"runeName":"RuneFirstHpDamage","behaviorName":null,"recycle":[],"isInPool":1}, +{"id":61024,"quality":2,"type":null,"icon":1,"nameId":61024,"runeName":"RuneHealCrit","behaviorName":null,"recycle":[],"isInPool":1}, +{"id":61025,"quality":2,"type":null,"icon":1,"nameId":61025,"runeName":"RuneCritRateDouble","behaviorName":null,"recycle":[],"isInPool":1}, +{"id":61026,"quality":2,"type":null,"icon":1,"nameId":61026,"runeName":"RuneAtkSpeedToAtkRate","behaviorName":null,"recycle":[],"isInPool":1}, {"id":62000,"quality":3,"type":1,"icon":1,"nameId":62000,"runeName":null,"behaviorName":null,"recycle":[],"isInPool":1} ] \ No newline at end of file diff --git a/src/ReplicatedStorage/Tools/Utils.luau b/src/ReplicatedStorage/Tools/Utils.luau index 581e640..3a1a37e 100644 --- a/src/ReplicatedStorage/Tools/Utils.luau +++ b/src/ReplicatedStorage/Tools/Utils.luau @@ -355,7 +355,7 @@ function Utils:GetWearingRuneData(equipmentUniqueId) } for k, v in pairs(runeInstance:GetAttributes()) do runeInfo[k] = v end - table.insert(runeData, runeInfo) + -- 只使用索引赋值,避免重复添加 runeData[runeInstance:GetAttribute("wearingSlot")] = runeInfo end end diff --git a/src/ServerStorage/Proxy/HelpProxy.luau b/src/ServerStorage/Proxy/HelpProxy.luau index 59b67b3..09bab38 100644 --- a/src/ServerStorage/Proxy/HelpProxy.luau +++ b/src/ServerStorage/Proxy/HelpProxy.luau @@ -20,13 +20,15 @@ function HelpProxy:CleanPlayerData(Player: Player) ArchiveProxy:CleanPlayerData(Player) end -RE_PlayerHelper.OnServerEvent:Connect(function(Player: Player, EventName: string, EventData: any) - if EventName == "CleanPlayerData" then - HelpProxy:CleanPlayerData(Player) - elseif EventName == "AddItem" then - ItemProxy:AddItem(Player, EventData[1], EventData[2]) - print("添加物品成功", EventData) - end -end) +if game:GetService("RunService"):IsStudio() then + RE_PlayerHelper.OnServerEvent:Connect(function(Player: Player, EventName: string, EventData: any) + if EventName == "CleanPlayerData" then + HelpProxy:CleanPlayerData(Player) + elseif EventName == "AddItem" then + ItemProxy:AddItem(Player, EventData[1], EventData[2]) + print("添加物品成功", EventData) + end + end) +end return HelpProxy \ No newline at end of file diff --git a/src/ServerStorage/Proxy/RuneProxy/init.luau b/src/ServerStorage/Proxy/RuneProxy/init.luau index a7b2302..781e0ee 100644 --- a/src/ServerStorage/Proxy/RuneProxy/init.luau +++ b/src/ServerStorage/Proxy/RuneProxy/init.luau @@ -167,7 +167,12 @@ function RuneProxy:WearRune(Player: Player, RuneUniqueId: number, EquipmentUniqu -- 获取装备数据 local EquipmentProxy = require(ServerStorage.Proxy.EquipmentProxy) local EquipmentData = EquipmentProxy:GetEquipmentData(Player, EquipmentUniqueId) - print(EquipmentData, EquipmentUniqueId) + + -- 检查装备是否有符文槽位 + if EquipmentData.maxRuneNumber <= 0 then + RE_PlayerTip:FireClient(Player, "装备没有符文槽位") + return + end -- 遍历符文查看现在穿了几个 local wearingCount = 0 @@ -179,14 +184,7 @@ function RuneProxy:WearRune(Player: Player, RuneUniqueId: number, EquipmentUniqu end end - -- 检查装备是否有符文槽位 - if EquipmentData.maxRuneNumber <= 0 then - RE_PlayerTip:FireClient(Player, "装备没有符文槽位") - return - end - -- 检查槽位数量是否充足 - print(wearingCount, EquipmentData.maxRuneNumber) if wearingCount >= EquipmentData.maxRuneNumber then RE_PlayerTip:FireClient(Player, "装备已满符文槽位") return diff --git a/src/StarterPlayerScripts/ClientMain/Helper.luau b/src/StarterPlayerScripts/ClientMain/Helper.luau index 0812cca..82ca310 100644 --- a/src/StarterPlayerScripts/ClientMain/Helper.luau +++ b/src/StarterPlayerScripts/ClientMain/Helper.luau @@ -7,6 +7,9 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage") local RE_PlayerHelper = ReplicatedStorage.Events.RE_PlayerHelper local RE_UpgradeAttributes = ReplicatedStorage.Events.RE_UpgradeAttributes +--> Json +local JsonRune = require(ReplicatedStorage.Json.Rune) + local UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(input, gameProcessed) @@ -22,11 +25,14 @@ UserInputService.InputBegan:Connect(function(input, gameProcessed) elseif input.KeyCode == Enum.KeyCode.K then -- RE_UpgradeAttributes:FireServer(1) RE_PlayerHelper:FireServer("AddItem", {2, 1000}) - RE_PlayerHelper:FireServer("AddItem", {60000, 1}) - RE_PlayerHelper:FireServer("AddItem", {61000, 1}) - RE_PlayerHelper:FireServer("AddItem", {62000, 1}) + -- RE_PlayerHelper:FireServer("AddItem", {60000, 1}) + -- RE_PlayerHelper:FireServer("AddItem", {61000, 1}) + -- RE_PlayerHelper:FireServer("AddItem", {62000, 1}) elseif input.KeyCode == Enum.KeyCode.L then - RE_UpgradeAttributes:FireServer(2) + -- RE_UpgradeAttributes:FireServer(2) + for k, v in JsonRune do + RE_PlayerHelper:FireServer("AddItem", {v.id, 1}) + end elseif input.KeyCode == Enum.KeyCode.M then RE_UpgradeAttributes:FireServer(3) elseif input.KeyCode == Enum.KeyCode.N then diff --git a/src/StarterPlayerScripts/UI/Common/RuneShow.luau b/src/StarterPlayerScripts/UI/Common/RuneShow.luau index 96bcc3d..3ffb8cd 100644 --- a/src/StarterPlayerScripts/UI/Common/RuneShow.luau +++ b/src/StarterPlayerScripts/UI/Common/RuneShow.luau @@ -69,6 +69,13 @@ function RuneShow:OnInitFinish() end function RuneShow:Destroy() + if self.Connections then + for _, con in pairs(self.Connections) do + if con and typeof(con) == "RBXScriptConnection" then + con:Disconnect() + end + end + end for k, v in pairs(self) do self[k] = nil end diff --git a/src/StarterPlayerScripts/UI/Windows/ChaWindow/PackageShow.luau b/src/StarterPlayerScripts/UI/Windows/ChaWindow/PackageShow.luau index 48069af..bce50d9 100644 --- a/src/StarterPlayerScripts/UI/Windows/ChaWindow/PackageShow.luau +++ b/src/StarterPlayerScripts/UI/Windows/ChaWindow/PackageShow.luau @@ -45,6 +45,7 @@ function PackageShow:Refresh() self.Variables["__listRuneWearing"]:AddComponent(RuneShow) local runeData = Utils:GetWearingRuneData(self.Data.id) + print("RuneData", runeData) self.Variables["__listRuneWearing"]:SetData(runeData) -- 模型展示 diff --git a/src/StarterPlayerScripts/UI/Windows/RecycleWindow/RecyclePackageShow.luau b/src/StarterPlayerScripts/UI/Windows/RecycleWindow/RecyclePackageShow.luau index 5c627fc..987bf0e 100644 --- a/src/StarterPlayerScripts/UI/Windows/RecycleWindow/RecyclePackageShow.luau +++ b/src/StarterPlayerScripts/UI/Windows/RecycleWindow/RecyclePackageShow.luau @@ -8,8 +8,15 @@ local Localization = require(ReplicatedStorage.Tools.Localization) local JsonEquipment = require(ReplicatedStorage.Json.Equipment) local JsonItemProp = require(ReplicatedStorage.Json.ItemProp) +--> Variables +local LocalPlayer = game.Players.LocalPlayer + local FolderEquipment = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Equipments") +--> Components +local CommonFolder = LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("UI"):WaitForChild("Common") +local RuneShow = require(CommonFolder:WaitForChild("RuneShow")) + function RecyclePackageShow:Init(data: table) local self = {} self.Data = data @@ -20,6 +27,7 @@ function RecyclePackageShow:Init(data: table) ["_tmpName"] = 0, ["_imgView"] = 0, ["_imgSelected"] = 0, + ["__listRuneWearing"] = 0, } self.Connections = {} @@ -49,6 +57,10 @@ function RecyclePackageShow:Refresh() viewportCamera.Parent = self.Variables["_imgView"] viewportCamera.CFrame = CFrame.new(Vector3.new(0, 0, 6), part.Handle.Position) self.ViewCamera = viewportCamera + + -- 符文展示 + self.Variables["__listRuneWearing"]:AddComponent(RuneShow) + self.Variables["__listRuneWearing"]:SetData(Utils:GetWearingRuneData(self.Data.id)) end function RecyclePackageShow:OnInitFinish() diff --git a/src/StarterPlayerScripts/UI/Windows/RecycleWindow/init.luau b/src/StarterPlayerScripts/UI/Windows/RecycleWindow/init.luau index 32f5978..4ee49de 100644 --- a/src/StarterPlayerScripts/UI/Windows/RecycleWindow/init.luau +++ b/src/StarterPlayerScripts/UI/Windows/RecycleWindow/init.luau @@ -115,7 +115,15 @@ function RecycleWindow:OnOpenWindow() local con = self.Variables._btnRecycle.MouseButton1Click:Connect(function() self:Recycle() end) + -- local bgCloseCon = self.Variables["_btnBgClose"].Activated:Connect(function() + -- self.UIManager:CloseWindow(script.Name) + -- end) + local closeCon = self.Variables["_btnClose"].Activated:Connect(function() + self.UIManager:CloseWindow(script.Name) + end) table.insert(self.Connections, con) + -- table.insert(self.Connections, bgCloseCon) + table.insert(self.Connections, closeCon) end return RecycleWindow \ No newline at end of file diff --git a/src/StarterPlayerScripts/UI/Windows/RuneWindow/PackageShow.luau b/src/StarterPlayerScripts/UI/Windows/RuneWindow/PackageShow.luau index 7d27717..35654a1 100644 --- a/src/StarterPlayerScripts/UI/Windows/RuneWindow/PackageShow.luau +++ b/src/StarterPlayerScripts/UI/Windows/RuneWindow/PackageShow.luau @@ -60,6 +60,13 @@ function PackageShow:OnInitFinish() end function PackageShow:Destroy() + if self.Connections then + for _, con in pairs(self.Connections) do + if con and typeof(con) == "RBXScriptConnection" then + con:Disconnect() + end + end + end for k, v in pairs(self) do self[k] = nil end diff --git a/src/StarterPlayerScripts/UI/Windows/RuneWindow/init.luau b/src/StarterPlayerScripts/UI/Windows/RuneWindow/init.luau index 308734b..92346d9 100644 --- a/src/StarterPlayerScripts/UI/Windows/RuneWindow/init.luau +++ b/src/StarterPlayerScripts/UI/Windows/RuneWindow/init.luau @@ -74,7 +74,7 @@ end function RuneWindow:ShowDetailData(uniqueId: number, orgId: number) if uniqueId then - if self.NowMaxRuneNumber == 0 then warn("当前最大符文数量为0") return end + if self.NowMaxRuneNumber == 0 then warn("当前最大符文数量为0", uniqueId, orgId) return end self.NowSelectRuneId = uniqueId local runeData = Utils:GetIdDataFromJson(JsonRune, orgId) self.Variables["_tmpNowRuneName"].Text = Localization:GetLanguageData(runeData.nameId) @@ -103,13 +103,17 @@ function RuneWindow:RefreshEquipmentName() end function RuneWindow:WearRefresh(data: table) - local newSlot = data.instance:GetAttribute("wearing") + local newSlot = data.instance:GetAttribute("wearingSlot") self.Variables["__listRuneWearing"]:RemoveData("slot"..newSlot) self.Variables["__listRunePackage"]:RemoveData(tostring(data.id)) -- 更新穿戴数据,要不再点击前端就不好使了 data.wearing = newSlot + data.wearingSlot = newSlot -- 确保wearingSlot字段正确设置 self.Variables["__listRuneWearing"]:AddData("slot"..newSlot, data) + + -- 重新应用布局顺序 + self.Variables["__listRuneWearing"]:ApplyLayoutOrder() -- 穿戴后,如果当前穿戴的符文是当前选中的符文,则刷新当前选中的符文为空 if data.id == self.NowSelectRuneId then self:ShowDetailData() end @@ -119,11 +123,15 @@ function RuneWindow:UnwearRefresh(data: table) local oldSlot = data.wearing self.Variables["__listRuneWearing"]:RemoveData("slot"..oldSlot) data.wearing = 0 + data.wearingSlot = 0 -- 重置wearingSlot字段 self.Variables["__listRunePackage"]:AddData(tostring(data.id), data) - self.Data.Wearing["slot"..oldSlot] = { - wearing = oldSlot, + self.Data.WearingRune["slot"..oldSlot] = { + wearingSlot = oldSlot, } - self.Variables["__listRuneWearing"]:AddData("slot"..oldSlot, self.Data.Wearing["slot"..oldSlot]) + self.Variables["__listRuneWearing"]:AddData("slot"..oldSlot, self.Data.WearingRune["slot"..oldSlot]) + + -- 重新应用布局顺序 + self.Variables["__listRuneWearing"]:ApplyLayoutOrder() end function RuneWindow:InlayRune() @@ -143,12 +151,24 @@ function RuneWindow:AddInstanceData(configInstance: Instance, Data: table?) parentName = "WearingRune" secondName = "slot"..attributes.wearingSlot end + + -- 如果是背包内,其他装备的符文,则不添加 + if parentName == "PackageRune" and attributes.wearingSlot > 0 then + return nil, nil + end + data[parentName][secondName] = {} for attributeKey, attributeValue in attributes do data[parentName][secondName][attributeKey] = attributeValue end data[parentName][secondName].instance = configInstance + + -- 确保wearingSlot字段正确设置 + if parentName == "WearingRune" then + data[parentName][secondName].wearingSlot = attributes.wearingSlot + end + return data[parentName][secondName], parentName end @@ -263,7 +283,10 @@ function RuneWindow:OnOpenWindow() local addCon = DataFolder.ChildAdded:Connect(function(child) local data, parentName = self:AddInstanceData(child, self.Data) if parentName == "WearingRune" then - self.Variables["__listRuneWearing"]:AddData("slot"..data.wearingSlot, data) + -- 确保wearingSlot字段存在 + if data and data.wearingSlot then + self.Variables["__listRuneWearing"]:AddData("slot"..data.wearingSlot, data) + end else self.Variables["__listRunePackage"]:AddData(child.Name, data) end diff --git a/src/StarterPlayerScripts/UI/Windows/SelectEquipmentWindow/PackageShow.luau b/src/StarterPlayerScripts/UI/Windows/SelectEquipmentWindow/PackageShow.luau index 83f1765..f7b074d 100644 --- a/src/StarterPlayerScripts/UI/Windows/SelectEquipmentWindow/PackageShow.luau +++ b/src/StarterPlayerScripts/UI/Windows/SelectEquipmentWindow/PackageShow.luau @@ -16,6 +16,7 @@ local LocalPlayer = game.Players.LocalPlayer --> Components local CommonFolder = LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("UI"):WaitForChild("Common") local EquipmentModelDetail = require(CommonFolder:WaitForChild("EquipmentModelDetail")) +local RuneShow = require(CommonFolder:WaitForChild("RuneShow")) function PackageShow:Init(data: table) local self = {} @@ -26,6 +27,7 @@ function PackageShow:Init(data: table) ["_tmpQuality"] = 0, ["_tmpName"] = 0, ["_imgView"] = 0, + ["__listRuneWearing"] = 0, } self.Connections = {} @@ -43,6 +45,10 @@ function PackageShow:Refresh() -- 模型展示 EquipmentModelDetail:ShowDetail(self.Variables["_imgView"], self.Data.orgId, false) + + -- 符文展示 + self.Variables["__listRuneWearing"]:AddComponent(RuneShow) + self.Variables["__listRuneWearing"]:SetData(Utils:GetWearingRuneData(self.Data.id)) end function PackageShow:OnInitFinish() diff --git a/src/StarterPlayerScripts/UI/Windows/SelectEquipmentWindow/init.luau b/src/StarterPlayerScripts/UI/Windows/SelectEquipmentWindow/init.luau index cf35dc3..ee93536 100644 --- a/src/StarterPlayerScripts/UI/Windows/SelectEquipmentWindow/init.luau +++ b/src/StarterPlayerScripts/UI/Windows/SelectEquipmentWindow/init.luau @@ -54,7 +54,6 @@ function SelectEquipmentWindow:OnOpenWindow() table.insert(self.Data.ShowData, newData) end end - print(self.Data) local bgCloseCon = self.Variables["_btnBgClose"].Activated:Connect(function() self.UIManager:CloseWindow(script.Name)