Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/src/js/jgame.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 75 by tsugehara, Sun Mar 31 04:04:43 2013 UTC revision 76 by tsugehara, Sun Mar 31 05:38:55 2013 UTC
# Line 2307  var Layer = (function (_super) { Line 2307  var Layer = (function (_super) {
2307  })(E);  })(E);
2308  var LoadingScene = (function (_super) {  var LoadingScene = (function (_super) {
2309      __extends(LoadingScene, _super);      __extends(LoadingScene, _super);
2310      function LoadingScene(game, resource, noShape) {      function LoadingScene(game, resource) {
2311          _super.call(this, game);          _super.call(this, game);
2312            this.game = game;
2313          this.resource = resource;          this.resource = resource;
2314          this.resource.loaded.handle(this, this.complete);          this.resource.loaded.handle(this, this.complete);
2315          this.resource.added.handle(this, this.added);          this.resource.added.handle(this, this.added);
2316          this.requestCount = this.resource.requests.length;          this.requestCount = this.resource.requests.length;
2317          this.finished = new Trigger();          this.finished = new Trigger();
2318          if(!noShape) {          this.init();
             this.shape = new Shape(game.width, 32);  
             this.shape.moveTo(0, game.height / 2 - 16);  
             this.shapeP = new Shape(1, 32, ShapeStyle.Fill);  
             this.shapeP.moveTo(0, game.height / 2 - 16);  
             this.append(this.shape);  
             this.append(this.shapeP);  
         }  
2319      }      }
2320      LoadingScene.prototype.complete = function (cnt) {      LoadingScene.prototype.init = function () {
2321          var per = (this.requestCount - cnt) / this.requestCount;          this.shape = new Shape(this.game.width, 32);
2322            this.shape.moveTo(0, this.game.height / 2 - 16);
2323            this.shapeP = new Shape(1, 32, ShapeStyle.Fill);
2324            this.shapeP.moveTo(0, this.game.height / 2 - 16);
2325            this.append(this.shape);
2326            this.append(this.shapeP);
2327        };
2328        LoadingScene.prototype.animate = function (per) {
2329          this.shapeP.width = this.game.width * per;          this.shapeP.width = this.game.width * per;
2330          this.shapeP.updated();          this.shapeP.updated();
2331        };
2332        LoadingScene.prototype.complete = function (cnt) {
2333            var per = (this.requestCount - cnt) / this.requestCount;
2334            this.animate(per);
2335          if(per == 1) {          if(per == 1) {
2336              this.resource.loaded.remove(this, this.complete);              this.resource.loaded.remove(this, this.complete);
2337              this.resource.added.remove(this, this.added);              this.resource.added.remove(this, this.added);
# Line 2754  var Game = (function () { Line 2759  var Game = (function () {
2759          this.width = width;          this.width = width;
2760          this.height = height;          this.height = height;
2761          this.targetFps = 0;          this.targetFps = 0;
2762          this.autoLoading = true;          this.loadingSceneClass = LoadingScene;
2763          this.loaded = new Trigger();          this.loaded = new Trigger();
2764          this.update = new Trigger();          this.update = new Trigger();
2765          this.pointDown = new Trigger();          this.pointDown = new Trigger();
# Line 3083  var Game = (function () { Line 3088  var Game = (function () {
3088                  this.resource.load(i, ary[i]);                  this.resource.load(i, ary[i]);
3089              }              }
3090          }          }
3091          if(this.autoLoading) {          if(this.loadingSceneClass && !this.loadingScene) {
3092              var loadingScene = new LoadingScene(this, this.resource);              this.setLoadingScene(this.loadingSceneClass);
             loadingScene.finished.handle(this, this.preloadComplete);  
             this.changeScene(loadingScene);  
3093          }          }
3094      };      };
3095      Game.prototype.preloadOther = function (identity) {      Game.prototype.preloadOther = function (identity) {
# Line 3095  var Game = (function () { Line 3098  var Game = (function () {
3098      Game.prototype.preloadCompleteOther = function (identity) {      Game.prototype.preloadCompleteOther = function (identity) {
3099          this.resource.completeManual(identity);          this.resource.completeManual(identity);
3100      };      };
3101        Game.prototype.setLoadingScene = function (scene) {
3102            if(!this.loadingScene) {
3103                if(scene instanceof LoadingScene) {
3104                    this.loadingScene = scene;
3105                } else {
3106                    this.loadingScene = new scene(this, this.resource);
3107                }
3108                this.loadingScene.finished.handle(this, this.preloadComplete);
3109                this.changeScene(this.loadingScene);
3110            }
3111        };
3112      Game.prototype.preloadComplete = function () {      Game.prototype.preloadComplete = function () {
3113            if(this.loadingScene) {
3114                delete this.loadingScene;
3115            }
3116          this.loaded.fire();          this.loaded.fire();
3117      };      };
3118      Game.prototype.end = function () {      Game.prototype.end = function () {

Legend:
Removed from v.75  
changed lines
  Added in v.76

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26