123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- var Global = require("Global");
- cc.Class({
- extends: cc.Component,
- properties: {
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {},
- showGoGameScene: function(arrRes, funCall) {
- this.node.active = true;
- this.updateProgress(0);
- var self = this;
- cc.resources.load(arrRes, function (completedCount, totalCount, item) {
- self.updateProgress((completedCount / totalCount));
- },
- function (err, assets) {
- if (funCall) {
- funCall();
- }
- });
- },
- loadingDir: function (strPath, funCall) {
- var self = this;
- cc.resources.loadDir(strPath, function (completedCount, totalCount, item) {
- if (totalCount > 0) {
- var percent = completedCount / totalCount;
- self.updateProgress(percent);
- }
- },
- function (err, prefab) {
- if (funCall) {
- funCall();
- }
- });
- },
- showBackHomeScene: function(startFun, endFun) {
- this.node.active = true;
- this.updateProgress(0);
- var self = this;
- this.scheduleOnce(function() {
- if (startFun) {
- startFun();
- }
- self.loadingDir("GamePrefabs/homescence", function () {
- if (endFun) {
- endFun();
- }
- cc.director.loadScene("hallscence");
- });
- }, 0.1);
-
- },
- updateProgress: function(percent) {
- this.node.getChildByName("Progress").width = 800 * percent;
- },
- hide: function() {
- this.node.active = false;
- },
-
- });
|