diff --git a/excel/ability.xlsx b/excel/ability.xlsx index daf3b44..adf63a1 100644 Binary files a/excel/ability.xlsx and b/excel/ability.xlsx differ diff --git a/excel/attribute.xlsx b/excel/attribute.xlsx index 3416d17..0f0f896 100644 Binary files a/excel/attribute.xlsx and b/excel/attribute.xlsx differ diff --git a/excel/equipment.xlsx b/excel/equipment.xlsx index 3f3c0b8..3bf41aa 100644 Binary files a/excel/equipment.xlsx and b/excel/equipment.xlsx differ diff --git a/excel/language.xlsx b/excel/language.xlsx index 3199228..1ef273c 100644 Binary files a/excel/language.xlsx and b/excel/language.xlsx differ diff --git a/src/ReplicatedStorage/Json/Ability.json b/src/ReplicatedStorage/Json/Ability.json index 1660d97..8eef569 100644 --- a/src/ReplicatedStorage/Json/Ability.json +++ b/src/ReplicatedStorage/Json/Ability.json @@ -1,4 +1,4 @@ [ -{"id":20000,"type":1,"icon":1,"behaviourName":"Attack","upgradeCost":[30000,5,0],"upgradeValue":[10,0],"recycle":[30000,0],"isInPool":null}, -{"id":20001,"type":1,"icon":1,"behaviourName":"SwordWave","upgradeCost":[30000,5,10],"upgradeValue":[10,200],"recycle":[30000,100],"isInPool":1} +{"id":20000,"type":1,"icon":1,"nameId":20000,"behaviourName":"Attack","upgradeCost":[30000,5,0],"upgradeValue":[10,0],"recycle":[30000,0],"isInPool":null}, +{"id":20001,"type":1,"icon":1,"nameId":20001,"behaviourName":"SwordWave","upgradeCost":[30000,5,10],"upgradeValue":[10,200],"recycle":[30000,100],"isInPool":1} ] \ No newline at end of file diff --git a/src/ReplicatedStorage/Json/Language_En_US.json b/src/ReplicatedStorage/Json/Language_En_US.json index 317c111..ac1eb76 100644 --- a/src/ReplicatedStorage/Json/Language_En_US.json +++ b/src/ReplicatedStorage/Json/Language_En_US.json @@ -38,6 +38,11 @@ {"id":253,"text":"元素属性数量上限"}, {"id":254,"text":"元素抗性数量上限"}, {"id":255,"text":"宝石数量上限"}, +{"id":1001,"text":"鉴定出{0}属性时 {1}+{2}"}, +{"id":1002,"text":"鉴定出{0}技能时 {1}+{2}"}, +{"id":1003,"text":"鉴定出{0}晶石时 {1}+{2}"}, +{"id":20000,"text":"普攻"}, +{"id":20001,"text":"剑气"}, {"id":40000,"text":"测试装备1"}, {"id":40001,"text":"测试装备2"}, {"id":40002,"text":"测试装备3"}, diff --git a/src/ReplicatedStorage/Json/Language_Zh_CN.json b/src/ReplicatedStorage/Json/Language_Zh_CN.json index e1e262e..ac1eb76 100644 --- a/src/ReplicatedStorage/Json/Language_Zh_CN.json +++ b/src/ReplicatedStorage/Json/Language_Zh_CN.json @@ -38,8 +38,11 @@ {"id":253,"text":"元素属性数量上限"}, {"id":254,"text":"元素抗性数量上限"}, {"id":255,"text":"宝石数量上限"}, -{"id":100006,"text":"Coin+{0}"}, -{"id":100007,"text":"Score+{0}"}, +{"id":1001,"text":"鉴定出{0}属性时 {1}+{2}"}, +{"id":1002,"text":"鉴定出{0}技能时 {1}+{2}"}, +{"id":1003,"text":"鉴定出{0}晶石时 {1}+{2}"}, +{"id":20000,"text":"普攻"}, +{"id":20001,"text":"剑气"}, {"id":40000,"text":"测试装备1"}, {"id":40001,"text":"测试装备2"}, {"id":40002,"text":"测试装备3"}, diff --git a/src/ReplicatedStorage/Tools/Localization.luau b/src/ReplicatedStorage/Tools/Localization.luau index 18f8b34..853c42f 100644 --- a/src/ReplicatedStorage/Tools/Localization.luau +++ b/src/ReplicatedStorage/Tools/Localization.luau @@ -120,4 +120,16 @@ function Localization:GetBlackTexture(): string return "rbxassetid://87376908468146" end +-- 字符串格式化函数,支持 {0}, {1}, {2} 等占位符 +function Localization:FormatString(template: string, ...) + local args = {...} + return string.gsub(template, "{(%d+)}", function(index) + local valueIndex = tonumber(index) + if valueIndex and args[valueIndex + 1] then + return tostring(args[valueIndex + 1]) + end + return "{" .. index .. "}" -- 如果找不到对应的值,保持原样 + end) +end + return Localization \ No newline at end of file diff --git a/src/ServerStorage/Proxy/EquipmentProxy.luau b/src/ServerStorage/Proxy/EquipmentProxy.luau index 07a95c6..3c906f8 100644 --- a/src/ServerStorage/Proxy/EquipmentProxy.luau +++ b/src/ServerStorage/Proxy/EquipmentProxy.luau @@ -397,7 +397,6 @@ function EquipmentProxy:GetPlayerAttributes(Player: Player) -- 技能类型加成 elseif EquipmentData.specialType == 2 then local wearingAbilityUniqueId, wearingOrgId = AbilityProxy:GetPlayerAbilityByEquipmentUniqueId(Player, EquipmentData.id) - print("穿戴技能", wearingOrgId, EquipmentData.specialRequire) if table.find(wearingOrgId, EquipmentData.specialRequire) then isActive = true end -- 晶石类型加成 elseif EquipmentData.specialType == 3 then diff --git a/src/StarterPlayerScripts/UI/Common/SpecialShow.luau b/src/StarterPlayerScripts/UI/Common/SpecialShow.luau new file mode 100644 index 0000000..3a9c161 --- /dev/null +++ b/src/StarterPlayerScripts/UI/Common/SpecialShow.luau @@ -0,0 +1,61 @@ +local SpecialShow = {} +SpecialShow.__index = SpecialShow + +local ReplicatedStorage = game:GetService("ReplicatedStorage") + +local Utils = require(ReplicatedStorage.Tools.Utils) +local Localization = require(ReplicatedStorage.Tools.Localization) +local JsonEquipment = require(ReplicatedStorage.Json.Equipment) +-- local JsonItemProp = require(ReplicatedStorage.Json.ItemProp) +local JsonAttributes = require(ReplicatedStorage.Json.Attributes) +local JsonAbility = require(ReplicatedStorage.Json.Ability) + +function SpecialShow:Init(data: table) + local self = {} + self.Data = data + self.Variables = { + ["_tmpSpecialTitle"] = 0, + ["_tmpDescTitle"] = 0, + ["_tmpSpecialRate"] = 0, + } + self.Connections = {} + + setmetatable(self, SpecialShow) + return self +end + +function SpecialShow:Refresh() + local baseDesc = Localization:GetLanguageData(1000 + self.Data.specialType) + local firstDesc, secondDesc, thirdDesc = "", "", "" + if self.Data.specialType == 1 then + firstDesc = Localization:GetLanguageData(Utils:GetIdDataFromJson(JsonAttributes, self.Data.specialRequire).nameId) + elseif self.Data.specialType == 2 then + firstDesc = Localization:GetLanguageData(Utils:GetIdDataFromJson(JsonAbility, self.Data.specialRequire).nameId) + elseif self.Data.specialType == 3 then + + end + + local equipmentData = Utils:GetIdDataFromJson(JsonEquipment, self.Data.orgId) + -- 增长数值显示 + local attributeData = Utils:GetIdDataFromJson(JsonAttributes, equipmentData.specialActive[1]) + secondDesc = Localization:GetLanguageData(attributeData.nameId) + thirdDesc = equipmentData.specialActive[2] + -- 百分比显示 + if attributeData["type"] == 2 then + thirdDesc = thirdDesc .. "%" + end + + print(baseDesc, firstDesc, secondDesc, thirdDesc) + self.Variables._tmpDescTitle.Text = Localization:FormatString(baseDesc, firstDesc, secondDesc, thirdDesc) + self.Variables._tmpSpecialRate.Visible = false + -- self.Variables._tmpSpecialRate.Text = Localization:GetLanguageData(itemData.nameId) +end + +function SpecialShow:Destroy() + for k, v in pairs(self) do + self[k] = nil + end + self = nil +end + +return SpecialShow \ No newline at end of file diff --git a/src/StarterPlayerScripts/UI/Windows/EquipmentDetailWindow/init.luau b/src/StarterPlayerScripts/UI/Windows/EquipmentDetailWindow/init.luau index f797133..be2a9f7 100644 --- a/src/StarterPlayerScripts/UI/Windows/EquipmentDetailWindow/init.luau +++ b/src/StarterPlayerScripts/UI/Windows/EquipmentDetailWindow/init.luau @@ -24,6 +24,10 @@ local RE_WearEquipment = ReplicatedStorage.Events.RE_WearEquipment --> Variables local LocalPlayer = game.Players.LocalPlayer +--> Common +local CommonFolder = LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("UI"):WaitForChild("Common") +local SpecialShow = require(CommonFolder:WaitForChild("SpecialShow")) + local FolderEquipment = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Equipments") -------------------------------------------------------------------------------- @@ -36,6 +40,7 @@ function EquipmentDetailWindow:Init(UIManager: table, Data: table?) local self = UIWindow:Init(UIManager, Data) setmetatable(self, EquipmentDetailWindow) self.Variables = { + ["__listSpecial"] = 0, ["__listBaseAttributes"] = 0, ["_goExAttributesPanel"] = 0, ["__listExAttributes"] = 0, @@ -250,6 +255,15 @@ function EquipmentDetailWindow:OnOpenWindow() else self.Variables["_goElementDefPanel"].Visible = false end + + -- 特殊属性 + if equipmentInstance:GetAttribute("specialType") then + self.Variables["__listSpecial"].Visible = true + self.Variables["__listSpecial"]:AddComponent(SpecialShow) + self.Variables["__listSpecial"]:SetData({[1] = equipmentInstance:GetAttributes()}) + else + self.Variables["__listSpecial"].Visible = false + end end diff --git a/src/StarterPlayerScripts/UI/Windows/GetEquipmentsWindow/init.luau b/src/StarterPlayerScripts/UI/Windows/GetEquipmentsWindow/init.luau index 263daff..c29c2aa 100644 --- a/src/StarterPlayerScripts/UI/Windows/GetEquipmentsWindow/init.luau +++ b/src/StarterPlayerScripts/UI/Windows/GetEquipmentsWindow/init.luau @@ -17,6 +17,9 @@ local EquipmentShow = require(script.EquipmentShow) local LocalPlayer = game:GetService("Players").LocalPlayer +local CommonFolder = LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("UI"):WaitForChild("Common") +local SpecialShow = require(CommonFolder:WaitForChild("SpecialShow")) + -------------------------------------------------------------------------------- local function centerSpecificListItem(scrollingFrame, targetItem) @@ -91,6 +94,7 @@ function GetEquipmentsWindow:Init(UIManager: table, Data: table?) ["_goRewardsPanel"] = 0, ["_goDetailPanel"] = 0, + ["__listSpecial"] = 0, ["_goBase"] = 0, ["_goExAttributesPanel"] = 0, ["_goElementPanel"] = 0, @@ -166,6 +170,12 @@ function GetEquipmentsWindow:ShowDetail(equipmentInstance: Instance) else self.Variables["_goElementDefPanel"].Visible = false end + + -- 特殊属性显示 + if equipmentInstance:GetAttribute("specialType") then + self.Variables["__listSpecial"].Visible = true + self.Variables["__listSpecial"]:SetData({[1] = equipmentInstance:GetAttributes()}) + end end function GetEquipmentsWindow:SetCenter(listName, equipmentData) @@ -233,6 +243,8 @@ function GetEquipmentsWindow:OnOpenWindow() self.Variables["__listElement"]:AddComponent(AttributeShow) self.Variables["__listElementDef"]:AddComponent(AttributeShow) + self.Variables["__listSpecial"]:AddComponent(SpecialShow) + -- 找到对应的原始equipmentInstance来显示详情 for _, equipmentInstance in self.Data do if equipmentInstance:GetAttribute("quality") == showDetailData.quality then