更新
This commit is contained in:
parent
faac257b02
commit
be1cd9fd41
Binary file not shown.
BIN
excel/cha.xlsx
BIN
excel/cha.xlsx
Binary file not shown.
@ -4,10 +4,9 @@
|
||||
{"id":3,"type":1,"effectAttribute":"swordAtk","cost":[1,300,0],"lvAdd":[10,0],"battleValueLimit":[5,20],"maxLv":null},
|
||||
{"id":4,"type":1,"effectAttribute":"swordWearBase","cost":[1,300,0],"lvAdd":[10,0],"battleValueLimit":[5,20],"maxLv":null},
|
||||
{"id":5,"type":1,"effectAttribute":"swordWearSpe","cost":[1,300,0],"lvAdd":[10,0],"battleValueLimit":[5,20],"maxLv":null},
|
||||
{"id":10,"type":2,"effectAttribute":"wearNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":4},
|
||||
{"id":11,"type":2,"effectAttribute":"abilityNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":3},
|
||||
{"id":12,"type":2,"effectAttribute":"extraAttributeNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":3},
|
||||
{"id":13,"type":2,"effectAttribute":"elementNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":4},
|
||||
{"id":14,"type":2,"effectAttribute":"elementDefNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":4},
|
||||
{"id":15,"type":2,"effectAttribute":"runeNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":4}
|
||||
{"id":10,"type":2,"effectAttribute":"abilityNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":3},
|
||||
{"id":11,"type":2,"effectAttribute":"extraAttributeNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":3},
|
||||
{"id":12,"type":2,"effectAttribute":"elementNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":4},
|
||||
{"id":13,"type":2,"effectAttribute":"elementDefNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":4},
|
||||
{"id":14,"type":2,"effectAttribute":"runeNumber","cost":[1,300,0],"lvAdd":[1,1],"battleValueLimit":[5,20],"maxLv":4}
|
||||
]
|
@ -419,8 +419,11 @@ function EquipmentProxy:WearEquipment(Player: Player, EquipmentId: number, Slot:
|
||||
-- 查看该槽位是否穿戴装备,穿戴就返回
|
||||
for _, EquipmentData in ArchiveProxy.pData[Player.UserId][STORE_NAME] do
|
||||
if EquipmentData.wearing == Slot then
|
||||
RE_PlayerTip:FireClient(Player, '该槽位已穿戴装备')
|
||||
return
|
||||
-- RE_PlayerTip:FireClient(Player, '该槽位已穿戴装备')
|
||||
-- return
|
||||
-- 触发替换逻辑
|
||||
self:UnwearEquipment(Player, EquipmentData.id)
|
||||
RE_PlayerTip:FireClient(Player, '替换装备')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -114,6 +114,9 @@ end
|
||||
-- 关闭窗口
|
||||
function UIManager:CloseWindow(WindowName: string)
|
||||
if not UIManager.Instances[WindowName] then
|
||||
-- 打印堆栈(具体对战调用)
|
||||
-- print("=== 调用堆栈信息 ===")
|
||||
-- print(debug.traceback("UIManager:CloseWindow() 被调用时的堆栈:"))
|
||||
warn("UIManager:CloseWindow() 窗口不存在:" .. WindowName)
|
||||
return
|
||||
end
|
||||
|
@ -60,9 +60,21 @@ function AttributeLvupShow:Refresh()
|
||||
local nowLv = self:GetNowLv()
|
||||
self.Variables._tmpLv.Text = "Lv." .. nowLv
|
||||
|
||||
-- TODO:战斗力计算
|
||||
local nowBattleValue = 0
|
||||
local limitBattleValue
|
||||
if nowLv == 0 then
|
||||
limitBattleValue = attributesUpgradeData.battleValueLimit[1]
|
||||
else
|
||||
limitBattleValue = attributesUpgradeData.battleValueLimit[1] + math.min(nowLv, self.Data.maxLv - 1) * attributesUpgradeData.battleValueLimit[2]
|
||||
end
|
||||
|
||||
-- 花费按钮显示
|
||||
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)
|
||||
|
||||
-- 如果满级或者战力限制,不让点击
|
||||
if nowLv >= self.Data.maxLv or nowBattleValue < limitBattleValue then self.Variables._btnUpgrade.Interactable = false end
|
||||
|
||||
-- 属性值显示
|
||||
local caculateValue = self.Data.lvAdd[1] + self.Data.lvAdd[2] * (self.Data.maxLv - 1)
|
||||
|
@ -0,0 +1,108 @@
|
||||
local WearingShowOne = {}
|
||||
WearingShowOne.__index = WearingShowOne
|
||||
|
||||
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 FolderEquipment = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Equipments")
|
||||
|
||||
local LocalPlayer = game.Players.LocalPlayer
|
||||
|
||||
local CommonFolder = LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("UI"):WaitForChild("Common")
|
||||
local EquipmentModelDetail = require(CommonFolder:WaitForChild("EquipmentModelDetail"))
|
||||
local RuneShow = require(CommonFolder:WaitForChild("RuneShow"))
|
||||
|
||||
function WearingShowOne:Init(data: table)
|
||||
local self = {}
|
||||
self.Data = data
|
||||
self.Variables = {
|
||||
["_btnClick"] = 0,
|
||||
["_imgBg"] = 0,
|
||||
["_imgIcon"] = 0,
|
||||
["_tmpQuality"] = 0,
|
||||
["_tmpName"] = 0,
|
||||
["_imgView"] = 0,
|
||||
["__listRuneWearing"] = 0,
|
||||
}
|
||||
self.Connections = {}
|
||||
|
||||
setmetatable(self, WearingShowOne)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function WearingShowOne:Refresh()
|
||||
-- 槽位为空
|
||||
if self.Data.id == nil then
|
||||
self.Variables._imgIcon.Image = ""
|
||||
self.Variables._imgBg.Visible = true
|
||||
self.Variables._tmpQuality.Text = ""
|
||||
self.Variables._tmpName.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 = Localization:GetColoredEquipmentQualityDesc(self.Data.quality)
|
||||
self.Variables._tmpName.Text = Localization:GetLanguageData(itemData.nameId)
|
||||
|
||||
-- 模型展示
|
||||
self.taskRotation, self.part, self.viewportCamera = EquipmentModelDetail:ShowDetail(self.Variables["_imgView"], self.Data.orgId, true)
|
||||
|
||||
self.Variables["__listRuneWearing"]:AddComponent(RuneShow)
|
||||
local runeData = Utils:GetWearingRuneData(self.Data.id)
|
||||
self.Variables["__listRuneWearing"]:SetData(runeData)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function WearingShowOne: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)
|
||||
|
||||
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
|
||||
|
||||
function WearingShowOne:Destroy()
|
||||
if self.taskRotation then
|
||||
task.cancel(self.taskRotation)
|
||||
self.taskRotation = nil
|
||||
end
|
||||
if self.part then
|
||||
self.part:Destroy()
|
||||
self.part = nil
|
||||
end
|
||||
if self.viewportCamera then
|
||||
self.viewportCamera:Destroy()
|
||||
self.viewportCamera = nil
|
||||
end
|
||||
for k, v in pairs(self) do
|
||||
self[k] = nil
|
||||
end
|
||||
self = nil
|
||||
end
|
||||
|
||||
return WearingShowOne
|
@ -6,7 +6,7 @@ local UIWindow = require(ReplicatedStorage.Base.UIWindow)
|
||||
local UIEnums = require(ReplicatedStorage.Base.UIEnums)
|
||||
|
||||
--> Components
|
||||
local WearingShow = require(script.WearingShow)
|
||||
local WearingShow = require(script.WearingShowOne)
|
||||
local PackageShow = require(script.PackageShow)
|
||||
|
||||
--> Dependencies
|
||||
@ -59,7 +59,9 @@ function ChaWindow:WearRefresh(data: table)
|
||||
self.Variables["__listWeaing"]:AddData("slot"..newSlot, data)
|
||||
|
||||
-- 关闭装备详情窗口
|
||||
self.UIManager:CloseWindow("EquipmentDetailWindow")
|
||||
if self.UIManager:IsOpened("EquipmentDetailWindow") then
|
||||
self.UIManager:CloseWindow("EquipmentDetailWindow")
|
||||
end
|
||||
end
|
||||
|
||||
function ChaWindow:UnwearRefresh(data: table)
|
||||
@ -73,7 +75,9 @@ function ChaWindow:UnwearRefresh(data: table)
|
||||
self.Variables["__listWeaing"]:AddData("slot"..oldSlot, self.Data.Wearing["slot"..oldSlot])
|
||||
|
||||
-- 关闭装备详情窗口
|
||||
self.UIManager:CloseWindow("EquipmentDetailWindow")
|
||||
if self.UIManager:IsOpened("EquipmentDetailWindow") then
|
||||
self.UIManager:CloseWindow("EquipmentDetailWindow")
|
||||
end
|
||||
end
|
||||
|
||||
function ChaWindow:AddInstanceData(configInstance: Instance, Data: table?)
|
||||
@ -125,6 +129,8 @@ function ChaWindow:OnOpenWindow()
|
||||
self:SetData(data)
|
||||
|
||||
local maxSlotNumber = Utils:GetIdDataFromJson(JsonAttributesUpgrade, 10).maxLv
|
||||
-- 临时只显示1个槽位
|
||||
maxSlotNumber = 1
|
||||
for i = 1, maxSlotNumber do
|
||||
local isExist = false
|
||||
for k, data in pairs(self.Data.Wearing) do
|
||||
|
@ -187,11 +187,12 @@ function EquipmentDetailWindow:OnOpenWindow()
|
||||
break
|
||||
end
|
||||
end
|
||||
if isExist then
|
||||
-- TODO: 提示弹窗,已经穿戴
|
||||
else
|
||||
RE_WearEquipment:FireServer(self.Data.EquipmentUniqueId, 1)
|
||||
end
|
||||
-- if isExist then
|
||||
-- -- TODO: 提示弹窗,已经穿戴
|
||||
-- else
|
||||
-- RE_WearEquipment:FireServer(self.Data.EquipmentUniqueId, 1)
|
||||
-- end
|
||||
RE_WearEquipment:FireServer(self.Data.EquipmentUniqueId, 1)
|
||||
end
|
||||
end)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user