79 lines
2.4 KiB
Plaintext
Raw Normal View History

2025-07-23 01:04:27 +08:00
--> Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--> Dependencies
local UIWindow = require(ReplicatedStorage.Base.UIWindow)
local UIEnums = require(ReplicatedStorage.Base.UIEnums)
local Utils = require(ReplicatedStorage.Tools.Utils)
--> Components
local AttributeLvupShow = require(script.AttributeLvupShow)
--> Json
local JsonAttributesUpgrade = require(ReplicatedStorage.Json.AttributesUpgrade)
--------------------------------------------------------------------------------
local AttributeLvupWindow = {}
AttributeLvupWindow.__index = AttributeLvupWindow
setmetatable(AttributeLvupWindow, {__index = UIWindow})
function AttributeLvupWindow:Init(UIManager: table, Data: table?)
local self = UIWindow:Init(UIManager, Data)
setmetatable(self, AttributeLvupWindow)
self.Variables = {
["_goSpecaialPanel"] = 0,
["_goBasePanel"] = 0,
["__listSpecialAttributes"] = 0,
["__listBaseAttributes"] = 0,
["_tmpSpecialTitle"] = 0,
["_tmpBaseTitle"] = 0,
2025-07-23 23:54:19 +08:00
["__moneyCoin"] = 0,
["_btnClose"] = 0,
["_btnBgClose"] = 0,
2025-07-23 01:04:27 +08:00
}
self.UIRootName = "ui_w_attribute_lvup"
self.UIParentName = UIEnums.UIParent.UIRoot
return self
end
function AttributeLvupWindow:OnOpenWindow()
UIWindow.OnOpenWindow(self)
local orgData = Utils:DeepCopyTable(JsonAttributesUpgrade)
local data = {
Special = {},
Base = {},
}
for key, value in pairs(orgData) do
local secondKey = "Base"
if value.type == 2 then secondKey = "Special" end
table.insert(data[secondKey], value)
end
self:SetData(data)
self.Variables["__listSpecialAttributes"]:AddComponent(AttributeLvupShow)
self.Variables["__listBaseAttributes"]:AddComponent(AttributeLvupShow)
self.Variables["__listSpecialAttributes"]:SetData(self.Data.Special)
self.Variables["__listBaseAttributes"]:SetData(self.Data.Base)
self.Variables["__listSpecialAttributes"]:SetLayoutOrder("id")
self.Variables["__listBaseAttributes"]:SetLayoutOrder("id")
2025-07-23 23:54:19 +08:00
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, bgCloseCon)
table.insert(self.Connections, closeCon)
2025-07-23 01:04:27 +08:00
end
return AttributeLvupWindow