Fix ui flicker in dev player
This commit is contained in:
1 parent
5c215ca974
commit
ee8f7a05dd
4 files changed
+24
-3
No files matched your search
@@ -3,6 +3,7 @@ import "pkg:/source/utils/Types.bs"
|
|||||||
function Init()
|
function Init()
|
||||||
m.background = m.top.findNode("background")
|
m.background = m.top.findNode("background")
|
||||||
m.icon = m.top.findNode("icon")
|
m.icon = m.top.findNode("icon")
|
||||||
|
m.icon2 = m.top.findNode("icon2")
|
||||||
|
|
||||||
OnDisabledChange()
|
OnDisabledChange()
|
||||||
|
|
||||||
@@ -19,9 +20,11 @@ function OnButtonFocused()
|
|||||||
if buttonFocused
|
if buttonFocused
|
||||||
m.background.blendColor = m.top.focusedBackgroundColor
|
m.background.blendColor = m.top.focusedBackgroundColor
|
||||||
m.icon.blendColor = m.top.focusedIconColor
|
m.icon.blendColor = m.top.focusedIconColor
|
||||||
|
m.icon2.blendColor = m.top.focusedIconColor
|
||||||
else
|
else
|
||||||
m.background.blendColor = m.top.backgroundColor
|
m.background.blendColor = m.top.backgroundColor
|
||||||
m.icon.blendColor = m.top.iconColor
|
m.icon.blendColor = m.top.iconColor
|
||||||
|
m.icon2.blendColor = m.top.iconColor
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -31,6 +34,7 @@ function OnDisabledChange()
|
|||||||
if disabled
|
if disabled
|
||||||
m.background.blendColor = m.top.disabledBackgroundColor
|
m.background.blendColor = m.top.disabledBackgroundColor
|
||||||
m.icon.blendColor = m.top.disabledIconColor
|
m.icon.blendColor = m.top.disabledIconColor
|
||||||
|
m.icon2.blendColor = m.top.disabledIconColor
|
||||||
else
|
else
|
||||||
OnButtonFocused()
|
OnButtonFocused()
|
||||||
end if
|
end if
|
||||||
@@ -52,3 +56,10 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function OnToggleStateChange()
|
||||||
|
toggleState = m.top.toggleState
|
||||||
|
|
||||||
|
m.icon.visible = toggleState
|
||||||
|
m.icon2.visible = not toggleState
|
||||||
|
end function
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
<field id="disabledBackgroundColor" type="color" value="#292929" />
|
<field id="disabledBackgroundColor" type="color" value="#292929" />
|
||||||
|
|
||||||
<field id="iconUri" type="uri" alias="icon.uri" />
|
<field id="iconUri" type="uri" alias="icon.uri" />
|
||||||
|
<field id="iconUri2" type="uri" alias="icon2.uri" />
|
||||||
|
<field id="toggleState" type="boolean" value="true" onChange="OnToggleStateChange" />
|
||||||
|
|
||||||
<field id="iconColor" type="color" value="#DDDDDD" />
|
<field id="iconColor" type="color" value="#DDDDDD" />
|
||||||
<field id="focusedIconColor" type="color" value="#262626" />
|
<field id="focusedIconColor" type="color" value="#262626" />
|
||||||
<field id="disabledIconColor" type="color" value="#606060" />
|
<field id="disabledIconColor" type="color" value="#606060" />
|
||||||
@@ -24,6 +27,12 @@
|
|||||||
width="42"
|
width="42"
|
||||||
height="42">
|
height="42">
|
||||||
</Poster>
|
</Poster>
|
||||||
|
<Poster
|
||||||
|
id="icon2"
|
||||||
|
width="42"
|
||||||
|
height="42"
|
||||||
|
visible="false">
|
||||||
|
</Poster>
|
||||||
</Poster>
|
</Poster>
|
||||||
</children>
|
</children>
|
||||||
</component>
|
</component>
|
||||||
@@ -170,9 +170,9 @@ end function
|
|||||||
function OnPlayerStateChange()
|
function OnPlayerStateChange()
|
||||||
state = m.top.state
|
state = m.top.state
|
||||||
if state = "playing"
|
if state = "playing"
|
||||||
m.playButton.iconUri = "pkg:/images/icons/player/pause.png"
|
m.playButton.toggleState = false ' Pause icon
|
||||||
else if state = "paused"
|
else if state = "paused"
|
||||||
m.playButton.iconUri = "pkg:/images/icons/player/play.png"
|
m.playButton.toggleState = true ' Play icon
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,8 @@
|
|||||||
disabled="true" />
|
disabled="true" />
|
||||||
<VideoPlayerButton
|
<VideoPlayerButton
|
||||||
id="PlayButton"
|
id="PlayButton"
|
||||||
iconUri="pkg:/images/icons/player/play.png" />
|
iconUri="pkg:/images/icons/player/play.png"
|
||||||
|
iconUri2="pkg:/images/icons/player/pause.png" />
|
||||||
<VideoPlayerButton
|
<VideoPlayerButton
|
||||||
id="NextButton"
|
id="NextButton"
|
||||||
iconUri="pkg:/images/icons/player/next.png"
|
iconUri="pkg:/images/icons/player/next.png"
|
||||||
|
|||||||
Reference in new issue
Block a user