Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DuibaGameTemplate
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
钱根
DuibaGameTemplate
Commits
5e32cddd
Commit
5e32cddd
authored
Dec 28, 2021
by
Master Q
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
b525a596
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
14 deletions
+36
-14
GPool.ts
module/tools/GPool.ts
+4
-0
ResJson.ts
src/ResJson.ts
+1
-1
GameOverPanel.ts
src/components/GameOverPanel.ts
+3
-0
ConveyorBelt.ts
src/scenes/GameScene/ConveyorBelt.ts
+2
-1
GameScene.ts
src/scenes/GameScene/GameScene.ts
+21
-12
IndexScene.ts
src/scenes/IndexScene.ts
+5
-0
No files found.
module/tools/GPool.ts
View file @
5e32cddd
...
@@ -38,4 +38,8 @@ export class GPool {
...
@@ -38,4 +38,8 @@ export class GPool {
}
}
this
.
pool
[
name
].
push
(
obj
);
this
.
pool
[
name
].
push
(
obj
);
}
}
public
static
clear
()
{
this
.
pool
=
Object
.
create
(
null
)
}
}
}
\ No newline at end of file
src/ResJson.ts
View file @
5e32cddd
...
@@ -656,5 +656,5 @@ export const ResJson = {
...
@@ -656,5 +656,5 @@ export const ResJson = {
"name"
:
"svga"
"name"
:
"svga"
}
}
],
],
"path"
:
"https://yun.duiba.com.cn/db_games/activity/template/16
39994156
/resource/"
"path"
:
"https://yun.duiba.com.cn/db_games/activity/template/16
40671399
/resource/"
}
}
\ No newline at end of file
src/components/GameOverPanel.ts
View file @
5e32cddd
...
@@ -3,6 +3,7 @@ import { RES } from "../../module/RES";
...
@@ -3,6 +3,7 @@ import { RES } from "../../module/RES";
import
{
Panel
}
from
"../../module/views/Panel"
;
import
{
Panel
}
from
"../../module/views/Panel"
;
import
UI
from
"../UI"
;
import
UI
from
"../UI"
;
import
IndexScene
from
'../scenes/IndexScene'
;
import
IndexScene
from
'../scenes/IndexScene'
;
import
{
LOG_TYPE
,
sendLog
}
from
'../WebNet'
;
interface
GameOverPanelInfer
{
interface
GameOverPanelInfer
{
"score"
:
number
,
"score"
:
number
,
...
@@ -25,6 +26,7 @@ export class GameOverPanel extends Panel {
...
@@ -25,6 +26,7 @@ export class GameOverPanel extends Panel {
RoleContainer
:
FYGE
.
Container
RoleContainer
:
FYGE
.
Container
initUi
():
void
{
initUi
():
void
{
sendLog
(
LOG_TYPE
.
EXPOSURE
,
76
)
const
RoleContainer
=
this
.
RoleContainer
=
UI
.
Ctn
(
this
,
(
750
-
616
)
/
2
,
(
1624
-
600
)
/
2
)
const
RoleContainer
=
this
.
RoleContainer
=
UI
.
Ctn
(
this
,
(
750
-
616
)
/
2
,
(
1624
-
600
)
/
2
)
UI
.
Sp
(
RoleContainer
,
'atomphere.png'
,
-
50
,
-
300
)
UI
.
Sp
(
RoleContainer
,
'atomphere.png'
,
-
50
,
-
300
)
RoleContainer
.
addChild
(
new
FYGE
.
MovieClip
(
RES
.
getRes
(
'获奖弹窗.svga'
)))
RoleContainer
.
addChild
(
new
FYGE
.
MovieClip
(
RES
.
getRes
(
'获奖弹窗.svga'
)))
...
@@ -40,6 +42,7 @@ export class GameOverPanel extends Panel {
...
@@ -40,6 +42,7 @@ export class GameOverPanel extends Panel {
},
this
,
40
,
430
)
},
this
,
40
,
430
)
UI
.
Btn
(
RoleContainer
,
'confirm-btn.png'
,
async
function
()
{
UI
.
Btn
(
RoleContainer
,
'confirm-btn.png'
,
async
function
()
{
sendLog
(
LOG_TYPE
.
CLICK
,
76
)
this
.
onGameRestart
()
this
.
onGameRestart
()
this
.
hidePanel
()
this
.
hidePanel
()
// changeScene(IndexScene)
// changeScene(IndexScene)
...
...
src/scenes/GameScene/ConveyorBelt.ts
View file @
5e32cddd
...
@@ -97,7 +97,8 @@ export class ConveyorBelt extends FYGE.Container {
...
@@ -97,7 +97,8 @@ export class ConveyorBelt extends FYGE.Container {
destroy
():
void
{
destroy
():
void
{
super
.
destroy
()
super
.
destroy
()
this
.
removeEvents
GPool
.
clear
()
this
.
removeEvents
()
}
}
/**
/**
...
...
src/scenes/GameScene/GameScene.ts
View file @
5e32cddd
import
{
LOG_TYPE
}
from
'./../../WebNet'
;
import
{
Tools
}
from
'./../../Tools'
;
import
{
Tools
}
from
'./../../Tools'
;
import
{
changeScene
}
from
'./../../../module/ctrls/index'
;
import
{
changeScene
}
from
'./../../../module/ctrls/index'
;
import
{
GPool
}
from
'./../../../module/tools/GPool'
;
import
{
GPool
}
from
'./../../../module/tools/GPool'
;
...
@@ -19,6 +20,7 @@ import { showPanel } from '../../../module/ctrls';
...
@@ -19,6 +20,7 @@ import { showPanel } from '../../../module/ctrls';
import
{
GameOverPanel
}
from
'../../components/GameOverPanel'
;
import
{
GameOverPanel
}
from
'../../components/GameOverPanel'
;
import
IndexScene
from
'../IndexScene'
;
import
IndexScene
from
'../IndexScene'
;
import
CircleProgressBar
from
'../../common/CircleProgressBar'
;
import
CircleProgressBar
from
'../../common/CircleProgressBar'
;
import
{
sendLog
}
from
'../../WebNet'
const
MD5
=
require
(
'js-md5'
)
const
MD5
=
require
(
'js-md5'
)
export
class
RadishCountDown
extends
FYGE
.
Container
{
export
class
RadishCountDown
extends
FYGE
.
Container
{
...
@@ -187,7 +189,7 @@ export class GameScene extends Scene {
...
@@ -187,7 +189,7 @@ export class GameScene extends Scene {
const
ScoreCont
=
UI
.
Ctn
(
this
,
280
,
180
)
const
ScoreCont
=
UI
.
Ctn
(
this
,
280
,
180
)
UI
.
Sp
(
ScoreCont
,
'score-back.png'
)
UI
.
Sp
(
ScoreCont
,
'score-back.png'
)
this
.
scoreText
=
UI
.
Txt
(
ScoreCont
,
'0'
,
36
,
'#ffffff'
,
FYGE
.
TEXT_ALIGN
.
LEFT
,
400
,
100
,
5
,
true
)
this
.
scoreText
=
UI
.
Txt
(
ScoreCont
,
'0'
,
36
,
'#ffffff'
,
FYGE
.
TEXT_ALIGN
.
LEFT
,
400
,
100
,
10
,
true
)
this
.
onInitNormalScoreGoalBoard
()
this
.
onInitNormalScoreGoalBoard
()
// @ts-ignore
// @ts-ignore
...
@@ -197,7 +199,7 @@ export class GameScene extends Scene {
...
@@ -197,7 +199,7 @@ export class GameScene extends Scene {
const
CountDownCom
=
UI
.
Ctn
(
this
,
650
,
180
)
const
CountDownCom
=
UI
.
Ctn
(
this
,
650
,
180
)
UI
.
Sp
(
CountDownCom
,
'countDown-back.png'
)
UI
.
Sp
(
CountDownCom
,
'countDown-back.png'
)
const
cdt
=
this
.
cdt
=
UI
.
Txt
(
CountDownCom
,
`
${
getTbData
(
TbNetName
.
doIndex
).
data
.
skiingCountdownSeconds
}
s`
,
30
,
'#b1231c'
,
FYGE
.
TEXT_ALIGN
.
CENTER
,
80
,
0
,
36
,
true
)
const
cdt
=
this
.
cdt
=
UI
.
Txt
(
CountDownCom
,
`
${
getTbData
(
TbNetName
.
doIndex
).
data
.
skiingCountdownSeconds
}
s`
,
30
,
'#b1231c'
,
FYGE
.
TEXT_ALIGN
.
CENTER
,
80
,
0
,
40
,
true
)
// this.addChild(new FYGE.MovieClip(RES.getRes('游戏兔子.svga')))
// this.addChild(new FYGE.MovieClip(RES.getRes('游戏兔子.svga')))
// Rabbit.anchor.set(0.5)
// Rabbit.anchor.set(0.5)
// Rabbit.position.set()
// Rabbit.position.set()
...
@@ -222,14 +224,14 @@ export class GameScene extends Scene {
...
@@ -222,14 +224,14 @@ export class GameScene extends Scene {
}))
}))
p
.
position
.
set
(
33
,
80
)
p
.
position
.
set
(
33
,
80
)
UI
.
Sp
(
p
,
'progress-point.png'
,
-
10
,
-
4
)
UI
.
Sp
(
p
,
'progress-point.png'
,
-
10
,
-
4
)
UI
.
Sp
(
p
,
'goal0'
,
0
,
-
40
,
true
)
UI
.
Sp
(
p
,
'goal0'
,
0
,
-
35
,
true
)
const
skiingScoreRewardCreditsList
=
this
.
skiingScoreRewardCreditsList
=
getTbData
(
TbNetName
.
doIndex
).
data
.
skiingScoreRewardCreditsList
const
skiingScoreRewardCreditsList
=
this
.
skiingScoreRewardCreditsList
=
getTbData
(
TbNetName
.
doIndex
).
data
.
skiingScoreRewardCreditsList
const
finalScore
=
this
.
maxScore
=
skiingScoreRewardCreditsList
.
slice
(
-
1
)[
0
].
score
const
finalScore
=
this
.
maxScore
=
skiingScoreRewardCreditsList
.
slice
(
-
1
)[
0
].
score
for
(
let
i
=
0
;
i
<
skiingScoreRewardCreditsList
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
skiingScoreRewardCreditsList
.
length
;
i
++
)
{
const
goal
=
skiingScoreRewardCreditsList
[
i
];
const
goal
=
skiingScoreRewardCreditsList
[
i
];
UI
.
Sp
(
p
,
'progress-point.png'
,
goal
.
score
/
finalScore
*
390
-
10
,
-
4
)
UI
.
Sp
(
p
,
'progress-point.png'
,
goal
.
score
/
finalScore
*
390
-
10
,
-
4
)
const
gi
=
UI
.
Sp
(
p
,
i
<
skiingScoreRewardCreditsList
.
length
-
1
?
'giftbox-disabled'
:
'finalgiftbox-disabled'
,
goal
.
score
/
finalScore
*
390
-
20
,
-
60
)
const
gi
=
UI
.
Sp
(
p
,
i
<
skiingScoreRewardCreditsList
.
length
-
1
?
'giftbox-disabled'
:
'finalgiftbox-disabled'
,
goal
.
score
/
finalScore
*
390
-
20
,
-
55
)
UI
.
Txt
(
p
,
`
${
goal
.
score
}
分`
,
24
,
'#c14c3b'
,
FYGE
.
TEXT_ALIGN
.
LEFT
,
200
,
goal
.
score
/
finalScore
*
390
-
20
,
15
)
UI
.
Txt
(
p
,
`
${
goal
.
score
}
分`
,
24
,
'#c14c3b'
,
FYGE
.
TEXT_ALIGN
.
LEFT
,
200
,
goal
.
score
/
finalScore
*
390
-
20
,
20
)
// @ts-ignore
// @ts-ignore
gi
.
_goalImage
=
i
<
skiingScoreRewardCreditsList
.
length
-
1
?
'giftbox'
:
'finalgiftbox'
gi
.
_goalImage
=
i
<
skiingScoreRewardCreditsList
.
length
-
1
?
'giftbox'
:
'finalgiftbox'
this
.
goalList
.
push
(
gi
)
this
.
goalList
.
push
(
gi
)
...
@@ -276,7 +278,7 @@ export class GameScene extends Scene {
...
@@ -276,7 +278,7 @@ export class GameScene extends Scene {
await
sendTbNet
(
TbNetName
.
doModifySkiingGuideFlag
,
{
await
sendTbNet
(
TbNetName
.
doModifySkiingGuideFlag
,
{
flag
:
1
flag
:
1
})
})
const
{
success
,
data
}
=
await
sendTbNet
(
TbNetName
.
doStart
)
const
{
success
,
data
}
=
await
sendTbNet
(
TbNetName
.
doStart
,
null
,
null
,
true
)
if
(
!
success
)
{
if
(
!
success
)
{
changeScene
(
IndexScene
)
changeScene
(
IndexScene
)
return
return
...
@@ -307,6 +309,12 @@ export class GameScene extends Scene {
...
@@ -307,6 +309,12 @@ export class GameScene extends Scene {
this
.
cdt
.
text
=
`
${
getTbData
(
TbNetName
.
doIndex
).
data
.
skiingCountdownSeconds
}
s`
this
.
cdt
.
text
=
`
${
getTbData
(
TbNetName
.
doIndex
).
data
.
skiingCountdownSeconds
}
s`
this
.
conveyorList
.
forEach
(
con
=>
con
.
onReset
())
this
.
conveyorList
.
forEach
(
con
=>
con
.
onReset
())
let
s
:
FYGE
.
MovieClip
let
s
:
FYGE
.
MovieClip
this
.
currRabbitIndex
=
1
this
.
goalList
&&
this
.
goalList
.
forEach
(
item
=>
{
// @ts-ignore
item
.
texture
=
RES
.
getRes
(
item
.
_goalImage
+
'-disabled.png'
)
})
if
(
this
.
CountDownSvga
)
{
if
(
this
.
CountDownSvga
)
{
s
=
this
.
CountDownSvga
s
=
this
.
CountDownSvga
}
else
{
}
else
{
...
@@ -345,7 +353,7 @@ export class GameScene extends Scene {
...
@@ -345,7 +353,7 @@ export class GameScene extends Scene {
const
{
success
,
data
}
=
await
sendTbNet
(
TbNetName
.
doSubmit
,
{
const
{
success
,
data
}
=
await
sendTbNet
(
TbNetName
.
doSubmit
,
{
startId
:
getTbData
(
TbNetName
.
doStart
).
data
.
startId
,
startId
:
getTbData
(
TbNetName
.
doStart
).
data
.
startId
,
score
:
this
.
score
,
score
:
this
.
score
,
signStr
:
MD5
(
`
${
11
}
_
${
this
.
score
}
_1696BD3E5BB915A0`
)
signStr
:
MD5
(
`
${
getTbData
(
TbNetName
.
doStart
).
data
.
startId
}
_
${
this
.
score
}
_1696BD3E5BB915A0`
)
})
})
if
(
success
)
{
if
(
success
)
{
...
@@ -356,7 +364,7 @@ export class GameScene extends Scene {
...
@@ -356,7 +364,7 @@ export class GameScene extends Scene {
}
}
onGameRestart
=
async
()
=>
{
onGameRestart
=
async
()
=>
{
const
{
success
,
data
}
=
await
sendTbNet
(
TbNetName
.
doStart
)
const
{
success
,
data
}
=
await
sendTbNet
(
TbNetName
.
doStart
,
null
,
null
,
true
)
if
(
success
)
{
if
(
success
)
{
this
.
onStart
()
this
.
onStart
()
}
else
{
}
else
{
...
@@ -435,8 +443,8 @@ export class GameScene extends Scene {
...
@@ -435,8 +443,8 @@ export class GameScene extends Scene {
}
}
initEvents
():
void
{
initEvents
():
void
{
this
.
stage
.
addEventListener
(
FYGE
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onTouchStart
,
this
)
this
.
addEventListener
(
FYGE
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onTouchStart
,
this
)
this
.
stage
.
addEventListener
(
FYGE
.
MouseEvent
.
MOUSE_UP
,
this
.
onTouchUp
,
this
)
this
.
addEventListener
(
FYGE
.
MouseEvent
.
MOUSE_UP
,
this
.
onTouchUp
,
this
)
this
.
addEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
onUpdate
,
this
)
this
.
addEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
onUpdate
,
this
)
GDispatcher
.
addEventListener
(
'update-score'
,
this
.
onUpdateScore
,
this
)
GDispatcher
.
addEventListener
(
'update-score'
,
this
.
onUpdateScore
,
this
)
GDispatcher
.
addEventListener
(
'game-over'
,
this
.
onGameOver
,
this
)
GDispatcher
.
addEventListener
(
'game-over'
,
this
.
onGameOver
,
this
)
...
@@ -445,8 +453,8 @@ export class GameScene extends Scene {
...
@@ -445,8 +453,8 @@ export class GameScene extends Scene {
}
}
removeEvents
():
void
{
removeEvents
():
void
{
this
.
stage
.
removeEventListener
(
FYGE
.
MouseEvent
.
MOUSE_UP
,
this
.
onTouchUp
,
this
)
this
.
removeEventListener
(
FYGE
.
MouseEvent
.
MOUSE_UP
,
this
.
onTouchUp
,
this
)
this
.
stage
.
removeEventListener
(
FYGE
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onTouchStart
,
this
)
this
.
removeEventListener
(
FYGE
.
MouseEvent
.
MOUSE_DOWN
,
this
.
onTouchStart
,
this
)
this
.
removeEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
onUpdate
,
this
)
this
.
removeEventListener
(
FYGE
.
Event
.
ENTER_FRAME
,
this
.
onUpdate
,
this
)
GDispatcher
.
removeEventListener
(
'update-score'
,
this
.
onUpdateScore
,
this
)
GDispatcher
.
removeEventListener
(
'update-score'
,
this
.
onUpdateScore
,
this
)
GDispatcher
.
removeEventListener
(
'show-radish'
,
this
.
onShowRadishTips
,
this
)
GDispatcher
.
removeEventListener
(
'show-radish'
,
this
.
onShowRadishTips
,
this
)
...
@@ -465,6 +473,7 @@ export class GameScene extends Scene {
...
@@ -465,6 +473,7 @@ export class GameScene extends Scene {
}
}
onTouchStart
(
e
)
{
onTouchStart
(
e
)
{
if
(
!
this
.
GameStatus
)
return
this
.
touchStartX
=
e
.
clientX
this
.
touchStartX
=
e
.
clientX
this
.
stage
.
addEventListener
(
FYGE
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onTouchMove
,
this
)
this
.
stage
.
addEventListener
(
FYGE
.
MouseEvent
.
MOUSE_MOVE
,
this
.
onTouchMove
,
this
)
this
.
stage
.
once
(
FYGE
.
MouseEvent
.
MOUSE_UP
,
function
()
{
this
.
stage
.
once
(
FYGE
.
MouseEvent
.
MOUSE_UP
,
function
()
{
...
...
src/scenes/IndexScene.ts
View file @
5e32cddd
...
@@ -8,6 +8,7 @@ import { GDispatcher } from '../Main';
...
@@ -8,6 +8,7 @@ import { GDispatcher } from '../Main';
import
{
GameScene
,
RadishCountDown
}
from
'./GameScene/GameScene'
;
import
{
GameScene
,
RadishCountDown
}
from
'./GameScene/GameScene'
;
import
{
getTbData
,
sendTbNet
,
TbNetName
}
from
'../TaoBaoNet'
;
import
{
getTbData
,
sendTbNet
,
TbNetName
}
from
'../TaoBaoNet'
;
import
CircleProgressBar
from
'../common/CircleProgressBar'
;
import
CircleProgressBar
from
'../common/CircleProgressBar'
;
import
{
LOG_TYPE
,
sendLog
}
from
'../WebNet'
;
export
const
IndexSceneConfig
=
{
export
const
IndexSceneConfig
=
{
ms
:
false
ms
:
false
...
@@ -62,6 +63,8 @@ export default class IndexScene extends Scene {
...
@@ -62,6 +63,8 @@ export default class IndexScene extends Scene {
start
(
data
?:
any
):
void
{
start
(
data
?:
any
):
void
{
super
.
start
()
super
.
start
()
sendLog
(
LOG_TYPE
.
EXPOSURE
,
74
)
sendLog
(
LOG_TYPE
.
EXPOSURE
,
75
)
sendTbNet
(
TbNetName
.
judgeLogin
)
sendTbNet
(
TbNetName
.
judgeLogin
)
sendTbNet
(
TbNetName
.
indexSceneVisible
,
{
visible
:
true
})
sendTbNet
(
TbNetName
.
indexSceneVisible
,
{
visible
:
true
})
}
}
...
@@ -74,6 +77,7 @@ export default class IndexScene extends Scene {
...
@@ -74,6 +77,7 @@ export default class IndexScene extends Scene {
}
}
async
onGameStart
()
{
async
onGameStart
()
{
sendLog
(
LOG_TYPE
.
CLICK
,
74
)
const
{
success
:
s
}
=
await
sendTbNet
(
TbNetName
.
checkGameNum
)
const
{
success
:
s
}
=
await
sendTbNet
(
TbNetName
.
checkGameNum
)
if
(
!
s
)
{
if
(
!
s
)
{
showToast
(
'游戏次数不足'
)
showToast
(
'游戏次数不足'
)
...
@@ -102,6 +106,7 @@ export default class IndexScene extends Scene {
...
@@ -102,6 +106,7 @@ export default class IndexScene extends Scene {
}
}
onBackActivity
()
{
onBackActivity
()
{
sendLog
(
LOG_TYPE
.
CLICK
,
75
)
sendTbNet
(
TbNetName
.
back
)
sendTbNet
(
TbNetName
.
back
)
}
}
...
...
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