更新玩家头像/用户信息绘制相关
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
local gc=love.graphics
|
local gc=love.graphics
|
||||||
local gc_setColor,gc_setLineWidth,gc_setShader=gc.setColor,gc.setLineWidth,gc.setShader
|
local gc_setColor,gc_setLineWidth,gc_setShader=gc.setColor,gc.setLineWidth,gc.setShader
|
||||||
local gc_push,gc_pop,gc_origin,gc_translate=gc.push,gc.pop,gc.origin,gc.translate
|
local gc_push,gc_pop,gc_origin,gc_translate=gc.push,gc.pop,gc.origin,gc.translate
|
||||||
local gc_draw,gc_rectangle=gc.draw,gc.rectangle
|
local gc_draw,gc_printf,gc_line,gc_rectangle=gc.draw,gc.printf,gc.line,gc.rectangle
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -490,6 +490,15 @@ function drawSelfProfile()
|
|||||||
gc_rectangle("line",-73,7,66,66,2)
|
gc_rectangle("line",-73,7,66,66,2)
|
||||||
gc_draw(selfAvatar,-72,8,nil,.5)
|
gc_draw(selfAvatar,-72,8,nil,.5)
|
||||||
|
|
||||||
|
--Draw username
|
||||||
|
setFont(30)
|
||||||
|
gc_printf(USERS.getUsername(USER.uid),-342,5,260,"right")
|
||||||
|
|
||||||
|
--Draw lv. & xp.
|
||||||
|
gc_draw(TEXTURE.lvIcon[USER.lv],-255,50)
|
||||||
|
gc_line(-230,55,-80,55,-80,70,-230,70)
|
||||||
|
gc_rectangle("fill",-230,55,150*USER.xp/USER.lv/USER.lv,15)
|
||||||
|
|
||||||
gc_pop()
|
gc_pop()
|
||||||
end
|
end
|
||||||
function drawWarning()
|
function drawWarning()
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ function scene.draw()
|
|||||||
|
|
||||||
--Avatar
|
--Avatar
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
gc.draw(USERS.getAvatar(p.uid),200,72+50*i,nil,.25)
|
gc.draw(USERS.getAvatar(p.uid),200,68+50*i,nil,.3125)
|
||||||
|
|
||||||
--Username
|
--Username
|
||||||
gc.print(p.username,240,60+50*i)
|
gc.print(p.username,240,60+50*i)
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ local function loadAvatar(path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local emptyUser={
|
local emptyUser={
|
||||||
username="_",
|
username="Player",
|
||||||
motto="",
|
motto="",
|
||||||
hash=false,
|
hash="",
|
||||||
new=true,
|
new=true,
|
||||||
}
|
}
|
||||||
local texture_noImage=DOGC{128,128,
|
local texture_noImage=DOGC{128,128,
|
||||||
@@ -31,14 +31,7 @@ local db_img={}
|
|||||||
local db=setmetatable({},{__index=function(self,k)
|
local db=setmetatable({},{__index=function(self,k)
|
||||||
if not k then return emptyUser end
|
if not k then return emptyUser end
|
||||||
local file="cache/user"..k..".dat"
|
local file="cache/user"..k..".dat"
|
||||||
local d=
|
local d=fs.getInfo(file)and JSON.decode(fs.read(file))or TABLE.copy(emptyUser)
|
||||||
fs.getInfo(file)and JSON.decode(fs.read(file))or
|
|
||||||
{
|
|
||||||
username="[X]",
|
|
||||||
motto="Techmino haowan",
|
|
||||||
hash="_",
|
|
||||||
new=false,
|
|
||||||
}
|
|
||||||
rawset(self,k,d)
|
rawset(self,k,d)
|
||||||
if type(d.hash)=="string"and #d.hash>0 and fs.getInfo("cache/"..d.hash)then
|
if type(d.hash)=="string"and #d.hash>0 and fs.getInfo("cache/"..d.hash)then
|
||||||
db_img[k]=loadAvatar("cache/"..d.hash)
|
db_img[k]=loadAvatar("cache/"..d.hash)
|
||||||
|
|||||||
Reference in New Issue
Block a user