-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdemo.py
More file actions
79 lines (47 loc) · 1.86 KB
/
demo.py
File metadata and controls
79 lines (47 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from ..gui import Gui, Page
import sbs
class StartPage(Page):
def present(self, sim, CID):
sbs.send_gui_clear(CID)
sbs.send_gui_text(
CID, "Hello, GUI", "text", 25, 30, 99, 90)
sbs.send_gui_button(CID, "Start", "start", 80,90, 99,99)
def on_message(self, sim, message_tag, clientID, _):
if message_tag == 'start':
# start the mission
sbs.create_new_sim()
sbs.resume_sim()
start_mission(sim)
def start_mission(sim):
pass
Gui.server_start_page_class(StartPage)
Gui.client_start_page_class(StartPage)
class StartPage(Page):
def present(self, sim, CID):
sbs.send_gui_clear(CID)
sbs.send_gui_text(
CID, "Hello, GUI", "text", 25, 30, 99, 90)
sbs.send_gui_button(CID, "Sub page", "subpage", 85, 90, 99, 94)
sbs.send_gui_button(CID, "Start", "start", 80,95, 99,99)
def on_message(self, sim, message_tag, clientID, _):
if message_tag == 'start':
# start the mission
sbs.create_new_sim()
sbs.resume_sim()
start_mission(sim)
if message_tag == 'subpage':
Gui.push(sim,clientID, SubPage())
def start_mission(sim):
pass
class SubPage(Page):
def present(self, sim, CID):
sbs.send_gui_clear(CID)
sbs.send_gui_text(
CID, "Sub Page", "text", 25, 30, 99, 90)
sbs.send_gui_button(CID, "Back", "back", 85, 90, 99, 94)
sbs.send_gui_button(CID, "Another", "again", 85, 95, 99, 99)
def on_message(self, sim, message_tag, clientID, _):
if message_tag == 'back':
Gui.pop(sim,clientID)
if message_tag == 'again':
Gui.push(sim,clientID, SubPage())