控件支持强制文本,不随语言变化
This commit is contained in:
@@ -50,11 +50,13 @@ function text:draw()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function WIDGET.newText(D)--name,x,y[,color][,font=30][,align="M"][,plain=false][,hide]
|
function WIDGET.newText(D)--name,x,y[,fText][,color][,font=30][,align="M"][,plain=false][,hide]
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
x= D.x,
|
x= D.x,
|
||||||
y= D.y,
|
y= D.y,
|
||||||
|
|
||||||
|
fText= D.fText,
|
||||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||||
font= D.font or 30,
|
font= D.font or 30,
|
||||||
align= D.align or"M",
|
align= D.align or"M",
|
||||||
@@ -166,7 +168,7 @@ function button:press()
|
|||||||
self:FX()
|
self:FX()
|
||||||
SFX.play("button")
|
SFX.play("button")
|
||||||
end
|
end
|
||||||
function WIDGET.newButton(D)--name,x,y,w[,h][,color][,font],code[,hide]
|
function WIDGET.newButton(D)--name,x,y,w[,h][,fText][,color][,font],code[,hide]
|
||||||
if not D.h then D.h=D.w end
|
if not D.h then D.h=D.w end
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
@@ -184,6 +186,7 @@ function WIDGET.newButton(D)--name,x,y,w[,h][,color][,font],code[,hide]
|
|||||||
D.x+D.w*.35,D.y+D.h*.35,
|
D.x+D.w*.35,D.y+D.h*.35,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fText= D.fText,
|
||||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||||
font= D.font or 30,
|
font= D.font or 30,
|
||||||
code= D.code,
|
code= D.code,
|
||||||
@@ -247,7 +250,7 @@ end
|
|||||||
function key:press()
|
function key:press()
|
||||||
self.code()
|
self.code()
|
||||||
end
|
end
|
||||||
function WIDGET.newKey(D)--name,x,y,w[,h][,color][,font],code[,hide]
|
function WIDGET.newKey(D)--name,x,y,w[,h][,fText][,color][,font],code[,hide]
|
||||||
if not D.h then D.h=D.w end
|
if not D.h then D.h=D.w end
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
@@ -265,6 +268,7 @@ function WIDGET.newKey(D)--name,x,y,w[,h][,color][,font],code[,hide]
|
|||||||
D.x+D.w*.35,D.y+D.h*.35,
|
D.x+D.w*.35,D.y+D.h*.35,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fText= D.fText,
|
||||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||||
font= D.font or 30,
|
font= D.font or 30,
|
||||||
code= D.code,
|
code= D.code,
|
||||||
@@ -335,7 +339,7 @@ function switch:press()
|
|||||||
self.code()
|
self.code()
|
||||||
SFX.play("move")
|
SFX.play("move")
|
||||||
end
|
end
|
||||||
function WIDGET.newSwitch(D)--name,x,y[,color][,font][,disp],code,hide
|
function WIDGET.newSwitch(D)--name,x,y[,fText][,color][,font][,disp],code,hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
@@ -346,6 +350,7 @@ function WIDGET.newSwitch(D)--name,x,y[,color][,font][,disp],code,hide
|
|||||||
D.x+25,D.y,
|
D.x+25,D.y,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fText= D.fText,
|
||||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||||
font= D.font or 30,
|
font= D.font or 30,
|
||||||
disp= D.disp,
|
disp= D.disp,
|
||||||
@@ -486,7 +491,7 @@ function slider:arrowKey(isLeft)
|
|||||||
self.change()
|
self.change()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function WIDGET.newSlider(D)--name,x,y,w[,color][,unit][,smooth][,font][,change],disp,code,hide
|
function WIDGET.newSlider(D)--name,x,y,w[,fText][,color][,unit][,smooth][,font][,change],disp,code,hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
@@ -502,6 +507,7 @@ function WIDGET.newSlider(D)--name,x,y,w[,color][,unit][,smooth][,font][,change]
|
|||||||
D.x+D.w,D.y,
|
D.x+D.w,D.y,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fText= D.fText,
|
||||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||||
unit= D.unit or 1,
|
unit= D.unit or 1,
|
||||||
smooth= false,
|
smooth= false,
|
||||||
@@ -654,7 +660,7 @@ function selector:arrowKey(isLeft)
|
|||||||
self.selText=self.list[s]
|
self.selText=self.list[s]
|
||||||
SFX.play("prerotate")
|
SFX.play("prerotate")
|
||||||
end
|
end
|
||||||
function WIDGET.newSelector(D)--name,x,y,w[,color],list,disp,code,hide
|
function WIDGET.newSelector(D)--name,x,y,w[,fText][,color],list,disp,code,hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
@@ -670,6 +676,7 @@ function WIDGET.newSelector(D)--name,x,y,w[,color],list,disp,code,hide
|
|||||||
D.x+D.w,D.y,
|
D.x+D.w,D.y,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
fText= D.fText,
|
||||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||||
list= D.list,
|
list= D.list,
|
||||||
disp= D.disp,
|
disp= D.disp,
|
||||||
@@ -832,7 +839,7 @@ function WIDGET.setLang(widgetText)
|
|||||||
for S,L in next,SCN.scenes do
|
for S,L in next,SCN.scenes do
|
||||||
if widgetText[S]then
|
if widgetText[S]then
|
||||||
for _,W in next,L.widgetList do
|
for _,W in next,L.widgetList do
|
||||||
W.text=widgetText[S][W.name]
|
W.text=W.fText or widgetText[S][W.name]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user