修复场景切换未在临界点切换问题
This commit is contained in:
@@ -8,6 +8,41 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
Array.prototype.findIndex = function (predicate) {
|
||||
function findIndex(array, predicate) {
|
||||
for (var i = 0, len = array.length; i < len; i++) {
|
||||
@@ -1101,6 +1136,11 @@ var Scene = (function (_super) {
|
||||
this.unload();
|
||||
};
|
||||
Scene.prototype.onStart = function () {
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
return [2];
|
||||
});
|
||||
});
|
||||
};
|
||||
Scene.prototype.onActive = function () {
|
||||
};
|
||||
@@ -3206,13 +3246,25 @@ var SceneTransition = (function () {
|
||||
}
|
||||
};
|
||||
SceneTransition.prototype.loadNextScene = function () {
|
||||
if (this.onScreenObscured)
|
||||
this.onScreenObscured();
|
||||
if (!this.loadsNewScene) {
|
||||
this.isNewSceneLoaded = true;
|
||||
}
|
||||
SceneManager.scene = this.sceneLoadAction();
|
||||
this.isNewSceneLoaded = true;
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var _a;
|
||||
return __generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
case 0:
|
||||
if (this.onScreenObscured)
|
||||
this.onScreenObscured();
|
||||
if (!this.loadsNewScene) {
|
||||
this.isNewSceneLoaded = true;
|
||||
}
|
||||
_a = SceneManager;
|
||||
return [4, this.sceneLoadAction()];
|
||||
case 1:
|
||||
_a.scene = _b.sent();
|
||||
this.isNewSceneLoaded = true;
|
||||
return [2];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
SceneTransition.prototype.tickEffectProgressProperty = function (filter, duration, easeType, reverseDirection) {
|
||||
if (reverseDirection === void 0) { reverseDirection = false; }
|
||||
@@ -3245,9 +3297,16 @@ var FadeTransition = (function (_super) {
|
||||
this._mask.graphics.endFill();
|
||||
SceneManager.stage.addChild(this._mask);
|
||||
egret.Tween.get(this).to({ _alpha: 1 }, this.fadeOutDuration * 1000, this.fadeEaseType)
|
||||
.call(function () {
|
||||
_this.loadNextScene();
|
||||
}).wait(this.delayBeforeFadeInDuration).call(function () {
|
||||
.call(function () { return __awaiter(_this, void 0, void 0, function () {
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4, this.loadNextScene()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2];
|
||||
}
|
||||
});
|
||||
}); }).wait(this.delayBeforeFadeInDuration).call(function () {
|
||||
egret.Tween.get(_this).to({ _alpha: 0 }, _this.fadeOutDuration * 1000, _this.fadeEaseType).call(function () {
|
||||
_this.transitionComplete();
|
||||
SceneManager.stage.removeChild(_this._mask);
|
||||
@@ -3328,6 +3387,103 @@ var WindTransition = (function (_super) {
|
||||
};
|
||||
return WindTransition;
|
||||
}(SceneTransition));
|
||||
var BaseView = (function (_super) {
|
||||
__extends(BaseView, _super);
|
||||
function BaseView() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
BaseView.prototype.init = function () {
|
||||
};
|
||||
BaseView.prototype.show = function (data) {
|
||||
};
|
||||
BaseView.prototype.refreshData = function (data) {
|
||||
this._data = data;
|
||||
};
|
||||
BaseView.prototype.refreshView = function () {
|
||||
};
|
||||
BaseView.prototype.close = function () {
|
||||
};
|
||||
BaseView.prototype.destroy = function () {
|
||||
if (this.parent) {
|
||||
this.parent.removeChild(this);
|
||||
}
|
||||
while (this.numChildren > 0) {
|
||||
this.removeChildAt(0);
|
||||
}
|
||||
};
|
||||
return BaseView;
|
||||
}(egret.DisplayObjectContainer));
|
||||
var BaseFuiView = (function (_super) {
|
||||
__extends(BaseFuiView, _super);
|
||||
function BaseFuiView(name) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.name = name;
|
||||
return _this;
|
||||
}
|
||||
return BaseFuiView;
|
||||
}(BaseView));
|
||||
var BaseSingle = (function () {
|
||||
function BaseSingle() {
|
||||
}
|
||||
BaseSingle.getInstance = function () {
|
||||
if (this._instance == null) {
|
||||
this._instance = new this();
|
||||
}
|
||||
return this._instance;
|
||||
};
|
||||
BaseSingle.prototype.clearFuiObj = function (obj) {
|
||||
if (obj) {
|
||||
egret.Tween.removeTweens(obj.displayObject);
|
||||
if (obj.displayObject && obj.displayObject.parent) {
|
||||
obj.displayObject.parent.removeChild(obj.displayObject);
|
||||
}
|
||||
obj.dispose();
|
||||
obj = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
return BaseSingle;
|
||||
}());
|
||||
var ViewManager = (function (_super) {
|
||||
__extends(ViewManager, _super);
|
||||
function ViewManager() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this._openDic = [];
|
||||
return _this;
|
||||
}
|
||||
ViewManager.prototype.refreshView = function (viewClass, data) {
|
||||
var view = this.getView(viewClass);
|
||||
if (view) {
|
||||
view.refreshData(data);
|
||||
view.refreshView();
|
||||
}
|
||||
};
|
||||
ViewManager.prototype.openView = function (viewClass, data, complete) {
|
||||
var newView = this.getView(viewClass);
|
||||
if (!newView) {
|
||||
newView = new viewClass();
|
||||
}
|
||||
if (this.existView(viewClass)) {
|
||||
newView.refreshData(data);
|
||||
newView.refreshView();
|
||||
return;
|
||||
}
|
||||
this._openDic.push(newView);
|
||||
};
|
||||
ViewManager.prototype.getView = function (viewClass) {
|
||||
var result = this._openDic.firstOrDefault(function (a) {
|
||||
return a instanceof viewClass;
|
||||
});
|
||||
return result;
|
||||
};
|
||||
ViewManager.prototype.existView = function (viewClass) {
|
||||
return this._openDic.findIndex(function (a) {
|
||||
return a instanceof viewClass;
|
||||
}) != -1;
|
||||
};
|
||||
return ViewManager;
|
||||
}(BaseSingle));
|
||||
var Flags = (function () {
|
||||
function Flags() {
|
||||
}
|
||||
@@ -4674,7 +4830,7 @@ var ContentManager = (function () {
|
||||
function ContentManager() {
|
||||
this.loadedAssets = new Map();
|
||||
}
|
||||
ContentManager.prototype.load = function (name, local) {
|
||||
ContentManager.prototype.loadRes = function (name, local) {
|
||||
var _this = this;
|
||||
if (local === void 0) { local = true; }
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
Reference in New Issue
Block a user