Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
JsxForFYGETemplate
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
钱根
JsxForFYGETemplate
Commits
d2093c22
Commit
d2093c22
authored
Dec 05, 2022
by
Master Q
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注意闭包导致的 变量引用出错
parent
4980dee1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
32 deletions
+50
-32
ResJson.ts
src/ResJson.ts
+1
-1
index.tsx
src/index.tsx
+6
-1
ModalControl.tsx
src/modules/ModalControl.tsx
+9
-0
ctrls.tsx
src/modules/layers/ctrls.tsx
+2
-3
GameResumeModal.tsx
src/panels/GameResumeModal/GameResumeModal.tsx
+2
-0
GameConfig.ts
src/scenes/GameScene/GameConfig.ts
+7
-7
GameScene.tsx
src/scenes/GameScene/GameScene.tsx
+7
-4
NewGuyScene.tsx
src/scenes/NewGuyScene/NewGuyScene.tsx
+4
-4
simpleTools.ts
src/tools/simpleTools.ts
+12
-12
No files found.
src/ResJson.ts
View file @
d2093c22
...
...
@@ -716,5 +716,5 @@ export const ResJson = {
}
],
// eslint-disable-next-line
"path"
:
"https://yun.duiba.com.cn/db_games/activity/template/16702
24643
/resource/"
"path"
:
"https://yun.duiba.com.cn/db_games/activity/template/16702
42040
/resource/"
}
\ No newline at end of file
src/index.tsx
View file @
d2093c22
import
{
destroyLayers
,
layers
}
from
"./modules/layers"
;
import
{
SceneController
}
from
"./modules/layers/ctrls"
;
import
{
ModalCtroller
}
from
"./modules/ModalControl"
;
import
{
RES
}
from
"./modules/RES"
;
import
{
ResJson
}
from
"./ResJson"
;
import
{
GameScene
}
from
"./scenes/GameScene/GameScene"
;
...
...
@@ -20,6 +21,7 @@ import getEnv = FYGE.getEnv;
export
const
GDispatcher
=
new
EventDispatcher
();
export
const
loadAllGroups
=
async
function
()
{
RES
.
loadConfig
(
ResJson
)
await
RES
.
loadAllGroup
()
}
...
...
@@ -188,7 +190,10 @@ export class Main {
this
.
stage
.
destroy
();
// 全局事件置空
// GDispatcher.removeAllEventListener();
GDispatcher
.
removeAllEventListener
();
// 晴空下
ModalCtroller
.
clearModalMap
()
// 淘宝环境网络数据记录清
// destroyTbNetData();
...
...
src/modules/ModalControl.tsx
View file @
d2093c22
...
...
@@ -190,9 +190,18 @@ export const ModalCtroller = (function() {
(
_
.
ModalContainer
as
FYGE
.
Container
).
destroy
();
ModalMap
.
delete
(
ModalNode
)
}
console
.
log
(
'closeModal config:'
,
_
.
props
.
_config
,
ModalMap
)
return
}
},
closeAllModal
()
{
ModalMap
.
forEach
(
item
=>
{
item
.
closeModal
&&
item
.
closeModal
()
})
},
clearModalMap
()
{
ModalMap
.
clear
()
}
}
})()
\ No newline at end of file
src/modules/layers/ctrls.tsx
View file @
d2093c22
...
...
@@ -74,14 +74,13 @@ export const SceneController = (function() {
let
preScene
:
SceneCompent
// 之前一个场景的
return
{
init
(
cont
:
FYGE
.
Container
)
{
if
(
!
controller
)
{
controller
=
cont
}
controller
=
cont
},
destroyScene
(
scene
:
SceneCompent
)
{
scene
.
destroy
()
},
changeScene
(
SceneNode
:
any
,
props
?:
Record
<
string
,
any
>
)
{
console
.
log
(
'controller==='
,
controller
)
if
(
!
controller
)
{
throw
new
Error
(
'没有场景controller'
)
}
...
...
src/panels/GameResumeModal/GameResumeModal.tsx
View file @
d2093c22
...
...
@@ -50,6 +50,8 @@ export class GameResumeModal extends Dream.RenderContainer<{
* 确认走复活逻辑
*/
onConfirm
=
async
()
=>
{
clearInterval
(
this
.
intervalId
)
const
{
success
}
=
await
sendTbNet
(
TbNetName
.
reduceTools
)
...
...
src/scenes/GameScene/GameConfig.ts
View file @
d2093c22
...
...
@@ -47,7 +47,7 @@ export const GameConfig = {
boxConfig
:
{
[
BoxType
.
Box1
]:
{
resName
:
'box1.png'
,
addScore
:
5
,
addScore
:
4
,
oc
:
{
x
:
142
,
y
:
230
// 判断中心点
},
...
...
@@ -67,7 +67,7 @@ export const GameConfig = {
},
[
BoxType
.
Box3
]:
{
resName
:
'box3.png'
,
addScore
:
5
,
addScore
:
6
,
oc
:
{
x
:
142
,
y
:
230
},
...
...
@@ -77,7 +77,7 @@ export const GameConfig = {
},
[
BoxType
.
Box4
]:
{
resName
:
'box4.png'
,
addScore
:
5
,
addScore
:
8
,
oc
:
{
x
:
142
,
y
:
250
},
...
...
@@ -87,7 +87,7 @@ export const GameConfig = {
},
[
BoxType
.
Box5
]:
{
resName
:
'box5.png'
,
addScore
:
5
,
addScore
:
10
,
oc
:
{
x
:
142
,
y
:
260
},
...
...
@@ -97,7 +97,7 @@ export const GameConfig = {
},
[
BoxType
.
Box6
]:
{
resName
:
'box6.png'
,
addScore
:
5
,
addScore
:
1
,
oc
:
{
x
:
142
,
y
:
230
},
...
...
@@ -107,7 +107,7 @@ export const GameConfig = {
},
[
BoxType
.
Box7
]:
{
resName
:
'box7.png'
,
addScore
:
5
,
addScore
:
1
5
,
oc
:
{
x
:
142
,
y
:
360
},
...
...
@@ -117,7 +117,7 @@ export const GameConfig = {
},
[
BoxType
.
Box8
]:
{
resName
:
'box8.png'
,
addScore
:
5
,
addScore
:
1
5
,
oc
:
{
x
:
142
,
y
:
360
},
...
...
src/scenes/GameScene/GameScene.tsx
View file @
d2093c22
...
...
@@ -258,7 +258,7 @@ export class GameScene extends Dream.RenderContainer {
offsetY
:
py
,
maxH
:
mh
})
console
.
log
(
'jumpEnd
'
)
console
.
log
(
'jumpEnd
:'
,
_i
)
if
(
_i
==
3
)
{
this
.
onJumpSuc
()
}
else
if
(
_i
==
2
||
_i
==
-
1
)
{
...
...
@@ -267,6 +267,7 @@ export class GameScene extends Dream.RenderContainer {
}
onJumpSuc
()
{
console
.
log
(
'onJumpSuc'
)
if
(
this
.
isWithGift
)
{
this
.
DecisionConfig
.
geleIns
.
onGetGift
()
this
.
isDrawed
=
true
...
...
@@ -281,6 +282,7 @@ export class GameScene extends Dream.RenderContainer {
onGameOver
()
{
this
.
isOver
=
true
let
f
=
Tools
.
PageData
.
liveCard
console
.
log
(
'GameOver'
)
if
(
f
&&
!
this
.
isUsed
)
{
ModalCtroller
.
showModal
(
GameResumeModal
,
{
resumeNum
:
Tools
.
PageData
.
liveCard
,
...
...
@@ -335,6 +337,9 @@ export class GameScene extends Dream.RenderContainer {
}
onShowGameOverModal
=
async
()
=>
{
if
(
this
.
isDrawed
)
{
await
this
.
onDraw
()
}
const
submitScore
=
this
.
ScoreBoardIns
.
score
const
{
success
...
...
@@ -342,9 +347,6 @@ export class GameScene extends Dream.RenderContainer {
score
:
submitScore
})
if
(
success
)
{
if
(
this
.
isDrawed
)
{
await
this
.
onDraw
()
}
ModalCtroller
.
showModal
(
GameOverModal
,
{
...
...
@@ -591,6 +593,7 @@ export class GameScene extends Dream.RenderContainer {
render
()
{
const
bottomAtomRes
=
RES
.
getRes
(
'bottomAtom.png'
)
console
.
log
(
'render GameScene'
)
return
(
<
FYGE
.
Container
>
...
...
src/scenes/NewGuyScene/NewGuyScene.tsx
View file @
d2093c22
...
...
@@ -47,7 +47,7 @@ export class NewGuyScene extends Dream.RenderContainer {
}
const
mapName
=
Object
.
keys
(
posMap
)
this
.
GuideContainer
.
addChild
(
<
DreamContainer
>
<
DreamContainer
onClick=
{
nextStep
}
>
<
DreamShape
alpha=
{
0.7
}
/>
<
DreamContainer
inlineProps=
{
{
...
...
@@ -78,7 +78,7 @@ export class NewGuyScene extends Dream.RenderContainer {
y
:
1100
}
}
text=
"踩到特殊格子 可获得额外得分"
color=
"#ffffff"
textWidth=
{
750
}
size=
{
32
}
/>
<
DreamSprite
onClick=
{
nextStep
}
inlineProps=
{
{
<
DreamSprite
inlineProps=
{
{
x
:
375
-
n
.
width
/
2
,
y
:
1200
}
}
src=
{
n
}
/>
...
...
@@ -88,7 +88,7 @@ export class NewGuyScene extends Dream.RenderContainer {
case
3
:
const
btn
=
RES
.
getRes
(
'startGameBtn.png'
)
this
.
GuideContainer
.
addChild
(
<
DreamContainer
>
<
DreamContainer
onClick=
{
nextStep
}
>
<
DreamShape
alpha=
{
0.7
}
/>
<
DreamTextField
text=
"踩到特殊道具"
color=
"#ffffff"
size=
{
fontSize
}
textWidth=
{
750
}
inlineProps=
{
{
...
...
@@ -98,7 +98,7 @@ export class NewGuyScene extends Dream.RenderContainer {
y
:
770
}
}
/>
<
DreamSprite
src=
{
btn
}
onClick=
{
nextStep
}
inlineProps=
{
{
<
DreamSprite
src=
{
btn
}
inlineProps=
{
{
x
:
375
-
btn
.
width
/
2
,
y
:
850
}
}
/>
...
...
src/tools/simpleTools.ts
View file @
d2093c22
// @ts-ignore
const
app
=
typeof
getApp
==
'function'
&&
getApp
()
const
audioIns
=
app
?.
audioContext
if
(
audioIns
)
{
audioIns
.
onPlay
(()
=>
{
console
.
log
(
'播放'
)
})
audioIns
.
onError
(()
=>
{
console
.
log
(
'audio error'
)
})
}
export
function
PlayAudio
()
{
console
.
log
(
'app ====='
,
app
)
// @ts-ignore
const
app
=
typeof
getApp
==
'function'
&&
getApp
()
const
audioIns
=
app
?.
audioContext
if
(
audioIns
)
{
audioIns
.
onPlay
(()
=>
{
console
.
log
(
'播放'
)
})
audioIns
.
onError
(()
=>
{
console
.
log
(
'audio error'
)
})
}
audioIns
&&
audioIns
.
play
()
}
...
...
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