forked from BryanLunduke/Linux-Tycoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmMain.rbfrm
500 lines (439 loc) · 13 KB
/
frmMain.rbfrm
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
#tag Window
Begin Window frmMain
BackColor = 11847396
Backdrop = ""
CloseButton = True
Composite = False
Frame = 0
FullScreen = False
HasBackColor = True
Height = 410
ImplicitInstance= True
LiveResize = False
MacProcID = 0
MaxHeight = 32000
MaximizeButton = False
MaxWidth = 32000
MenuBar = 267652706
MenuBarVisible = True
MinHeight = 64
MinimizeButton = True
MinWidth = 64
Placement = 0
Resizeable = False
Title = "Linux Tycoon"
Visible = True
Width = 620
Begin Label lblDate1
AutoDeactivate = True
Bold = ""
DataField = ""
DataSource = ""
Enabled = True
Height = 20
HelpTag = ""
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 515
LockBottom = ""
LockedInPosition= False
LockLeft = False
LockRight = True
LockTop = True
Multiline = ""
Scope = 0
Selectable = False
TabIndex = 2
TabPanelIndex = 0
TabStop = True
Text = ""
TextAlign = 2
TextColor = 16580602
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 1
Transparent = False
Underline = ""
Visible = True
Width = 100
End
Begin canvas canMain
AcceptFocus = ""
AcceptTabs = ""
AutoDeactivate = True
Backdrop = ""
DoubleBuffer = False
Enabled = True
EraseBackground = True
Height = 390
HelpTag = ""
Index = -2147483648
InitialParent = ""
Left = 0
LockBottom = True
LockedInPosition= False
LockLeft = True
LockRight = True
LockTop = True
Scope = 0
TabIndex = 0
TabPanelIndex = 0
TabStop = True
Top = 22
UseFocusRing = True
Visible = True
Width = 620
End
Begin Timer timeRedraw
Height = 32
Index = -2147483648
Left = -55
LockedInPosition= False
Mode = 2
Period = 30
Scope = 0
TabIndex = 2
TabPanelIndex = 0
TabStop = True
Top = 22
Width = 32
End
Begin Label lblDate
AutoDeactivate = True
Bold = ""
DataField = ""
DataSource = ""
Enabled = True
Height = 20
HelpTag = ""
Index = -2147483648
InitialParent = ""
Italic = ""
Left = 358
LockBottom = ""
LockedInPosition= False
LockLeft = False
LockRight = True
LockTop = True
Multiline = ""
Scope = 0
Selectable = False
TabIndex = 1
TabPanelIndex = 0
TabStop = True
Text = ""
TextAlign = 2
TextColor = 0
TextFont = "System"
TextSize = 0
TextUnit = 0
Top = 0
Transparent = False
Underline = ""
Visible = True
Width = 228
End
Begin Timer timeDayChange
Height = 32
Index = -2147483648
Left = -55
LockedInPosition= False
Mode = 0
Period = 1000
Scope = 0
TabIndex = 4
TabPanelIndex = 0
TabStop = True
Top = 74
Width = 32
End
Begin canBtn btnPause
AcceptFocus = ""
AcceptTabs = ""
AutoDeactivate = True
Backdrop = ""
DoubleBuffer = False
Enabled = True
EraseBackground = True
Height = 22
HelpTag = ""
Index = -2147483648
InitialParent = ""
isMouseOver = ""
Left = 598
LockBottom = ""
LockedInPosition= False
LockLeft = True
LockRight = ""
LockTop = True
myEnabled = ""
Scope = 0
TabIndex = 3
TabPanelIndex = 0
TabStop = True
Top = 0
UseFocusRing = True
Visible = True
Width = 22
End
Begin Timer timeMMO
Height = 32
Index = -2147483648
Left = -55
LockedInPosition= False
Mode = 0
Period = 5000
Scope = 0
TabIndex = 6
TabPanelIndex = 0
TabStop = True
Top = 157
Width = 32
End
End
#tag EndWindow
#tag WindowCode
#tag Event
Function ConstructContextualMenu(base as MenuItem, x as Integer, y as Integer) As Boolean
'base.append(New MenuItem("Set Wallpaper"))
'base.append(New MenuItem("Set Distro Logo"))
Return True
End Function
#tag EndEvent
#tag Event
Function ContextualMenuAction(hitItem as MenuItem) As Boolean
dim f as FolderItem
select case hitItem.Text
case "Set Wallpaper"
'Opens the picture using the Open shared method
f = GetOpenFolderItem(filetypes1.Jpeg + FileTypes1.Png)
if f <> nil then
CustomWallpaper=Picture.Open(f)
if CustomWallpaper <> nil then
frmMain.Backdrop = CustomWallpaper
end if
end if
case"Set Distro Logo"
'Opens the picture using the Open shared method
f = GetOpenFolderItem(filetypes1.Jpeg + FileTypes1.Png)
if f <> nil then
CustomLogo=Picture.Open(f)
if CustomLogo <> nil then
frmMain.myConDistoStats.canLogo.Backdrop = CustomLogo
end if
end if
end Select
End Function
#tag EndEvent
#tag Event
Sub Open()
me.Title = app.LongVersion
PrefBackgroundColor = rgb(255,255,255)
PrefBorderColor = rgb(0,0,128)
TheDate = new date
BuildInitialPackageList
BuildInitialDistroList
'GeneralStuff.LoadScenario(StandardScenario)
// Set the game mode
GameMode = kModeLocal
'GameMode = kModeServer
myClientSocket = new theClientSocket
if GameMode = kModeServer then
myServer = new theServer
myServer.Port = 6175
myServer.Listen
end if
isFirstRun = true
isFirstWorkerPaid = true
isFirstWorkerVolunteer = true
NewLinuxUsersDaily = 50
MyDistro = new Distro
MyDistro.Version = 1
MyDistro.ReleasedVer = 0
MyDistro.Logo = new Picture(32,32,32)
MyDistro.Logo.Graphics.DrawPicture(Tux32x32,0,0)
MyDistro.Logo.Mask.Graphics.DrawPicture(Tux32x32.Mask,0,0)
if DebugBuild = true then
'MyDistro = new Distro
'MyDistro.Bugs = 0
'MyDistro.Hype = 0
'MyDistro.Name = "MyDistro"
'MyDistro.Users = 1
'MyDistro.WorkersPaid = 10
'MyDistro.WorkersVolunteers = 10
'MyDistro.Version = 1
'MyDistro.ReleasedVer = 0
'MyDistro.ReleasedDate = new date
end if
myConMessage = new conMessage
myConMessage.EmbedWithin frmMain.canMain, 5,5
CenterContainer(myConMessage)
myConMessage.Visible = false
myConWorkerAssignment = new conWorkerAssignment
myConWorkerAssignment.EmbedWithin frmMain.canMain, 5,5
CenterContainer(myConWorkerAssignment)
myConWorkerAssignment.Visible = false
myConOverView = new conOverView
myConOverView.EmbedWithin frmMain.canMain, 5,5
LeftAlignContainer(myConOverView)
myConOverView.Visible = false
myConDistroRank = new conDistroRank
myConDistroRank.EmbedWithin frmMain.canMain, 400,68
LeftAlignContainer(myConDistroRank)
myConDistroRank.Visible = false
myConPackageSelection = new conPackageSelection
myConPackageSelection.EmbedWithin frmMain.canMain, 50,50
CenterContainer(myConPackageSelection)
myConPackageSelection.Visible = false
myConDistoStats = new conDistroStats
myConDistoStats.EmbedWithin frmMain.canMain, 5,5
myConDistoStats.Visible = false
myConNewRelease = new conNewRelease
myConNewRelease.EmbedWithin frmMain.canMain, 10,50
CenterContainer(myConNewRelease)
myConNewRelease.Visible = false
myConIntro = new conIntro
myConIntro.EmbedWithin frmMain.canMain, 50,10
CenterContainer(myConIntro)
myConIntro.Visible = false
'myConServerList = new conServerList
'myConServerList.EmbedWithin frmMain.canMain, 50,10
'CenterContainer(myConServerList)
'myConServerList.Visible = false
myConLogin = new conLogin
myConLogin.EmbedWithin frmMain.canMain, 50,10
CenterContainer(myConLogin)
myConLogin.Visible = false
myConNewUser = new conNewUser
myConNewUser.EmbedWithin frmMain.canMain, 50,10
CenterContainer(myConNewUser)
myConNewUser.Visible = false
'myConServer = new conServer
'myConServer.EmbedWithin frmMain.canMain, 50,10
'CenterContainer(myConServer)
'myConServer.Visible = false
myConSacrificeWorker = new conSacrificeWorker
myConSacrificeWorker.EmbedWithin frmMain.canMain, 50,10
CenterContainer(myConSacrificeWorker)
myConSacrificeWorker.Visible = false
myConNotifications = new conNotifications
myConNotifications.EmbedWithin frmMain.canMain, myConOverView.Left, 68
'CenterContainer(myConIntro)
myConNotifications.Visible = false
myConMainMenu = new conMainMenu
myConMainMenu.EmbedWithin frmMain.canMain, 50,10
CenterContainer(myConMainMenu)
'myConMainMenu.Visible = false
End Sub
#tag EndEvent
#tag Property, Flags = &h0
myConDistoStats As conDistroStats
#tag EndProperty
#tag Property, Flags = &h0
myConDistroRank As conDistroRank
#tag EndProperty
#tag Property, Flags = &h0
myConIntro As conIntro
#tag EndProperty
#tag Property, Flags = &h0
myConLogin As conLogin
#tag EndProperty
#tag Property, Flags = &h0
myConMainMenu As conMainMenu
#tag EndProperty
#tag Property, Flags = &h0
myConMessage As conMessage
#tag EndProperty
#tag Property, Flags = &h0
myConNewRelease As conNewRelease
#tag EndProperty
#tag Property, Flags = &h0
myConNewUser As conNewUser
#tag EndProperty
#tag Property, Flags = &h0
myConNotifications As conNotifications
#tag EndProperty
#tag Property, Flags = &h0
myConOverView As conOverView
#tag EndProperty
#tag Property, Flags = &h0
myConPackageSelection As conPackageSelection
#tag EndProperty
#tag Property, Flags = &h0
myConSacrificeWorker As conSacrificeWorker
#tag EndProperty
#tag Property, Flags = &h0
myConWorkerAssignment As conWorkerAssignment
#tag EndProperty
#tag EndWindowCode
#tag Events canMain
#tag Event
Sub Paint(g As Graphics, areas() As REALbasic.Rect)
'dim x as integer
'dim y as integer
'
'x = (g.Width / 2) - 16
'y = (g.Height / 2) - 16
'
'g.DrawPicture MyDistro.Logo,x, y
End Sub
#tag EndEvent
#tag EndEvents
#tag Events timeDayChange
#tag Event
Sub Action()
if isPaused = false then
if GameMode = kModeLocal then
IncrementByADay
end if
myConOverView.UpdateStats
myConDistroRank.UpdateDistroRank
'myConDistoStats.UpdateStats
'GeneralStuff.ShowMessage("This is a test message to test scrolling and such. Congratulations on seeing this message.")
if GameMode = KModeOnline then
btnPause.Enabled = False
btnPause.Visible = false
myConDistoStats.btnSaveQuit.Text = "Quit"
end if
end if
End Sub
#tag EndEvent
#tag EndEvents
#tag Events btnPause
#tag Event
Sub Open()
me.Text = "||"
me.DrawNormal
me.Visible = false
End Sub
#tag EndEvent
#tag Event
Sub Clicked()
if me.Text = "||" then
isPaused = true
me.Text = ">"
ElseIf me.Text = ">" then
isPaused = false
me.Text = "||"
end if
End Sub
#tag EndEvent
#tag EndEvents
#tag Events timeMMO
#tag Event
Sub Action()
myClientSocket.FetchTimeUpdate
myClientSocket.FetchFullUpdateWithoutMyDistro
myClientSocket.SendMyDistroUpdateToServer
'MsgBox "Fetched!"
'
'if myClientSocket.isBusy = false then
'myClientSocket.FetchFullUpdateWithoutMyDistro
'else
'
'end if
End Sub
#tag EndEvent
#tag EndEvents