Permalink
Browse files

Japanese localization fix, no more intro skipping on touch device.

  • Loading branch information...
1 parent 1a4bb8c commit 39892278ce5f463b5c9222f71f27a2d89f09d250 @ingemaradahl ingemaradahl committed May 21, 2012
Showing with 25 additions and 4 deletions.
  1. +1 −1 src/App.js
  2. +6 −1 src/AppStates.js
  3. +8 −0 src/Input.js
  4. +10 −2 src/ResourceDepot.js
View
2 src/App.js
@@ -236,7 +236,7 @@ App.prototype.update = function(dt) {
if (this.showSkipButton) {
if (this.useTouch) {
- if (InputHandler.instance.touches.length != 0)
+ if (!InputHandler.instance.noTouches())
this.fsm.message("skip");
} else if (GameInput.instance.pressed(Buttons.attack) || GameInput.instance.pressed(Buttons.interact) || InputHandler.instance.mouse.left.down)
this.fsm.message("skip");
View
7 src/AppStates.js
@@ -81,12 +81,14 @@ DeveloperSplashState.constructor = DeveloperSplashState;
DeveloperSplashState.prototype.enter = function(msg, fromState) {
this.host.canvas.onmousedown = createCallback(function(e) {
+ e.preventDefault();
this.skip = true;
this.host.input = new InputHandler(this.host.canvas, false);
}, this);
window.onkeydown = this.host.canvas.onmousedown;
this.host.canvas.ontouchstart = createCallback(function(e) {
+ e.preventDefault();
this.skip = true;
this.host.input = new InputHandler(this.host.canvas, true);
// Some units seem to send both touch and mousedown events, prevent
@@ -535,6 +537,7 @@ MainMenuState.constructor = MainMenuState;
MainMenuState.prototype.enter = function(msg, fromState) {
if (this.doStartScreen) {
this.host.canvas.onmousedown = createCallback(function(e) {
+ e.preventDefault();
this.timeInactive = 0;
this.doStartScreen = true;
this.timeIntoStartScreen = 0.01;
@@ -545,6 +548,7 @@ MainMenuState.prototype.enter = function(msg, fromState) {
window.onkeydown = this.host.canvas.onmousedown;
this.host.canvas.ontouchstart = createCallback(function(e) {
+ e.preventDefault();
this.timeInactive = 0;
this.doStartScreen = true;
this.timeIntoStartScreen = 0.01;
@@ -957,6 +961,7 @@ IntroState.prototype.enter = function(msg, fromState) {
"atlas/gui/titlescreen2.png",
"atlas/no_c_red/titlescreen3.png",
"atlas/no_c_red/titlescreen4.png",
+ "atlas/no_c_red/storyboardintro.png",
"atlas/gui/titletext_html5.png",
"atlas/gui/titlescreen_wick_eyes.png",
"atlas/gui/titlescreen_kindle_eyes.png",
@@ -1919,4 +1924,4 @@ StoryboardState.prototype.nextState = function() {
this.host.setState(appStates.kStateLoadingStage, "stage0");
break;
}
-};
+};
View
8 src/Input.js
@@ -228,6 +228,14 @@ InputHandler.prototype.update = function () {
};
+InputHandler.prototype.noTouches = function () {
+ for (var t in this.touches) {
+ return false;
+ }
+
+ return true;
+};
+
InputHandler.prototype.clickInCircle = function(x, y, r){
if (this.useTouch) {
for (var k in this.touches){
View
12 src/ResourceDepot.js
@@ -77,7 +77,7 @@ ResourceDepot.prototype.detectLanguage = function() {
return "german";
case "it":
return "italian";
- case "jp":
+ case "ja":
return "japanese";
case "pl":
return "polish";
@@ -463,7 +463,15 @@ function loadJSON(file, callback) {
if (request.status == 404)
console.log("ERROR: file '" + file + "' does not exist!");
else {
- callback(request.responseText);
+ var len = parseInt(request.getResponseHeader("Content-Length"));
+ if (request.responseText.length !== len) {
+ console.log(len, request.responseText.length);
+ // TODO
+ alert("An error occured while downloading Emberwind, please clear your cache and try again.");
+ }
+ else {
+ callback(request.responseText);
+ }
}
}
};

0 comments on commit 3989227

Please sign in to comment.