Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
崔立强
db-game-template
Commits
8f3a7218
Commit
8f3a7218
authored
Nov 09, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
08228071
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
40 deletions
+48
-40
MainBase.ts
egret/libs/new_wx/MainBase.ts
+29
-29
Loading.ts
egret/libs/new_wx/components/Loading.ts
+8
-0
layers.ts
egret/libs/new_wx/views/layers.ts
+11
-11
No files found.
egret/libs/new_wx/MainBase.ts
View file @
8f3a7218
...
...
@@ -96,7 +96,7 @@ export default class MainBase extends eui.UILayer {
this
.
registerModules
();
this
.
loadFirstScreen
();
//
this.loadFirstScreen();
Loading
.
instace
.
show
();
RES
.
setMaxLoadingThread
(
10
);
...
...
@@ -115,32 +115,32 @@ export default class MainBase extends eui.UILayer {
// }
}
_firstBgLoaded
=
false
;
loadFirstScreen
()
{
this
.
loadFirstBG
((
bitmap
:
egret
.
Bitmap
)
=>
{
const
t
=
Date
.
now
()
-
window
[
'__startTime__'
];
console
.
log
(
`首屏背景显示时间:
${
t
}
ms`
);
layers
.
addFirstBackground
(
bitmap
);
this
.
_firstBgLoaded
=
true
;
this
.
check
();
});
}
//
_firstBgLoaded = false;
//
loadFirstScreen() {
//
this.loadFirstBG((bitmap: egret.Bitmap) => {
//
const t = Date.now() - window['__startTime__'];
//
console.log(`首屏背景显示时间:${t}ms`);
//
layers.addFirstBackground(bitmap);
//
this._firstBgLoaded = true;
//
this.check();
//
});
//
}
loadFirstBG
(
callback
)
{
const
onImageLoaded
=
(
e
:
egret
.
Event
)
=>
{
const
imageLoader
:
egret
.
ImageLoader
=
e
.
currentTarget
;
const
bitmapData
:
egret
.
BitmapData
=
imageLoader
.
data
;
const
texture
=
new
egret
.
Texture
();
texture
.
_setBitmapData
(
bitmapData
);
const
bitmap
=
new
egret
.
Bitmap
(
texture
);
callback
(
bitmap
);
}
const
imageLoader
=
new
egret
.
ImageLoader
();
imageLoader
.
once
(
egret
.
Event
.
COMPLETE
,
onImageLoaded
,
this
);
const
url
=
getResPath
()
+
"resource/assets/startScene/startscenebg.jpg"
;
// url = getImgURL(url);
imageLoader
.
load
(
url
);
}
//
loadFirstBG(callback) {
//
const onImageLoaded = (e: egret.Event) => {
//
const imageLoader: egret.ImageLoader = e.currentTarget;
//
const bitmapData: egret.BitmapData = imageLoader.data;
//
const texture = new egret.Texture();
//
texture._setBitmapData(bitmapData);
//
const bitmap = new egret.Bitmap(texture);
//
callback(bitmap);
//
}
//
const imageLoader = new egret.ImageLoader();
//
imageLoader.once(egret.Event.COMPLETE, onImageLoaded, this);
//
const url = getResPath() + "resource/assets/startScene/startscenebg.jpg";
//
// url = getImgURL(url);
//
imageLoader.load(url);
//
}
private
async
runGame
()
{
await
this
.
loadResource
()
...
...
@@ -182,8 +182,8 @@ export default class MainBase extends eui.UILayer {
}
check
()
{
if
(
this
.
_startSceneReady
&&
this
.
_firstBgLoaded
)
{
layers
.
removeFirstBackground
();
if
(
this
.
_startSceneReady
)
{
//
layers.removeFirstBackground();
const
t
=
Date
.
now
()
-
window
[
'__startTime__'
];
console
.
log
(
`start scene显示时间:
${
t
}
ms`
);
//开始场景图集和开始场景背景全部加载完成并显示
...
...
egret/libs/new_wx/components/Loading.ts
View file @
8f3a7218
This diff is collapsed.
Click to expand it.
egret/libs/new_wx/views/layers.ts
View file @
8f3a7218
...
...
@@ -15,18 +15,18 @@ class Layers extends eui.UILayer {
this
.
addChild
(
this
.
_topLayer
);
}
_bg
:
egret
.
Bitmap
;
addFirstBackground
(
bitmap
:
egret
.
Bitmap
):
any
{
this
.
_bg
=
bitmap
;
this
.
_bottomLayer
.
addChild
(
bitmap
);
}
//
_bg: egret.Bitmap;
//
addFirstBackground(bitmap: egret.Bitmap): any {
//
this._bg = bitmap;
//
this._bottomLayer.addChild(bitmap);
//
}
removeFirstBackground
():
any
{
egret
.
Tween
.
get
(
this
.
_bg
).
to
({
alpha
:
0
},
700
).
call
(()
=>
{
this
.
_bottomLayer
.
removeChild
(
this
.
_bg
);
this
.
_bg
=
null
;
})
}
//
removeFirstBackground(): any {
//
egret.Tween.get(this._bg).to({ alpha: 0 }, 700).call(() => {
//
this._bottomLayer.removeChild(this._bg);
//
this._bg = null;
//
})
//
}
get
topLayer
()
{
return
this
.
_topLayer
}
get
popupLayer
()
{
return
this
.
_popupLayer
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment