@@ -9,11 +9,22 @@ export class Game
9
9
{
10
10
this . width = width ;
11
11
this . height = height ;
12
+ this . sfxVolume = 1 ;
13
+
12
14
this . app = new Application (
13
15
{
14
16
features :
15
17
{
16
- sfx : true
18
+ captions : true ,
19
+ sound : true ,
20
+ soundVolume : true ,
21
+ vo : true ,
22
+ voVolume : true ,
23
+ music : true ,
24
+ musicVolume : true ,
25
+ sfx : true ,
26
+ sfxVolume : true ,
27
+
17
28
}
18
29
} ) ;
19
30
@@ -28,47 +39,44 @@ export class Game
28
39
callback : this . resize
29
40
} ) ;
30
41
31
- // Subscribe to required springroll States.
42
+ // Listen for container events from the application.
43
+ // wait for the app to be ready, then set the new scene
44
+ this . app . state . ready . subscribe ( ( ) =>
45
+ {
46
+ this . app . state . scene . value = new TitleScene ( this ) ;
47
+ } ) ;
48
+
32
49
this . app . state . pause . subscribe ( ( value ) =>
33
50
{
34
51
this . isPaused = value ;
35
52
} ) ;
36
-
53
+ this . app . state . captionsMuted . subscribe ( result =>
54
+ {
55
+ console . log ( 'captionsMuted: ' , result ) ;
56
+ } ) ;
37
57
this . app . state . soundVolume . subscribe ( ( value ) =>
38
58
{
39
- // set master volume
59
+ // set main volume
40
60
createjs . Sound . volume = value ;
41
61
} ) ;
42
-
43
- this . sfxVolume = 1 ;
44
- this . app . state . sfxVolume . subscribe ( ( value ) =>
62
+ this . app . state . voVolume . subscribe ( result =>
45
63
{
46
- this . sfxVolume = value ;
64
+ console . log ( 'voVolume: ' , result ) ;
47
65
} ) ;
48
66
this . app . state . musicVolume . subscribe ( result =>
49
67
{
50
68
console . log ( 'musicVolume: ' , result ) ;
51
69
} ) ;
52
- this . app . state . voVolume . subscribe ( result =>
53
- {
54
- console . log ( 'voVolume: ' , result ) ;
55
- } ) ;
56
- this . app . state . captionsMuted . subscribe ( result =>
70
+ this . app . state . sfxVolume . subscribe ( ( value ) =>
57
71
{
58
- console . log ( 'captionsMuted: ' , result ) ;
72
+ this . sfxVolume = value ;
59
73
} ) ;
60
74
61
75
// add an extra state property for storying the current scene. Whenever the scene is changed, this class
62
76
// will swap out the container attached to the stage
63
77
this . app . state . scene = new Property ( null ) ;
64
78
this . app . state . scene . subscribe ( this . onChangeScene . bind ( this ) ) ;
65
79
66
- // wait for the app to be ready, then set the new scene
67
- this . app . state . ready . subscribe ( ( ) =>
68
- {
69
- this . app . state . scene . value = new TitleScene ( this ) ;
70
- } ) ;
71
-
72
80
// Set Ticker
73
81
createjs . Ticker . framerate = 60 ;
74
82
createjs . Ticker . timingMode = createjs . Ticker . RAF_SYNCHED ;
0 commit comments