-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfboat.kv
More file actions
596 lines (529 loc) · 10.4 KB
/
fboat.kv
File metadata and controls
596 lines (529 loc) · 10.4 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
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
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
#:kivy 1.10
# Kivy file defining GUI layout
# API docs:
# https://kivy.org/doc/stable/api-kivy.html
# TODO:
# * Play Screen
# * Pop-up Notifications
Manager:
id: screen_manager
playScr: playScr
placement_scr: placementScr
ConnectScreen:
name: "connectScr"
id: connectScr
pos: root.pos
size: root.size
JoinScreen:
name: "joinScr"
id: joinScr
pos: root.pos
size: root.size
PlacementScreen:
name: "placementScr"
id: placementScr
pos: root.pos
size: root.size
PlayScreen:
name: "playScr"
id: playScr
pos: root.pos
size: root.size
<ConnectScreen>:
manager: root.manager
id: conn_scr
canvas:
Color:
rgb: app.colorLightGray + [1]
Rectangle:
size: root.size
pos: root.pos
BoxLayout:
padding: [0, 0, 0, conn_scr.height/25]
orientation: 'vertical'
Label:
text: "Fighter Boat"
font_size: 200
text_size: (conn_scr.width*3/4, conn_scr.height/3)
halign: 'center'
color: app.colorMain + [1]
GridLayout:
size_hint: (None, .4)
pos_hint: {'center_x': .5}
width: conn_scr.width/3
spacing: [0, 30]
cols: 2
Label:
size_hint_y: None
pos_hint: {'right': conn_scr.center_x}
color: app.colorDarkGray + [1]
text: "Server Address"
TextInput:
text: root.address
pos_hint: {'left': conn_scr.center_x}
size_hint_y: None
padding: [0, self.height/3]
color: app.colorBlack + [1]
multiline: False
on_text: root.address = self.text
Label:
pos_hint: {'right': conn_scr.center_x}
size_hint_y: None
color: app.colorDarkGray + [1]
text: "Server Port"
TextInput:
text: root.port
pos_hint: {'left': conn_scr.center_x}
size_hint_y: None
padding: [0, self.height/3]
color: app.colorBlack + [1]
multiline: False
on_text: root.port = self.text
Button:
size_hint: (None, .2)
pos_hint: {'center_x': .5, 'center_y': .5}
width: conn_scr.width/4
text: "Connect"
on_press: root.create_connection()
<JoinScreen>:
manager: root.manager
join_buttons: join_button_1, join_button_2, join_button_3, join_button_4
waitText: wait_text
id: join_screen
canvas:
Color:
rgb: app.colorLightGray + [1]
Rectangle:
size: self.size
pos: self.pos
BoxLayout:
padding: [join_screen.width/10, join_screen.height/6]
spacing: join_screen.height/20
orientation: 'vertical'
Label:
text: "Select Number of Opponents"
color: app.colorDarkGray + [1]
font_size: 75
background_color: app.colorBlack + [1]
BoxLayout:
spacing: join_screen.width/20
Button:
id: join_button_1
text: '1'
color: app.colorDarkGray + [1]
font_size: 80
background_color: app.colorMain + [1]
background_normal: ''
on_press: root.send_join_msg(self.text)
Button:
id: join_button_2
text: '2'
color: app.colorDarkGray + [1]
font_size: 80
background_color: app.colorMain + [1]
background_normal: ''
on_press: root.send_join_msg(self.text)
Button:
id: join_button_3
text: '3'
color: app.colorDarkGray + [1]
font_size: 80
background_color: app.colorMain + [1]
background_normal: ''
on_press: root.send_join_msg(self.text)
Button:
id: join_button_4
text: '4'
color: app.colorDarkGray + [1]
font_size: 80
background_color: app.colorMain + [1]
background_normal: ''
on_press: root.send_join_msg(self.text)
Label:
id: wait_text
text: "Loading..."
font_size: 40
color: app.colorDarkGray + [0]
background_color: app.colorBlack + [0]
<PlacementScreen>:
id: placement_screen
manager: root.manager
hor: root.hor
boat_span: root.boat_span
boatButtons: [place_1, place_2, place_3, place_4, place_5]
canvas:
Color:
rgb: app.colorLightGray + [1]
Rectangle:
size: self.size
pos: self.pos
BoxLayout:
orientation: 'vertical'
padding: [placement_screen.width/10, placement_screen.height/40, placement_screen.width/10, placement_screen.height/20]
spacing: placement_screen.height/25
Button:
text: 'Place your ships'
height: placement_screen.height/8
font_size: 75
size_hint_y: .15
BoxLayout:
size_hint_y: .7
FbBoard:
id: board
size_hint_x: .7
BoxLayout:
size_hint_x: .1
orientation: 'vertical'
Button:
size_hint_y: 1/9
font_size: 40
markup: True
text: "[u][b]Select a boat[/b][/u]"
background_normal: ''
background_color: app.colorLightGray + [1]
color: app.colorDarkGray + [1]
BoxLayout:
orientation: 'vertical'
spacing: placement_screen.height/20
size_hint_y: 8/9
BoatButton:
text: 'Place 2 Boat'
id: place_1
on_press: self.register_click()
BoatButton:
text: 'Place 3 Boat'
id: place_2
on_press: self.register_click()
BoatButton:
text: 'Place 3 Boat'
id: place_3
on_press: self.register_click()
BoatButton:
text: 'Place 4 Boat'
id: place_4
on_press: self.register_click()
BoatButton:
text: 'Place 5 Boat'
id: place_5
on_press: self.register_click()
BoxLayout:
size_hint_y: .1
spacing: self.width/15
Button:
# size_hint_x: .1
text: 'Rotate selected boat'
size_hint_x: .75
background_normal: ''
background_color: (.7, .3, .5, 1)
on_press: root.hor = not root.hor
Button:
text: 'Ready to play'
on_press: root.go_to_play()
size_hint_x: .25
background_normal: ''
background_color: (.7, .3, .5, 1)
<BoatButton>:
background_normal: ''
background_color: (.5, .7, .3, 1)
text_size: self.width, None
halign: 'center'
<PlayScreen>:
id: placement_screen
manager: root.manager
canvas:
Color:
rgb: app.colorLightGray + [1]
Rectangle:
size: self.size
pos: self.pos
TabbedPanel:
id: panelFrame
background_color: app.colorAccent1
background_image: ''
do_default_tab: False
PlayTab:
id: tab_0
text: "You"
background_color: app.colorAccent2
background_image: ''
<PlayTab>:
BoxLayout:
orientation: 'vertical'
Label:
size_hint_y: .1
id: namePlate
FbBoard:
size_hint_y: .9
id: board
<FbBoard>:
id: board
BoxLayout:
orientation: 'vertical'
padding: [board.width/10, 0]
spacing: 2
FbBoardRow:
Button:
background_normal: ''
background_color: (0, 0, 0, 0)
BoardLabel:
text: 'A'
BoardLabel:
text: 'B'
BoardLabel:
text: 'C'
BoardLabel:
text: 'D'
BoardLabel:
text: 'E'
BoardLabel:
text: 'F'
BoardLabel:
text: 'G'
BoardLabel:
text: 'H'
FbBoardRow:
BoardLabel:
text: '1'
FbBoardSpace:
text: "00"
id: space00
FbBoardSpace:
text: "10"
id: space10
FbBoardSpace:
text: "20"
id: space20
FbBoardSpace:
text: "30"
id: space30
FbBoardSpace:
text: "40"
id: space40
FbBoardSpace:
text: "50"
id: space50
FbBoardSpace:
text: "60"
id: space60
FbBoardSpace:
text: "70"
id: space70
FbBoardRow:
BoardLabel:
text: '2'
FbBoardSpace:
text: "01"
id: space01
FbBoardSpace:
text: "11"
id: space11
FbBoardSpace:
text: "21"
id: space21
FbBoardSpace:
text: "31"
id: space31
FbBoardSpace:
text: "41"
id: space41
FbBoardSpace:
text: "51"
id: space51
FbBoardSpace:
text: "61"
id: space61
FbBoardSpace:
text: "71"
id: space71
FbBoardRow:
BoardLabel:
text: '3'
FbBoardSpace:
text: "02"
id: space02
FbBoardSpace:
text: "12"
id: space12
FbBoardSpace:
text: "22"
id: space22
FbBoardSpace:
text: "32"
id: space32
FbBoardSpace:
text: "42"
id: space42
FbBoardSpace:
text: "52"
id: space52
FbBoardSpace:
text: "62"
id: space62
FbBoardSpace:
text: "72"
id: space72
FbBoardRow:
BoardLabel:
text: '4'
FbBoardSpace:
text: "03"
id: space03
FbBoardSpace:
text: "13"
id: space13
FbBoardSpace:
text: "23"
id: space23
FbBoardSpace:
text: "33"
id: space33
FbBoardSpace:
text: "43"
id: space43
FbBoardSpace:
text: "53"
id: space53
FbBoardSpace:
text: "63"
id: space63
FbBoardSpace:
text: "73"
id: space73
FbBoardRow:
BoardLabel:
text: '5'
FbBoardSpace:
text: "04"
id: space04
FbBoardSpace:
text: "14"
id: space14
FbBoardSpace:
text: "24"
id: space24
FbBoardSpace:
text: "34"
id: space34
FbBoardSpace:
text: "44"
id: space44
FbBoardSpace:
text: "54"
id: space54
FbBoardSpace:
text: "64"
id: space64
FbBoardSpace:
text: "74"
id: space74
FbBoardRow:
BoardLabel:
text: '6'
FbBoardSpace:
text: "05"
id: space05
FbBoardSpace:
text: "15"
id: space15
FbBoardSpace:
text: "25"
id: space25
FbBoardSpace:
text: "35"
id: space35
FbBoardSpace:
text: "45"
id: space45
FbBoardSpace:
text: "55"
id: space55
FbBoardSpace:
text: "65"
id: space65
FbBoardSpace:
text: "75"
id: space75
FbBoardRow:
BoardLabel:
text: '7'
FbBoardSpace:
text: "06"
id: space06
FbBoardSpace:
text: "16"
id: space16
FbBoardSpace:
text: "26"
id: space26
FbBoardSpace:
text: "36"
id: space36
FbBoardSpace:
text: "46"
id: space46
FbBoardSpace:
text: "56"
id: space56
FbBoardSpace:
text: "66"
id: space66
FbBoardSpace:
text: "76"
id: space76
FbBoardRow:
BoardLabel:
text: '8'
FbBoardSpace:
text: "07"
id: space07
FbBoardSpace:
text: "17"
id: space17
FbBoardSpace:
text: "27"
id: space27
FbBoardSpace:
text: "37"
id: space37
FbBoardSpace:
text: "47"
id: space47
FbBoardSpace:
text: "57"
id: space57
FbBoardSpace:
text: "67"
id: space67
FbBoardSpace:
text: "77"
id: space77
<FbBoardSpace>:
background_normal: ''
background_color: (.7, .7, .7, 1)
color: (0,0,0,0)
<BoardLabel@Label>:
color: (0, 0, 0, 1)
<FbBoardRow@BoxLayout>:
orientation: 'horizontal'
spacing: 2
# <PlayScreen>:
# BoxLayout:
# ScreenManager:
# MenuScreen:
# SettingsScreen:
# <MenuScreen>:
# id: 'menu'
# BoxLayout:
# Button:
# text: 'Goto settings'
# on_press: root.manager.current = 'settings'
# Button:
# text: 'Quit'
# <SettingsScreen>:
# id: "settings"
# BoxLayout:
# Button:
# text: 'My settings button'
# Button:
# text: 'Back to menu'
# on_press: root.manager.current = 'menu'