Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
duiba-egret-games
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
wildfirecode13
duiba-egret-games
Commits
69ed4eda
Commit
69ed4eda
authored
Nov 08, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
8ccbd567
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
14 deletions
+42
-14
MainBase.ts
egret/libs/new_wx/MainBase.ts
+27
-5
sceneCtrl.ts
egret/libs/new_wx/ctrls/sceneCtrl.ts
+5
-4
layers.ts
egret/libs/new_wx/views/layers.ts
+10
-5
No files found.
egret/libs/new_wx/MainBase.ts
View file @
69ed4eda
...
...
@@ -115,16 +115,26 @@ 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
();
});
}
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
);
layers
.
addFirstBackground
(
bitmap
);
callback
(
bitmap
);
}
const
imageLoader
=
new
egret
.
ImageLoader
();
imageLoader
.
once
(
egret
.
Event
.
COMPLETE
,
onImageLoaded
,
this
);
const
url
=
getResPath
()
+
"resource/assets/startScene/bg.jpg"
...
...
@@ -158,13 +168,25 @@ export default class MainBase extends eui.UILayer {
})
}
/**
* 创建场景界面
* Create scene interface
*/
_startSceneReady
=
false
;
protected
createGameScene
()
{
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
START_SCENE
,
null
,
()
=>
{
this
.
_startSceneReady
=
true
;
this
.
check
();
});
}
check
()
{
if
(
this
.
_startSceneReady
&&
this
.
_firstBgLoaded
)
{
layers
.
removeFirstBackground
();
SceneCtrl
.
instance
.
change
(
ModuleTypes
.
START_SCENE
);
const
t
=
Date
.
now
()
-
window
[
'__startTime__'
];
console
.
log
(
`start scene显示时间:
${
t
}
ms`
);
//开始场景图集和开始场景背景全部加载完成并显示
}
}
}
\ No newline at end of file
egret/libs/new_wx/ctrls/sceneCtrl.ts
View file @
69ed4eda
...
...
@@ -14,21 +14,21 @@ export default class SceneCtrl {
this
.
_parent
=
parent
;
}
change
(
type
:
ModuleTypes
,
data
?)
{
change
(
type
:
ModuleTypes
,
data
?
,
onComplete
?:
Function
)
{
const
cls
=
this
.
_sceneClassMap
[
type
];
const
scene
:
Scene
=
new
cls
();
if
(
!
window
[
'development'
])
{
Loading
.
instace
.
show
();
RES
.
getResByUrl
(
`
${
scene
.
skinKey
.
toLowerCase
()}
_json`
,
(
sheet
:
egret
.
SpriteSheet
)
=>
{
Loading
.
instace
.
hide
();
this
.
showAfterLoadAtlas
(
scene
,
data
);
this
.
showAfterLoadAtlas
(
scene
,
data
,
onComplete
);
},
this
,
RES
.
ResourceItem
.
TYPE_SHEET
);
}
else
{
this
.
showAfterLoadAtlas
(
scene
,
data
);
this
.
showAfterLoadAtlas
(
scene
,
data
,
onComplete
);
}
}
showAfterLoadAtlas
(
scene
:
Scene
,
data
)
{
showAfterLoadAtlas
(
scene
:
Scene
,
data
,
onComplete
:
Function
)
{
if
(
this
.
_currentScene
)
{
this
.
_currentScene
.
destroy
();
this
.
_parent
.
removeChild
(
this
.
_currentScene
);
...
...
@@ -36,6 +36,7 @@ export default class SceneCtrl {
scene
.
loadSkin
();
scene
.
start
();
this
.
addToStage
(
scene
);
onComplete
&&
onComplete
();
}
addMask
()
{
...
...
egret/libs/new_wx/views/layers.ts
View file @
69ed4eda
...
...
@@ -15,16 +15,21 @@ class Layers extends eui.UILayer {
this
.
addChild
(
this
.
_topLayer
);
}
_removeTag
:
number
;
_bg
:
egret
.
Bitmap
;
addFirstBackground
(
bitmap
:
egret
.
Bitmap
):
any
{
if
(
!
this
.
_removeTag
)
{
this
.
_bg
=
bitmap
;
this
.
_bottomLayer
.
addChild
(
bitmap
);
}
}
removeFirstBackground
():
any
{
// if (this._bg)
// this._bottomLayer.removeChild(this._bg);
// this._bg = null;
this
.
_removeTag
=
1
;
if
(
this
.
_bg
)
{
this
.
_bottomLayer
.
removeChild
(
this
.
_bg
);
this
.
_bg
=
null
;
}
}
get
topLayer
()
{
return
this
.
_topLayer
}
...
...
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