This commit is contained in:
Ggafrik 2025-08-15 00:45:18 +08:00
parent b41e4d8b93
commit 47c238cfcd
8 changed files with 59 additions and 45 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"robloxLsp.diagnostics.workspaceDelay": 30000
}

View File

@ -54,6 +54,9 @@ function UIWindow:AutoInjectVariables()
if firstChar == "_" then if firstChar == "_" then
if sixChar == "__list" then if sixChar == "__list" then
local prefab = Utils:FindInDescendantsUI(self.UIRoot, varName) local prefab = Utils:FindInDescendantsUI(self.UIRoot, varName)
if not prefab then
warn("没找到预制体", self.UIRoot, varName)
end
target = UIList:Init(prefab) target = UIList:Init(prefab)
target.TopUI = self target.TopUI = self
elseif sevenChar == "__money" then elseif sevenChar == "__money" then

View File

@ -97,6 +97,7 @@ local function OnPlayerAdded(Player: Player)
Proxies.AbilityProxy:InitPlayer(Player) Proxies.AbilityProxy:InitPlayer(Player)
Proxies.GemProxy:InitPlayer(Player) Proxies.GemProxy:InitPlayer(Player)
Proxies.BookProxy:InitPlayer(Player) Proxies.BookProxy:InitPlayer(Player)
Proxies.RuneProxy:InitPlayer(Player)
Proxies.PlayerFightProxy:InitPlayer(Player) Proxies.PlayerFightProxy:InitPlayer(Player)
end end

View File

@ -245,6 +245,26 @@ function EquipmentProxy:AddEquipment(Player: Player, EquipmentId: number)
end end
end end
------------------------------------------------------------
-- 随机生成技能槽位数量
local AbilityProxy = require(ServerStorage.Proxy.AbilityProxy)
local maxAbilityNumber = PlayerInfoProxy:GetPlayerInfo(Player)["AttributesUpgrade"]["11"] or 0
local abilityNumber = rng:NextInteger(0, maxAbilityNumber)
ResultData.maxAbilityNumber = abilityNumber
-- 随机生成宝石数量
local GemProxy = require(ServerStorage.Proxy.GemProxy)
local maxGemNumber = PlayerInfoProxy:GetPlayerInfo(Player).gemNumber or 0
local gemNumber = rng:NextInteger(0, maxGemNumber)
ResultData.maxGemNumber = gemNumber
-- 随机生成符文数量
local RuneProxy = require(ServerStorage.Proxy.RuneProxy)
local maxRuneNumber = PlayerInfoProxy:GetPlayerInfo(Player).runeNumber or 0
local runeNumber = rng:NextInteger(0, maxRuneNumber)
ResultData.maxRuneNumber = runeNumber
------------------------------------------------------------ ------------------------------------------------------------
ArchiveProxy.pData[Player.UserId][STORE_NAME][UniqueId] = ResultData ArchiveProxy.pData[Player.UserId][STORE_NAME][UniqueId] = ResultData
@ -253,12 +273,6 @@ function EquipmentProxy:AddEquipment(Player: Player, EquipmentId: number)
------------------------------------------------------------ ------------------------------------------------------------
-- 下面逻辑会找Instance实例所以放在之后执行逻辑 -- 下面逻辑会找Instance实例所以放在之后执行逻辑
-- 随机生成技能槽位数量
local AbilityProxy = require(ServerStorage.Proxy.AbilityProxy)
local maxAbilityNumber = PlayerInfoProxy:GetPlayerInfo(Player)["AttributesUpgrade"]["11"] or 0
local abilityNumber = rng:NextInteger(0, maxAbilityNumber)
ResultData.maxAbilityNumber = abilityNumber
if abilityNumber > 0 then if abilityNumber > 0 then
local spawnAbilitiesId = {} local spawnAbilitiesId = {}
for i = 1, abilityNumber do for i = 1, abilityNumber do
@ -279,11 +293,6 @@ function EquipmentProxy:AddEquipment(Player: Player, EquipmentId: number)
end end
end end
-- 随机生成宝石数量
local GemProxy = require(ServerStorage.Proxy.GemProxy)
local maxGemNumber = PlayerInfoProxy:GetPlayerInfo(Player).gemNumber or 0
local gemNumber = rng:NextInteger(0, maxGemNumber)
ResultData.maxGemNumber = gemNumber
if gemNumber > 0 then if gemNumber > 0 then
local spawnGemsId = {} local spawnGemsId = {}
for i = 1, gemNumber do for i = 1, gemNumber do
@ -294,11 +303,6 @@ function EquipmentProxy:AddEquipment(Player: Player, EquipmentId: number)
end end
end end
-- 随机生成符文数量
local RuneProxy = require(ServerStorage.Proxy.RuneProxy)
local maxRuneNumber = PlayerInfoProxy:GetPlayerInfo(Player).runeNumber or 0
local runeNumber = rng:NextInteger(0, maxRuneNumber)
ResultData.maxRuneNumber = runeNumber
if runeNumber > 0 then if runeNumber > 0 then
local spawnRunesId = {} local spawnRunesId = {}
for i = 1, runeNumber do for i = 1, runeNumber do

View File

@ -87,6 +87,7 @@ function MainWindow:Init(UIManager: table, Data: table?)
["_btnMainAttributeUpgrade"] = 0, ["_btnMainAttributeUpgrade"] = 0,
["_btnStartChallenge"] = 0, ["_btnStartChallenge"] = 0,
["_btnBlessing"] = 0, ["_btnBlessing"] = 0,
["_btnRune"] = 0,
-- 锻造条 -- 锻造条
["_goForgeBar"] = 0, ["_goForgeBar"] = 0,
@ -154,12 +155,16 @@ function MainWindow:OnOpenWindow()
local blessingCon = self.Variables["_btnBlessing"].Activated:Connect(function() local blessingCon = self.Variables["_btnBlessing"].Activated:Connect(function()
self.UIManager:OpenWindow("BlessingWindow") self.UIManager:OpenWindow("BlessingWindow")
end) end)
local runeCon = self.Variables["_btnRune"].Activated:Connect(function()
self.UIManager:OpenWindow("RuneWindow")
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) table.insert(self.Connections, attributeUpgradeCon)
table.insert(self.Connections, startChallengeCon) table.insert(self.Connections, startChallengeCon)
table.insert(self.Connections, blessingCon) table.insert(self.Connections, blessingCon)
table.insert(self.Connections, runeCon)
local challengeLevelEndCon = challengeLevelEndSignal:Connect(function(result: boolean) local challengeLevelEndCon = challengeLevelEndSignal:Connect(function(result: boolean)
self.Variables["_btnStartChallenge"].Visible = true self.Variables["_btnStartChallenge"].Visible = true

View File

@ -8,8 +8,6 @@ local Localization = require(ReplicatedStorage.Tools.Localization)
local JsonRune = require(ReplicatedStorage.Json.Rune) local JsonRune = require(ReplicatedStorage.Json.Rune)
local JsonItemProp = require(ReplicatedStorage.Json.ItemProp) local JsonItemProp = require(ReplicatedStorage.Json.ItemProp)
local FolderRune = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Runes")
function PackageShow:Init(data: table) function PackageShow:Init(data: table)
local self = {} local self = {}
self.Data = data self.Data = data

View File

@ -8,8 +8,6 @@ local Localization = require(ReplicatedStorage.Tools.Localization)
local JsonRune = require(ReplicatedStorage.Json.Rune) local JsonRune = require(ReplicatedStorage.Json.Rune)
local JsonItemProp = require(ReplicatedStorage.Json.ItemProp) local JsonItemProp = require(ReplicatedStorage.Json.ItemProp)
local FolderRune = ReplicatedStorage:WaitForChild("Prefabs"):WaitForChild("Runes")
function WearingShow:Init(data: table) function WearingShow:Init(data: table)
local self = {} local self = {}
self.Data = data self.Data = data

View File

@ -26,16 +26,15 @@ local LocalPlayer = game.Players.LocalPlayer
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
local ChaWindow = {} local RuneWindow = {}
ChaWindow.__index = ChaWindow RuneWindow.__index = RuneWindow
setmetatable(ChaWindow, {__index = UIWindow}) setmetatable(RuneWindow, {__index = UIWindow})
function ChaWindow:Init(UIManager: table, Data: table?) function RuneWindow:Init(UIManager: table, Data: table?)
local self = UIWindow:Init(UIManager, Data) local self = UIWindow:Init(UIManager, Data)
setmetatable(self, ChaWindow) setmetatable(self, RuneWindow)
self.Variables = { self.Variables = {
["_goRunePanel"] = 0, ["_goRunePanel"] = 0,
["_goEquipmentDetail"] = 0,
["__listRunePackage"] = 0, ["__listRunePackage"] = 0,
["__listRuneWearing"] = 0, ["__listRuneWearing"] = 0,
["_tmpCombatValue"] = 0, ["_tmpCombatValue"] = 0,
@ -57,7 +56,7 @@ function ChaWindow:Init(UIManager: table, Data: table?)
return self return self
end end
function ChaWindow:ShowDetailData(uniqueId: number) function RuneWindow:ShowDetailData(uniqueId: number)
if uniqueId then if uniqueId then
self.NowSelectRuneId = uniqueId self.NowSelectRuneId = uniqueId
local runeData = Utils:GetIdDataFromJson(JsonRune, uniqueId) local runeData = Utils:GetIdDataFromJson(JsonRune, uniqueId)
@ -74,7 +73,7 @@ function ChaWindow:ShowDetailData(uniqueId: number)
end end
end end
function ChaWindow:WearRefresh(data: table) function RuneWindow:WearRefresh(data: table)
local newSlot = data.instance:GetAttribute("wearing") local newSlot = data.instance:GetAttribute("wearing")
self.Variables["__listRuneWearing"]:RemoveData("slot"..newSlot) self.Variables["__listRuneWearing"]:RemoveData("slot"..newSlot)
self.Variables["__listRunePackage"]:RemoveData(tostring(data.id)) self.Variables["__listRunePackage"]:RemoveData(tostring(data.id))
@ -87,7 +86,7 @@ function ChaWindow:WearRefresh(data: table)
if data.id == self.NowSelectRuneId then self:ShowDetailData() end if data.id == self.NowSelectRuneId then self:ShowDetailData() end
end end
function ChaWindow:UnwearRefresh(data: table) function RuneWindow:UnwearRefresh(data: table)
local oldSlot = data.wearing local oldSlot = data.wearing
self.Variables["__listRuneWearing"]:RemoveData("slot"..oldSlot) self.Variables["__listRuneWearing"]:RemoveData("slot"..oldSlot)
data.wearing = 0 data.wearing = 0
@ -98,13 +97,13 @@ function ChaWindow:UnwearRefresh(data: table)
self.Variables["__listRuneWearing"]:AddData("slot"..oldSlot, self.Data.Wearing["slot"..oldSlot]) self.Variables["__listRuneWearing"]:AddData("slot"..oldSlot, self.Data.Wearing["slot"..oldSlot])
end end
function ChaWindow:InlayRune() function RuneWindow:InlayRune()
if self.NowSelectRuneId and self.ShowEquipmentId then if self.NowSelectRuneId and self.ShowEquipmentId then
RE_RuneInlay:FireClient(self.NowSelectRuneId, self.ShowEquipmentId) RE_RuneInlay:FireClient(self.NowSelectRuneId, self.ShowEquipmentId)
end end
end end
function ChaWindow:AddInstanceData(configInstance: Instance, Data: table?) function RuneWindow: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
local attributes = configInstance:GetAttributes() local attributes = configInstance:GetAttributes()
@ -124,7 +123,7 @@ function ChaWindow:AddInstanceData(configInstance: Instance, Data: table?)
return data[parentName][secondName], parentName return data[parentName][secondName], parentName
end end
function ChaWindow:RemoveInstanceData(configInstance: Instance, Data: table?) function RuneWindow:RemoveInstanceData(configInstance: Instance, Data: table?)
for key, data in pairs(self.Data.WearingRune) do for key, data in pairs(self.Data.WearingRune) do
if data.instance == configInstance then if data.instance == configInstance then
return tostring(key), "WearingRune" return tostring(key), "WearingRune"
@ -138,8 +137,20 @@ function ChaWindow:RemoveInstanceData(configInstance: Instance, Data: table?)
return nil return nil
end end
function ChaWindow:OnOpenWindow() function RuneWindow:OnOpenWindow()
UIWindow.OnOpenWindow(self) UIWindow.OnOpenWindow(self)
self.Variables["__listRunePackage"]:AddComponent(PackageShow)
self.Variables["__listRuneWearing"]:AddComponent(WearingShow)
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, bgCloseCon)
table.insert(self.Connections, closeCon)
-- 自己进行数据处理 -- 自己进行数据处理
local DataFolder = Utils:WaitPlayerDataFolder(LocalPlayer):FindFirstChild("Rune") local DataFolder = Utils:WaitPlayerDataFolder(LocalPlayer):FindFirstChild("Rune")
@ -218,29 +229,20 @@ function ChaWindow:OnOpenWindow()
end end
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, addCon)
table.insert(self.Connections, removeCon) table.insert(self.Connections, removeCon)
table.insert(self.Connections, bgCloseCon)
table.insert(self.Connections, closeCon)
self.Variables["__listRunePackage"]:AddComponent(PackageShow) print(self.Variables["__listRunePackage"], self.Variables["__listRuneWearing"])
self.Variables["__listRuneWearing"]:AddComponent(WearingShow)
self.Variables["__listRunePackage"]:SetData(self.Data.PackageRune) self.Variables["__listRunePackage"]:SetData(self.Data.PackageRune)
self.Variables["__listRuneWearing"]:SetData(self.Data.WearingRune) self.Variables["__listRuneWearing"]:SetData(self.Data.WearingRune)
self.Variables["__listRuneWearing"]:SetLayoutOrder("wearingSlot") self.Variables["__listRuneWearing"]:SetLayoutOrder("wearingSlot")
end end
function ChaWindow:OnCloseWindow() function RuneWindow:OnCloseWindow()
UIWindow.OnCloseWindow(self) UIWindow.OnCloseWindow(self)
end end
return ChaWindow return RuneWindow