-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame Menu-Teste.sb
More file actions
217 lines (194 loc) · 5.6 KB
/
Game Menu-Teste.sb
File metadata and controls
217 lines (194 loc) · 5.6 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
'Game Menu 0.7
'Small Quest (Teste)
'Copyright © 2015 Filipe Cardoso Martins and Nonki Takahashi. The MIT License.
'Last update 2015-06-25
'Program ID CBW762-1
'Configurações da janela do jogo. / The game window settings.
GraphicsWindow.Hide()
GraphicsWindow.Show()
GraphicsWindow.Title = "Game Menu 0.7"
GraphicsWindow.Height = "550"
GraphicsWindow.Width = "800"
'Designer da janela do jogo. / Designer of the game window.
GraphicsWindow.BackgroundColor= "DodgerBlue"
GraphicsWindow.BrushColor= GraphicsWindow.GetColorFromRGB (255, 255, 255)
GraphicsWindow.FillRectangle (10, 10, 780, 530)
GraphicsWindow.BrushColor= GraphicsWindow.GetColorFromRGB (0, 0, 0)
GraphicsWindow.FillRectangle (15, 15, 770, 520)
'Foto de Fundo. / Photo Fund.
imagem = ImageList.LoadImage(Program.Directory + "/image/FundoTelaCarregamento.png")
GraphicsWindow.DrawImage(imagem, 15, 15)
GraphicsWindow.BrushColor = "#CC000000"
GraphicsWindow.FillRectangle(300, 160, 200, 260)
'Título do jogo / Game title.
GraphicsWindow.BrushColor = "DarkOrange"
GraphicsWindow.FontSize = "40"
nameGame = Shapes.AddText("Small Quest")
Shapes.Move(nameGame, 280, 50)
lang = "en-US" 'idioma padrão / default language
GetTextFromDAT()
'Configurações do game menu. / Game settings menu.
GameMenu_Add()
GraphicsWindow.MouseMove = OnMouseMove
GraphicsWindow.MouseDown = OnMouseDown
GameMenu_Select()
Program.End()
Sub Game_New
EndSub
Sub GameMenu_Add
GraphicsWindow.BrushColor = "DeepSkyBlue"
GraphicsWindow.FontSize = "20"
menuName = Shapes.AddText(dat["gameMenu"])
Shapes.Move(menuName, dat["gameMenuX"], 110)
GraphicsWindow.BrushColor = "White"
dark = 30
y0 = 180
dy = 35
For i = 1 To nMenu
y = y0 + (i - 1) * dy
menu[i] = Shapes.AddText(dat["menu" + i])
Shapes.Move(menu[i], dat["menuX" + i], y)
Shapes.SetOpacity(menu[i], dark)
EndFor
EndSub
Sub GameMenu_Select
inGame = "True"
While inGame
If mouseMove Then
my = GraphicsWindow.MouseY
selected = ""
For i = 1 To nMenu
y1 = y0 + (i - 1) * dy
y2 = y1 + dy
If y1 <= my And my < y2 Then
Shapes.SetOpacity(menu[i], 100)
selected = i
Else
Shapes.SetOpacity(menu[i], dark)
EndIf
EndFor
mouseMove = "False"
EndIf
If mouseDown Then
If selected = 1 Then 'CONTINUAR / CONTINUE
title = dat["warning"]
txt = dat["warning1"]
GraphicsWindow.ShowMessage(txt, title)
ElseIf selected = 2 Then 'NOVO JOGO / NEW GAME
Game_New()
ElseIf selected = 3 Then 'LINGUAGEM / LANGUAGE
GameMenu_Remove()
Language_Add()
mouseDown = "False"
Language_Select()
Language_Remove()
GameMenu_Add()
ElseIf selected = 4 Then 'AJUDA / HELP
title = dat["warning"]
txt = dat["warning1"]
GraphicsWindow.ShowMessage(txt, title)
ElseIf selected = 5 Then 'SAIR / EXIT
inGame = "False"
EndIf
mouseDown = "False"
EndIf
EndWhile
EndSub
Sub GameMenu_Remove
Shapes.Remove(menuName)
For i = 1 To nMenu
Shapes.Remove(menu[i])
EndFor
EndSub
Sub GetTextFromDAT
Stack.PushValue("local", i)
ln = 1
datLine = File.ReadLine(Program.Directory + "/" + lang + ".dat", ln)
While datLine <> ""
nItem = Array.GetItemCount(datLine)
index = Array.GetAllIndices(datLine)
For i = 1 To nItem
dat[index[i]] = datLine[index[i]]
EndFor
ln = ln + 1
datLine = File.ReadLine(Program.Directory + "/" + lang + ".dat", ln)
EndWhile
For i = 1 To 10 ' max menu
If Array.ContainsIndex(dat, "menu" + i) Then
nMenu = i
EndIf
EndFor
i = Stack.PopValue("local")
EndSub
Sub Language_Add
GraphicsWindow.BrushColor = "DeepSkyBlue"
GraphicsWindow.FontSize = "20"
menuName = Shapes.AddText("LANGUAGE SELECTION")
Shapes.Move(menuName, 284, 110)
'Texto Básico para teste / Basic text for testing.
GraphicsWindow.BrushColor = "White"
menu[1] = Shapes.AddText("ENGLISH")
Shapes.Move(menu[1], 360, 180)
flag[1] = Shapes.AddImage(Program.Directory + "/image/EstadosUnidos.png")
Shapes.Move(flag[1], 320, 180 + 4)
menu[2] = Shapes.AddText("PORTUGÊS")
Shapes.Move(menu[2], 360, 215)
flag[2] = Shapes.AddImage(Program.Directory + "/image/Brasil.png")
Shapes.Move(flag[2], 320, 215 + 4)
menu[3] = Shapes.AddText("日本語")
Shapes.Move(menu[3], 360, 250)
flag[3] = Shapes.AddImage(Program.Directory + "/image/Japam.png")
Shapes.Move(flag[3], 320, 250 + 4)
nLang = 3
For i = 1 To nLang
Shapes.SetOpacity(menu[i], dark)
Shapes.SetOpacity(flag[i], dark)
EndFor
EndSub
Sub Language_Select
inSelection = "True"
While inSelection
If mouseMove Then
my = GraphicsWindow.MouseY
selected = ""
For i = 1 To nLang
y1 = y0 + (i - 1) * dy
y2 = y1 + dy
If y1 <= my And my < y2 Then
Shapes.SetOpacity(menu[i], 100)
Shapes.SetOpacity(flag[i], 100)
selected = i
If selected = 1 Then
lang = "en-US"
ElseIf selected = 2 Then
lang = "pt-BR"
ElseIf selected = 3 Then
lang = "ja-JP"
EndIf
GetTextFromDAT()
Else
Shapes.SetOpacity(menu[i], dark)
Shapes.SetOpacity(flag[i], dark)
EndIf
EndFor
mouseMove = "False"
EndIf
If mouseDown Then
inSelection = "False"
mouseDown = "False"
EndIf
EndWhile
EndSub
Sub Language_Remove
Shapes.Remove(menuName)
For i = 1 To nLang
Shapes.Remove(menu[i])
Shapes.Remove(flag[i])
EndFor
EndSub
Sub OnMouseMove
mouseMove = "True"
EndSub
Sub OnMouseDown
mouseDown = "True"
EndSub