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
be9d5e11
Commit
be9d5e11
authored
Dec 11, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
6708c7ef
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
135 additions
and
40 deletions
+135
-40
StartSkin.exml
egret/resource/skins/StartSkin.exml
+3
-5
TreasurePanel.ts
egret/src/TreasurePanel.ts
+1
-2
StartScene.ts
egret/src/startScene/StartScene.ts
+41
-24
check.ts
egret/src/startScene/check.ts
+9
-9
createItems.ts
egret/src/startScene/createItems.ts
+7
-0
levels.ts
egret/src/startScene/levels.ts
+67
-0
updateLVProgress.ts
egret/src/startScene/updateLVProgress.ts
+7
-0
No files found.
egret/resource/skins/StartSkin.exml
View file @
be9d5e11
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
<e:Skin
class=
"StartSkin"
width=
"750"
height=
"1624"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Skin
class=
"StartSkin"
width=
"750"
height=
"1624"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<w:Config
id=
"16705cb4eec"
/>
<w:Config
id=
"16705cb4eec"
/>
<e:Image
source=
"startscenebg_jpg"
x=
"0"
y=
"0"
/>
<e:Image
source=
"startscenebg_jpg"
x=
"0"
y=
"0"
/>
<e:Image
source=
"scorebg_png"
horizontalCenter=
"0"
top=
"0"
/>
<e:Label
id=
"scoreTxt"
text=
"得分:0"
height=
"48"
width=
"750"
horizontalCenter=
"0"
top=
"0"
textAlign=
"center"
verticalAlign=
"middle"
textColor=
"0xfcdf9b"
/>
<e:Label
id=
"exemptionTxt"
text=
"*兑换项与活动均与设备制造商Apple Inc.公司无关*"
width=
"100%"
horizontalCenter=
"0"
bottom=
"5"
<e:Label
id=
"exemptionTxt"
text=
"*兑换项与活动均与设备制造商Apple Inc.公司无关*"
width=
"100%"
horizontalCenter=
"0"
bottom=
"5"
verticalAlign=
"middle"
textAlign=
"center"
size=
"18"
textColor=
"0xffffff"
/>
verticalAlign=
"middle"
textAlign=
"center"
size=
"18"
textColor=
"0xffffff"
/>
<e:Button
id=
"recordBtn"
label=
""
y=
"16"
scaleX=
"1"
scaleY=
"1"
right=
"23"
>
<e:Button
id=
"recordBtn"
label=
""
y=
"16"
scaleX=
"1"
scaleY=
"1"
right=
"23"
>
...
@@ -54,7 +52,7 @@
...
@@ -54,7 +52,7 @@
<e:Image
source=
"bubble_png"
x=
"268"
y=
"1082"
visible=
"false"
/>
<e:Image
source=
"bubble_png"
x=
"268"
y=
"1082"
visible=
"false"
/>
<e:Image
id=
"progressbg"
source=
"progressbg_png"
y=
"74"
x=
"182.5"
/>
<e:Image
id=
"progressbg"
source=
"progressbg_png"
y=
"74"
x=
"182.5"
/>
<e:Image
id=
"progressfront"
source=
"progressfront_png"
width=
"380"
y=
"77"
x=
"185"
/>
<e:Image
id=
"progressfront"
source=
"progressfront_png"
width=
"380"
y=
"77"
x=
"185"
/>
<e:Group
id=
"progress1"
y=
"74"
width=
"386"
height=
"36"
horizontalCenter=
"0"
visible=
"false"
>
<e:Group
id=
"progress1"
y=
"74"
width=
"386"
height=
"36"
horizontalCenter=
"0"
>
<e:Image
verticalCenter=
"0"
x=
"325"
source=
"progress_f1_png"
/>
<e:Image
verticalCenter=
"0"
x=
"325"
source=
"progress_f1_png"
/>
<e:Image
source=
"5_png"
x=
"350.5"
y=
"23.02"
/>
<e:Image
source=
"5_png"
x=
"350.5"
y=
"23.02"
/>
</e:Group>
</e:Group>
...
@@ -81,8 +79,8 @@
...
@@ -81,8 +79,8 @@
<e:Image
source=
"10_png"
x=
"173.99"
y=
"19.7"
/>
<e:Image
source=
"10_png"
x=
"173.99"
y=
"19.7"
/>
</e:Group>
</e:Group>
<e:Group
id=
"lvLayer"
x=
"0"
y=
"167.74"
>
<e:Group
id=
"lvLayer"
x=
"0"
y=
"167.74"
>
<e:Image
id=
"lvbg"
source=
"lvbg_png"
x=
"55"
y=
"0"
/>
<e:Image
id=
"lvbg"
source=
"lvbg_png"
x=
"55"
y=
"0"
visible=
"false"
/>
<e:Group
id=
"lv1"
x=
"0"
y=
"166.26"
width=
"750"
>
<e:Group
id=
"lv1"
x=
"0"
y=
"166.26"
width=
"750"
visible=
"false"
>
<e:Image
source=
"lv_common_png"
y=
"103.08"
horizontalCenter=
"14"
/>
<e:Image
source=
"lv_common_png"
y=
"103.08"
horizontalCenter=
"14"
/>
<e:Image
source=
"lv1_png"
y=
"0"
horizontalCenter=
"0"
/>
<e:Image
source=
"lv1_png"
y=
"0"
horizontalCenter=
"0"
/>
</e:Group>
</e:Group>
...
...
egret/src/TreasurePanel.ts
View file @
be9d5e11
...
@@ -4,11 +4,10 @@ import getCountTxt from "../libs/new_tw/datas/getCountTxt";
...
@@ -4,11 +4,10 @@ import getCountTxt from "../libs/new_tw/datas/getCountTxt";
import
Loading
from
"../libs/new_wx/components/Loading"
;
import
Loading
from
"../libs/new_wx/components/Loading"
;
import
Panel
from
"../libs/new_wx/components/Panel"
;
import
Panel
from
"../libs/new_wx/components/Panel"
;
import
PanelCtrl
from
"../libs/new_wx/ctrls/panelCtrl"
;
import
PanelCtrl
from
"../libs/new_wx/ctrls/panelCtrl"
;
import
showAlertPanel
from
"../libs/new_wx/ctrls/showAlertPanel"
;
import
{
ModuleTypes
}
from
"../libs/new_wx/types/sceneTypes"
;
import
{
ModuleTypes
}
from
"../libs/new_wx/types/sceneTypes"
;
import
{
DataManager
}
from
"../libs/tw/manager/DataManager"
;
import
{
DataManager
}
from
"../libs/tw/manager/DataManager"
;
import
{
NetManager
}
from
"../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../libs/tw/manager/NetManager"
;
import
{
Data
}
from
"../libs/tw/data/Data"
;
import
showAlertPanel
from
"../libs/new_wx/ctrls/showAlertPanel"
;
export
default
class
TreasurePanel
extends
Panel
{
export
default
class
TreasurePanel
extends
Panel
{
start
(
data
)
{
start
(
data
)
{
...
...
egret/src/startScene/StartScene.ts
View file @
be9d5e11
import
StartSceneBase
from
"../../libs/new_wx/components/StartSceneBase"
;
import
StartSceneBase
from
"../../libs/new_wx/components/StartSceneBase"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
import
{
ABNetManager
}
from
"../../libs/tc/manager/ABNetManager"
;
import
{
GDispatcher
}
from
"../../libs/tc/util/GDispatcher"
;
import
EgretRender
from
"../physics/EgretRender"
;
import
EgretRender
from
"../physics/EgretRender"
;
import
check
from
"./check"
;
import
check
from
"./check"
;
import
{
bubble
,
bubbleGroup
,
bubbleMask
}
from
"./collisionConfig"
;
import
{
bubble
,
bubbleGroup
,
bubbleMask
}
from
"./collisionConfig"
;
...
@@ -6,11 +9,10 @@ import createBox from "./createBox";
...
@@ -6,11 +9,10 @@ import createBox from "./createBox";
import
createBtns
from
"./createBtns"
;
import
createBtns
from
"./createBtns"
;
import
createBubblePic
from
"./createBubblePic"
;
import
createBubblePic
from
"./createBubblePic"
;
import
createItems
from
"./createItems"
;
import
createItems
from
"./createItems"
;
import
{
addLvScore
,
getCurrentPercent
,
onLvBoom
,
getCurrentLevel
,
getLevelAniTag
,
setLevelAniTag
}
from
"./levels"
;
import
random
from
"./random"
;
import
random
from
"./random"
;
import
{
startStandbyBubblesLeft
,
startStandbyBubblesRight
,
stopStandbyBubblesLeft
,
stopStandbyBubblesRight
}
from
"./standbyBubbles"
;
import
{
startStandbyBubblesLeft
,
startStandbyBubblesRight
,
stopStandbyBubblesLeft
,
stopStandbyBubblesRight
}
from
"./standbyBubbles"
;
import
{
GDispatcher
}
from
"../../libs/tc/util/GDispatcher"
;
import
updateLVProgress
from
"./updateLVProgress"
;
import
{
ABNetManager
}
from
"../../libs/tc/manager/ABNetManager"
;
import
PanelCtrl
from
"../../libs/new_wx/ctrls/panelCtrl"
;
export
default
class
StartScene
extends
StartSceneBase
{
export
default
class
StartScene
extends
StartSceneBase
{
_engine
:
Matter
.
Engine
;
_engine
:
Matter
.
Engine
;
...
@@ -19,11 +21,8 @@ export default class StartScene extends StartSceneBase {
...
@@ -19,11 +21,8 @@ export default class StartScene extends StartSceneBase {
_startStandbyBubblesLeft
:
number
;
_startStandbyBubblesLeft
:
number
;
_startStandbyBubblesRight
:
number
;
_startStandbyBubblesRight
:
number
;
egretRenderContainer
:
egret
.
Sprite
;
egretRenderContainer
:
egret
.
Sprite
;
score
=
10
;
MAX_SCORE
=
20
;
private
scoreTxt
:
eui
.
Label
;
onPanelRemoved
(){
onPanelRemoved
()
{
}
}
...
@@ -35,38 +34,54 @@ export default class StartScene extends StartSceneBase {
...
@@ -35,38 +34,54 @@ export default class StartScene extends StartSceneBase {
}
}
toNextLevel
()
{
}
initLevel
()
{
const
lv
=
getCurrentLevel
();
updateLVProgress
(
this
,
lv
);
this
.
updateProgress
();
this
[
'lvLayer'
].
touchChildren
=
this
[
'lvLayer'
].
touchEnabled
=
false
;
}
playLevelAni
()
{
if
(
!
getLevelAniTag
())
{
const
lv
=
getCurrentLevel
();
setLevelAniTag
();
this
[
'lvbg'
].
visible
=
true
;
this
[
'lvbg'
].
alpha
=
1
;
this
[
`lv
${
lv
}
`
].
visible
=
true
;
egret
.
Tween
.
get
(
this
[
`lv
${
lv
}
`
]).
set
({
y
:
166.26
-
1624
}).
to
({
y
:
166.26
},
700
,
egret
.
Ease
.
backOut
)
.
wait
(
1000
).
to
({
y
:
1624
+
166.26
},
500
,
egret
.
Ease
.
backIn
);
egret
.
Tween
.
get
(
this
[
'lvbg'
]).
wait
(
700
+
1000
).
to
({
alpha
:
0
},
500
);
}
else
{
}
}
updateProgress
()
{
updateProgress
()
{
const
percent
=
this
.
score
/
this
.
MAX_SCORE
;
const
percent
=
getCurrentPercent
()
;
const
maxwidth
=
this
.
progressfront
.
width
;
const
maxwidth
=
this
.
progressfront
.
width
;
egret
.
Tween
.
removeTweens
(
this
.
progressfront
.
mask
);
egret
.
Tween
.
removeTweens
(
this
.
progressfront
.
mask
);
egret
.
Tween
.
get
(
this
.
progressfront
.
mask
).
to
({
width
:
percent
*
maxwidth
},
200
);
egret
.
Tween
.
get
(
this
.
progressfront
.
mask
).
to
({
width
:
percent
*
maxwidth
},
200
);
}
}
onBoom
():
any
{
onBoom
():
any
{
this
.
score
=
0
;
onLvBoom
()
;
this
.
updateProgress
();
this
.
updateProgress
();
this
.
updateScoreTxt
();
}
}
addScore
():
any
{
addScore
():
any
{
this
.
score
++
;
addLvScore
();
const
old
=
this
.
score
;
if
(
old
==
this
.
MAX_SCORE
)
{
this
.
score
=
0
;
}
this
.
updateScoreTxt
();
this
.
updateProgress
();
this
.
updateProgress
();
return
old
;
}
updateScoreTxt
()
{
this
.
scoreTxt
.
text
=
`得分:
${
this
.
score
}
`
;
}
}
async
start
(
data
?)
{
async
start
(
data
?)
{
super
.
start
();
super
.
start
();
GDispatcher
.
addEvent
(
ABNetManager
.
NET_ERROR
,
this
.
onNetError
,
this
);
GDispatcher
.
addEvent
(
ABNetManager
.
NET_ERROR
,
this
.
onNetError
,
this
);
PanelCtrl
.
instance
.
addEventListener
(
'onPanelRemoved'
,
this
.
onPanelRemoved
,
this
)
PanelCtrl
.
instance
.
addEventListener
(
'onPanelRemoved'
,
this
.
onPanelRemoved
,
this
)
egret
.
lifecycle
.
onPause
=
()
=>
{
egret
.
lifecycle
.
onPause
=
()
=>
{
console
.
log
(
"app 进入后台"
);
console
.
log
(
"app 进入后台"
);
egret
.
ticker
.
pause
();
// 关闭渲染与心跳
egret
.
ticker
.
pause
();
// 关闭渲染与心跳
...
@@ -91,6 +106,7 @@ export default class StartScene extends StartSceneBase {
...
@@ -91,6 +106,7 @@ export default class StartScene extends StartSceneBase {
this
.
addChild
(
this
[
'basket_top'
]);
this
.
addChild
(
this
[
'basket_top'
]);
this
.
addChild
(
this
[
'glass'
]);
this
.
addChild
(
this
[
'glass'
]);
this
.
addChild
(
this
[
'lvLayer'
]);
[
this
[
'basket_bottom'
],
this
[
'basket_top'
],
this
[
'glass'
]].
forEach
(
item
=>
[
this
[
'basket_bottom'
],
this
[
'basket_top'
],
this
[
'glass'
]].
forEach
(
item
=>
egret
.
Tween
.
get
(
item
).
set
({
alpha
:
0
}).
to
({
alpha
:
1
},
500
));
egret
.
Tween
.
get
(
item
).
set
({
alpha
:
0
}).
to
({
alpha
:
1
},
500
));
...
@@ -124,6 +140,9 @@ export default class StartScene extends StartSceneBase {
...
@@ -124,6 +140,9 @@ export default class StartScene extends StartSceneBase {
rect
.
width
=
0
;
rect
.
width
=
0
;
this
.
progressfront
.
mask
=
rect
;
this
.
progressfront
.
mask
=
rect
;
this
.
initLevel
();
this
.
playLevelAni
();
const
reslist
=
[
'boom'
,
'gift'
,
'candy'
,
'coin'
,
'egg'
]
const
reslist
=
[
'boom'
,
'gift'
,
'candy'
,
'coin'
,
'egg'
]
await
Promise
.
all
(
await
Promise
.
all
(
reslist
.
map
(
res
=>
RES
.
getResAsync
(
`
${
res
}
_json`
))
reslist
.
map
(
res
=>
RES
.
getResAsync
(
`
${
res
}
_json`
))
...
@@ -209,8 +228,6 @@ export default class StartScene extends StartSceneBase {
...
@@ -209,8 +228,6 @@ export default class StartScene extends StartSceneBase {
startStandbyBubblesLeft
(
this
.
_egretRender
);
startStandbyBubblesLeft
(
this
.
_egretRender
);
startStandbyBubblesRight
(
this
.
_egretRender
);
startStandbyBubblesRight
(
this
.
_egretRender
);
// initScoreTxt(this);
this
.
updateScoreTxt
();
this
.
updateProgress
();
this
.
updateProgress
();
}
}
...
...
egret/src/startScene/check.ts
View file @
be9d5e11
...
@@ -55,15 +55,15 @@ const check = (_this: StartScene) => {
...
@@ -55,15 +55,15 @@ const check = (_this: StartScene) => {
}
}
const
checkAdd
=
(
that
:
StartScene
,
oldscore
)
=>
{
const
checkAdd
=
(
that
:
StartScene
,
oldscore
)
=>
{
if
(
oldscore
===
5
)
{
//
if (oldscore === 5) {
createNewBubble
(
that
,
LabelType
.
candy
);
//
createNewBubble(that, LabelType.candy);
}
//
}
else
if
(
oldscore
===
20
)
{
//
else if (oldscore === 20) {
createNewBubble
(
that
,
LabelType
.
egg
);
//
createNewBubble(that, LabelType.egg);
}
//
}
else
if
(
oldscore
===
that
.
MAX_SCORE
)
{
//
else if (oldscore === that.MAX_SCORE) {
createNewBubble
(
that
,
LabelType
.
gift
);
//
createNewBubble(that, LabelType.gift);
}
//
}
}
}
export
default
check
export
default
check
\ No newline at end of file
egret/src/startScene/createItems.ts
View file @
be9d5e11
...
@@ -3,6 +3,7 @@ import createItem from "./items/createItem";
...
@@ -3,6 +3,7 @@ import createItem from "./items/createItem";
import
{
award
,
awardMask
}
from
"./collisionConfig"
;
import
{
award
,
awardMask
}
from
"./collisionConfig"
;
import
random
from
"./random"
;
import
random
from
"./random"
;
import
LabelType
from
"./items/LabelType"
;
import
LabelType
from
"./items/LabelType"
;
import
{
getCurrentItems
}
from
"./levels"
;
export
const
createNewBubble
=
(
_this
:
StartScene
,
type
:
LabelType
)
=>
{
export
const
createNewBubble
=
(
_this
:
StartScene
,
type
:
LabelType
)
=>
{
createBubble
(
_this
,
type
,
Math
.
random
()
>
0.5
?
180
:
750
-
180
,
220
);
createBubble
(
_this
,
type
,
Math
.
random
()
>
0.5
?
180
:
750
-
180
,
220
);
...
@@ -29,7 +30,13 @@ const createBubble = (_this: StartScene, type: LabelType, x: number, y: number)
...
@@ -29,7 +30,13 @@ const createBubble = (_this: StartScene, type: LabelType, x: number, y: number)
}
}
export
default
(
_this
:
StartScene
)
=>
{
export
default
(
_this
:
StartScene
)
=>
{
const
items
=
getCurrentItems
();
//[[LabelType.boom, 1], [LabelType.coin, 5]]
const
list
=
[];
for
(
const
item
of
items
)
{
}
let
count
=
0
;
let
count
=
0
;
const
countMax
=
1
;
const
coinsFall
=
setInterval
(()
=>
{
const
coinsFall
=
setInterval
(()
=>
{
if
(
count
<
14
)
{
if
(
count
<
14
)
{
// const types = [ LabelType.candy, LabelType.coin, LabelType.gift,LabelType.egg]
// const types = [ LabelType.candy, LabelType.coin, LabelType.gift,LabelType.egg]
...
...
egret/src/startScene/levels.ts
0 → 100644
View file @
be9d5e11
import
LabelType
from
"./items/LabelType"
;
const
levels
=
{
'1'
:
{
max
:
5
,
items
:
[[
LabelType
.
boom
,
1
],
[
LabelType
.
coin
,
5
]]
}
}
const
MAX_LEVELS
=
4
;
export
const
getCurrentItems
=
()
=>
{
return
getLevelData
().
items
}
export
const
getCurrentScore
=
()
=>
{
const
data
=
localStorage
.
getItem
(
'currentScore'
)
if
(
!
data
)
return
0
return
parseInt
(
data
)
}
export
const
addCurrentScore
=
()
=>
{
let
score
=
getCurrentScore
();
score
++
;
localStorage
.
setItem
(
'currentScore'
,
score
+
''
)
}
export
const
clearCurrentScore
=
()
=>
{
localStorage
.
setItem
(
'currentScore'
,
'0'
)
}
export
const
getCurrentLevel
=
()
=>
{
const
data
=
localStorage
.
getItem
(
'currentLevel'
)
if
(
!
data
)
return
1
return
parseInt
(
data
)
}
export
const
addCurrentLevel
=
()
=>
{
let
lv
=
getCurrentLevel
();
lv
++
;
localStorage
.
setItem
(
'currentLevel'
,
lv
+
''
)
}
export
const
getCurrentPercent
=
()
=>
{
return
getCurrentScore
()
/
getLevelData
().
max
;
}
export
const
onLvBoom
=
()
=>
{
clearCurrentScore
();
}
export
const
addLvScore
=
()
=>
{
addCurrentScore
();
}
export
const
getLevelData
=
()
=>
{
return
levels
[
getCurrentLevel
()]
}
export
const
getLevelAniTag
=
()
=>
{
return
!!
localStorage
.
getItem
(
`LevelAniTag
${
getCurrentLevel
()}
`
)
}
export
const
setLevelAniTag
=
()
=>
{
return
localStorage
.
setItem
(
`LevelAniTag
${
getCurrentLevel
()}
`
,
'1'
)
}
egret/src/startScene/updateLVProgress.ts
0 → 100644
View file @
be9d5e11
export
default
(
that
,
lv
)
=>
{
that
.
progress1
.
visible
=
false
;
that
.
progress2
.
visible
=
false
;
that
.
progress3
.
visible
=
false
;
that
.
progress4
.
visible
=
false
;
that
[
`progress
${
lv
}
`
].
visible
=
true
;
}
\ 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