jxlast/lua_probject/base_project/Game/Data/User.lua

111 lines
1.7 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

--用户账号数据类
--author--
---
-- a user
User = {
account_id = "",
-- acc
acc ="",
--头像
head_url = "",
-- 用户IP
host_ip = "",
-- 经纬度坐标
location = nil,
-- 昵称
nick_name = "",
--性别
sex = 0,
-- 房间ID
room_id = "",
-- 房卡数
diamo = 0,
-- 代理类型0不是代理1普通代理2大联盟代理
agent = 0,
invite_code = "1",
-- 当前圈子
cur_group = nil,
-- 圈子id重连时用来标记是否在圈子房间中
group_id = 0,
playback = {},
--弹窗公告
notices = {},
}
---
-- @type User
local M = User
--- Create a new User
function User.new()
local self = {}
setmetatable(self, {__index = M})
return self
end
function M:getGameData(game_id)
local game_list = self.games
for i=1,#game_list do
local game = game_list[i]
if game.game_id == game_id then
return game
end
end
end
function M:addGameData(data)
local game_list = self.games
for i=1,#game_list do
local game = game_list[i]
if game.game_id == data.game_id then
game_list[i] = data
return
end
end
game_list[#game_list+1] = data
end
function M:removeGameData(game_id)
local game_list = self.games
for i=1,#game_list do
local game = game_list[i]
if game.game_id == game_id then
table.remove(game_list,i)
return
end
end
end
--[[
local GuildData = {
--公会ID
id = 1,
--公会区名
zone = "",
--公会名称
name = "",
--游戏列表
games =nil
}
local GameInfo = {
--游戏ID
game_id = 1,
--服务器版本
version = "1.0.0",
table_data = nil
}
]]