Commit 9dbc3a99 authored by rockyl's avatar rockyl

修复

parent c7394971
...@@ -170,11 +170,9 @@ export class GameStage extends Node { ...@@ -170,11 +170,9 @@ export class GameStage extends Node {
loadingView = await this.instantiateView(loadingViewName, true, false); loadingView = await this.instantiateView(loadingViewName, true, false);
this._loadingView.addChild(loadingView); this._loadingView.addChild(loadingView);
} }
this._loadingView.visible = true;
Tween.get(this._loadingView, null, null, true) Tween.get(this._loadingView, null, null, true)
.to({alpha: 0}, 200) .to({alpha: 1}, 200);
.call(() => {
this._loadingView.visible = true;
});
} }
/** /**
...@@ -183,7 +181,7 @@ export class GameStage extends Node { ...@@ -183,7 +181,7 @@ export class GameStage extends Node {
hideInnerLoadingView() { hideInnerLoadingView() {
if (this._loadingView.visible) { if (this._loadingView.visible) {
Tween.get(this._loadingView, null, null, true) Tween.get(this._loadingView, null, null, true)
.to({alpha: 1}, 200) .to({alpha: 0}, 200)
.call(() => { .call(() => {
this._loadingView.visible = false; this._loadingView.visible = false;
}); });
...@@ -330,6 +328,9 @@ export class GameStage extends Node { ...@@ -330,6 +328,9 @@ export class GameStage extends Node {
}; };
async loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete) { async loadPreloadAssets(onPreloadAssetsProgress, onPreloadAssetsComplete) {
//直接显示菊花loading
onPreloadAssetsProgress && onPreloadAssetsProgress(0, 1);
const {assets, customs} = this._config; const {assets, customs} = this._config;
let loaded = 0; let loaded = 0;
...@@ -340,6 +341,7 @@ export class GameStage extends Node { ...@@ -340,6 +341,7 @@ export class GameStage extends Node {
if (assetsToLoad.length > 0) { if (assetsToLoad.length > 0) {
await this.showInnerLoadingView(); await this.showInnerLoadingView();
onPreloadAssetsComplete && onPreloadAssetsComplete();
await loadAssetsGroups({ await loadAssetsGroups({
preload: assetsToLoad, preload: assetsToLoad,
}, async () => { }, async () => {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import {GameStage} from "./GameStage"; import {GameStage} from "./GameStage";
import {Label, Rect, Node} from "./nodes/index"; import {Label, Rect, Node} from "./nodes/index";
import {Tween} from "../../2d/tween/index"; import {Tween} from "../../2d/tween/index";
import {TEXT_ALIGN} from "../../2d/const";
export class Toast extends Node { export class Toast extends Node {
private _contentSample: Node; private _contentSample: Node;
...@@ -82,7 +83,7 @@ export class Toast extends Node { ...@@ -82,7 +83,7 @@ export class Toast extends Node {
} }
if (!view) { if (!view) {
if (!this._contentSample) { if (!this._contentSample) {
const {borderRadius = 10, labColor = 'white', labSize = 30, bgColor = 'black', bgAlpha = 0.7} = props; const {borderRadius = 10, labColor = 'white', labSize = 30, labelAlign = TEXT_ALIGN.CENTER, bgColor = 'black', bgAlpha = 0.7} = props;
this._contentSample = new Node(); this._contentSample = new Node();
let bg = new Rect(); let bg = new Rect();
...@@ -96,6 +97,7 @@ export class Toast extends Node { ...@@ -96,6 +97,7 @@ export class Toast extends Node {
lab.name = 'lab'; lab.name = 'lab';
lab.fillColor = labColor; lab.fillColor = labColor;
lab.size = labSize; lab.size = labSize;
lab.textAlign = labelAlign;
this._contentSample.addChild(lab); this._contentSample.addChild(lab);
} }
view = this._contentSample; view = this._contentSample;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment