Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
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
xiaoxiaole
Commits
9ce49c8a
Commit
9ce49c8a
authored
Apr 23, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化性能暂存
parent
89e088d3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
sceneCtrl.ts
egret/libs/new_wx/ctrls/sceneCtrl.ts
+25
-3
MapScene.ts
egret/src/mapScene/MapScene.ts
+2
-1
No files found.
egret/libs/new_wx/ctrls/sceneCtrl.ts
View file @
9ce49c8a
...
@@ -3,6 +3,7 @@ import Scene from "../components/Scene";
...
@@ -3,6 +3,7 @@ import Scene from "../components/Scene";
import
Loading
from
"../components/Loading"
;
import
Loading
from
"../components/Loading"
;
import
wait
from
"../../new_tc/wait"
;
import
wait
from
"../../new_tc/wait"
;
import
MainScene
from
"../../../src/mainScene/MainScene"
;
import
MainScene
from
"../../../src/mainScene/MainScene"
;
import
MapScene
from
"../../../src/mapScene/MapScene"
;
export
default
class
SceneCtrl
{
export
default
class
SceneCtrl
{
private
_parent
:
egret
.
Sprite
;
private
_parent
:
egret
.
Sprite
;
private
_currentScene
:
Scene
;
private
_currentScene
:
Scene
;
...
@@ -11,6 +12,7 @@ export default class SceneCtrl {
...
@@ -11,6 +12,7 @@ export default class SceneCtrl {
static
_instance
:
SceneCtrl
;
static
_instance
:
SceneCtrl
;
mainscene
:
MainScene
;
mainscene
:
MainScene
;
mapscene
:
MapScene
;
static
get
instance
()
{
static
get
instance
()
{
return
SceneCtrl
.
_instance
||
(
SceneCtrl
.
_instance
=
new
SceneCtrl
())
return
SceneCtrl
.
_instance
||
(
SceneCtrl
.
_instance
=
new
SceneCtrl
())
}
}
...
@@ -24,7 +26,7 @@ export default class SceneCtrl {
...
@@ -24,7 +26,7 @@ export default class SceneCtrl {
}
}
change
(
type
:
ModuleTypes
,
data
?,
onComplete
?:
Function
)
{
change
(
type
:
ModuleTypes
,
data
?,
onComplete
?:
Function
)
{
if
(
type
==
ModuleTypes
.
MAIN_SCENE
){
if
(
type
==
ModuleTypes
.
MAIN_SCENE
){
//游戏页
// console.log("游戏界面单例处理");
// console.log("游戏界面单例处理");
if
(
this
.
mainscene
){
if
(
this
.
mainscene
){
// console.log("使用已存在mainscene");
// console.log("使用已存在mainscene");
...
@@ -44,11 +46,31 @@ export default class SceneCtrl {
...
@@ -44,11 +46,31 @@ export default class SceneCtrl {
this
.
showAfterLoadAtlas
(
this
.
mainscene
,
data
,
onComplete
);
this
.
showAfterLoadAtlas
(
this
.
mainscene
,
data
,
onComplete
);
}
}
}
}
}
else
{
}
// else if(type==ModuleTypes.MAP_SCENE){//mapscene
// if(this.mapscene){
// console.log("单例mapscene");
// this.showAfterLoadAtlas(this.mapscene,data,onComplete);
// }else{
// console.log("新建mapscene");
// this.mapscene = new MapScene();
// if (!window['development']) {
// const promise = Promise.all([
// RES.getResAsync(`${'Map'}_json`),
// RES.getResAsync(`${'Map'}_png`)]);
// promise.then(() => {
// this.showAfterLoadAtlas(this.mapscene, data, onComplete);
// });
// } else {
// this.showAfterLoadAtlas(this.mapscene, data, onComplete);
// }
// }
// }
else
{
const
cls
=
this
.
_sceneClassMap
[
type
];
const
cls
=
this
.
_sceneClassMap
[
type
];
const
scene
:
Scene
=
new
cls
();
const
scene
:
Scene
=
new
cls
();
if
(
!
window
[
'development'
])
{
if
(
!
window
[
'development'
])
{
if
(
type
!=
ModuleTypes
.
MAP_SCENE
)
//
if (type != ModuleTypes.MAP_SCENE)
Loading
.
instace
.
show
();
Loading
.
instace
.
show
();
const
key
=
scene
.
skinKey
.
toLowerCase
();
const
key
=
scene
.
skinKey
.
toLowerCase
();
const
promise
=
Promise
.
all
([
const
promise
=
Promise
.
all
([
...
...
egret/src/mapScene/MapScene.ts
View file @
9ce49c8a
...
@@ -350,7 +350,7 @@ export default class MapScene extends Scene {
...
@@ -350,7 +350,7 @@ export default class MapScene extends Scene {
RES
.
getResAsync
(
`
${
key
}
_png`
)]);
RES
.
getResAsync
(
`
${
key
}
_png`
)]);
}
catch
(
error
)
{
}
catch
(
error
)
{
}
}
console
.
log
(
"开始加载一系列资源"
);
RES
.
getResAsync
(
'candydis0_json'
);
RES
.
getResAsync
(
'candydis0_json'
);
RES
.
getResAsync
(
'candydis1_json'
);
RES
.
getResAsync
(
'candydis1_json'
);
RES
.
getResAsync
(
'candydis2_json'
);
RES
.
getResAsync
(
'candydis2_json'
);
...
@@ -393,6 +393,7 @@ export default class MapScene extends Scene {
...
@@ -393,6 +393,7 @@ export default class MapScene extends Scene {
loadSvga
(
getResPath
()
+
'resource/assets/svgas/sand_dis.svga'
);
loadSvga
(
getResPath
()
+
'resource/assets/svgas/sand_dis.svga'
);
// loadSvga(getResPath() + 'resource/assets/svgas/fireworks.svga');
// loadSvga(getResPath() + 'resource/assets/svgas/fireworks.svga');
console
.
log
(
"一系列资源加载完毕"
);
if
(
!
window
[
'development'
])
{
if
(
!
window
[
'development'
])
{
RES
.
getResAsync
(
`inviterulepanel_json`
);
RES
.
getResAsync
(
`inviterulepanel_json`
);
}
}
...
...
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