Skip to content

Commit

Permalink
ADD: Disable restart button while booting
Browse files Browse the repository at this point in the history
  • Loading branch information
bajdcc committed Feb 1, 2018
1 parent d31e8b5 commit d8a1d43
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
21 changes: 21 additions & 0 deletions CCGameFramework/script/lib/ui/comctl/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,27 @@ end
function M:reset(text)
self.text = text
self.layers.fg.text = text
if self.enable ~= 1 then
self.layers.bg.color = self.bgcolor
self.layers.fg.color = self.fgcolor_disable
end
self.layers.bg:update()
self.layers.fg:update()
end

function M:disabled()
self.enable = 2
self.layers.bg.color = self.bgcolor
self.layers.fg.color = self.fgcolor_disable
self.layers.bg:update()
self.layers.fg:update()
end

function M:enabled()
self.enable = 1
self.layers.bg.color = self.bgcolor
self.layers.fg.color = self.fgcolor
self.layers.bg:update()
self.layers.fg:update()
end

Expand Down
11 changes: 11 additions & 0 deletions CCGameFramework/script/scene/simu/x86.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ function M:init_event()
this.layers.rtstatus.text = string.format("IPS: %d", span)
end
this.layers.rtstatus:update_and_paint()
elseif id == 12 then
this.layers.restart_btn:enabled()
UIExt.paint()
UIExt.kill_timer(12)
end
end
self.handler[self.win_event.keydown] = function(this, code, flags)
Expand Down Expand Up @@ -171,8 +175,14 @@ function M:init_menu(info)
font_size = 16,
click = function()
UIExt.refresh(CurrentScene.layers.x86, 5)
CurrentScene.layers.restart_btn:disabled()
UIExt.set_timer(12, 6000)
UIExt.paint()
end
}):attach(slider)
self.layers.restart_btn = slider.children[#slider.children]
self.layers.restart_btn:disabled()
UIExt.set_timer(12, 6000)
Button:new({
text = '暂停/继续',
font_family = '楷体',
Expand All @@ -190,6 +200,7 @@ function M:init_menu(info)
end
}):attach(slider)
self.layers.rtstatus = slider.children[#slider.children]
UIExt.paint()
end

return M

0 comments on commit d8a1d43

Please sign in to comment.