-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiagram.py
67 lines (56 loc) · 2.03 KB
/
diagram.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
class Diagram:
def __init__(self):
self.BlueBox = None
self.GreenBox = None
self.YellowBox = None
self.VAxis = None
self.HAxis = None
self.ScaleLength = 0
def Show(self, switch):
self.BlueBox.setVisible(switch)
self.GreenBox.setVisible(switch)
self.YellowBox.setVisible(switch)
self.VAxis.setVisible(switch)
self.HAxis.setVisible(switch)
def ShowCrustDiagram(self, planet):
minerals = planet.Explored.Crust.Ironium + planet.Explored.Crust.Boranium + planet.Explored.Crust.Germanium
if planet.Discovered and minerals > 0:
box = self.BlueBox.rect()
box.setBottom(-self.ScaleLength * planet.Explored.Crust.Ironium / 100.0)
self.BlueBox.setRect(box)
box = self.GreenBox.rect()
box.setBottom(-self.ScaleLength * planet.Explored.Crust.Boranium / 100.0)
self.GreenBox.setRect(box)
box = self.YellowBox.rect()
box.setBottom(-self.ScaleLength * planet.Explored.Crust.Germanium / 100.0)
self.YellowBox.setRect(box)
self.Show(True)
else:
self.Show(False)
def ShowSurfaceDiagram(self, planet):
minerals = planet.Explored.Surface.Ironium + planet.Explored.Surface.Boranium + planet.Explored.Surface.Germanium
if planet.Discovered and minerals > 0:
if planet.Explored.Surface.Ironium < 120:
val = planet.Explored.Surface.Ironium / 100.0
else:
val = 1.2
box = self.BlueBox.rect()
box.setBottom(-self.ScaleLength * val)
self.BlueBox.setRect(box)
if planet.Explored.Surface.Boranium < 120:
val = planet.Explored.Surface.Boranium / 100.0
else:
val = 1.2
box = self.GreenBox.rect()
box.setBottom(-self.ScaleLength * val)
self.GreenBox.setRect(box)
if planet.Explored.Surface.Germanium < 120:
val = planet.Explored.Surface.Germanium / 100.0
else:
val = 1.2
box = self.YellowBox.rect()
box.setBottom(-self.ScaleLength * val)
self.YellowBox.setRect(box)
self.Show(True)
else:
self.Show(False)