控件模块新增修改显示内容的方法,修复key控件右对齐模式绘制错误,修复主菜单快速开始按钮内容不正确

This commit is contained in:
MrZ626
2021-04-22 00:46:50 +08:00
parent ca746075db
commit 31cb4b1ad9
2 changed files with 16 additions and 2 deletions

View File

@@ -103,6 +103,13 @@ local button={
function button:reset()
self.ATV=0
end
function button:setObject(obj)
if type(obj)=="string"or type(obj)=="number"then
self.obj=gc.newText(getFont(self.font),obj)
elseif obj then
self.obj=obj
end
end
function button:isAbove(x,y)
local ATV=self.ATV
return
@@ -219,6 +226,13 @@ local key={
function key:reset()
self.ATV=0
end
function key:setObject(obj)
if type(obj)=="string"or type(obj)=="number"then
self.obj=gc.newText(getFont(self.font),obj)
elseif obj then
self.obj=obj
end
end
function key:isAbove(x,y)
return
x>self.x and
@@ -256,7 +270,7 @@ function key:draw()
elseif self.align=="L"then
mDraw_Y(self.obj,x+self.edge,y+h*.5)
elseif self.align=="R"then
mDraw_Y(self.obj,x+w*.5,y+h*.5)
mDraw_Y(self.obj,self.x-self.edge-self.obj:getWidth(),y+h*.5)
end
end
function key:getInfo()

View File

@@ -31,7 +31,7 @@ function scene.sceneInit()
cmdEntryThread()
--Set quick-play-button text
scene.widgetList[2].text=gc.newText(getFont(scene.widgetList[2].font),text.WidgetText.main.qplay..": "..text.modes[STAT.lastPlay][1])
scene.widgetList[2]:setObject(text.WidgetText.main.qplay..": "..text.modes[STAT.lastPlay][1])
quickSure=false
--Create demo player