Begin work on server selection screen

This commit is contained in:
Nick Bisby 2019-02-10 14:47:24 -06:00
parent f2358a1e42
commit cf4554b7e6
No known key found for this signature in database
GPG Key ID: F6E0C4E6D0B5EB36
4 changed files with 69 additions and 36 deletions

View File

@ -0,0 +1,9 @@
sub init()
print "HI"
m.top.backgroundColor = "#000b35"
r = m.top.findNode("theRect")
print(r)
m.top.visible = true
print "HI"
m.top.setFocus(true)
end sub

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="ServerSelect" extends="Scene">
<children>
<Rectangle
id="theRect"
color="#000b35"
width="1920"
height="1080"
opacity=".6"
translation="[0,0]" />
<label text="Connect to Server" translation="[150, 150]" />
</children>
<interface>
<field id="hostname" type="string" />
<field id="port" type="string" />
</interface>
<script type="text/brightscript" uri="pkg:/components/ServerSelect.brs"/>
</component>

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<component name="ServerSelect" extends="Scene">
<!-- BrightScript Portion -->
<script type="text/brightscript" >
<![CDATA[
'**
'** Example: Edit a Label size and color with BrightScript
'**
function init()
m.top.setFocus(true)
'**
'** The full list of editable attributes can be located at:
'** http://sdkdocs.roku.com/display/sdkdoc/Label#Label-Fields
'**
end function
]]>
</script>
<!-- End of BrightScript Portion -->
</component>

View File

@ -1,25 +1,26 @@
sub Main()
'Indicate this is a Roku SceneGraph application'
globals()
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
if get_setting("server") = invalid then
set_setting("server", get_var("server"))
screen.CreateScene("ServerSelect")
screen.show()
' TODO - Do server select logic here
print("SERVER IS MISSING")
ShowServerSelect()
end if
print("WE MOVED ON")
m.port = CreateObject("roMessagePort")
if get_setting("active_user") = invalid then
screen = CreateObject("roSGScreen")
screen.setMessagePort(m.port)
screen.CreateScene("UserSignIn")
screen.show()
' TODO - sign in here
get_token(get_var("username"), get_var("password"))
await_response()
screen.close()
end if
screen = CreateObject("roSGScreen")
screen.setMessagePort(m.port)
first_scene = "Library"
'Create a scene and load a component'
m.scene = screen.CreateScene(first_scene)
@ -30,6 +31,8 @@ sub Main()
'librow.GetRowListContent()
print 1 + "halt"
while(true)
msg = wait(0, m.port)
msgType = type(msg)
@ -39,8 +42,30 @@ sub Main()
end while
end sub
sub ShowServerSelect()
screen = CreateObject("roSGScreen")
m.port = CreateObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.CreateScene("ServerSelect")
screen.show()
function get_var(key as String)
return GetGlobalAA().Lookup(key)
end function
while(true)
msg = wait(0, m.port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed() then return
end if
end while
end sub
sub await_response()
while(true)
msg = wait(0, m.port)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed() then return
end if
end while
end sub