Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化loadingPage的延迟时间,用户可配置Scene.ts #230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/layaAir/laya/display/Scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Timer } from "../utils/Timer"
import { ILaya } from "../../ILaya";
import { ClassUtils } from "../utils/ClassUtils";
import { URL } from "../net/URL";
import { Config } from "../../Config";

/**
* 场景类,负责场景创建,加载,销毁等功能
Expand Down Expand Up @@ -421,7 +422,7 @@ export class Scene extends Sprite {
* @param param 打开参数,如果是scene,则会传递给onOpened方法
* @param delay 延迟打开时间,默认500毫秒
*/
static showLoadingPage(param: any = null, delay: number = 500): void {
static showLoadingPage(param: any = null, delay: number = Config.showLoadingPageDelay): void {
if (Scene._loadPage) {
ILaya.systemTimer.clear(null, Scene._showLoading);
ILaya.systemTimer.clear(null, Scene._hideLoading);
Expand All @@ -442,7 +443,7 @@ export class Scene extends Sprite {
* 隐藏loading界面
* @param delay 延迟关闭时间,默认500毫秒
*/
static hideLoadingPage(delay: number = 500): void {
static hideLoadingPage(delay: number = Config.hideLoadingPageDelay): void {
if (Scene._loadPage) {
ILaya.systemTimer.clear(null, Scene._showLoading);
ILaya.systemTimer.clear(null, Scene._hideLoading);
Expand All @@ -453,4 +454,4 @@ export class Scene extends Sprite {

ILaya.regClass(Scene);
ClassUtils.regClass("laya.display.Scene", Scene);
ClassUtils.regClass("Laya.Scene", Scene);
ClassUtils.regClass("Laya.Scene", Scene);