31 lines
961 B
Plaintext
31 lines
961 B
Plaintext
|
-- 道具代理
|
||
|
local ItemProxy = {}
|
||
|
|
||
|
--> Services
|
||
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||
|
local ServerStorage = game:GetService("ServerStorage")
|
||
|
|
||
|
--> Json
|
||
|
local JsonItem = require(ReplicatedStorage.Json.ItemProp)
|
||
|
|
||
|
--> Variables
|
||
|
local Utils = require(ReplicatedStorage.Tools.Utils)
|
||
|
-- local ArchiveProxy = require(ReplicatedStorage.Modules.ArchiveProxy)
|
||
|
local PlayerInfoProxy = require(ServerStorage.Proxy.PlayerInfoProxy)
|
||
|
|
||
|
--------------------------------------------------------------------------------
|
||
|
|
||
|
function ItemProxy:AddItem(Player: Player, ItemId: number, ItemCount: number)
|
||
|
local pData = Utils:GetPlayerDataFolder(Player)
|
||
|
if not pData then return end
|
||
|
|
||
|
local ItemData = Utils:GetIdDataFromJson(JsonItem, ItemId)
|
||
|
if not ItemData then return end
|
||
|
|
||
|
-- 之后根据不同类型做处理
|
||
|
if ItemData.type == 1 then
|
||
|
PlayerInfoProxy:ChangeItemCount(Player, ItemId, ItemCount)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return ItemProxy
|