-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui.py
86 lines (68 loc) · 1.91 KB
/
gui.py
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
import pyWinhook
import pythoncom
import os
import turtle
import star
import main
def trans(pos):
return 8 * star.maplist[pos]['pos'][0], 8 * star.maplist[pos]['pos'][1]
def setup():
turtle.setup(900, 900)
turtle.clear()
turtle.ht()
turtle.tracer(False)
pass
def map():
turtle.color('black')
for i in star.maplist:
turtle.pu()
turtle.goto(8 * i['pos'][0], 8 * i['pos'][1])
turtle.pd()
turtle.begin_fill()
turtle.circle(2)
turtle.end_fill()
turtle.update()
pass
pass
def civpos():
colors = ['red', 'green', 'blue']
for i in main.civs:
turtle.color(colors[main.civs[i].character - 1])
turtle.pu()
turtle.goto(trans(main.civiposlist[i]))
turtle.pd()
turtle.begin_fill()
turtle.circle(5)
turtle.end_fill()
pass
def staff(self_pos, self_staff):
colors = ['yellow', 'red', 'blue', 'brown', 'green']
movement = {'search': 0, 'attack': 1, 'trap': 2, 'immigrate': 3, 'communicate': 4}
for i in self_staff:
if movement[i[0]] != 0:
turtle.color(colors[movement[i[0]]])
turtle.pu()
turtle.goto(trans(self_pos))
turtle.pd()
turtle.goto(trans(i[1]))
year = 0
# print('year=', 0, civs[1].state, civs[1].stars_in_sight, civs[1].stars_landed, civs[1].staff)
hm = pyWinhook.HookManager()
def onkeyboardevent(event):
global year
year += 1
# setup()
for i in main.civs:
main.civs[i].move()
# staff(main.civiposlist[i], main.civs[i].staff)
print('stafflist:', main.stafflist,'civs:',main.civs.keys())
main.move()
# map()
# civpos()
# turtle.update()
# print('year=', year, civs[1].state, civs[1].stars_in_sight, civs[1].stars_landed, civs[1].staff)
print(year)
return True
hm.KeyDown = onkeyboardevent
hm.HookKeyboard()
pythoncom.PumpMessages()