This commit is contained in:
gechangfu 2025-09-01 19:57:57 +08:00
parent e167d9cd48
commit 592f4aee24
6 changed files with 71 additions and 3 deletions

Binary file not shown.

View File

@ -27,6 +27,7 @@ local JsonQualityEffect = require(ReplicatedStorage.Json.QualityEffect)
local RE_PlayerTip = ReplicatedStorage.Events.RE_PlayerTip
local RE_WearEquipment = ReplicatedStorage.Events.RE_WearEquipment
local RE_RecycleEquipment = ReplicatedStorage.Events.RE_RecycleEquipment
local RE_AutoRecycleEquipment = ReplicatedStorage.Events.RE_AutoRecycleEquipment
--> Constants
local STORE_NAME = "Equipment"
@ -461,6 +462,26 @@ function EquipmentProxy:UnwearEquipment(Player: Player, EquipmentId: number)
PlayerFightProxy:UpdatePlayerFightData(Player)
end
-- 自动回收装备(低于当前最高品质,且无符文槽位)
function EquipmentProxy:AutoRecycleEquipment(Player: Player)
local EquipmentData = ArchiveProxy.pData[Player.UserId][STORE_NAME]
if not EquipmentData then return end
-- 找到当前最高品质装备
local highestQuality = 0
for _, EquipmentData in EquipmentData do
if EquipmentData.quality > highestQuality then
highestQuality = EquipmentData.quality
end
end
for _, EquipmentData in EquipmentData do
if EquipmentData.quality < highestQuality and EquipmentData.maxRuneNumber == 0 then
self:RecycleEquipment(Player, EquipmentData.id)
end
end
end
-- 获取穿戴中的装备UniqueId
function EquipmentProxy:GetPlayerWearingEquipmentUniqueId(Player: Player)
local wearingEquipmentUniqueId = {}
@ -556,6 +577,9 @@ end)
RE_RecycleEquipment.OnServerEvent:Connect(function(Player: Player, EquipmentUniqueIds: table)
EquipmentProxy:RecycleEquipmentList(Player, EquipmentUniqueIds)
end)
RE_AutoRecycleEquipment.OnServerEvent:Connect(function(Player: Player)
EquipmentProxy:AutoRecycleEquipment(Player)
end)
return EquipmentProxy

View File

@ -184,7 +184,6 @@ function PlayerFightProxy:UpdatePlayerFightData(Player: Player)
end
end
-- 根据技能添加玩家AI行为
local abilityIdList, behaviorNameList = AbilityProxy:GetPlayerWearingAbilityData(Player)
local playerAI = PlayerFightProxy:GetPlayerAI(Player)

View File

@ -25,6 +25,7 @@ function AttributeLvupShow:Init(data: table)
["_tmpBattleValueRequire"] = 0,
["_tmpValue"] = 0,
["_tmpLv"] = 0,
["_tmpRed"] = 0,
["_btnUpgrade"] = 0,
}
self.Connections = {}
@ -61,7 +62,6 @@ function AttributeLvupShow:Refresh()
self.Variables._imgIcon.Image = Localization:GetImageData(attributeData.iconId)
self.Variables._tmpAttributeName.Text = Localization:GetLanguageData(attributeData.nameId)
local nowLv = self:GetNowLv()
self.Variables._tmpLv.Text = "Lv." .. nowLv

View File

@ -19,6 +19,7 @@ local JsonForge = require(ReplicatedStorage.Json.Forge)
--> Events
local RE_Forge = ReplicatedStorage.Events.RE_Forge
local RE_AutoRecycleEquipment = ReplicatedStorage.Events.RE_AutoRecycleEquipment
local LocalPlayer = game.Players.LocalPlayer
@ -165,10 +166,12 @@ function CreateWindow:SetShowForgeCost(nowForgeTime : number, moneyValue: number
end
end
function CreateWindow:OnOpenWindow()
UIWindow.OnOpenWindow(self)
-- 自动打开回收
self:OnToggleAutoRecycleClick()
-- 自己进行数据处理
local DataFolder = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("Book")
local data = {}
@ -260,6 +263,9 @@ function CreateWindow:OnOpenWindow()
end
function CreateWindow:OnCloseWindow()
if self.AutoRecycle then
RE_AutoRecycleEquipment:FireServer()
end
UIWindow.OnCloseWindow(self)
end

View File

@ -9,6 +9,7 @@ local Signal = require(ReplicatedStorage.Tools.Signal)
--> Json
local JsonLevel = require(ReplicatedStorage.Json.Level)
local JsonForge = require(ReplicatedStorage.Json.Forge)
local JsonAttributesUpgrade = require(ReplicatedStorage.Json.AttributesUpgrade)
local Utils = require(ReplicatedStorage.Tools.Utils)
@ -98,6 +99,7 @@ function MainWindow:Init(UIManager: table, Data: table?)
-- 锻造临时红点
["_tmpRedCreate"] = 0,
["_tmpRedAttributeUpgrade"] = 0,
}
self.UIRootName = "ui_w_main"
self.UIParentName = UIEnums.UIParent.UIRoot
@ -138,6 +140,43 @@ function MainWindow:SetShowForgeBar(nowForgeTime : number, moneyValue: number)
end
end
function MainWindow:CheckShowAttributeUpgradeRed(newValue)
-- 临时做一个(当没有成长和限制算)
if newValue < 150 then
self.Variables["_tmpRedAttributeUpgrade"].Visible = false
else
self.Variables["_tmpRedAttributeUpgrade"].Visible = true
end
end
-- 设置当前加点红点
function MainWindow:SetShowAttributeUpgradeRed()
-- 设置货币监听
local CheckMoneyId = 1
local MoneyFolder = Utils:GetPlayerDataFolder(LocalPlayer):FindFirstChild("PlayerInfo"):FindFirstChild("Items")
if not MoneyFolder then warn("无法获取物品文件夹") return end
local InstanceMoney = MoneyFolder:FindFirstChild(CheckMoneyId)
if not InstanceMoney then
self.Variables["_tmpRedAttributeUpgrade"].Visible = false
local connectionFolder
connectionFolder = MoneyFolder.ChildAdded:Connect(function(child)
if child.Name == tostring(CheckMoneyId) then
InstanceMoney = child
connectionFolder:Disconnect()
end
end)
else
local con = InstanceMoney.Changed:Connect(function(newValue)
self:CheckShowAttributeUpgradeRed(newValue)
end)
table.insert(self.Connections, con)
-- 初始化显示设置
self:CheckShowAttributeUpgradeRed(InstanceMoney.Value)
end
end
function MainWindow:OnOpenWindow()
UIWindow.OnOpenWindow(self)