更新
This commit is contained in:
parent
6b6d563780
commit
0d1d5e3e3e
@ -58,18 +58,34 @@ function UIList:SetData(Data: table)
|
|||||||
self:Refresh()
|
self:Refresh()
|
||||||
end
|
end
|
||||||
|
|
||||||
function UIList:AddData(data: table)
|
-- 列表添加单个数据
|
||||||
self.Data[#self.Data + 1] = data
|
function UIList:AddData(key: string, data: table)
|
||||||
self:SetSingleInstance(#self.Data, data)
|
self.Data[key] = data
|
||||||
|
self:SetSingleInstance(key, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function UIList:RemoveData(data: table)
|
-- 列表清除单个数据
|
||||||
for i, v in pairs(self.Data) do
|
function UIList:RemoveData(key)
|
||||||
if Utils:CompareTableJson(v, data) then
|
if self.Data[key] then
|
||||||
self.Instances[i]:Destroy()
|
for k, v in pairs(self.Instances) do
|
||||||
table.remove(self.Data, i)
|
if v.Data == self.Data[key] then
|
||||||
return i
|
for _, connection in pairs(v.Connections) do
|
||||||
|
connection:Disconnect()
|
||||||
end
|
end
|
||||||
|
v.Connections = nil
|
||||||
|
if v.UIRoot then v.UIRoot:Destroy() end
|
||||||
|
if v.Destroy then v:Destroy() end
|
||||||
|
if type(key) == "number" then
|
||||||
|
table.remove(self.Instances, k)
|
||||||
|
else
|
||||||
|
self.Instances[k] = nil
|
||||||
|
end
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.Data[key] = nil
|
||||||
|
else
|
||||||
|
warn("UIList:RemoveData() 数据不存在", key, self.Data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -161,6 +177,7 @@ function UIList:Destroy()
|
|||||||
self.SignalConnections = nil
|
self.SignalConnections = nil
|
||||||
self.Connections = nil
|
self.Connections = nil
|
||||||
self.Org:Destroy()
|
self.Org:Destroy()
|
||||||
|
if self.UIRoot then self.UIRoot:Destroy() end
|
||||||
self = nil
|
self = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -75,7 +75,6 @@ function UIWindow:OnOpenWindow()
|
|||||||
-- 创建UI根节点
|
-- 创建UI根节点
|
||||||
self.UIRoot = FolderWindows:FindFirstChild(self.UIRootName):Clone()
|
self.UIRoot = FolderWindows:FindFirstChild(self.UIRootName):Clone()
|
||||||
self.UIRoot.Parent = FolderPlayerGui:WaitForChild(self.UIParentName)
|
self.UIRoot.Parent = FolderPlayerGui:WaitForChild(self.UIParentName)
|
||||||
print("节点", self.UIRoot, self.UIParentName, FolderPlayerGui, FolderPlayerGui:FindFirstChild(self.UIParentName))
|
|
||||||
else
|
else
|
||||||
self.UIRoot.Visible = true
|
self.UIRoot.Visible = true
|
||||||
self:Refresh()
|
self:Refresh()
|
||||||
|
@ -39,7 +39,7 @@ end
|
|||||||
|
|
||||||
-- 获取图片Id数据
|
-- 获取图片Id数据
|
||||||
function Localization:GetImageData(Id: number)
|
function Localization:GetImageData(Id: number)
|
||||||
if not Id then return end
|
if not Id then return "" end
|
||||||
local data = Utils:GetIdDataFromJson(JsonImage, Id)
|
local data = Utils:GetIdDataFromJson(JsonImage, Id)
|
||||||
if not data then return "" end
|
if not data then return "" end
|
||||||
return data.sourceId
|
return data.sourceId
|
||||||
|
@ -65,7 +65,7 @@ function Utils:GetIdDataFromJson(JsonData: table, id: number)
|
|||||||
-- 遍历JsonData,查找id字段等于目标id的项
|
-- 遍历JsonData,查找id字段等于目标id的项
|
||||||
for _, item in ipairs(JsonData) do
|
for _, item in ipairs(JsonData) do
|
||||||
if item.id == id then
|
if item.id == id then
|
||||||
return item
|
return Utils:DeepCopyTable(item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil -- 没有找到对应id
|
return nil -- 没有找到对应id
|
||||||
@ -215,9 +215,23 @@ end
|
|||||||
|
|
||||||
-- 合并表(加法合并)
|
-- 合并表(加法合并)
|
||||||
function Utils:MergeTable(t1: table, t2: table)
|
function Utils:MergeTable(t1: table, t2: table)
|
||||||
|
-- 检查是否为空表
|
||||||
|
local t1Empty = next(t1) == nil
|
||||||
|
local t2Empty = next(t2) == nil
|
||||||
|
|
||||||
|
-- 如果其中一个为空表,返回不为空的表
|
||||||
|
if t1Empty and not t2Empty then
|
||||||
|
return t2
|
||||||
|
elseif not t1Empty and t2Empty then
|
||||||
|
return t1
|
||||||
|
elseif t1Empty and t2Empty then
|
||||||
|
return t1 -- 全为空表,返回t1
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 正常合并逻辑
|
||||||
for k, v in pairs(t2) do
|
for k, v in pairs(t2) do
|
||||||
if type(v) == "number" then
|
if type(v) == "number" then
|
||||||
t1[k] = t1[k] + v
|
t1[k] = (t1[k] or 0) + v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return t1
|
return t1
|
||||||
|
@ -34,6 +34,8 @@ function Character.new(Player: Player, CharacterModel: Model, CharacterData: tab
|
|||||||
Attributes.Name = "Attributes"
|
Attributes.Name = "Attributes"
|
||||||
Attributes.Parent = self.Instance
|
Attributes.Parent = self.Instance
|
||||||
for attributeKey, attributeValue in self.Config do
|
for attributeKey, attributeValue in self.Config do
|
||||||
|
-- 只设置非表类型的属性值
|
||||||
|
if type(attributeValue) ~= "table" then
|
||||||
Attributes:SetAttribute(attributeKey, attributeValue)
|
Attributes:SetAttribute(attributeKey, attributeValue)
|
||||||
-- 设置限制值
|
-- 设置限制值
|
||||||
if table.find(LIMIT_ATTRIBUTE, attributeKey) then
|
if table.find(LIMIT_ATTRIBUTE, attributeKey) then
|
||||||
@ -41,6 +43,7 @@ function Character.new(Player: Player, CharacterModel: Model, CharacterData: tab
|
|||||||
Attributes:SetAttribute("max" .. attributeKey, attributeValue)
|
Attributes:SetAttribute("max" .. attributeKey, attributeValue)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- 通过函数调用了,不绑定事件了
|
-- 通过函数调用了,不绑定事件了
|
||||||
-- local conAttribute = Attributes.AttributeChanged:Connect(function(attributeKey: string, attributeValue: number)
|
-- local conAttribute = Attributes.AttributeChanged:Connect(function(attributeKey: string, attributeValue: number)
|
||||||
|
@ -47,7 +47,7 @@ local function ChangeValue(Player: Player, EquipmentUniqueId: number, KeyName: s
|
|||||||
local ValueInstance = GetPlayerEquipmentFolder(Player):FindFirstChild(EquipmentUniqueId)
|
local ValueInstance = GetPlayerEquipmentFolder(Player):FindFirstChild(EquipmentUniqueId)
|
||||||
if not ValueInstance then warn("ValueInstance not found", KeyName) return end
|
if not ValueInstance then warn("ValueInstance not found", KeyName) return end
|
||||||
|
|
||||||
ArchiveProxy.pData[Player.UserId][EquipmentUniqueId][KeyName] = Value
|
ArchiveProxy.pData[Player.UserId][STORE_NAME][EquipmentUniqueId][KeyName] = Value
|
||||||
ValueInstance:SetAttribute(KeyName, Value)
|
ValueInstance:SetAttribute(KeyName, Value)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -363,7 +363,6 @@ RE_WearEquipment.OnServerEvent:Connect(function(Player: Player, EquipmentUniqueI
|
|||||||
if Unwear then
|
if Unwear then
|
||||||
EquipmentProxy:UnwearEquipment(Player, EquipmentUniqueId)
|
EquipmentProxy:UnwearEquipment(Player, EquipmentUniqueId)
|
||||||
else
|
else
|
||||||
print(Player, EquipmentUniqueId, SlotId)
|
|
||||||
EquipmentProxy:WearEquipment(Player, EquipmentUniqueId, SlotId)
|
EquipmentProxy:WearEquipment(Player, EquipmentUniqueId, SlotId)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
@ -124,13 +124,19 @@ function PlayerFightProxy:UpdatePlayerFightData(Player: Player)
|
|||||||
|
|
||||||
-- 计算角色基础属性值 + 装备属性值 + 宝石属性值,赋值属性
|
-- 计算角色基础属性值 + 装备属性值 + 宝石属性值,赋值属性
|
||||||
local PlayerInfoAttributes = PlayerInfoProxy:GetPlayerAttributes(Player)
|
local PlayerInfoAttributes = PlayerInfoProxy:GetPlayerAttributes(Player)
|
||||||
AttributesData = Utils:MergeTable(AttributesData, PlayerInfoAttributes)
|
if PlayerInfoAttributes.UpgradeAttributes then
|
||||||
|
Utils:TableSafeAddTableValue(AttributesData, PlayerInfoAttributes.UpgradeAttributes)
|
||||||
|
end
|
||||||
|
|
||||||
local EquipmentAttributes = EquipmentProxy:GetPlayerAttributes(Player)
|
local EquipmentAttributes = EquipmentProxy:GetPlayerAttributes(Player)
|
||||||
AttributesData = Utils:MergeTable(AttributesData, EquipmentAttributes)
|
if EquipmentAttributes then
|
||||||
|
Utils:TableSafeAddTableValue(AttributesData, EquipmentAttributes)
|
||||||
|
end
|
||||||
|
|
||||||
local GemAttributes = GemProxy:GetPlayerAttributes(Player)
|
local GemAttributes = GemProxy:GetPlayerAttributes(Player)
|
||||||
AttributesData = Utils:MergeTable(AttributesData, GemAttributes)
|
if GemAttributes.GemWearingAttributes then
|
||||||
|
Utils:TableSafeAddTableValue(AttributesData, GemAttributes.GemWearingAttributes)
|
||||||
|
end
|
||||||
|
|
||||||
-- 角色基础数据
|
-- 角色基础数据
|
||||||
local PlayerRole = self:GetPlayerRole(Player)
|
local PlayerRole = self:GetPlayerRole(Player)
|
||||||
|
@ -0,0 +1,119 @@
|
|||||||
|
local AttributeLvupShow = {}
|
||||||
|
AttributeLvupShow.__index = AttributeLvupShow
|
||||||
|
|
||||||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
|
|
||||||
|
local Utils = require(ReplicatedStorage.Tools.Utils)
|
||||||
|
local Localization = require(ReplicatedStorage.Tools.Localization)
|
||||||
|
local JsonAttributesUpgrade = require(ReplicatedStorage.Json.AttributesUpgrade)
|
||||||
|
local JsonAttributes = require(ReplicatedStorage.Json.Attributes)
|
||||||
|
|
||||||
|
local RE_UpgradeAttributes = ReplicatedStorage.Events.RE_UpgradeAttributes
|
||||||
|
|
||||||
|
local LocalPlayer = game:GetService("Players").LocalPlayer
|
||||||
|
|
||||||
|
function AttributeLvupShow:Init(data: table)
|
||||||
|
local self = {}
|
||||||
|
self.Data = data
|
||||||
|
self.Variables = {
|
||||||
|
["_imgIcon"] = 0,
|
||||||
|
["_tmpAttributeName"] = 0,
|
||||||
|
["_tmpValue"] = 0,
|
||||||
|
["_tmpLv"] = 0,
|
||||||
|
["_btnUpgrade"] = 0,
|
||||||
|
}
|
||||||
|
self.Connections = {}
|
||||||
|
setmetatable(self, AttributeLvupShow)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
function AttributeLvupShow:GetNowLv()
|
||||||
|
local attributeFolder = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("PlayerInfo"):FindFirstChild("AttributesUpgrade")
|
||||||
|
local instance = attributeFolder:FindFirstChild(tostring(self.Data.id))
|
||||||
|
local nowLv = 0
|
||||||
|
if instance then nowLv = instance.Value end
|
||||||
|
return nowLv
|
||||||
|
end
|
||||||
|
|
||||||
|
function AttributeLvupShow:Refresh()
|
||||||
|
-- 如果有实例,,并且之前有监听,则断开添加监听
|
||||||
|
if self.instance then
|
||||||
|
if self.folderCon then
|
||||||
|
self.folderCon:Disconnect()
|
||||||
|
self.folderCon = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.instance and not self.instanceCon then
|
||||||
|
local instanceCon = self.instance.ValueChanged:Connect(function()
|
||||||
|
self:Refresh()
|
||||||
|
end)
|
||||||
|
self.instanceCon = instanceCon
|
||||||
|
end
|
||||||
|
|
||||||
|
local attributeData = Utils:GetSpecialKeyDataFromJson(JsonAttributes, "effectAttribute", self.Data.attribute)
|
||||||
|
self.Variables._imgIcon.Image = Localization:GetImageData(attributeData.iconId)
|
||||||
|
self.Variables._tmpAttributeName.Text = self.Data.id
|
||||||
|
self.UIRoot.LayoutOrder = 1000 - attributeData.id
|
||||||
|
|
||||||
|
local nowLv = self:GetNowLv()
|
||||||
|
self.Variables._tmpLv.Text = "Lv." .. nowLv
|
||||||
|
|
||||||
|
-- 花费按钮显示
|
||||||
|
if self.Data.maxLv then
|
||||||
|
self.Variables._btnUpgrade.Text = nowLv >= self.Data.maxLv and "满级" or self.Data.cost[2] + self.Data.cost[3] * (self.Data.maxLv - 1)
|
||||||
|
|
||||||
|
-- 属性值显示
|
||||||
|
local caculateValue = self.Data.lvAdd[1] + self.Data.lvAdd[2] * (self.Data.maxLv - 1)
|
||||||
|
self.Variables._tmpValue.Text = string.format("%.2f%%", caculateValue / 100)
|
||||||
|
else
|
||||||
|
self.Variables._btnUpgrade.Text = self.Data.cost[2] + self.Data.cost[3] * nowLv
|
||||||
|
-- 属性值显示(下一级)
|
||||||
|
self.Variables._tmpValue.Text = self.Data.lvAdd[1] + self.Data.lvAdd[2] * nowLv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function AttributeLvupShow:OnInitFinish()
|
||||||
|
local con = self.Variables._btnUpgrade.MouseButton1Click:Connect(function()
|
||||||
|
if self.Data.maxLv then
|
||||||
|
if self:GetNowLv() >= self.Data.maxLv then
|
||||||
|
-- TODO: 之后做提示弹窗
|
||||||
|
else
|
||||||
|
RE_UpgradeAttributes:FireServer(self.Data.id)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- TODO: 检查货币是否充足
|
||||||
|
RE_UpgradeAttributes:FireServer(self.Data.id)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
table.insert(self.Connections, con)
|
||||||
|
|
||||||
|
-- 没有实例时,监听文件夹,有实例时,监听实例
|
||||||
|
if not self.instance then
|
||||||
|
local attributeFolder = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("PlayerInfo"):FindFirstChild("AttributesUpgrade")
|
||||||
|
local folderCon = attributeFolder.ChildAdded:Connect(function(child)
|
||||||
|
if child.Name == tostring(self.Data.id) then
|
||||||
|
self.instance = child
|
||||||
|
self:Refresh()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
self.folderCon = folderCon
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function AttributeLvupShow:Destroy()
|
||||||
|
if self.instanceCon then
|
||||||
|
self.instanceCon:Disconnect()
|
||||||
|
self.instanceCon = nil
|
||||||
|
end
|
||||||
|
if self.folderCon then
|
||||||
|
self.folderCon:Disconnect()
|
||||||
|
self.folderCon = nil
|
||||||
|
end
|
||||||
|
for k, v in pairs(self) do
|
||||||
|
self[k] = nil
|
||||||
|
end
|
||||||
|
self = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return AttributeLvupShow
|
@ -0,0 +1,65 @@
|
|||||||
|
--> 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,
|
||||||
|
}
|
||||||
|
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")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return AttributeLvupWindow
|
@ -19,6 +19,7 @@ function PackageShow:Init(data: table)
|
|||||||
self.Connections = {}
|
self.Connections = {}
|
||||||
|
|
||||||
setmetatable(self, PackageShow)
|
setmetatable(self, PackageShow)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -38,6 +39,21 @@ function PackageShow:OnInitFinish()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
table.insert(self.Connections, con)
|
table.insert(self.Connections, con)
|
||||||
|
|
||||||
|
if self.Data.instance then
|
||||||
|
local wearingCon = self.Data.instance:GetAttributeChangedSignal("wearing"):Connect(function()
|
||||||
|
local oldWearing = self.Data.wearing
|
||||||
|
local newWearing = self.Data.instance:GetAttribute("wearing")
|
||||||
|
if oldWearing ~= newWearing then
|
||||||
|
if newWearing > 0 then
|
||||||
|
self.TopUI:WearRefresh(self.Data)
|
||||||
|
else
|
||||||
|
self.TopUI:UnwearRefresh(self.Data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
table.insert(self.Connections, wearingCon)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function PackageShow:Destroy()
|
function PackageShow:Destroy()
|
||||||
|
@ -49,6 +49,21 @@ function WearingShow:OnInitFinish()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
table.insert(self.Connections, con)
|
table.insert(self.Connections, con)
|
||||||
|
|
||||||
|
if self.Data.instance then
|
||||||
|
local wearingCon = self.Data.instance:GetAttributeChangedSignal("wearing"):Connect(function()
|
||||||
|
local oldWearing = self.Data.wearing
|
||||||
|
local newWearing = self.Data.instance:GetAttribute("wearing")
|
||||||
|
if oldWearing ~= newWearing then
|
||||||
|
if newWearing > 0 then
|
||||||
|
self.TopUI:WearRefresh(self.Data)
|
||||||
|
else
|
||||||
|
self.TopUI:UnwearRefresh(self.Data)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
table.insert(self.Connections, wearingCon)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function WearingShow:Destroy()
|
function WearingShow:Destroy()
|
||||||
|
@ -48,6 +48,33 @@ function ChaWindow:ShowDetailData(uniqueId: number)
|
|||||||
self.UIManager:OpenWindow("EquipmentDetailWindow", data)
|
self.UIManager:OpenWindow("EquipmentDetailWindow", data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ChaWindow:WearRefresh(data: table)
|
||||||
|
local newSlot = data.instance:GetAttribute("wearing")
|
||||||
|
self.Variables["__listWeaing"]:RemoveData("slot"..newSlot)
|
||||||
|
self.Variables["__listWeaponPackage"]:RemoveData(tostring(data.id))
|
||||||
|
|
||||||
|
-- 更新穿戴数据,要不再点击前端就不好使了
|
||||||
|
data.wearing = newSlot
|
||||||
|
self.Variables["__listWeaing"]:AddData("slot"..newSlot, data)
|
||||||
|
|
||||||
|
-- 关闭装备详情窗口
|
||||||
|
self.UIManager:CloseWindow("EquipmentDetailWindow")
|
||||||
|
end
|
||||||
|
|
||||||
|
function ChaWindow:UnwearRefresh(data: table)
|
||||||
|
local oldSlot = data.wearing
|
||||||
|
self.Variables["__listWeaing"]:RemoveData("slot"..oldSlot)
|
||||||
|
data.wearing = 0
|
||||||
|
self.Variables["__listWeaponPackage"]:AddData(tostring(data.id), data)
|
||||||
|
self.Data.Wearing["slot"..oldSlot] = {
|
||||||
|
wearing = oldSlot,
|
||||||
|
}
|
||||||
|
self.Variables["__listWeaing"]:AddData("slot"..oldSlot, self.Data.Wearing["slot"..oldSlot])
|
||||||
|
|
||||||
|
-- 关闭装备详情窗口
|
||||||
|
self.UIManager:CloseWindow("EquipmentDetailWindow")
|
||||||
|
end
|
||||||
|
|
||||||
function ChaWindow:AddInstanceData(configInstance: Instance, Data: table?)
|
function ChaWindow:AddInstanceData(configInstance: Instance, Data: table?)
|
||||||
local data = self.Data
|
local data = self.Data
|
||||||
if Data then data = Data end
|
if Data then data = Data end
|
||||||
@ -61,6 +88,7 @@ function ChaWindow:AddInstanceData(configInstance: Instance, Data: table?)
|
|||||||
for attributeKey, attributeValue in attributes do
|
for attributeKey, attributeValue in attributes do
|
||||||
data[parentName][configInstance.Name][attributeKey] = attributeValue
|
data[parentName][configInstance.Name][attributeKey] = attributeValue
|
||||||
end
|
end
|
||||||
|
data[parentName][configInstance.Name].instance = configInstance
|
||||||
return data[parentName][configInstance.Name], parentName
|
return data[parentName][configInstance.Name], parentName
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ function MainWindow:Init(UIManager: table, Data: table?)
|
|||||||
self.Variables = {
|
self.Variables = {
|
||||||
["_btnMainCreate"] = 0,
|
["_btnMainCreate"] = 0,
|
||||||
["_btnMainCha"] = 0,
|
["_btnMainCha"] = 0,
|
||||||
|
["_btnMainAttributeUpgrade"] = 0,
|
||||||
}
|
}
|
||||||
self.UIRootName = "ui_w_main"
|
self.UIRootName = "ui_w_main"
|
||||||
self.UIParentName = UIEnums.UIParent.UIRoot
|
self.UIParentName = UIEnums.UIParent.UIRoot
|
||||||
@ -33,9 +34,13 @@ function MainWindow:OnOpenWindow()
|
|||||||
local chaCon = self.Variables["_btnMainCha"].Activated:Connect(function()
|
local chaCon = self.Variables["_btnMainCha"].Activated:Connect(function()
|
||||||
self.UIManager:OpenWindow("ChaWindow")
|
self.UIManager:OpenWindow("ChaWindow")
|
||||||
end)
|
end)
|
||||||
|
local attributeUpgradeCon = self.Variables["_btnMainAttributeUpgrade"].Activated:Connect(function()
|
||||||
|
self.UIManager:OpenWindow("AttributeLvupWindow")
|
||||||
|
end)
|
||||||
|
|
||||||
table.insert(self.Connections, createCon)
|
table.insert(self.Connections, createCon)
|
||||||
table.insert(self.Connections, chaCon)
|
table.insert(self.Connections, chaCon)
|
||||||
|
table.insert(self.Connections, attributeUpgradeCon)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user