50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
|
local PackageShow = {}
|
||
|
PackageShow.__index = PackageShow
|
||
|
|
||
|
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)
|
||
|
|
||
|
function PackageShow:Init(data: table)
|
||
|
local self = {}
|
||
|
self.Data = data
|
||
|
self.Variables = {
|
||
|
["_btnClick"] = 0,
|
||
|
["_imgIcon"] = 0,
|
||
|
["_tmpQuality"] = 0,
|
||
|
}
|
||
|
self.Connections = {}
|
||
|
|
||
|
setmetatable(self, PackageShow)
|
||
|
return self
|
||
|
end
|
||
|
|
||
|
function PackageShow:Refresh()
|
||
|
local itemData = Utils:GetIdDataFromJson(JsonItemProp, self.Data.orgId)
|
||
|
self.Variables._imgIcon.Image = Localization:GetImageData(itemData.iconId)
|
||
|
self.Variables._imgIcon.Visible = false
|
||
|
self.Variables._tmpQuality.Text = self.Data.quality
|
||
|
end
|
||
|
|
||
|
function PackageShow:OnInitFinish()
|
||
|
local con = self.Variables._btnClick.MouseButton1Click:Connect(function()
|
||
|
if self.Data == {} then
|
||
|
-- TODO: 之后做提示弹窗
|
||
|
else
|
||
|
self.TopUI:ShowDetailData(self.Data.id)
|
||
|
end
|
||
|
end)
|
||
|
table.insert(self.Connections, con)
|
||
|
end
|
||
|
|
||
|
function PackageShow:Destroy()
|
||
|
for k, v in pairs(self) do
|
||
|
self[k] = nil
|
||
|
end
|
||
|
self = nil
|
||
|
end
|
||
|
|
||
|
return PackageShow
|