-
Notifications
You must be signed in to change notification settings - Fork 0
/
State_Intro.py
170 lines (94 loc) · 3.76 KB
/
State_Intro.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
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
from Platform_Windows import CAttribute
from OSPlatform import Platform
import Engine
import State
import Renderer
import Timing
class IntroState (State.AState) :
def Load(self) :
Renderer.WriteToLog("Intro State: Loaded")
if self.Loaded == False :
self.Title_Cells .String = self.IntroTitle
self.Version_Cells.String = self.EngineVersion
self.Title_Cells .SetAttribute(Renderer.CAttribute.FG_Intensity)
self.Version_Cells.SetAttribute(Renderer.CAttribute.FG_Intensity)
startingCell = Renderer.Vec2D()
startingCell.Y = 9
startingCell.X = int(Renderer.CBufferWidth / 2) - int(len(self.IntroTitle) / 2) - 1
self.Title_Cells.Position = Platform.CreateCoord(X = startingCell.X, Y = startingCell. Y)
startingCell.Y = 11
startingCell.X = int(Renderer.CBufferWidth / 2) - int(len(self.EngineVersion) / 2) - 1
self.Version_Cells.Position = Platform.CreateCoord(X = startingCell.X, Y = startingCell.Y)
self.Loaded = True
LogTitle = True
LogTitle_ChangeToWhite = True
LogVersion = True
LogVersion_ChangeToWhite = True
Log_FadeToGrey = True
Log_Fade = True
Log_End = True
def Unload(self) :
Renderer.WriteToLogs("Intro State: Unloaded")
def Update(self) :
self.IntroTimer.Tick()
self.TillTitle .Tick()
Renderer.WriteToPersistentSection(4, "Intro Time Elapsed: " + str(self.IntroTimer.Elapsed))
if self.TillTitle.Ended() :
if self.LogTitle :
Renderer.WriteToLog("Title Appears: Grey")
self.RenderTitle = True
self.LogTitle = False
self.TillTitle_ToWhite.Tick()
if self.LogTitle_ChangeToWhite and self.TillTitle_ToWhite.Ended() :
self.Title_Cells.SetAttribute(Platform.CConsole_WhiteCell)
Renderer.WriteToLog("Title Appears: White")
self.LogTitle_ChangeToWhite = False
self.TillVersion.Tick()
if self.LogVersion and self.TillVersion.Ended() :
Renderer.WriteToLog("Version Appears: Grey")
self.LogVersion = False
self.RenderVersion = True
if self.RenderVersion :
self.TillVersion_ToWhite.Tick()
if self.LogVersion_ChangeToWhite and self.TillVersion_ToWhite.Ended() :
Renderer.WriteToLog("Version Appears: White")
self.Version_Cells.SetAttribute(Platform.CConsole_WhiteCell)
self.LogVersion_ChangeToWhite = False
self.TillFadeToGrey.Tick()
if self.TillFadeToGrey.Ended() :
self.Title_Cells .SetAttribute(Renderer.CAttribute.FG_Intensity)
self.Version_Cells.SetAttribute(Renderer.CAttribute.FG_Intensity)
if self.Log_FadeToGrey :
Renderer.WriteToLog("Fading")
self.Log_FadeToGrey = False
self.TillFadeOut.Tick()
if self.Log_Fade and self.TillFadeOut.Ended() :
Renderer.WriteToLog("Faded out")
self.RenderTitle = False
self.RenderVersion = False
self.Log_Fade = False
if self.Log_End and self.IntroTimer.Ended() :
Renderer.WriteToLog("Intro Ended")
self.Log_End = False
if Engine.LoadGame == None :
Renderer.WriteToLog("Engine: LoadGame has not been set.")
else : State.SetEngineState(Engine.LoadGame())
def Render(self) :
if self.RenderTitle : self.Title_Cells .WriteToBuffer()
if self.RenderVersion : self.Version_Cells.WriteToBuffer()
IntroTimer = Timing.Timer(float(7.0))
TillTitle = Timing.Timer(2.0)
TillVersion = Timing.Timer(1.2)
TillFadeToGrey = Timing.Timer(TillTitle.EndTime + 4.2)
TillTitle_ToWhite = Timing.Timer(0.134)
TillVersion_ToWhite = Timing.Timer(0.134)
TillFadeOut = Timing.Timer(0.134)
Loaded = False
IntroTitle = "Trial By Fire Engine"
EngineVersion = "Type Python"
RenderTitle = False
RenderVersion = False
Title_Cells = Renderer.CellPacket()
Version_Cells = Renderer.CellPacket()
StateObj = IntroState()
def GetState() : return StateObj