Add some UI to dev player
This commit is contained in:
1 parent
43b62a0ef8
commit
5c215ca974
19 files changed
+292
-4
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.background = m.top.findNode("background")
|
||||
m.icon = m.top.findNode("icon")
|
||||
|
||||
OnDisabledChange()
|
||||
|
||||
m.top.observeField("focusedChild", FuncName(OnFocusedChild))
|
||||
end function
|
||||
|
||||
function OnFocusedChild()
|
||||
m.top.buttonFocused = m.top.hasFocus()
|
||||
end function
|
||||
|
||||
function OnButtonFocused()
|
||||
buttonFocused = m.top.buttonFocused
|
||||
|
||||
if buttonFocused
|
||||
m.background.blendColor = m.top.focusedBackgroundColor
|
||||
m.icon.blendColor = m.top.focusedIconColor
|
||||
else
|
||||
m.background.blendColor = m.top.backgroundColor
|
||||
m.icon.blendColor = m.top.iconColor
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnDisabledChange()
|
||||
disabled = m.top.disabled
|
||||
|
||||
if disabled
|
||||
m.background.blendColor = m.top.disabledBackgroundColor
|
||||
m.icon.blendColor = m.top.disabledIconColor
|
||||
else
|
||||
OnButtonFocused()
|
||||
end if
|
||||
m.top.focusable = not disabled
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if not press
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = "OK"
|
||||
disabled = m.top.disabled
|
||||
if not disabled
|
||||
m.top.buttonSelected = true
|
||||
end if
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
Reference in new issue
Block a user