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
67d65ec2
Commit
67d65ec2
authored
Nov 29, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
1514e0ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
32 deletions
+15
-32
StartScene.ts
egret/src/startScene/StartScene.ts
+5
-24
check.ts
egret/src/startScene/check.ts
+4
-4
createBtns.ts
egret/src/startScene/createBtns.ts
+5
-3
playMovieClip.ts
egret/src/startScene/playMovieClip.ts
+1
-1
No files found.
egret/src/startScene/StartScene.ts
View file @
67d65ec2
import
StartSceneBase
from
"../../libs/new_wx/components/StartSceneBase"
;
import
DebugRender
from
"../physics/DebugRender"
;
import
EgretRender
from
"../physics/EgretRender"
;
import
check
from
"./check"
;
import
{
bubble
,
bubbleGroup
,
bubbleMask
}
from
"./collisionConfig"
;
import
createBox
from
"./createBox"
;
import
createBtns
from
"./createBtns"
;
import
createBubblePic
from
"./createBubblePic"
;
import
createItems
from
"./createItems"
;
import
random
from
"./random"
;
import
{
startStandbyBubblesLeft
,
startStandbyBubblesRight
,
stopStandbyBubblesLeft
,
stopStandbyBubblesRight
}
from
"./standbyBubbles"
;
import
{
playScoreAni
}
from
"./playMovieClip"
;
import
createBtns
from
"./createBtns"
;
export
default
class
StartScene
extends
StartSceneBase
{
_engine
:
Matter
.
Engine
;
_egretRender
:
EgretRender
;
private
_debugRender
:
DebugRender
;
private
_lastTimestamp
=
0
;
_startStandbyBubblesLeft
:
number
;
_startStandbyBubblesRight
:
number
;
egretRenderContainer
:
egret
.
Sprite
;
async
start
(
data
?)
{
super
.
start
();
egret
.
lifecycle
.
onPause
=
()
=>
{
...
...
@@ -38,12 +36,9 @@ export default class StartScene extends StartSceneBase {
this
.
_engine
.
world
.
gravity
.
y
=
0.2
;
//创建egret渲染
const
egretRenderContainer
=
new
egret
.
Sprite
();
this
.
addChild
(
egretRenderContainer
);
this
.
_egretRender
=
new
EgretRender
(
egretRenderContainer
,
this
.
_engine
);
this
.
_debugRender
=
new
DebugRender
(
this
.
_engine
);
// this.addChild(this._debugRender);
this
.
egretRenderContainer
=
new
egret
.
Sprite
();
this
.
addChild
(
this
.
egretRenderContainer
);
this
.
_egretRender
=
new
EgretRender
(
this
.
egretRenderContainer
,
this
.
_engine
);
this
.
addChild
(
this
[
'basket_top'
]);
this
.
addChild
(
this
[
'glass'
]);
...
...
@@ -133,9 +128,6 @@ export default class StartScene extends StartSceneBase {
this
.
_egretRender
.
remove
(
body
);
},
1000
);
}
console
.
log
(
'吹起来'
);
});
[
this
[
'leftBtn'
],
this
[
'rightBtn'
]].
forEach
(
btn
=>
{
...
...
@@ -155,8 +147,6 @@ export default class StartScene extends StartSceneBase {
startStandbyBubblesRight
(
this
.
_egretRender
);
},
1000
);
}
// playScoreAni(this,-1)
},
this
);
});
...
...
@@ -170,14 +160,6 @@ export default class StartScene extends StartSceneBase {
egret
.
startTick
(
this
.
onTick
,
this
);
}
// onGetAward() {
// egret.stopTick(this.onTick, this);
// setTimeout(() => {
// this._lastTimestamp = 0;
// this.runEngine();
// }, 1000);
// }
private
onTick
(
timestamp
:
number
)
{
if
(
this
.
_lastTimestamp
===
0
)
{
this
.
_lastTimestamp
=
timestamp
;
...
...
@@ -189,7 +171,6 @@ export default class StartScene extends StartSceneBase {
this
.
_lastTimestamp
=
timestamp
;
Matter
.
Engine
.
update
(
this
.
_engine
,
delta
);
// console.log(delta);
this
.
_debugRender
.
run
();
this
.
_egretRender
.
run
();
check
(
this
);
return
false
;
...
...
egret/src/startScene/check.ts
View file @
67d65ec2
...
...
@@ -33,13 +33,13 @@ const check = (_this: StartScene) => {
console
.
log
(
'boom'
);
_this
.
_egretRender
.
remove
(
i
);
vibrate
(
_this
,
2
);
playBoom
(
_this
);
playScoreAni
(
_this
,
-
1
);
playBoom
(
_this
.
egretRenderContainer
);
playScoreAni
(
_this
.
egretRenderContainer
,
-
1
);
}
else
{
console
.
log
(
'不是boom,重用'
,
Date
.
now
()
/
1000
);
playScoreAni
(
_this
,
1
)
playSuccess
(
_this
);
playScoreAni
(
_this
.
egretRenderContainer
,
1
)
playSuccess
(
_this
.
egretRenderContainer
);
}
// _this.onGetAward();
}
...
...
egret/src/startScene/createBtns.ts
View file @
67d65ec2
...
...
@@ -17,7 +17,7 @@ export default (that: StartScene) => {
const
btn
=
e
.
currentTarget
;
const
shape
=
btn
.
maskShape
;
egret
.
Tween
.
removeTweens
(
shape
);
egret
.
Tween
.
get
(
shape
).
to
({
alpha
:
0
},
200
);
egret
.
Tween
.
get
(
shape
).
to
({
alpha
:
1
},
200
);
},
that
);
});
...
...
@@ -26,7 +26,7 @@ export default (that: StartScene) => {
const
btn
=
e
.
currentTarget
;
const
shape
=
btn
.
maskShape
;
egret
.
Tween
.
removeTweens
(
shape
);
egret
.
Tween
.
get
(
shape
).
to
({
alpha
:
1
},
200
);
egret
.
Tween
.
get
(
shape
).
to
({
alpha
:
0
},
200
);
},
that
);
});
...
...
@@ -35,7 +35,7 @@ export default (that: StartScene) => {
const
btn
=
e
.
currentTarget
;
const
shape
=
btn
.
maskShape
;
egret
.
Tween
.
removeTweens
(
shape
);
egret
.
Tween
.
get
(
shape
).
to
({
alpha
:
1
},
200
);
egret
.
Tween
.
get
(
shape
).
to
({
alpha
:
0
},
200
);
},
that
);
});
...
...
@@ -51,5 +51,7 @@ export default (that: StartScene) => {
shapeR
.
x
=
that
[
'rightBtn'
].
x
;
shapeR
.
y
=
that
[
'rightBtn'
].
y
;
that
[
'rightBtn'
].
maskShape
=
shapeR
;
shapeLeft
.
alpha
=
shapeR
.
alpha
=
0
;
}
egret/src/startScene/playMovieClip.ts
View file @
67d65ec2
...
...
@@ -70,6 +70,6 @@ const createText = (score: number) => {
txt
.
bold
=
true
;
const
prefix
=
score
>
0
?
'+'
:
''
;
txt
.
text
=
prefix
+
score
;
txt
.
textColor
=
score
>
0
?
0x
00ff00
:
0xff000
0
;
txt
.
textColor
=
score
>
0
?
0x
ffffff
:
0xffff9
0
;
return
txt
;
}
\ No newline at end of file
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