修复场景切换未在临界点切换问题
This commit is contained in:
33
demo/libs/framework/framework.d.ts
vendored
33
demo/libs/framework/framework.d.ts
vendored
@@ -220,7 +220,7 @@ declare class Scene extends egret.DisplayObjectContainer {
|
||||
removeRenderer(renderer: Renderer): void;
|
||||
begin(): void;
|
||||
end(): void;
|
||||
protected onStart(): void;
|
||||
protected onStart(): Promise<void>;
|
||||
protected onActive(): void;
|
||||
protected onDeactive(): void;
|
||||
protected unload(): void;
|
||||
@@ -713,7 +713,7 @@ declare abstract class SceneTransition {
|
||||
render(): void;
|
||||
onBeginTransition(): void;
|
||||
protected transitionComplete(): void;
|
||||
protected loadNextScene(): void;
|
||||
protected loadNextScene(): Promise<void>;
|
||||
tickEffectProgressProperty(filter: egret.CustomFilter, duration: number, easeType: Function, reverseDirection?: boolean): Promise<{}>;
|
||||
}
|
||||
declare class FadeTransition extends SceneTransition {
|
||||
@@ -737,6 +737,31 @@ declare class WindTransition extends SceneTransition {
|
||||
constructor(sceneLoadAction: Function);
|
||||
onBeginTransition(): void;
|
||||
}
|
||||
declare class BaseView extends egret.DisplayObjectContainer {
|
||||
protected _data: any;
|
||||
protected init(): void;
|
||||
show(data?: any): void;
|
||||
refreshData(data?: any): void;
|
||||
refreshView(): void;
|
||||
close(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
declare class BaseFuiView extends BaseView {
|
||||
protected _name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
declare class BaseSingle {
|
||||
private static _instance;
|
||||
static getInstance<T>(): T;
|
||||
protected clearFuiObj(obj: fairygui.GObject): boolean;
|
||||
}
|
||||
declare class ViewManager extends BaseSingle {
|
||||
private _openDic;
|
||||
refreshView(viewClass: any, data?: any): void;
|
||||
openView(viewClass: any, data?: any, complete?: Function): void;
|
||||
getView<T>(viewClass: any): T;
|
||||
existView(viewClass: any): boolean;
|
||||
}
|
||||
declare class Flags {
|
||||
static isFlagSet(self: number, flag: number): boolean;
|
||||
static isUnshiftedFlagSet(self: number, flag: number): boolean;
|
||||
@@ -990,9 +1015,11 @@ declare class NumberDictionary {
|
||||
tryGetValue(x: number, y: number): Collider[];
|
||||
clear(): void;
|
||||
}
|
||||
declare class fui {
|
||||
}
|
||||
declare class ContentManager {
|
||||
protected loadedAssets: Map<string, any>;
|
||||
load(name: string, local?: boolean): Promise<any>;
|
||||
loadRes(name: string, local?: boolean): Promise<any>;
|
||||
dispose(): void;
|
||||
}
|
||||
declare class Emitter<T> {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
2
demo/libs/framework/framework.min.js
vendored
2
demo/libs/framework/framework.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -8,31 +8,29 @@ class MainScene extends Scene {
|
||||
this.breadthfirstTest();
|
||||
}
|
||||
|
||||
public onStart() {
|
||||
this.content.load("http://www.hyuan.org/123.jpeg", false).then((data) => {
|
||||
console.log(data);
|
||||
let bgSprite = new Sprite(data);
|
||||
let bg = this.createEntity("bg");
|
||||
bg.position = new Vector2(0, 0);
|
||||
bg.addComponent(new SpriteRenderer()).setSprite(bgSprite);
|
||||
public async onStart() {
|
||||
let data = await this.content.loadRes("http://www.hyuan.org/123.jpeg", false);
|
||||
let bgSprite = new Sprite(data);
|
||||
let bg = this.createEntity("bg");
|
||||
bg.position = new Vector2(0, 0);
|
||||
bg.addComponent(new SpriteRenderer()).setSprite(bgSprite);
|
||||
|
||||
for (let i = 0; i < 20; i++) {
|
||||
let sprite = new Sprite(RES.getRes("checkbox_select_disabled_png"));
|
||||
let player2 = this.createEntity("player2");
|
||||
player2.addComponent(new SpriteRenderer()).setSprite(sprite);
|
||||
player2.position = new Vector2(Math.random() * 100 * i, Math.random() * 100 * i);
|
||||
player2.addComponent(new BoxCollider());
|
||||
}
|
||||
for (let i = 0; i < 20; i++) {
|
||||
let sprite = new Sprite(RES.getRes("checkbox_select_disabled_png"));
|
||||
let player2 = this.createEntity("player2");
|
||||
player2.addComponent(new SpriteRenderer()).setSprite(sprite);
|
||||
player2.position = new Vector2(Math.random() * 100 * i, Math.random() * 100 * i);
|
||||
player2.addComponent(new BoxCollider());
|
||||
}
|
||||
|
||||
let button = new eui.Button();
|
||||
button.label = "切换场景";
|
||||
this.addChild(button);
|
||||
button.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
|
||||
SceneManager.startSceneTransition(new FadeTransition(() => {
|
||||
return new MainScene();
|
||||
}));
|
||||
}, this);
|
||||
});
|
||||
let button = new eui.Button();
|
||||
button.label = "切换场景";
|
||||
this.addChild(button);
|
||||
button.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
|
||||
SceneManager.startSceneTransition(new FadeTransition(() => {
|
||||
return new MainScene();
|
||||
}));
|
||||
}, this);
|
||||
}
|
||||
|
||||
public breadthfirstTest() {
|
||||
|
||||
33
source/bin/framework.d.ts
vendored
33
source/bin/framework.d.ts
vendored
@@ -220,7 +220,7 @@ declare class Scene extends egret.DisplayObjectContainer {
|
||||
removeRenderer(renderer: Renderer): void;
|
||||
begin(): void;
|
||||
end(): void;
|
||||
protected onStart(): void;
|
||||
protected onStart(): Promise<void>;
|
||||
protected onActive(): void;
|
||||
protected onDeactive(): void;
|
||||
protected unload(): void;
|
||||
@@ -713,7 +713,7 @@ declare abstract class SceneTransition {
|
||||
render(): void;
|
||||
onBeginTransition(): void;
|
||||
protected transitionComplete(): void;
|
||||
protected loadNextScene(): void;
|
||||
protected loadNextScene(): Promise<void>;
|
||||
tickEffectProgressProperty(filter: egret.CustomFilter, duration: number, easeType: Function, reverseDirection?: boolean): Promise<{}>;
|
||||
}
|
||||
declare class FadeTransition extends SceneTransition {
|
||||
@@ -737,6 +737,31 @@ declare class WindTransition extends SceneTransition {
|
||||
constructor(sceneLoadAction: Function);
|
||||
onBeginTransition(): void;
|
||||
}
|
||||
declare class BaseView extends egret.DisplayObjectContainer {
|
||||
protected _data: any;
|
||||
protected init(): void;
|
||||
show(data?: any): void;
|
||||
refreshData(data?: any): void;
|
||||
refreshView(): void;
|
||||
close(): void;
|
||||
destroy(): void;
|
||||
}
|
||||
declare class BaseFuiView extends BaseView {
|
||||
protected _name: string;
|
||||
constructor(name: string);
|
||||
}
|
||||
declare class BaseSingle {
|
||||
private static _instance;
|
||||
static getInstance<T>(): T;
|
||||
protected clearFuiObj(obj: fairygui.GObject): boolean;
|
||||
}
|
||||
declare class ViewManager extends BaseSingle {
|
||||
private _openDic;
|
||||
refreshView(viewClass: any, data?: any): void;
|
||||
openView(viewClass: any, data?: any, complete?: Function): void;
|
||||
getView<T>(viewClass: any): T;
|
||||
existView(viewClass: any): boolean;
|
||||
}
|
||||
declare class Flags {
|
||||
static isFlagSet(self: number, flag: number): boolean;
|
||||
static isUnshiftedFlagSet(self: number, flag: number): boolean;
|
||||
@@ -990,9 +1015,11 @@ declare class NumberDictionary {
|
||||
tryGetValue(x: number, y: number): Collider[];
|
||||
clear(): void;
|
||||
}
|
||||
declare class fui {
|
||||
}
|
||||
declare class ContentManager {
|
||||
protected loadedAssets: Map<string, any>;
|
||||
load(name: string, local?: boolean): Promise<any>;
|
||||
loadRes(name: string, local?: boolean): Promise<any>;
|
||||
dispose(): void;
|
||||
}
|
||||
declare class Emitter<T> {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
2
source/bin/framework.min.js
vendored
2
source/bin/framework.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -145,7 +145,7 @@ class Scene extends egret.DisplayObjectContainer {
|
||||
this.unload();
|
||||
}
|
||||
|
||||
protected onStart() {
|
||||
protected async onStart() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ class FadeTransition extends SceneTransition {
|
||||
SceneManager.stage.addChild(this._mask);
|
||||
|
||||
egret.Tween.get(this).to({ _alpha: 1}, this.fadeOutDuration * 1000, this.fadeEaseType)
|
||||
.call(() => {
|
||||
this.loadNextScene();
|
||||
.call(async () => {
|
||||
await this.loadNextScene();
|
||||
}).wait(this.delayBeforeFadeInDuration).call(() => {
|
||||
egret.Tween.get(this).to({ _alpha: 0 }, this.fadeOutDuration * 1000, this.fadeEaseType).call(() => {
|
||||
this.transitionComplete();
|
||||
|
||||
@@ -50,7 +50,7 @@ abstract class SceneTransition {
|
||||
}
|
||||
}
|
||||
|
||||
protected loadNextScene() {
|
||||
protected async loadNextScene() {
|
||||
if (this.onScreenObscured)
|
||||
this.onScreenObscured();
|
||||
|
||||
@@ -58,7 +58,7 @@ abstract class SceneTransition {
|
||||
this.isNewSceneLoaded = true;
|
||||
}
|
||||
|
||||
SceneManager.scene = this.sceneLoadAction();
|
||||
SceneManager.scene = await this.sceneLoadAction();
|
||||
this.isNewSceneLoaded = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
///<reference path="./BaseView.ts" />
|
||||
/** 用于承载fui界面 */
|
||||
class BaseFuiView extends BaseView {
|
||||
/** 界面名称 */
|
||||
|
||||
Reference in New Issue
Block a user