更新
This commit is contained in:
parent
a0889bdba6
commit
c2d8059834
@ -8,6 +8,8 @@ local Localization = require(ReplicatedStorage.Tools.Localization)
|
|||||||
local JsonEquipment = require(ReplicatedStorage.Json.Equipment)
|
local JsonEquipment = require(ReplicatedStorage.Json.Equipment)
|
||||||
local JsonItemProp = require(ReplicatedStorage.Json.ItemProp)
|
local JsonItemProp = require(ReplicatedStorage.Json.ItemProp)
|
||||||
|
|
||||||
|
local FolderEquipment = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Equipments")
|
||||||
|
|
||||||
function PackageShow:Init(data: table)
|
function PackageShow:Init(data: table)
|
||||||
local self = {}
|
local self = {}
|
||||||
self.Data = data
|
self.Data = data
|
||||||
@ -15,6 +17,8 @@ function PackageShow:Init(data: table)
|
|||||||
["_btnClick"] = 0,
|
["_btnClick"] = 0,
|
||||||
["_imgIcon"] = 0,
|
["_imgIcon"] = 0,
|
||||||
["_tmpQuality"] = 0,
|
["_tmpQuality"] = 0,
|
||||||
|
["_tmpName"] = 0,
|
||||||
|
["_imgView"] = 0,
|
||||||
}
|
}
|
||||||
self.Connections = {}
|
self.Connections = {}
|
||||||
|
|
||||||
@ -27,7 +31,23 @@ function PackageShow:Refresh()
|
|||||||
local itemData = Utils:GetIdDataFromJson(JsonItemProp, self.Data.orgId)
|
local itemData = Utils:GetIdDataFromJson(JsonItemProp, self.Data.orgId)
|
||||||
self.Variables._imgIcon.Image = Localization:GetImageData(itemData.iconId)
|
self.Variables._imgIcon.Image = Localization:GetImageData(itemData.iconId)
|
||||||
self.Variables._imgIcon.Visible = false
|
self.Variables._imgIcon.Visible = false
|
||||||
self.Variables._tmpQuality.Text = self.Data.quality
|
self.Variables._tmpQuality.Text = Localization:GetColoredEquipmentQualityDesc(self.Data.quality)
|
||||||
|
self.Variables._tmpName.Text = Localization:GetLanguageData(itemData.nameId)
|
||||||
|
|
||||||
|
local equipmentData = Utils:GetIdDataFromJson(JsonEquipment, self.Data.orgId)
|
||||||
|
-- 模型
|
||||||
|
local part = FolderEquipment:FindFirstChild(equipmentData.modelName):Clone()
|
||||||
|
part.Handle.Position = Vector3.new(0, 0, 0)
|
||||||
|
part.Handle.CFrame = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(90), 0, 0)
|
||||||
|
part.Parent = self.Variables["_imgView"]
|
||||||
|
self.Prefab = part
|
||||||
|
|
||||||
|
-- 相机
|
||||||
|
local viewportCamera = Instance.new("Camera")
|
||||||
|
self.Variables["_imgView"].CurrentCamera = viewportCamera
|
||||||
|
viewportCamera.Parent = self.Variables["_imgView"]
|
||||||
|
viewportCamera.CFrame = CFrame.new(Vector3.new(0, 0, 6), part.Handle.Position)
|
||||||
|
self.ViewCamera = viewportCamera
|
||||||
end
|
end
|
||||||
|
|
||||||
function PackageShow:OnInitFinish()
|
function PackageShow:OnInitFinish()
|
||||||
|
@ -8,14 +8,18 @@ local Localization = require(ReplicatedStorage.Tools.Localization)
|
|||||||
local JsonEquipment = require(ReplicatedStorage.Json.Equipment)
|
local JsonEquipment = require(ReplicatedStorage.Json.Equipment)
|
||||||
local JsonItemProp = require(ReplicatedStorage.Json.ItemProp)
|
local JsonItemProp = require(ReplicatedStorage.Json.ItemProp)
|
||||||
|
|
||||||
|
local FolderEquipment = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Equipments")
|
||||||
|
|
||||||
function WearingShow:Init(data: table)
|
function WearingShow:Init(data: table)
|
||||||
local self = {}
|
local self = {}
|
||||||
self.Data = data
|
self.Data = data
|
||||||
self.Variables = {
|
self.Variables = {
|
||||||
["_btnClick"] = 0,
|
["_btnClick"] = 0,
|
||||||
|
["_imgBg"] = 0,
|
||||||
["_imgIcon"] = 0,
|
["_imgIcon"] = 0,
|
||||||
["_imgbg"] = 0,
|
|
||||||
["_tmpQuality"] = 0,
|
["_tmpQuality"] = 0,
|
||||||
|
["_tmpName"] = 0,
|
||||||
|
["_imgView"] = 0,
|
||||||
}
|
}
|
||||||
self.Connections = {}
|
self.Connections = {}
|
||||||
|
|
||||||
@ -28,14 +32,32 @@ function WearingShow:Refresh()
|
|||||||
-- 槽位为空
|
-- 槽位为空
|
||||||
if self.Data.id == nil then
|
if self.Data.id == nil then
|
||||||
self.Variables._imgIcon.Image = ""
|
self.Variables._imgIcon.Image = ""
|
||||||
self.Variables._imgbg.Visible = true
|
self.Variables._imgBg.Visible = true
|
||||||
self.Variables._tmpQuality.Text = ""
|
self.Variables._tmpQuality.Text = ""
|
||||||
|
self.Variables._tmpName.Text = ""
|
||||||
else
|
else
|
||||||
-- 槽位有装备
|
-- 槽位有装备
|
||||||
local itemData = Utils:GetIdDataFromJson(JsonItemProp, self.Data.orgId)
|
local itemData = Utils:GetIdDataFromJson(JsonItemProp, self.Data.orgId)
|
||||||
self.Variables._imgIcon.Image = Localization:GetImageData(itemData.iconId)
|
self.Variables._imgIcon.Image = Localization:GetImageData(itemData.iconId)
|
||||||
self.Variables._imgbg.Visible = false
|
self.Variables._imgBg.Visible = false
|
||||||
self.Variables._tmpQuality.Text = self.Data.quality
|
self.Variables._tmpQuality.Text = Localization:GetColoredEquipmentQualityDesc(self.Data.quality)
|
||||||
|
self.Variables._tmpName.Text = Localization:GetLanguageData(itemData.nameId)
|
||||||
|
|
||||||
|
|
||||||
|
local equipmentData = Utils:GetIdDataFromJson(JsonEquipment, self.Data.orgId)
|
||||||
|
-- 模型
|
||||||
|
local part = FolderEquipment:FindFirstChild(equipmentData.modelName):Clone()
|
||||||
|
part.Handle.Position = Vector3.new(0, 0, 0)
|
||||||
|
part.Handle.CFrame = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(90), 0, 0)
|
||||||
|
part.Parent = self.Variables["_imgView"]
|
||||||
|
self.Prefab = part
|
||||||
|
|
||||||
|
-- 相机
|
||||||
|
local viewportCamera = Instance.new("Camera")
|
||||||
|
self.Variables["_imgView"].CurrentCamera = viewportCamera
|
||||||
|
viewportCamera.Parent = self.Variables["_imgView"]
|
||||||
|
viewportCamera.CFrame = CFrame.new(Vector3.new(0, 0, 6), part.Handle.Position)
|
||||||
|
self.ViewCamera = viewportCamera
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ function ChaWindow:OnOpenWindow()
|
|||||||
UIWindow.OnOpenWindow(self)
|
UIWindow.OnOpenWindow(self)
|
||||||
|
|
||||||
-- 自己进行数据处理
|
-- 自己进行数据处理
|
||||||
local DataFolder = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment")
|
local DataFolder = Utils:WaitPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment")
|
||||||
local data = {
|
local data = {
|
||||||
Wearing = {},
|
Wearing = {},
|
||||||
Package = {},
|
Package = {},
|
||||||
|
@ -24,6 +24,8 @@ local RE_WearEquipment = ReplicatedStorage.Events.RE_WearEquipment
|
|||||||
--> Variables
|
--> Variables
|
||||||
local LocalPlayer = game.Players.LocalPlayer
|
local LocalPlayer = game.Players.LocalPlayer
|
||||||
|
|
||||||
|
local FolderEquipment = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Equipments")
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
local EquipmentDetailWindow = {}
|
local EquipmentDetailWindow = {}
|
||||||
@ -46,6 +48,7 @@ function EquipmentDetailWindow:Init(UIManager: table, Data: table?)
|
|||||||
["_tmpName"] = 0,
|
["_tmpName"] = 0,
|
||||||
["_tmpQuality"] = 0,
|
["_tmpQuality"] = 0,
|
||||||
["_tmpCombatValue"] = 0,
|
["_tmpCombatValue"] = 0,
|
||||||
|
["_imgView"] = 0,
|
||||||
|
|
||||||
["_goBottomPanel"] = 0,
|
["_goBottomPanel"] = 0,
|
||||||
["_btnUnwear"] = 0,
|
["_btnUnwear"] = 0,
|
||||||
@ -111,6 +114,7 @@ function EquipmentDetailWindow:OnOpenWindow()
|
|||||||
|
|
||||||
-- 处理数据
|
-- 处理数据
|
||||||
local selfData = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment")
|
local selfData = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment")
|
||||||
|
|
||||||
local equipmentInstance = selfData:FindFirstChild(self.Data.EquipmentUniqueId)
|
local equipmentInstance = selfData:FindFirstChild(self.Data.EquipmentUniqueId)
|
||||||
local data = {
|
local data = {
|
||||||
EquipmentUniqueId = self.Data.EquipmentUniqueId,
|
EquipmentUniqueId = self.Data.EquipmentUniqueId,
|
||||||
@ -189,10 +193,25 @@ function EquipmentDetailWindow:OnOpenWindow()
|
|||||||
local equipmentInstance = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment"):FindFirstChild(self.Data.EquipmentUniqueId)
|
local equipmentInstance = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Equipment"):FindFirstChild(self.Data.EquipmentUniqueId)
|
||||||
local equipmentData = Utils:GetIdDataFromJson(JsonItemProp, equipmentInstance:GetAttribute("orgId"))
|
local equipmentData = Utils:GetIdDataFromJson(JsonItemProp, equipmentInstance:GetAttribute("orgId"))
|
||||||
self.Variables["_imgIcon"].Image = Localization:GetImageData(equipmentData.iconId)
|
self.Variables["_imgIcon"].Image = Localization:GetImageData(equipmentData.iconId)
|
||||||
self.Variables["_tmpName"].Text = Localization:GetLanguageData(equipmentData.textId)
|
self.Variables["_tmpName"].Text = Localization:GetLanguageData(equipmentData.nameId)
|
||||||
self.Variables["_tmpQuality"].Text = equipmentInstance:GetAttribute("quality")
|
self.Variables["_tmpQuality"].Text = Localization:GetColoredEquipmentQualityDesc(equipmentData.quality)
|
||||||
self.Variables["_tmpCombatValue"].Text = 0
|
self.Variables["_tmpCombatValue"].Text = 0
|
||||||
|
|
||||||
|
local equipmentData = Utils:GetIdDataFromJson(JsonEquipment, equipmentInstance:GetAttribute("orgId"))
|
||||||
|
-- 模型
|
||||||
|
local part = FolderEquipment:FindFirstChild(equipmentData.modelName):Clone()
|
||||||
|
part.Handle.Position = Vector3.new(0, 0, 0)
|
||||||
|
part.Handle.CFrame = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(90), 0, 0)
|
||||||
|
part.Parent = self.Variables["_imgView"]
|
||||||
|
self.Prefab = part
|
||||||
|
|
||||||
|
-- 相机
|
||||||
|
local viewportCamera = Instance.new("Camera")
|
||||||
|
self.Variables["_imgView"].CurrentCamera = viewportCamera
|
||||||
|
viewportCamera.Parent = self.Variables["_imgView"]
|
||||||
|
viewportCamera.CFrame = CFrame.new(Vector3.new(0, 0, 6), part.Handle.Position)
|
||||||
|
self.ViewCamera = viewportCamera
|
||||||
|
|
||||||
-- 穿戴状态按钮显示
|
-- 穿戴状态按钮显示
|
||||||
self.Variables["_btnUnwear"].Visible = self.Data.base.wearing ~= 0
|
self.Variables["_btnUnwear"].Visible = self.Data.base.wearing ~= 0
|
||||||
self.Variables["_btnWear"].Visible = self.Data.base.wearing == 0
|
self.Variables["_btnWear"].Visible = self.Data.base.wearing == 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user