Skip to content

Commit

Permalink
Fix TankOp theme start twice on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
llaske committed Aug 23, 2017
1 parent 9dbdef5 commit c991017
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions activities/TankOp.activity/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ enyo.kind({
this.$.nextmission.setContent(l10n.get("NextMission"));
this.$.completed.setContent(l10n.get("Completed"));

// Play theme
sound.play("audio/soundtrack", true);

// Draw completed mission
var items = [];
this.$.mission.setContent(preferences.levels[this.currentlevel].name = l10n.get(preferences.levels[this.currentlevel].id));
Expand Down Expand Up @@ -105,6 +102,11 @@ enyo.kind({
this.$.creditsPopup.show();
},

// Play theme
playTheme: function() {
sound.play("audio/soundtrack", true);
},

// Play game
play: function() {
// Stop sound
Expand All @@ -116,6 +118,7 @@ enyo.kind({

// Load game from datastore
load: function() {
this.playTheme();
var datastoreObject = this.activity.getDatastoreObject();
var currentthis = this;
datastoreObject.loadAsText(function (error, metadata, data) {
Expand Down
1 change: 1 addition & 0 deletions activities/TankOp.activity/js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ define(["sugar-web/activity/activity"], function (activity) {
}

// Create sound component
if (sound) sound.pause();
sound = new TankOp.Audio();
sound.renderInto(document.getElementById("audio"));

Expand Down
1 change: 1 addition & 0 deletions activities/TankOp.activity/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ enyo.kind({

// Back to app
app.init();
app.playTheme()
app.renderInto(document.getElementById("board"));
},

Expand Down

0 comments on commit c991017

Please sign in to comment.