blob: f678b4cab7ba9428e0304fca238c4c05964244a6 (
plain)
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
|
// Utility functions
// Namespace
Abcd = {};
// Game context handling
Abcd.context = {
screen: null,
lang: "fr",
casevalue: 0,
};
Abcd.saveContext = function() {
Abcd.sugar.sendMessage(
"save-context", {});
};
Abcd.loadContext = function(context) {
};
// Init Sugar interface
Abcd.setLocale = function(texts) {
__$FC_l10n_set(texts);
Abcd.letters = Abcd[Abcd.context.lang+"Letters"];
if (Abcd.context.screen != null)
Abcd.context.screen.setLocale();
}
Abcd.setCase = function(casevalue) {
Abcd.context.casevalue = casevalue;
if (Abcd.context.screen != null)
Abcd.context.screen.setCase();
}
Abcd.sugar = new Sugar();
Abcd.sugar.connect("localization", Abcd.setLocale);
Abcd.sugar.connect("save-context", Abcd.saveContext);
Abcd.sugar.connect("load-context", Abcd.loadContext);
Abcd.log = function(msg) {
Abcd.sugar.sendMessage("console-message", msg);
console.log(msg);
};
// Home handling
Abcd.goHome = function() {
if (Abcd.context.home != null) {
Abcd.context.home.renderInto(document.getElementById("body"));
Abcd.context.home.playTheme();
}
};
|