/
GameRoot.as
84 lines (57 loc) · 1.89 KB
/
GameRoot.as
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
package
{
import flash.display.MovieClip;
//-----------------------
//Purpose: The application root for a GameSession
//
//Properties:
//
//Methods:
//
//-----------------------
public class GameRoot extends MovieClip
{
// Constants //
//- Constants -//
// Public Properties //
public function get controller():GameController
{
return _gameController;
}
// REFACTOR: right now this is needed b/c some of gameRoot's children like UIManager need to reach through the game root to main to access the stage and stage
// is weird so I don't know if you can make a function in gameRoot like GetStage():stage??? Since I'm in the middle of a huge ball of refactoring and can't
// test anything at the moment and I don't want to deal with this shit at the moment I'm going to play it safe and just make main accessible through this property.
// HOWEVER, I really don't know if any of gameRoot's children should or should need to access this in the future - I hope not.
public function get main():Main
{
return _main;
}
//- Public Properties -//
// Private Properties //
private var _gameController:GameController;
private var _gameSession:GameSession;
private var _main:Main;
private var _uiManager:UIManager;
//- Private Properties -//
// Initialization //
public function GameRoot(main:Main, newGame:Boolean)
{
_main = main;
_gameSession = new GameSession(this, newGame);
_uiManager = _gameSession.uiManager;
_gameController = new GameController(this, _gameSession, _uiManager);
this.addChild(_uiManager);
}
//- Initialization -//
// Public Methods //
public function ModeSwapGameToTitle():void
{
_main.ModeSwapGameToTitle();
}
//- Public Methods -//
// Private Methods //
//- Private Methods -//
// Testing Methods //
//- Testing Methods -//
}
}