更新-前端部分界面做了一半
This commit is contained in:
parent
e48107d424
commit
6b6d563780
Binary file not shown.
Binary file not shown.
@ -63,6 +63,16 @@ function UIList:AddData(data: table)
|
||||
self:SetSingleInstance(#self.Data, data)
|
||||
end
|
||||
|
||||
function UIList:RemoveData(data: table)
|
||||
for i, v in pairs(self.Data) do
|
||||
if Utils:CompareTableJson(v, data) then
|
||||
self.Instances[i]:Destroy()
|
||||
table.remove(self.Data, i)
|
||||
return i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UIList:SetLayoutOrder(keyName: string)
|
||||
self.LayoutOrderKey = keyName
|
||||
for _, ui in pairs(self.Instances) do
|
||||
@ -126,15 +136,19 @@ function UIList:Clean()
|
||||
|
||||
-- 清除下面组件的内容
|
||||
for _, ui in pairs(self.Instances) do
|
||||
for _, connection in pairs(ui.SignalConnections) do
|
||||
connection:DisconnectAll()
|
||||
if ui.SignalConnections then
|
||||
for _, connection in pairs(ui.SignalConnections) do
|
||||
connection:DisconnectAll()
|
||||
end
|
||||
self.SignalConnections = nil
|
||||
end
|
||||
self.SignalConnections = nil
|
||||
|
||||
for _, connection in pairs(ui.Connections) do
|
||||
connection:Disconnect()
|
||||
if ui.Connections then
|
||||
for _, connection in pairs(ui.Connections) do
|
||||
connection:Disconnect()
|
||||
end
|
||||
self.Connections = nil
|
||||
end
|
||||
self.Connections = nil
|
||||
|
||||
if ui.UIRoot then ui.UIRoot:Destroy() end
|
||||
ui:Destroy()
|
||||
|
@ -133,6 +133,26 @@ function UIWindow:Destroy()
|
||||
end
|
||||
self.Connections = nil
|
||||
|
||||
-- 销毁数据
|
||||
if self.Data then
|
||||
if type(self.Data) == "table" then
|
||||
for k, v in pairs(self.Data) do
|
||||
self.Data[k] = nil
|
||||
end
|
||||
end
|
||||
self.Data = nil
|
||||
end
|
||||
|
||||
-- 销毁实例内容
|
||||
if self.Variables then
|
||||
for k, v in pairs(self.Variables) do
|
||||
if v.Destroy then
|
||||
v:Destroy()
|
||||
end
|
||||
v = nil
|
||||
end
|
||||
end
|
||||
|
||||
for k, v in pairs(self) do
|
||||
self[k] = nil
|
||||
end
|
||||
|
@ -1,33 +1,33 @@
|
||||
[
|
||||
{"id":1,"type":1,"effectAttribute":"attack","battleValue":[1,10]},
|
||||
{"id":2,"type":1,"effectAttribute":"hp","battleValue":[1,10]},
|
||||
{"id":3,"type":1,"effectAttribute":"swordAtk","battleValue":[1,10]},
|
||||
{"id":4,"type":2,"effectAttribute":"swordWearBase","battleValue":[1,10]},
|
||||
{"id":5,"type":2,"effectAttribute":"swordWearSpe","battleValue":[1,10]},
|
||||
{"id":6,"type":2,"effectAttribute":"fireAtk","battleValue":[1,10]},
|
||||
{"id":7,"type":2,"effectAttribute":"iceAtk","battleValue":[1,10]},
|
||||
{"id":8,"type":2,"effectAttribute":"lightAtk","battleValue":[1,10]},
|
||||
{"id":9,"type":2,"effectAttribute":"shadowAtk","battleValue":[1,10]},
|
||||
{"id":10,"type":1,"effectAttribute":"fireDef","battleValue":[1,10]},
|
||||
{"id":11,"type":1,"effectAttribute":"iceDef","battleValue":[1,10]},
|
||||
{"id":12,"type":1,"effectAttribute":"lightDef","battleValue":[1,10]},
|
||||
{"id":13,"type":1,"effectAttribute":"shadowDef","battleValue":[1,10]},
|
||||
{"id":14,"type":2,"effectAttribute":"attackRate","battleValue":[1,10]},
|
||||
{"id":15,"type":2,"effectAttribute":"hpRate","battleValue":[1,10]},
|
||||
{"id":16,"type":2,"effectAttribute":"atkSpeed","battleValue":[1,10]},
|
||||
{"id":20,"type":2,"effectAttribute":"critRate","battleValue":[1,10]},
|
||||
{"id":21,"type":2,"effectAttribute":"critDamageRate","battleValue":[1,10]},
|
||||
{"id":22,"type":2,"effectAttribute":"atkSpeedRate","battleValue":[1,10]},
|
||||
{"id":23,"type":2,"effectAttribute":"cdRate","battleValue":[1,10]},
|
||||
{"id":24,"type":1,"effectAttribute":"mpBonus","battleValue":[1,10]},
|
||||
{"id":25,"type":2,"effectAttribute":"mpReduceRate","battleValue":[1,10]},
|
||||
{"id":26,"type":1,"effectAttribute":"mpRecoverBonus","battleValue":[1,10]},
|
||||
{"id":27,"type":2,"effectAttribute":"vampireRate","battleValue":[1,10]},
|
||||
{"id":28,"type":2,"effectAttribute":"coinBonus","battleValue":[1,10]},
|
||||
{"id":50,"type":1,"effectAttribute":"wearNumber","battleValue":[1,10]},
|
||||
{"id":51,"type":1,"effectAttribute":"skillNumber","battleValue":[1,10]},
|
||||
{"id":52,"type":1,"effectAttribute":"extraAttributeNumber","battleValue":[1,10]},
|
||||
{"id":53,"type":1,"effectAttribute":"elementNumber","battleValue":[1,10]},
|
||||
{"id":54,"type":1,"effectAttribute":"elementDefNumber","battleValue":[1,10]},
|
||||
{"id":55,"type":1,"effectAttribute":"gemNumber","battleValue":[1,10]}
|
||||
{"id":1,"type":1,"effectAttribute":"attack","battleValue":[1,10],"iconId":1},
|
||||
{"id":2,"type":1,"effectAttribute":"hp","battleValue":[1,10],"iconId":2},
|
||||
{"id":3,"type":1,"effectAttribute":"swordAtk","battleValue":[1,10],"iconId":3},
|
||||
{"id":4,"type":2,"effectAttribute":"swordWearBase","battleValue":[1,10],"iconId":4},
|
||||
{"id":5,"type":2,"effectAttribute":"swordWearSpe","battleValue":[1,10],"iconId":5},
|
||||
{"id":6,"type":2,"effectAttribute":"fireAtk","battleValue":[1,10],"iconId":6},
|
||||
{"id":7,"type":2,"effectAttribute":"iceAtk","battleValue":[1,10],"iconId":7},
|
||||
{"id":8,"type":2,"effectAttribute":"lightAtk","battleValue":[1,10],"iconId":8},
|
||||
{"id":9,"type":2,"effectAttribute":"shadowAtk","battleValue":[1,10],"iconId":9},
|
||||
{"id":10,"type":1,"effectAttribute":"fireDef","battleValue":[1,10],"iconId":10},
|
||||
{"id":11,"type":1,"effectAttribute":"iceDef","battleValue":[1,10],"iconId":11},
|
||||
{"id":12,"type":1,"effectAttribute":"lightDef","battleValue":[1,10],"iconId":12},
|
||||
{"id":13,"type":1,"effectAttribute":"shadowDef","battleValue":[1,10],"iconId":13},
|
||||
{"id":14,"type":2,"effectAttribute":"attackRate","battleValue":[1,10],"iconId":14},
|
||||
{"id":15,"type":2,"effectAttribute":"hpRate","battleValue":[1,10],"iconId":15},
|
||||
{"id":16,"type":2,"effectAttribute":"atkSpeed","battleValue":[1,10],"iconId":16},
|
||||
{"id":20,"type":2,"effectAttribute":"critRate","battleValue":[1,10],"iconId":17},
|
||||
{"id":21,"type":2,"effectAttribute":"critDamageRate","battleValue":[1,10],"iconId":18},
|
||||
{"id":22,"type":2,"effectAttribute":"atkSpeedRate","battleValue":[1,10],"iconId":19},
|
||||
{"id":23,"type":2,"effectAttribute":"cdRate","battleValue":[1,10],"iconId":20},
|
||||
{"id":24,"type":1,"effectAttribute":"mpBonus","battleValue":[1,10],"iconId":21},
|
||||
{"id":25,"type":2,"effectAttribute":"mpReduceRate","battleValue":[1,10],"iconId":22},
|
||||
{"id":26,"type":1,"effectAttribute":"mpRecoverBonus","battleValue":[1,10],"iconId":23},
|
||||
{"id":27,"type":2,"effectAttribute":"vampireRate","battleValue":[1,10],"iconId":24},
|
||||
{"id":28,"type":2,"effectAttribute":"coinBonus","battleValue":[1,10],"iconId":25},
|
||||
{"id":50,"type":1,"effectAttribute":"wearNumber","battleValue":[1,10],"iconId":26},
|
||||
{"id":51,"type":1,"effectAttribute":"skillNumber","battleValue":[1,10],"iconId":27},
|
||||
{"id":52,"type":1,"effectAttribute":"extraAttributeNumber","battleValue":[1,10],"iconId":28},
|
||||
{"id":53,"type":1,"effectAttribute":"elementNumber","battleValue":[1,10],"iconId":29},
|
||||
{"id":54,"type":1,"effectAttribute":"elementDefNumber","battleValue":[1,10],"iconId":30},
|
||||
{"id":55,"type":1,"effectAttribute":"gemNumber","battleValue":[1,10],"iconId":31}
|
||||
]
|
@ -2,6 +2,7 @@ local Utils = {}
|
||||
|
||||
--> Services
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
local HttpService = game:GetService("HttpService")
|
||||
|
||||
--> Variables
|
||||
local PlayerDataFolder = ReplicatedStorage:WaitForChild("PlayerData")
|
||||
@ -184,6 +185,12 @@ function Utils:CreateDataInstance(Player: Player, UniqueId: number, EquipmentDat
|
||||
return Config
|
||||
end
|
||||
|
||||
function Utils:CompareTableJson(t1: table, t2: table)
|
||||
local json1 = HttpService:JSONEncode(t1)
|
||||
local json2 = HttpService:JSONEncode(t2)
|
||||
return json1 == json2
|
||||
end
|
||||
|
||||
-- 复制表
|
||||
function Utils:CopyTable(t: table)
|
||||
local newTable = {}
|
||||
|
@ -19,6 +19,8 @@ local JsonParam = require(ReplicatedStorage.Json.Param)
|
||||
|
||||
--> Events
|
||||
local RE_PlayerTip = ReplicatedStorage.Events.RE_PlayerTip
|
||||
local RE_WearEquipment = ReplicatedStorage.Events.RE_WearEquipment
|
||||
|
||||
|
||||
--> Constants
|
||||
local STORE_NAME = "Equipment"
|
||||
@ -64,7 +66,7 @@ function EquipmentProxy:InitPlayer(Player: Player)
|
||||
|
||||
-- 初始化装备
|
||||
for uniqueId, EquipmentData in ArchiveProxy.pData[Player.UserId][STORE_NAME] do
|
||||
Utils:CreateDataInstance(Player, uniqueId, EquipmentData, GetPlayerEquipmentFolder(Player))
|
||||
local config = Utils:CreateDataInstance(Player, uniqueId, EquipmentData, GetPlayerEquipmentFolder(Player))
|
||||
end
|
||||
end
|
||||
|
||||
@ -78,7 +80,7 @@ function EquipmentProxy:AddEquipment(Player: Player, EquipmentId: number)
|
||||
local EquipmentData = Utils:GetIdDataFromJson(JsonEquipment, EquipmentId)
|
||||
if not EquipmentData then return end
|
||||
|
||||
local UniqueId = Utils:GenUniqueId(ArchiveProxy.pData[Player.UserId])
|
||||
local UniqueId = Utils:GenUniqueId(ArchiveProxy.pData[Player.UserId][STORE_NAME])
|
||||
-- 配置表内容
|
||||
local ResultData = {}
|
||||
for key, value in pairs(EquipmentData) do
|
||||
@ -107,16 +109,16 @@ function EquipmentProxy:AddEquipment(Player: Player, EquipmentId: number)
|
||||
[6] = 5,
|
||||
}
|
||||
local quality = Utils:GetRandomWeightIndex(qualityWeightTable)
|
||||
local qualityParam = Utils:GetIdDataFromJson(JsonParam, 1)
|
||||
local qualityParam = Utils:GetIdDataFromJson(JsonParam, 1).intArray
|
||||
ResultData.quality = quality
|
||||
|
||||
-- 生成装备基础词条(固定的)
|
||||
ResultData.attributes = {}
|
||||
for i = 1, EquipmentData.attributesNumber, 3 do
|
||||
for i = 1, #EquipmentData.attributes, 3 do
|
||||
local AttributeData = Utils:GetIdDataFromJson(JsonAttributes, EquipmentData.attributes[i])
|
||||
local baseLvValue = EquipmentData.attributes[i + 1] + EquipmentData.attributes[i + 2] * (PlayerLevel - 1)
|
||||
local qualityEffectValue = math.floor(baseLvValue * (qualityParam[quality] / 100))
|
||||
ResultData.attributes[AttributeData.name] = qualityEffectValue
|
||||
ResultData.attributes[AttributeData.effectAttribute] = qualityEffectValue
|
||||
end
|
||||
|
||||
-- TODO: 其他随机词条内容添加在下面
|
||||
@ -216,7 +218,8 @@ function EquipmentProxy:AddEquipment(Player: Player, EquipmentId: number)
|
||||
|
||||
------------------------------------------------------------
|
||||
|
||||
ArchiveProxy.pData[Player.UserId][UniqueId] = ResultData
|
||||
ArchiveProxy.pData[Player.UserId][STORE_NAME][UniqueId] = ResultData
|
||||
print(ArchiveProxy.pData[Player.UserId][STORE_NAME])
|
||||
Utils:CreateDataInstance(Player, UniqueId, ResultData, GetPlayerEquipmentFolder(Player))
|
||||
|
||||
-- 添加图鉴记录
|
||||
@ -257,7 +260,8 @@ function EquipmentProxy:WearEquipment(Player: Player, EquipmentId: number, Slot:
|
||||
-- TODO :穿戴装备时再生成模型
|
||||
-- 查看槽位数量是否超出
|
||||
local PlayerInfoData = PlayerInfoProxy:GetPlayerInfo(Player)
|
||||
if Slot > PlayerInfoData.wearingNumber then
|
||||
-- 没升级是没有键值对的,所以做了个括号简单判断
|
||||
if Slot > (PlayerInfoData.AttributesUpgrade.wearingNumber or 1) then
|
||||
RE_PlayerTip:FireClient(Player, '穿戴装备槽位超出')
|
||||
return
|
||||
end
|
||||
@ -355,5 +359,14 @@ end
|
||||
ReplicatedStorage.Remotes.PlayerRemoving.Event:Connect(function(PlayerUserId: string)
|
||||
EquipmentProxy:OnPlayerRemoving(PlayerUserId)
|
||||
end)
|
||||
RE_WearEquipment.OnServerEvent:Connect(function(Player: Player, EquipmentUniqueId: number, SlotId: number, Unwear: boolean?)
|
||||
if Unwear then
|
||||
EquipmentProxy:UnwearEquipment(Player, EquipmentUniqueId)
|
||||
else
|
||||
print(Player, EquipmentUniqueId, SlotId)
|
||||
EquipmentProxy:WearEquipment(Player, EquipmentUniqueId, SlotId)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
return EquipmentProxy
|
@ -23,13 +23,16 @@ RE_PlayerHelper.OnServerEvent:Connect(function(Player: Player, EventName: string
|
||||
elseif EventName == "AddItem" then
|
||||
local PlayerInfoProxy = require(script.Parent.PlayerInfoProxy)
|
||||
local itemData = Utils:GetIdDataFromJson(JsonItemProp, EventData[1])
|
||||
if itemData.type == 3 then
|
||||
if itemData.type == 2 then
|
||||
local EquipmentProxy = require(script.Parent.EquipmentProxy)
|
||||
EquipmentProxy:AddEquipment(Player, EventData[1], EventData[2])
|
||||
elseif itemData.type == 3 then
|
||||
local BookProxy = require(script.Parent.BookProxy)
|
||||
BookProxy:UnlockBook(Player, EventData[1] - 10000)
|
||||
else
|
||||
PlayerInfoProxy:ChangeItemCount(Player, EventData[1], EventData[2])
|
||||
end
|
||||
print("添加物品成功", PlayerInfoProxy:GetItemCount(Player, EventData[1]))
|
||||
print("添加物品成功", EventData)
|
||||
end
|
||||
end)
|
||||
|
||||
|
@ -127,7 +127,7 @@ end
|
||||
function PlayerInfoProxy:GetPlayerLevel(Player: Player)
|
||||
if not Player then warn('获取玩家等级失败: ', Player.Name) return end
|
||||
local playerInfoData = ArchiveProxy.pData[Player.UserId][STORE_NAME]
|
||||
return playerInfoData.Stats.level
|
||||
return playerInfoData.Stats.level.value
|
||||
end
|
||||
|
||||
function PlayerInfoProxy:GetPlayerAttributesUpgrade(Player: Player, AttributeName: string)
|
||||
|
@ -1,32 +1,32 @@
|
||||
local function load_bil_gui()
|
||||
local player = game.Players.LocalPlayer
|
||||
local gui = player:WaitForChild("PlayerGui")
|
||||
local bil_gui = game.StarterPlayer.StarterPlayerScripts.BilGui -- BilGui 是一个文件夹
|
||||
-- local function load_bil_gui()
|
||||
-- local player = game.Players.LocalPlayer
|
||||
-- local gui = player:WaitForChild("PlayerGui")
|
||||
-- local bil_gui = game.StarterPlayer.StarterPlayerScripts.BilGui -- BilGui 是一个文件夹
|
||||
|
||||
print("加载bilgui开始")
|
||||
-- 将 BilGui 加载到指定的 UI 预制体中
|
||||
for _, folder in ipairs(bil_gui:GetChildren()) do
|
||||
if folder:IsA("Folder") then
|
||||
local target_ui = gui:WaitForChild(folder.Name)
|
||||
if target_ui then
|
||||
for _, script in ipairs(folder:GetChildren()) do
|
||||
if script:IsA("LocalScript") then
|
||||
local target_frame = target_ui:WaitForChild(script.Name) -- 找对应脚本名字的frame
|
||||
if target_frame then
|
||||
local script_clone = script:Clone()
|
||||
script_clone.Parent = target_frame
|
||||
print("加载成功: " .. script.Name)
|
||||
else
|
||||
warn("目标 Frame 未找到: " .. script.Name)
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
warn("目标 UI 预制体未找到: " .. script.Name)
|
||||
end
|
||||
end
|
||||
end
|
||||
print("加载bilgui结束")
|
||||
end
|
||||
-- print("加载bilgui开始")
|
||||
-- -- 将 BilGui 加载到指定的 UI 预制体中
|
||||
-- for _, folder in ipairs(bil_gui:GetChildren()) do
|
||||
-- if folder:IsA("Folder") then
|
||||
-- local target_ui = gui:WaitForChild(folder.Name)
|
||||
-- if target_ui then
|
||||
-- for _, script in ipairs(folder:GetChildren()) do
|
||||
-- if script:IsA("LocalScript") then
|
||||
-- local target_frame = target_ui:WaitForChild(script.Name) -- 找对应脚本名字的frame
|
||||
-- if target_frame then
|
||||
-- local script_clone = script:Clone()
|
||||
-- script_clone.Parent = target_frame
|
||||
-- print("加载成功: " .. script.Name)
|
||||
-- else
|
||||
-- warn("目标 Frame 未找到: " .. script.Name)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- else
|
||||
-- warn("目标 UI 预制体未找到: " .. script.Name)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
-- print("加载bilgui结束")
|
||||
-- end
|
||||
|
||||
load_bil_gui()
|
||||
-- load_bil_gui()
|
@ -26,6 +26,8 @@ UserInputService.InputBegan:Connect(function(input, gameProcessed)
|
||||
RE_UpgradeAttributes:FireServer(4)
|
||||
elseif input.KeyCode == Enum.KeyCode.KeypadOne then
|
||||
RE_PlayerHelper:FireServer("AddItem", {math.random(50000, 50015), 1})
|
||||
elseif input.KeyCode == Enum.KeyCode.KeypadTwo then
|
||||
RE_PlayerHelper:FireServer("AddItem", {math.random(40000, 40015), 1})
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
@ -55,13 +55,13 @@ RE_PerformanceEvent.OnClientEvent:Connect(function(ServerTime: number, CastTag:
|
||||
|
||||
local delayTime = ServerTime - tick()
|
||||
if CastTag == "Init" then
|
||||
print("Init", BehaviourName)
|
||||
-- print("Init", BehaviourName)
|
||||
-- 暂时就新增一个表,不调用初始化,因为服务端不是多个new做的,而是多次调用
|
||||
if not PerformanceClient.pData[UserId][BehaviourName] then
|
||||
PerformanceClient.pData[UserId][BehaviourName] = {}
|
||||
end
|
||||
elseif CastTag == "Show" then
|
||||
print("Show", BehaviourName, Behaviours, Infos)
|
||||
-- print("Show", BehaviourName, Behaviours, Infos)
|
||||
-- 直接调用init和对应的show(因为服务端只new一次,客户端多次调用)
|
||||
if not PerformanceClient.pData[UserId][BehaviourName] then return end
|
||||
for _, CastInfo in pairs(Infos) do
|
||||
@ -94,7 +94,11 @@ end)
|
||||
-- 这里主要是初始化
|
||||
RE_AbilityPerformance.OnClientEvent:Connect(function(ServerTime: number, CastTag: string, CastPlayer: Player, AbilityDetail: table)
|
||||
print("AbilityPerformance", ServerTime, CastTag, CastPlayer, AbilityDetail)
|
||||
UIManager:OpenWindow("AbilityStateWindow", AbilityDetail)
|
||||
if not UIManager:IsOpened("AbilityStateWindow") then
|
||||
UIManager:OpenWindow("AbilityStateWindow", AbilityDetail)
|
||||
else
|
||||
UIManager:SetData("AbilityStateWindow", AbilityDetail)
|
||||
end
|
||||
end)
|
||||
|
||||
-- 清理玩家所有表现数据
|
||||
|
@ -18,6 +18,14 @@ function UIManager:OpenWindow(WindowName: string, Data: table?)
|
||||
UIManager.Instances[WindowName]:OnOpenWindow()
|
||||
end
|
||||
|
||||
function UIManager:SetData(WindowName: string, Data: table)
|
||||
if not UIManager.Instances[WindowName] then
|
||||
warn("UIManager:SetData() 窗口不存在:" .. WindowName)
|
||||
return
|
||||
end
|
||||
UIManager.Instances[WindowName]:SetData(Data)
|
||||
end
|
||||
|
||||
function UIManager:CloseWindow(WindowName: string)
|
||||
if not UIManager.Instances[WindowName] then
|
||||
warn("UIManager:CloseWindow() 窗口不存在:" .. WindowName)
|
||||
@ -25,6 +33,12 @@ function UIManager:CloseWindow(WindowName: string)
|
||||
end
|
||||
|
||||
UIManager.Instances[WindowName]:OnCloseWindow()
|
||||
UIManager.Instances[WindowName]:Destroy()
|
||||
UIManager.Instances[WindowName] = nil
|
||||
end
|
||||
|
||||
function UIManager:IsOpened(WindowName: string)
|
||||
return UIManager.Instances[WindowName] ~= nil
|
||||
end
|
||||
|
||||
|
||||
|
@ -0,0 +1,50 @@
|
||||
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
|
@ -0,0 +1,61 @@
|
||||
local WearingShow = {}
|
||||
WearingShow.__index = WearingShow
|
||||
|
||||
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 WearingShow:Init(data: table)
|
||||
local self = {}
|
||||
self.Data = data
|
||||
self.Variables = {
|
||||
["_btnClick"] = 0,
|
||||
["_imgIcon"] = 0,
|
||||
["_imgbg"] = 0,
|
||||
["_tmpQuality"] = 0,
|
||||
}
|
||||
self.Connections = {}
|
||||
|
||||
setmetatable(self, WearingShow)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function WearingShow:Refresh()
|
||||
-- 槽位为空
|
||||
if self.Data.id == nil then
|
||||
self.Variables._imgIcon.Image = ""
|
||||
self.Variables._imgbg.Visible = true
|
||||
self.Variables._tmpQuality.Text = ""
|
||||
else
|
||||
-- 槽位有装备
|
||||
local itemData = Utils:GetIdDataFromJson(JsonItemProp, self.Data.orgId)
|
||||
self.Variables._imgIcon.Image = Localization:GetImageData(itemData.iconId)
|
||||
self.Variables._imgbg.Visible = false
|
||||
self.Variables._tmpQuality.Text = self.Data.quality
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function WearingShow: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 WearingShow:Destroy()
|
||||
for k, v in pairs(self) do
|
||||
self[k] = nil
|
||||
end
|
||||
self = nil
|
||||
end
|
||||
|
||||
return WearingShow
|
142
src/StarterPlayerScripts/UI/Windows/ChaWindow/init.luau
Normal file
142
src/StarterPlayerScripts/UI/Windows/ChaWindow/init.luau
Normal file
@ -0,0 +1,142 @@
|
||||
--> Services
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
--> Dependencies
|
||||
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)
|
||||
|
||||
--> Json
|
||||
local JsonAttributesUpgrade = require(ReplicatedStorage.Json.AttributesUpgrade)
|
||||
|
||||
--> Variables
|
||||
local LocalPlayer = game.Players.LocalPlayer
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local ChaWindow = {}
|
||||
ChaWindow.__index = ChaWindow
|
||||
setmetatable(ChaWindow, {__index = UIWindow})
|
||||
|
||||
function ChaWindow:Init(UIManager: table, Data: table?)
|
||||
local self = UIWindow:Init(UIManager, Data)
|
||||
setmetatable(self, ChaWindow)
|
||||
self.Variables = {
|
||||
["__listWeaponPackage"] = 0,
|
||||
["__listWeaing"] = 0,
|
||||
["_tmpCombatValue"] = 0,
|
||||
["_imgIcon"] = 0,
|
||||
["_btnClose"] = 0,
|
||||
["_btnBgClose"] = 0,
|
||||
}
|
||||
self.UIRootName = "ui_w_cha"
|
||||
self.UIParentName = UIEnums.UIParent.UIRoot
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function ChaWindow:ShowDetailData(uniqueId: number)
|
||||
local data = {
|
||||
EquipmentUniqueId = uniqueId,
|
||||
}
|
||||
self.UIManager:OpenWindow("EquipmentDetailWindow", data)
|
||||
end
|
||||
|
||||
function ChaWindow:AddInstanceData(configInstance: Instance, Data: table?)
|
||||
local data = self.Data
|
||||
if Data then data = Data end
|
||||
local attributes = configInstance:GetAttributes()
|
||||
|
||||
-- 归类是否是穿戴的装备
|
||||
local parentName = "Package"
|
||||
if attributes.wearing ~= 0 then parentName = "Wearing" end
|
||||
data[parentName][configInstance.Name] = {}
|
||||
|
||||
for attributeKey, attributeValue in attributes do
|
||||
data[parentName][configInstance.Name][attributeKey] = attributeValue
|
||||
end
|
||||
return data[parentName][configInstance.Name], parentName
|
||||
end
|
||||
|
||||
function ChaWindow:OnOpenWindow()
|
||||
UIWindow.OnOpenWindow(self)
|
||||
|
||||
-- 自己进行数据处理
|
||||
local DataFolder = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment")
|
||||
local data = {
|
||||
Wearing = {},
|
||||
Package = {},
|
||||
}
|
||||
for _, child in DataFolder:GetChildren() do
|
||||
self:AddInstanceData(child, data)
|
||||
end
|
||||
self:SetData(data)
|
||||
|
||||
local maxSlotNumber = Utils:GetIdDataFromJson(JsonAttributesUpgrade, 10).maxLv
|
||||
for i = 1, maxSlotNumber do
|
||||
local isExist = false
|
||||
for k, data in pairs(self.Data.Wearing) do
|
||||
if data.wearing == i then
|
||||
isExist = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not isExist then
|
||||
self.Data.Wearing["slot" .. i] = {
|
||||
wearing = i,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local addCon = DataFolder.ChildAdded:Connect(function(child)
|
||||
local data, parentName = self:AddInstanceData(child, data)
|
||||
if parentName == "Wearing" then
|
||||
self.Variables["__listWeaing"]:AddData(data)
|
||||
else
|
||||
self.Variables["__listWeaponPackage"]:AddData(data)
|
||||
end
|
||||
end)
|
||||
|
||||
local removeCon = DataFolder.ChildRemoved:Connect(function(child)
|
||||
local parentName = self:RemoveInstanceData(child, data)
|
||||
if parentName == "Wearing" then
|
||||
local removeIndex = self.Variables["__listWeaing"]:RemoveData(data)
|
||||
self.Data.Wearing[removeIndex] = {}
|
||||
else
|
||||
local removeIndex = self.Variables["__listWeaponPackage"]:RemoveData(data)
|
||||
self.Data.Package[removeIndex] = {}
|
||||
end
|
||||
end)
|
||||
|
||||
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, addCon)
|
||||
table.insert(self.Connections, removeCon)
|
||||
table.insert(self.Connections, bgCloseCon)
|
||||
table.insert(self.Connections, closeCon)
|
||||
|
||||
self.Variables["__listWeaponPackage"]:AddComponent(PackageShow)
|
||||
self.Variables["__listWeaing"]:AddComponent(WearingShow)
|
||||
self.Variables["__listWeaponPackage"]:SetData(self.Data.Package)
|
||||
self.Variables["__listWeaing"]:SetData(self.Data.Wearing)
|
||||
self.Variables["__listWeaing"]:SetLayoutOrder("wearing")
|
||||
end
|
||||
|
||||
function ChaWindow:OnCloseWindow()
|
||||
UIWindow.OnCloseWindow(self)
|
||||
end
|
||||
|
||||
|
||||
|
||||
return ChaWindow
|
@ -151,8 +151,6 @@ end
|
||||
|
||||
function CreateWindow:OnCloseWindow()
|
||||
UIWindow.OnCloseWindow(self)
|
||||
|
||||
self.Variables["__listWeaponPackage"]:Clean()
|
||||
end
|
||||
|
||||
|
||||
|
@ -0,0 +1,50 @@
|
||||
local AttributeShow = {}
|
||||
AttributeShow.__index = AttributeShow
|
||||
|
||||
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)
|
||||
|
||||
function AttributeShow:Init(data: table)
|
||||
local self = {}
|
||||
self.Data = data
|
||||
self.Variables = {
|
||||
["_imgIcon"] = 0,
|
||||
["_tmpAttributeName"] = 0,
|
||||
["_tmpValue"] = 0,
|
||||
}
|
||||
|
||||
setmetatable(self, AttributeShow)
|
||||
return self
|
||||
end
|
||||
|
||||
function AttributeShow:Refresh()
|
||||
local attributeData = Utils:GetSpecialKeyDataFromJson(JsonAttributes, "effectAttribute", self.Data.attribute)
|
||||
if attributeData.id == 14 or attributeData.id == 15 or attributeData.id == 16 then
|
||||
self.Variables._imgIcon.Image = Localization:GetImageData(attributeData.iconId)
|
||||
else
|
||||
self.Variables._imgIcon:Destroy()
|
||||
self.Variables._imgIcon = nil
|
||||
end
|
||||
self.Variables._tmpAttributeName.Text = self.Data.attribute
|
||||
self.UIRoot.LayoutOrder = 1000 - attributeData.id
|
||||
|
||||
if attributeData.type == 2 then
|
||||
self.Variables._tmpValue.Text = string.format("%.2f%%", self.Data.value / 100)
|
||||
else
|
||||
self.Variables._tmpValue.Text = self.Data.value
|
||||
end
|
||||
end
|
||||
|
||||
function AttributeShow:Destroy()
|
||||
for k, v in pairs(self) do
|
||||
self[k] = nil
|
||||
end
|
||||
self = nil
|
||||
end
|
||||
|
||||
return AttributeShow
|
@ -0,0 +1,57 @@
|
||||
local ReplaceShow = {}
|
||||
ReplaceShow.__index = ReplaceShow
|
||||
|
||||
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)
|
||||
|
||||
--> Events
|
||||
local RE_WearEquipment = ReplicatedStorage.Events.RE_WearEquipment
|
||||
|
||||
function ReplaceShow:Init(data: table)
|
||||
local self = {}
|
||||
self.Data = data
|
||||
self.Variables = {
|
||||
["_btnClick"] = 0,
|
||||
["_imgIcon"] = 0,
|
||||
["_imgbg"] = 0,
|
||||
["_tmpQuality"] = 0,
|
||||
}
|
||||
self.Connections = {}
|
||||
|
||||
setmetatable(self, ReplaceShow)
|
||||
|
||||
local con = self.Variables._btnClick.MouseButton1Click:Connect(function()
|
||||
RE_WearEquipment:FireServer(self.Data.uniqueId, self.Data.wearing, false)
|
||||
self.TopUI:CloseReplaceWindow()
|
||||
end)
|
||||
table.insert(self.Connections, con)
|
||||
return self
|
||||
end
|
||||
|
||||
function ReplaceShow:Refresh()
|
||||
-- 槽位为空
|
||||
if self.Data.id == nil then
|
||||
self.Variables._imgIcon.Image = ""
|
||||
self.Variables._imgbg.Image.Visible = true
|
||||
self.Variables._tmpQuality.Text = ""
|
||||
else
|
||||
-- 槽位有装备
|
||||
local itemData = Utils:GetIdDataFromJson(JsonItemProp, self.Data.orgId)
|
||||
self.Variables._imgIcon.Image = Localization:GetItemIcon(itemData.iconId)
|
||||
self.Variables._imgbg.Image.Visible = false
|
||||
self.Variables._tmpQuality.Text = self.Data.quality
|
||||
end
|
||||
end
|
||||
|
||||
function ReplaceShow:Destroy()
|
||||
for k, v in pairs(self) do
|
||||
self[k] = nil
|
||||
end
|
||||
self = nil
|
||||
end
|
||||
|
||||
return ReplaceShow
|
@ -0,0 +1,234 @@
|
||||
--> Services
|
||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||
|
||||
--> Dependencies
|
||||
local UIWindow = require(ReplicatedStorage.Base.UIWindow)
|
||||
local UIEnums = require(ReplicatedStorage.Base.UIEnums)
|
||||
|
||||
--> Components
|
||||
local AttributeShow = require(script.AttributeShow)
|
||||
local ReplaceShow = require(script.ReplaceShow)
|
||||
|
||||
--> Dependencies
|
||||
local Utils = require(ReplicatedStorage.Tools.Utils)
|
||||
local Localization = require(ReplicatedStorage.Tools.Localization)
|
||||
|
||||
--> Json
|
||||
local JsonItemProp = require(ReplicatedStorage.Json.ItemProp)
|
||||
local JsonEquipment = require(ReplicatedStorage.Json.Equipment)
|
||||
local JsonAttributesUpgrade = require(ReplicatedStorage.Json.AttributesUpgrade)
|
||||
|
||||
--> Events
|
||||
local RE_WearEquipment = ReplicatedStorage.Events.RE_WearEquipment
|
||||
|
||||
--> Variables
|
||||
local LocalPlayer = game.Players.LocalPlayer
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
local EquipmentDetailWindow = {}
|
||||
EquipmentDetailWindow.__index = EquipmentDetailWindow
|
||||
setmetatable(EquipmentDetailWindow, {__index = UIWindow})
|
||||
|
||||
function EquipmentDetailWindow:Init(UIManager: table, Data: table?)
|
||||
local self = UIWindow:Init(UIManager, Data)
|
||||
setmetatable(self, EquipmentDetailWindow)
|
||||
self.Variables = {
|
||||
["__listBaseAttributes"] = 0,
|
||||
["_goExAttributesPanel"] = 0,
|
||||
["__listExAttributes"] = 0,
|
||||
["_goElementPanel"] = 0,
|
||||
["__listElement"] = 0,
|
||||
["_goElementDefPanel"] = 0,
|
||||
["__listElementDef"] = 0,
|
||||
|
||||
["_imgIcon"] = 0,
|
||||
["_tmpName"] = 0,
|
||||
["_tmpQuality"] = 0,
|
||||
["_tmpCombatValue"] = 0,
|
||||
|
||||
["_goBottomPanel"] = 0,
|
||||
["_btnUnwear"] = 0,
|
||||
["_btnWear"] = 0,
|
||||
|
||||
["_goReplaceDetail"] = 0,
|
||||
["__listReplace"] = 0,
|
||||
|
||||
["_btnClose"] = 0,
|
||||
["_btnBgClose"] = 0,
|
||||
["_btnReplaceClose"] = 0,
|
||||
}
|
||||
self.UIRootName = "ui_w_equipment_detail"
|
||||
self.UIParentName = UIEnums.UIParent.UIRoot
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function EquipmentDetailWindow:TransformKeyTable(data: table)
|
||||
local newData = {}
|
||||
local index = 1
|
||||
for k, v in pairs(data) do
|
||||
newData[index] = {}
|
||||
newData[index]["attribute"] = k
|
||||
newData[index]["value"] = v
|
||||
index = index + 1
|
||||
end
|
||||
return newData
|
||||
end
|
||||
|
||||
function EquipmentDetailWindow:AddInstanceData(configInstance: Instance, Data: table?)
|
||||
local data = self.Data
|
||||
if Data then data = Data end
|
||||
local attributes = configInstance:GetAttributes()
|
||||
|
||||
-- 归类是否是穿戴的装备
|
||||
local parentName = "Package"
|
||||
data[parentName][configInstance.Name] = {}
|
||||
if attributes.wearing then parentName = "Wearing" end
|
||||
|
||||
for attributeKey, attributeValue in attributes do
|
||||
data[parentName][configInstance.Name][attributeKey] = attributeValue
|
||||
end
|
||||
return data[parentName][configInstance.Name], parentName
|
||||
end
|
||||
|
||||
function EquipmentDetailWindow:ShowReplaceWindow(data: table)
|
||||
self.Variables["_goReplaceDetail"].Visible = true
|
||||
self.Variables["__listReplace"]:AddComponent(ReplaceShow)
|
||||
self.Variables["__listReplace"]:SetData(data)
|
||||
self.Variables["__listReplace"]:SetLayoutOrder("wearing")
|
||||
end
|
||||
|
||||
function EquipmentDetailWindow:CloseReplaceWindow()
|
||||
self.Variables["_goReplaceDetail"].Visible = false
|
||||
end
|
||||
|
||||
function EquipmentDetailWindow:OnOpenWindow()
|
||||
UIWindow.OnOpenWindow(self)
|
||||
|
||||
-- 关闭替换页面
|
||||
self.Variables["_goReplaceDetail"].Visible = false
|
||||
|
||||
-- 处理数据
|
||||
local selfData = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment")
|
||||
local equipmentInstance = selfData:FindFirstChild(self.Data.EquipmentUniqueId)
|
||||
local data = {
|
||||
EquipmentUniqueId = self.Data.EquipmentUniqueId,
|
||||
base = equipmentInstance:GetAttributes(),
|
||||
attributes = equipmentInstance:FindFirstChild("attributes"):GetAttributes(),
|
||||
exAttributes = equipmentInstance:FindFirstChild("exAttributes"):GetAttributes(),
|
||||
elements = equipmentInstance:FindFirstChild("elements"):GetAttributes(),
|
||||
elementDef = equipmentInstance:FindFirstChild("elementDef"):GetAttributes(),
|
||||
}
|
||||
self:SetData(data)
|
||||
|
||||
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)
|
||||
|
||||
local btnUnwearCon = self.Variables["_btnUnwear"].Activated:Connect(function()
|
||||
if self.Data.base.wearing ~= 0 then
|
||||
RE_WearEquipment:FireServer(self.Data.EquipmentUniqueId, 0, true)
|
||||
else
|
||||
-- TODO: 提示弹窗,暂时没有穿戴
|
||||
end
|
||||
end)
|
||||
local btnWearCon = self.Variables["_btnWear"].Activated:Connect(function()
|
||||
-- TODO: 只有一个槽位时,直接穿戴,如果有多个槽位,让他选择穿戴槽位
|
||||
local wearNumberInstance = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("PlayerInfo"):FindFirstChild("AttributesUpgrade"):FindFirstChild("wearNumber")
|
||||
local EquipmentFolder = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment")
|
||||
|
||||
if wearNumberInstance then
|
||||
local data = {}
|
||||
-- 穿戴装备数据设置
|
||||
for _, equipmentInstance in EquipmentFolder:GetChildren() do
|
||||
local attributes = equipmentInstance:GetAttributes()
|
||||
if attributes.wearing ~= 0 then
|
||||
data[attributes.wearing] = {}
|
||||
for attributeKey, attributeValue in attributes do
|
||||
data[attributes.wearing][attributeKey] = attributeValue
|
||||
end
|
||||
end
|
||||
end
|
||||
-- 空槽位补充
|
||||
local maxSlotNumber = Utils:GetIdDataFromJson(JsonAttributesUpgrade, 11).maxLv
|
||||
for i = 1, maxSlotNumber do
|
||||
if not data[i] then
|
||||
data[i] = {
|
||||
wearing = i,
|
||||
}
|
||||
end
|
||||
end
|
||||
self:ShowReplaceWindow(data)
|
||||
else
|
||||
-- 检查是否已经穿戴
|
||||
local isExist = false
|
||||
for _, equipmentInstance in EquipmentFolder:GetChildren() do
|
||||
if equipmentInstance:GetAttribute("wearing") == 1 then
|
||||
isExist = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if isExist then
|
||||
-- TODO: 提示弹窗,已经穿戴
|
||||
else
|
||||
RE_WearEquipment:FireServer(self.Data.EquipmentUniqueId, 1)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
table.insert(self.Connections, bgCloseCon)
|
||||
table.insert(self.Connections, closeCon)
|
||||
table.insert(self.Connections, btnUnwearCon)
|
||||
table.insert(self.Connections, btnWearCon)
|
||||
|
||||
-- 装备信息
|
||||
local equipmentInstance = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment"):FindFirstChild(self.Data.EquipmentUniqueId)
|
||||
local equipmentData = Utils:GetIdDataFromJson(JsonItemProp, equipmentInstance:GetAttribute("id"))
|
||||
self.Variables["_imgIcon"].Image = Localization:GetImageData(equipmentData.iconId)
|
||||
self.Variables["_tmpName"].Text = Localization:GetLanguageData(equipmentData.textId)
|
||||
self.Variables["_tmpQuality"].Text = equipmentInstance:GetAttribute("quality")
|
||||
self.Variables["_tmpCombatValue"].Text = 0
|
||||
|
||||
-- 穿戴状态按钮显示
|
||||
self.Variables["_btnUnwear"].Visible = self.Data.base.wearing ~= 0
|
||||
self.Variables["_btnWear"].Visible = self.Data.base.wearing == 0
|
||||
|
||||
-- 基础属性
|
||||
self.Variables["__listBaseAttributes"]:AddComponent(AttributeShow)
|
||||
self.Variables["__listBaseAttributes"]:SetData(self:TransformKeyTable(self.Data.attributes))
|
||||
|
||||
-- 额外属性
|
||||
if self.Data.exAttributes then
|
||||
self.Variables["_goExAttributesPanel"].Visible = true
|
||||
self.Variables["__listExAttributes"]:AddComponent(AttributeShow)
|
||||
self.Variables["__listExAttributes"]:SetData(self:TransformKeyTable(self.Data.exAttributes))
|
||||
else
|
||||
self.Variables["_goExAttributesPanel"].Visible = false
|
||||
end
|
||||
|
||||
-- 元素属性
|
||||
if self.Data.elements then
|
||||
self.Variables["_goElementPanel"].Visible = true
|
||||
self.Variables["__listElement"]:AddComponent(AttributeShow)
|
||||
self.Variables["__listElement"]:SetData(self:TransformKeyTable(self.Data.elements))
|
||||
else
|
||||
self.Variables["_goElementPanel"].Visible = false
|
||||
end
|
||||
|
||||
-- 元素定义属性
|
||||
if self.Data.elementDef then
|
||||
self.Variables["_goElementDefPanel"].Visible = true
|
||||
self.Variables["__listElementDef"]:AddComponent(AttributeShow)
|
||||
self.Variables["__listElementDef"]:SetData(self:TransformKeyTable(self.Data.elementDef))
|
||||
else
|
||||
self.Variables["_goElementDefPanel"].Visible = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return EquipmentDetailWindow
|
@ -16,6 +16,7 @@ function MainWindow:Init(UIManager: table, Data: table?)
|
||||
setmetatable(self, MainWindow)
|
||||
self.Variables = {
|
||||
["_btnMainCreate"] = 0,
|
||||
["_btnMainCha"] = 0,
|
||||
}
|
||||
self.UIRootName = "ui_w_main"
|
||||
self.UIParentName = UIEnums.UIParent.UIRoot
|
||||
@ -29,7 +30,12 @@ function MainWindow:OnOpenWindow()
|
||||
local createCon = self.Variables["_btnMainCreate"].Activated:Connect(function()
|
||||
self.UIManager:OpenWindow("CreateWindow")
|
||||
end)
|
||||
local chaCon = self.Variables["_btnMainCha"].Activated:Connect(function()
|
||||
self.UIManager:OpenWindow("ChaWindow")
|
||||
end)
|
||||
|
||||
table.insert(self.Connections, createCon)
|
||||
table.insert(self.Connections, chaCon)
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user