更新玩家头像/用户信息绘制相关

This commit is contained in:
MrZ626
2021-04-23 13:05:17 +08:00
parent b0064d179c
commit 05b697debf
3 changed files with 14 additions and 12 deletions

View File

@@ -13,9 +13,9 @@ local function loadAvatar(path)
end
local emptyUser={
username="_",
username="Player",
motto="",
hash=false,
hash="",
new=true,
}
local texture_noImage=DOGC{128,128,
@@ -31,14 +31,7 @@ local db_img={}
local db=setmetatable({},{__index=function(self,k)
if not k then return emptyUser end
local file="cache/user"..k..".dat"
local d=
fs.getInfo(file)and JSON.decode(fs.read(file))or
{
username="[X]",
motto="Techmino haowan",
hash="_",
new=false,
}
local d=fs.getInfo(file)and JSON.decode(fs.read(file))or TABLE.copy(emptyUser)
rawset(self,k,d)
if type(d.hash)=="string"and #d.hash>0 and fs.getInfo("cache/"..d.hash)then
db_img[k]=loadAvatar("cache/"..d.hash)