-
Notifications
You must be signed in to change notification settings - Fork 0
/
Global.as
55 lines (44 loc) · 931 Bytes
/
Global.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
package Vortex
{
import Framework.Utils.FSave;
public class Global
{
public static var recentScore:int;
public static var highScore:int;
public static var hasPlayed:Boolean;
public static const saveName:String = "Vortex";
public function Global()
{
trace("Don't instantiate the global class.");
}
public static function Init():void
{
highScore = 0;
recentScore = 0;
hasPlayed = false;
}
public static function Load():void
{
var a:Array = FSave.Load(saveName);
if(a != null)
{
highScore = a["highScore"];
recentScore = a["recentScore"];
hasPlayed = a["hasPlayed"];
}
}
public static function Save():void
{
var a:Array = new Array();
a["highScore"] = highScore;
a["recentScore"] = recentScore;
a["hasPlayed"] = hasPlayed;
FSave.Save(a, saveName);
}
public static function Clear():void
{
Init();
FSave.Clear(saveName);
}
}
}