更新
This commit is contained in:
parent
13c974adbe
commit
c605ade2a2
@ -24,14 +24,14 @@
|
||||
{"id":26,"type":1,"specialType":null,"effectAttribute":"mpRecoverBonus","battleValue":[1,10],"iconId":23,"nameId":226},
|
||||
{"id":27,"type":2,"specialType":null,"effectAttribute":"vampireRate","battleValue":[1,10],"iconId":24,"nameId":227},
|
||||
{"id":28,"type":2,"specialType":null,"effectAttribute":"coinBonus","battleValue":[1,10],"iconId":25,"nameId":228},
|
||||
{"id":29,"type":2,"specialType":1,"effectAttribute":"critRateFire","battleValue":[1,10],"iconId":26,"nameId":229},
|
||||
{"id":30,"type":2,"specialType":1,"effectAttribute":"critRateIce","battleValue":[1,10],"iconId":27,"nameId":230},
|
||||
{"id":31,"type":2,"specialType":1,"effectAttribute":"critRateLight","battleValue":[1,10],"iconId":28,"nameId":231},
|
||||
{"id":32,"type":2,"specialType":1,"effectAttribute":"critRateDark","battleValue":[1,10],"iconId":29,"nameId":232},
|
||||
{"id":33,"type":2,"specialType":1,"effectAttribute":"critDamageRateFire","battleValue":[1,10],"iconId":26,"nameId":233},
|
||||
{"id":34,"type":2,"specialType":1,"effectAttribute":"critDamageRateIce","battleValue":[1,10],"iconId":27,"nameId":234},
|
||||
{"id":35,"type":2,"specialType":1,"effectAttribute":"critDamageRateLight","battleValue":[1,10],"iconId":28,"nameId":235},
|
||||
{"id":36,"type":2,"specialType":1,"effectAttribute":"critDamageRateDark","battleValue":[1,10],"iconId":29,"nameId":236},
|
||||
{"id":29,"type":2,"specialType":null,"effectAttribute":"critRateFire","battleValue":[1,10],"iconId":26,"nameId":229},
|
||||
{"id":30,"type":2,"specialType":null,"effectAttribute":"critRateIce","battleValue":[1,10],"iconId":27,"nameId":230},
|
||||
{"id":31,"type":2,"specialType":null,"effectAttribute":"critRateLight","battleValue":[1,10],"iconId":28,"nameId":231},
|
||||
{"id":32,"type":2,"specialType":null,"effectAttribute":"critRateDark","battleValue":[1,10],"iconId":29,"nameId":232},
|
||||
{"id":33,"type":2,"specialType":null,"effectAttribute":"critDamageRateFire","battleValue":[1,10],"iconId":26,"nameId":233},
|
||||
{"id":34,"type":2,"specialType":null,"effectAttribute":"critDamageRateIce","battleValue":[1,10],"iconId":27,"nameId":234},
|
||||
{"id":35,"type":2,"specialType":null,"effectAttribute":"critDamageRateLight","battleValue":[1,10],"iconId":28,"nameId":235},
|
||||
{"id":36,"type":2,"specialType":null,"effectAttribute":"critDamageRateDark","battleValue":[1,10],"iconId":29,"nameId":236},
|
||||
{"id":37,"type":2,"specialType":null,"effectAttribute":"ironBonus","battleValue":[1,0],"iconId":37,"nameId":237},
|
||||
{"id":50,"type":1,"specialType":null,"effectAttribute":"wearNumber","battleValue":[1,10],"iconId":50,"nameId":250},
|
||||
{"id":51,"type":1,"specialType":null,"effectAttribute":"skillNumber","battleValue":[1,10],"iconId":51,"nameId":251},
|
||||
|
@ -308,6 +308,69 @@ function Utils:FindInRoot(root, name)
|
||||
return root:FindFirstChild(name)
|
||||
end
|
||||
|
||||
-- 获取穿戴符文
|
||||
function Utils:GetWearingRuneData(equipmentUniqueId)
|
||||
-- 从ReplicatedStorage获取当前穿戴的符文
|
||||
local runeData = {}
|
||||
local Players = game:GetService("Players")
|
||||
local LocalPlayer = Players.LocalPlayer
|
||||
|
||||
-- 获取玩家数据文件夹
|
||||
local PlayerDataFolder = ReplicatedStorage:WaitForChild("PlayerData")
|
||||
local PlayerFolder = PlayerDataFolder:FindFirstChild(LocalPlayer.UserId)
|
||||
if not PlayerFolder then return runeData end
|
||||
|
||||
-- 获取装备文件夹,找到当前穿戴的装备
|
||||
local EquipmentFolder = PlayerFolder:FindFirstChild("Equipment")
|
||||
if not EquipmentFolder then return runeData end
|
||||
|
||||
local wearingEquipmentUniqueId = equipmentUniqueId
|
||||
local instance = nil
|
||||
local maxRuneNumber = 0
|
||||
for _, equipmentInstance in pairs(EquipmentFolder:GetChildren()) do
|
||||
if tostring(wearingEquipmentUniqueId) == equipmentInstance.Name then
|
||||
instance = equipmentInstance
|
||||
maxRuneNumber = equipmentInstance:GetAttribute("maxRuneNumber")
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
-- 如果没有穿戴装备,返回空数据
|
||||
if not instance then
|
||||
print("没有穿戴装备")
|
||||
return runeData
|
||||
end
|
||||
|
||||
-- 获取符文文件夹
|
||||
local RuneFolder = PlayerFolder:FindFirstChild("Rune")
|
||||
if not RuneFolder then return runeData end
|
||||
|
||||
-- 遍历所有符文,找到镶嵌在当前穿戴装备上的符文
|
||||
for _, runeInstance in pairs(RuneFolder:GetChildren()) do
|
||||
local wearing = runeInstance:GetAttribute("wearing")
|
||||
if wearing and tostring(wearing) == wearingEquipmentUniqueId then
|
||||
local runeInfo = {
|
||||
wearingSlot = runeInstance:GetAttribute("wearingSlot") or 1,
|
||||
instance = runeInstance
|
||||
}
|
||||
for k, v in pairs(runeInstance:GetAttributes()) do runeInfo[k] = v end
|
||||
|
||||
table.insert(runeData, runeInfo)
|
||||
runeData[runeInstance:GetAttribute("wearingSlot")] = runeInfo
|
||||
end
|
||||
end
|
||||
|
||||
-- 空槽位填充
|
||||
for i = 1, maxRuneNumber do
|
||||
if not runeData[i] then
|
||||
runeData[i] = {
|
||||
wearingSlot = i
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return runeData
|
||||
end
|
||||
|
||||
-- UI递归查找
|
||||
function Utils:FindInDescendantsUI(root, name)
|
||||
|
@ -7,7 +7,7 @@ local Utils = require(ReplicatedStorage.Tools.Utils)
|
||||
local TypeList = require(ServerStorage.Base.TypeList)
|
||||
local Rune = require(ServerStorage.Base.Rune)
|
||||
local DamageProxy = require(ServerStorage.Proxy.DamageProxy)
|
||||
local Rng = require(ServerStorage.Base.Rng)
|
||||
local Rng = require(ReplicatedStorage.Tools.Rng)
|
||||
|
||||
--> EventFilter
|
||||
local EventFilter = require(ReplicatedStorage.Modules.EventFilter)
|
||||
|
@ -7,7 +7,7 @@ local Utils = require(ReplicatedStorage.Tools.Utils)
|
||||
local TypeList = require(ServerStorage.Base.TypeList)
|
||||
local Rune = require(ServerStorage.Base.Rune)
|
||||
local DamageProxy = require(ServerStorage.Proxy.DamageProxy)
|
||||
local Rng = require(ServerStorage.Base.Rng)
|
||||
local Rng = require(ReplicatedStorage.Tools.Rng)
|
||||
|
||||
--> EventFilter
|
||||
local EventFilter = require(ReplicatedStorage.Modules.EventFilter)
|
||||
|
@ -1,5 +1,5 @@
|
||||
local WearingShow = {}
|
||||
WearingShow.__index = WearingShow
|
||||
local RuneShow = {}
|
||||
RuneShow.__index = RuneShow
|
||||
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
@ -8,7 +8,7 @@ local Localization = require(ReplicatedStorage.Tools.Localization)
|
||||
local JsonRune = require(ReplicatedStorage.Json.Rune)
|
||||
local JsonItemProp = require(ReplicatedStorage.Json.ItemProp)
|
||||
|
||||
function WearingShow:Init(data: table)
|
||||
function RuneShow:Init(data: table)
|
||||
local self = {}
|
||||
self.Data = data
|
||||
self.Variables = {
|
||||
@ -19,12 +19,12 @@ function WearingShow:Init(data: table)
|
||||
}
|
||||
self.Connections = {}
|
||||
|
||||
setmetatable(self, WearingShow)
|
||||
setmetatable(self, RuneShow)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function WearingShow:Refresh()
|
||||
function RuneShow:Refresh()
|
||||
if self.Data.instance then
|
||||
local itemData = Utils:GetIdDataFromJson(JsonItemProp, self.Data.orgId)
|
||||
local runeData = Utils:GetIdDataFromJson(JsonRune, self.Data.orgId)
|
||||
@ -42,7 +42,7 @@ function WearingShow:Refresh()
|
||||
end
|
||||
end
|
||||
|
||||
function WearingShow:OnInitFinish()
|
||||
function RuneShow:OnInitFinish()
|
||||
local con = self.Variables._btnClick.MouseButton1Click:Connect(function()
|
||||
if self.Data.instance then
|
||||
self.TopUI:ShowDetailData(self.Data.id)
|
||||
@ -68,11 +68,11 @@ function WearingShow:OnInitFinish()
|
||||
end
|
||||
end
|
||||
|
||||
function WearingShow:Destroy()
|
||||
function RuneShow:Destroy()
|
||||
for k, v in pairs(self) do
|
||||
self[k] = nil
|
||||
end
|
||||
self = nil
|
||||
end
|
||||
|
||||
return WearingShow
|
||||
return RuneShow
|
@ -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,11 +27,11 @@ function PackageShow:Init(data: table)
|
||||
["_tmpQuality"] = 0,
|
||||
["_tmpName"] = 0,
|
||||
["_imgView"] = 0,
|
||||
["__listRuneWearing"] = 0,
|
||||
}
|
||||
self.Connections = {}
|
||||
|
||||
setmetatable(self, PackageShow)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -40,6 +41,11 @@ function PackageShow:Refresh()
|
||||
self.Variables._imgIcon.Visible = false
|
||||
self.Variables._tmpQuality.Text = Localization:GetColoredEquipmentQualityDesc(self.Data.quality)
|
||||
self.Variables._tmpName.Text = Localization:GetLanguageData(itemData.nameId)
|
||||
|
||||
|
||||
self.Variables["__listRuneWearing"]:AddComponent(RuneShow)
|
||||
local runeData = Utils:GetWearingRuneData(self.Data.id)
|
||||
self.Variables["__listRuneWearing"]:SetData(runeData)
|
||||
|
||||
-- 模型展示
|
||||
EquipmentModelDetail:ShowDetail(self.Variables["_imgView"], self.Data.orgId, false)
|
||||
|
@ -14,6 +14,7 @@ local LocalPlayer = game.Players.LocalPlayer
|
||||
|
||||
local CommonFolder = LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("UI"):WaitForChild("Common")
|
||||
local EquipmentModelDetail = require(CommonFolder:WaitForChild("EquipmentModelDetail"))
|
||||
local RuneShow = require(CommonFolder:WaitForChild("RuneShow"))
|
||||
|
||||
function WearingShow:Init(data: table)
|
||||
local self = {}
|
||||
@ -25,6 +26,7 @@ function WearingShow:Init(data: table)
|
||||
["_tmpQuality"] = 0,
|
||||
["_tmpName"] = 0,
|
||||
["_imgView"] = 0,
|
||||
["__listRuneWearing"] = 0,
|
||||
}
|
||||
self.Connections = {}
|
||||
|
||||
@ -50,6 +52,10 @@ function WearingShow:Refresh()
|
||||
|
||||
-- 模型展示
|
||||
EquipmentModelDetail:ShowDetail(self.Variables["_imgView"], self.Data.orgId, false)
|
||||
|
||||
self.Variables["__listRuneWearing"]:AddComponent(RuneShow)
|
||||
local runeData = Utils:GetWearingRuneData(self.Data.id)
|
||||
self.Variables["__listRuneWearing"]:SetData(runeData)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -28,6 +28,7 @@ local LocalPlayer = game.Players.LocalPlayer
|
||||
local CommonFolder = LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("UI"):WaitForChild("Common")
|
||||
local SpecialShow = require(CommonFolder:WaitForChild("SpecialShow"))
|
||||
local EquipmentModelDetail = require(CommonFolder:WaitForChild("EquipmentModelDetail"))
|
||||
local RuneShow = require(CommonFolder:WaitForChild("RuneShow"))
|
||||
|
||||
local FolderEquipment = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Equipments")
|
||||
|
||||
@ -49,6 +50,8 @@ function EquipmentDetailWindow:Init(UIManager: table, Data: table?)
|
||||
["__listElement"] = 0,
|
||||
["_goElementDefPanel"] = 0,
|
||||
["__listElementDef"] = 0,
|
||||
["_goRuneWearing"] = 0,
|
||||
["__listRuneWearing"] = 0,
|
||||
|
||||
["_imgIcon"] = 0,
|
||||
["_tmpName"] = 0,
|
||||
@ -130,6 +133,7 @@ function EquipmentDetailWindow:OnOpenWindow()
|
||||
exAttributes = equipmentInstance:FindFirstChild("exAttributes"):GetAttributes(),
|
||||
elements = equipmentInstance:FindFirstChild("elements"):GetAttributes(),
|
||||
elementDef = equipmentInstance:FindFirstChild("elementDef"):GetAttributes(),
|
||||
runeWearing = Utils:GetWearingRuneData(self.Data.EquipmentUniqueId),
|
||||
}
|
||||
self:SetData(data)
|
||||
|
||||
@ -222,7 +226,7 @@ function EquipmentDetailWindow:OnOpenWindow()
|
||||
self.Variables["__listBaseAttributes"]:SetData(self:TransformKeyTable(self.Data.attributes))
|
||||
|
||||
-- 额外属性
|
||||
if self.Data.exAttributes then
|
||||
if #self.Data.exAttributes > 0 then
|
||||
self.Variables["_goExAttributesPanel"].Visible = true
|
||||
self.Variables["__listExAttributes"]:AddComponent(AttributeShow)
|
||||
self.Variables["__listExAttributes"]:SetData(self:TransformKeyTable(self.Data.exAttributes))
|
||||
@ -231,7 +235,7 @@ function EquipmentDetailWindow:OnOpenWindow()
|
||||
end
|
||||
|
||||
-- 元素属性
|
||||
if self.Data.elements then
|
||||
if #self.Data.elements > 0 then
|
||||
self.Variables["_goElementPanel"].Visible = true
|
||||
self.Variables["__listElement"]:AddComponent(AttributeShow)
|
||||
self.Variables["__listElement"]:SetData(self:TransformKeyTable(self.Data.elements))
|
||||
@ -240,7 +244,7 @@ function EquipmentDetailWindow:OnOpenWindow()
|
||||
end
|
||||
|
||||
-- 元素定义属性
|
||||
if self.Data.elementDef then
|
||||
if #self.Data.elementDef > 0 then
|
||||
self.Variables["_goElementDefPanel"].Visible = true
|
||||
self.Variables["__listElementDef"]:AddComponent(AttributeShow)
|
||||
self.Variables["__listElementDef"]:SetData(self:TransformKeyTable(self.Data.elementDef))
|
||||
@ -256,6 +260,15 @@ function EquipmentDetailWindow:OnOpenWindow()
|
||||
else
|
||||
self.Variables["__listSpecial"].Visible = false
|
||||
end
|
||||
|
||||
-- 符文属性
|
||||
if #self.Data.runeWearing > 0 then
|
||||
self.Variables["_goRuneWearing"].Visible = true
|
||||
self.Variables["__listRuneWearing"]:AddComponent(RuneShow)
|
||||
self.Variables["__listRuneWearing"]:SetData(self.Data.runeWearing)
|
||||
else
|
||||
self.Variables["_goRuneWearing"].Visible = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@ local FolderEquipment = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("
|
||||
local LocalPlayer = game.Players.LocalPlayer
|
||||
local CommonFolder = LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("UI"):WaitForChild("Common")
|
||||
local EquipmentModelDetail = require(CommonFolder:WaitForChild("EquipmentModelDetail"))
|
||||
local RuneShow = require(CommonFolder:WaitForChild("RuneShow"))
|
||||
|
||||
function EquipmentShow:Init(data: table)
|
||||
local self = {}
|
||||
@ -21,6 +22,7 @@ function EquipmentShow:Init(data: table)
|
||||
self.Variables = {
|
||||
["_imgView"] = 0,
|
||||
["_btnSelect"] = 0,
|
||||
["__listRuneWearing"] = 0,
|
||||
}
|
||||
self.Connections = {}
|
||||
|
||||
@ -33,7 +35,10 @@ function EquipmentShow:Refresh()
|
||||
self.TaskRotation = taskRotation
|
||||
self.Prefab = part
|
||||
self.ViewCamera = viewportCamera
|
||||
print(taskRotation, part, viewportCamera)
|
||||
|
||||
self.Variables["__listRuneWearing"]:AddComponent(RuneShow)
|
||||
local runeData = Utils:GetWearingRuneData(self.Data.id)
|
||||
self.Variables["__listRuneWearing"]:SetData(runeData)
|
||||
end
|
||||
|
||||
function EquipmentShow:OnInitFinish()
|
||||
|
@ -1,5 +1,5 @@
|
||||
local RuneShow = {}
|
||||
RuneShow.__index = RuneShow
|
||||
local RuneStateShow = {}
|
||||
RuneStateShow.__index = RuneStateShow
|
||||
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
@ -10,7 +10,7 @@ local Signal = require(ReplicatedStorage.Tools.Signal)
|
||||
|
||||
local showRuneSignal = Signal.new(Signal.ENUM.SHOW_RUNE)
|
||||
|
||||
function RuneShow:Init(data: table)
|
||||
function RuneStateShow:Init(data: table)
|
||||
local self = {}
|
||||
self.Data = data
|
||||
self.Variables = {
|
||||
@ -29,15 +29,15 @@ function RuneShow:Init(data: table)
|
||||
end)
|
||||
table.insert(self.SignalConnections, con)
|
||||
|
||||
setmetatable(self, RuneShow)
|
||||
setmetatable(self, RuneStateShow)
|
||||
return self
|
||||
end
|
||||
|
||||
-- 初始化完成后的回调
|
||||
function RuneShow:OnInitFinish()
|
||||
function RuneStateShow:OnInitFinish()
|
||||
end
|
||||
|
||||
function RuneShow:Refresh()
|
||||
function RuneStateShow:Refresh()
|
||||
if self.Task then
|
||||
task.cancel(self.Task)
|
||||
self.Task = nil
|
||||
@ -85,7 +85,7 @@ function RuneShow:Refresh()
|
||||
end
|
||||
|
||||
-- 播放激活动画
|
||||
function RuneShow:PlayActivateAnimation()
|
||||
function RuneStateShow:PlayActivateAnimation()
|
||||
-- 创建激活效果
|
||||
local effect = Instance.new("Frame")
|
||||
effect.Size = UDim2.new(1, 0, 1, 0)
|
||||
@ -129,7 +129,7 @@ function RuneShow:PlayActivateAnimation()
|
||||
end)
|
||||
end
|
||||
|
||||
function RuneShow:Destroy()
|
||||
function RuneStateShow:Destroy()
|
||||
if self.Task then
|
||||
task.cancel(self.Task)
|
||||
self.Task = nil
|
||||
@ -148,4 +148,4 @@ function RuneShow:Destroy()
|
||||
self = nil
|
||||
end
|
||||
|
||||
return RuneShow
|
||||
return RuneStateShow
|
@ -12,7 +12,7 @@ local FormatNumber = require(ReplicatedStorage.Modules.FormatNumber)
|
||||
local JsonAttributes = require(ReplicatedStorage.Json.Attributes)
|
||||
|
||||
--> Components
|
||||
local RuneShow = require(script.RuneShow)
|
||||
local RuneStateShow = require(script.RuneStateShow)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -213,7 +213,7 @@ end
|
||||
function RuneStateWindow:OnOpenWindow()
|
||||
UIWindow.OnOpenWindow(self)
|
||||
|
||||
self.Variables["__listRune"]:AddComponent(RuneShow)
|
||||
self.Variables["__listRune"]:AddComponent(RuneStateShow)
|
||||
|
||||
-- 连接符文执行记录事件
|
||||
self:ConnectRuneExecutionEvent()
|
||||
|
@ -6,7 +6,6 @@ local UIWindow = require(ReplicatedStorage.Base.UIWindow)
|
||||
local UIEnums = require(ReplicatedStorage.Base.UIEnums)
|
||||
|
||||
--> Components
|
||||
local WearingShow = require(script.WearingShow)
|
||||
local PackageShow = require(script.PackageShow)
|
||||
--> Dependencies
|
||||
local Utils = require(ReplicatedStorage.Tools.Utils)
|
||||
@ -30,6 +29,7 @@ local DataFolder = Utils:WaitPlayerDataFolder(LocalPlayer):WaitForChild("Rune")
|
||||
|
||||
local CommonFolder = LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("UI"):WaitForChild("Common")
|
||||
local EquipmentModelDetail = require(CommonFolder:WaitForChild("EquipmentModelDetail"))
|
||||
local RuneShow = require(CommonFolder:WaitForChild("RuneShow"))
|
||||
|
||||
--> Signals
|
||||
local Signal = require(ReplicatedStorage.Tools.Signal)
|
||||
@ -228,7 +228,7 @@ end
|
||||
function RuneWindow:OnOpenWindow()
|
||||
UIWindow.OnOpenWindow(self)
|
||||
self.Variables["__listRunePackage"]:AddComponent(PackageShow)
|
||||
self.Variables["__listRuneWearing"]:AddComponent(WearingShow)
|
||||
self.Variables["__listRuneWearing"]:AddComponent(RuneShow)
|
||||
|
||||
local bgCloseCon = self.Variables["_btnBgClose"].Activated:Connect(function()
|
||||
self.UIManager:CloseWindow(script.Name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user