特殊属性ui显示-但是没符文镶嵌功能
This commit is contained in:
gechangfu 2025-08-12 16:42:03 +08:00
parent 170d8d28b2
commit 879ae4efb8
12 changed files with 111 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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":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,"behaviourName":"SwordWave","upgradeCost":[30000,5,10],"upgradeValue":[10,200],"recycle":[30000,100],"isInPool":1} {"id":20001,"type":1,"icon":1,"nameId":20001,"behaviourName":"SwordWave","upgradeCost":[30000,5,10],"upgradeValue":[10,200],"recycle":[30000,100],"isInPool":1}
] ]

View File

@ -38,6 +38,11 @@
{"id":253,"text":"元素属性数量上限"}, {"id":253,"text":"元素属性数量上限"},
{"id":254,"text":"元素抗性数量上限"}, {"id":254,"text":"元素抗性数量上限"},
{"id":255,"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":40000,"text":"测试装备1"},
{"id":40001,"text":"测试装备2"}, {"id":40001,"text":"测试装备2"},
{"id":40002,"text":"测试装备3"}, {"id":40002,"text":"测试装备3"},

View File

@ -38,8 +38,11 @@
{"id":253,"text":"元素属性数量上限"}, {"id":253,"text":"元素属性数量上限"},
{"id":254,"text":"元素抗性数量上限"}, {"id":254,"text":"元素抗性数量上限"},
{"id":255,"text":"宝石数量上限"}, {"id":255,"text":"宝石数量上限"},
{"id":100006,"text":"Coin+{0}"}, {"id":1001,"text":"鉴定出{0}属性时 {1}+{2}"},
{"id":100007,"text":"Score+{0}"}, {"id":1002,"text":"鉴定出{0}技能时 {1}+{2}"},
{"id":1003,"text":"鉴定出{0}晶石时 {1}+{2}"},
{"id":20000,"text":"普攻"},
{"id":20001,"text":"剑气"},
{"id":40000,"text":"测试装备1"}, {"id":40000,"text":"测试装备1"},
{"id":40001,"text":"测试装备2"}, {"id":40001,"text":"测试装备2"},
{"id":40002,"text":"测试装备3"}, {"id":40002,"text":"测试装备3"},

View File

@ -120,4 +120,16 @@ function Localization:GetBlackTexture(): string
return "rbxassetid://87376908468146" return "rbxassetid://87376908468146"
end 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 return Localization

View File

@ -397,7 +397,6 @@ function EquipmentProxy:GetPlayerAttributes(Player: Player)
-- 技能类型加成 -- 技能类型加成
elseif EquipmentData.specialType == 2 then elseif EquipmentData.specialType == 2 then
local wearingAbilityUniqueId, wearingOrgId = AbilityProxy:GetPlayerAbilityByEquipmentUniqueId(Player, EquipmentData.id) local wearingAbilityUniqueId, wearingOrgId = AbilityProxy:GetPlayerAbilityByEquipmentUniqueId(Player, EquipmentData.id)
print("穿戴技能", wearingOrgId, EquipmentData.specialRequire)
if table.find(wearingOrgId, EquipmentData.specialRequire) then isActive = true end if table.find(wearingOrgId, EquipmentData.specialRequire) then isActive = true end
-- 晶石类型加成 -- 晶石类型加成
elseif EquipmentData.specialType == 3 then elseif EquipmentData.specialType == 3 then

View File

@ -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

View File

@ -24,6 +24,10 @@ local RE_WearEquipment = ReplicatedStorage.Events.RE_WearEquipment
--> Variables --> Variables
local LocalPlayer = game.Players.LocalPlayer 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") local FolderEquipment = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Equipments")
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -36,6 +40,7 @@ function EquipmentDetailWindow:Init(UIManager: table, Data: table?)
local self = UIWindow:Init(UIManager, Data) local self = UIWindow:Init(UIManager, Data)
setmetatable(self, EquipmentDetailWindow) setmetatable(self, EquipmentDetailWindow)
self.Variables = { self.Variables = {
["__listSpecial"] = 0,
["__listBaseAttributes"] = 0, ["__listBaseAttributes"] = 0,
["_goExAttributesPanel"] = 0, ["_goExAttributesPanel"] = 0,
["__listExAttributes"] = 0, ["__listExAttributes"] = 0,
@ -250,6 +255,15 @@ function EquipmentDetailWindow:OnOpenWindow()
else else
self.Variables["_goElementDefPanel"].Visible = false self.Variables["_goElementDefPanel"].Visible = false
end 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 end

View File

@ -17,6 +17,9 @@ local EquipmentShow = require(script.EquipmentShow)
local LocalPlayer = game:GetService("Players").LocalPlayer 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) local function centerSpecificListItem(scrollingFrame, targetItem)
@ -91,6 +94,7 @@ function GetEquipmentsWindow:Init(UIManager: table, Data: table?)
["_goRewardsPanel"] = 0, ["_goRewardsPanel"] = 0,
["_goDetailPanel"] = 0, ["_goDetailPanel"] = 0,
["__listSpecial"] = 0,
["_goBase"] = 0, ["_goBase"] = 0,
["_goExAttributesPanel"] = 0, ["_goExAttributesPanel"] = 0,
["_goElementPanel"] = 0, ["_goElementPanel"] = 0,
@ -166,6 +170,12 @@ function GetEquipmentsWindow:ShowDetail(equipmentInstance: Instance)
else else
self.Variables["_goElementDefPanel"].Visible = false self.Variables["_goElementDefPanel"].Visible = false
end end
-- 特殊属性显示
if equipmentInstance:GetAttribute("specialType") then
self.Variables["__listSpecial"].Visible = true
self.Variables["__listSpecial"]:SetData({[1] = equipmentInstance:GetAttributes()})
end
end end
function GetEquipmentsWindow:SetCenter(listName, equipmentData) function GetEquipmentsWindow:SetCenter(listName, equipmentData)
@ -233,6 +243,8 @@ function GetEquipmentsWindow:OnOpenWindow()
self.Variables["__listElement"]:AddComponent(AttributeShow) self.Variables["__listElement"]:AddComponent(AttributeShow)
self.Variables["__listElementDef"]:AddComponent(AttributeShow) self.Variables["__listElementDef"]:AddComponent(AttributeShow)
self.Variables["__listSpecial"]:AddComponent(SpecialShow)
-- 找到对应的原始equipmentInstance来显示详情 -- 找到对应的原始equipmentInstance来显示详情
for _, equipmentInstance in self.Data do for _, equipmentInstance in self.Data do
if equipmentInstance:GetAttribute("quality") == showDetailData.quality then if equipmentInstance:GetAttribute("quality") == showDetailData.quality then