滑条和开关控件也可以有颜色了,修复一个节日名字打错导致报错
This commit is contained in:
@@ -323,7 +323,7 @@ function switch:draw()
|
|||||||
--Text
|
--Text
|
||||||
local t=self.text
|
local t=self.text
|
||||||
if t then
|
if t then
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(self.color)
|
||||||
setFont(self.font)
|
setFont(self.font)
|
||||||
gc.printf(t,x-412-ATV,y+20-self.font*.7,400,"right")
|
gc.printf(t,x-412-ATV,y+20-self.font*.7,400,"right")
|
||||||
end
|
end
|
||||||
@@ -335,7 +335,7 @@ function switch:press()
|
|||||||
self.code()
|
self.code()
|
||||||
SFX.play("move")
|
SFX.play("move")
|
||||||
end
|
end
|
||||||
function WIDGET.newSwitch(D)--name,x,y[,font][,disp],code,hide
|
function WIDGET.newSwitch(D)--name,x,y[,color][,font][,disp],code,hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
@@ -346,6 +346,7 @@ function WIDGET.newSwitch(D)--name,x,y[,font][,disp],code,hide
|
|||||||
D.x+25,D.y,
|
D.x+25,D.y,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
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,
|
||||||
code= D.code,
|
code= D.code,
|
||||||
@@ -446,7 +447,7 @@ function slider:draw()
|
|||||||
--Text
|
--Text
|
||||||
local t=self.text
|
local t=self.text
|
||||||
if t then
|
if t then
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(self.color)
|
||||||
setFont(self.font)
|
setFont(self.font)
|
||||||
gc.printf(t,x-312-ATV,y-self.font*.7,300,"right")
|
gc.printf(t,x-312-ATV,y-self.font*.7,300,"right")
|
||||||
end
|
end
|
||||||
@@ -485,7 +486,7 @@ function slider:arrowKey(isLeft)
|
|||||||
self.change()
|
self.change()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function WIDGET.newSlider(D)--name,x,y,w[,unit][,smooth][,font][,change],disp,code,hide
|
function WIDGET.newSlider(D)--name,x,y,w[,color][,unit][,smooth][,font][,change],disp,code,hide
|
||||||
local _={
|
local _={
|
||||||
name= D.name,
|
name= D.name,
|
||||||
|
|
||||||
@@ -501,6 +502,7 @@ function WIDGET.newSlider(D)--name,x,y,w[,unit][,smooth][,font][,change],disp,co
|
|||||||
D.x+D.w,D.y,
|
D.x+D.w,D.y,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
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,
|
||||||
font= D.font or 30,
|
font= D.font or 30,
|
||||||
@@ -577,7 +579,6 @@ function selector:update()
|
|||||||
end
|
end
|
||||||
function selector:draw()
|
function selector:draw()
|
||||||
local x,y=self.x,self.y
|
local x,y=self.x,self.y
|
||||||
local r,g,b=unpack(self.color)
|
|
||||||
local w=self.w
|
local w=self.w
|
||||||
local ATV=self.ATV
|
local ATV=self.ATV
|
||||||
|
|
||||||
@@ -607,7 +608,7 @@ function selector:draw()
|
|||||||
setFont(30)
|
setFont(30)
|
||||||
t=self.text
|
t=self.text
|
||||||
if t then
|
if t then
|
||||||
gc.setColor(r,g,b)
|
gc.setColor(self.color)
|
||||||
mStr(self.text,x+w*.5,y+17-21)
|
mStr(self.text,x+w*.5,y+17-21)
|
||||||
end
|
end
|
||||||
gc.setColor(1,1,1)
|
gc.setColor(1,1,1)
|
||||||
@@ -814,14 +815,15 @@ function WIDGET.set(list)
|
|||||||
end
|
end
|
||||||
if FESTIVAL and SCN.cur~="custom_field"then
|
if FESTIVAL and SCN.cur~="custom_field"then
|
||||||
local c1,c2,c3
|
local c1,c2,c3
|
||||||
if FESTIVAL=="Xmas"then
|
if FESTIVAL=="xMas"then
|
||||||
c1,c2,c3=COLOR.red,COLOR.white,COLOR.green
|
c1,c2,c3=COLOR.red,COLOR.white,COLOR.green
|
||||||
elseif FESTIVAL=="sprFes"then
|
elseif FESTIVAL=="sprFes"then
|
||||||
c1,c2,c3=COLOR.red,COLOR.orange,COLOR.yellow
|
c1,c2,c3=COLOR.red,COLOR.orange,COLOR.yellow
|
||||||
end
|
end
|
||||||
|
local rnd=math.random
|
||||||
for _,W in next,list do
|
for _,W in next,list do
|
||||||
if W.color then
|
if W.color then
|
||||||
W.color=math.random()<.3 and c1 or math.random()<.5 and c2 or c3
|
W.color=rnd()<.3 and c1 or rnd()<.5 and c2 or c3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user