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
09f8472b
Commit
09f8472b
authored
Dec 05, 2022
by
Master Q
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
音频文件和 游戏 spi 文件要放到 淘宝cdn 上
parent
b4122601
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
673 deletions
+45
-673
ResJson.ts
src/ResJson.ts
+16
-663
RES.ts
src/modules/RES.ts
+4
-5
GameScene.tsx
src/scenes/GameScene/GameScene.tsx
+1
-1
Player.tsx
src/scenes/GameScene/Player.tsx
+7
-2
simpleTools.ts
src/tools/simpleTools.ts
+17
-2
No files found.
src/ResJson.ts
View file @
09f8472b
...
...
@@ -2,709 +2,63 @@ export const ResJson = {
"groups"
:
[
{
"keys"
:
"box1.png,box2.png,box3.png,box4.png,box5.png,box6.png,box7.png,box8.png"
,
"name"
:
"Boxes"
,
"atlas"
:
{
"box7.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
233
,
"h"
:
442
,
"ox"
:
26
,
"oy"
:
7
,
"sw"
:
283
,
"sh"
:
449
,
"ro"
:
false
},
"box8.png"
:
{
"x"
:
237
,
"y"
:
2
,
"w"
:
184
,
"h"
:
429
,
"ox"
:
50
,
"oy"
:
20
,
"sw"
:
283
,
"sh"
:
449
,
"ro"
:
false
},
"box3.png"
:
{
"x"
:
423
,
"y"
:
2
,
"w"
:
225
,
"h"
:
284
,
"ox"
:
29
,
"oy"
:
44
,
"sw"
:
283
,
"sh"
:
328
,
"ro"
:
false
},
"box2.png"
:
{
"x"
:
2
,
"y"
:
446
,
"w"
:
280
,
"h"
:
204
,
"ox"
:
0
,
"oy"
:
91
,
"sw"
:
283
,
"sh"
:
328
,
"ro"
:
false
},
"box4.png"
:
{
"x"
:
284
,
"y"
:
433
,
"w"
:
184
,
"h"
:
276
,
"ox"
:
50
,
"oy"
:
52
,
"sw"
:
283
,
"sh"
:
328
,
"ro"
:
true
},
"box6.png"
:
{
"x"
:
650
,
"y"
:
2
,
"w"
:
255
,
"h"
:
221
,
"ox"
:
14
,
"oy"
:
95
,
"sw"
:
283
,
"sh"
:
328
,
"ro"
:
true
},
"box1.png"
:
{
"x"
:
650
,
"y"
:
259
,
"w"
:
228
,
"h"
:
214
,
"ox"
:
28
,
"oy"
:
92
,
"sw"
:
283
,
"sh"
:
328
,
"ro"
:
true
},
"box5.png"
:
{
"x"
:
423
,
"y"
:
288
,
"w"
:
224
,
"h"
:
142
,
"ox"
:
30
,
"oy"
:
151
,
"sw"
:
283
,
"sh"
:
328
,
"ro"
:
false
}
}
"name"
:
"Boxes"
},
{
"keys"
:
"DFM1.png,DFMB.png"
,
"name"
:
"DrawFailModal"
,
"atlas"
:
{
"DFMB.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
541
,
"h"
:
467
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
541
,
"sh"
:
467
,
"ro"
:
false
},
"DFM1.png"
:
{
"x"
:
2
,
"y"
:
471
,
"w"
:
369
,
"h"
:
97
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
369
,
"sh"
:
97
,
"ro"
:
false
}
}
"name"
:
"DrawFailModal"
},
{
"keys"
:
"DSM1.png,DSMB.png"
,
"name"
:
"DrawSucModal"
,
"atlas"
:
{
"DSMB.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
576
,
"h"
:
747
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
576
,
"sh"
:
747
,
"ro"
:
false
},
"DSM1.png"
:
{
"x"
:
580
,
"y"
:
2
,
"w"
:
369
,
"h"
:
97
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
369
,
"sh"
:
97
,
"ro"
:
true
}
}
"name"
:
"DrawSucModal"
},
{
"keys"
:
"FGM1.png,FGMB.png"
,
"name"
:
"FinalGiftModal"
,
"atlas"
:
{
"FGMB.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
503
,
"h"
:
571
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
503
,
"sh"
:
571
,
"ro"
:
false
},
"FGM1.png"
:
{
"x"
:
507
,
"y"
:
2
,
"w"
:
369
,
"h"
:
97
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
369
,
"sh"
:
97
,
"ro"
:
true
}
}
"name"
:
"FinalGiftModal"
},
{
"keys"
:
"2b727ace1b5c959dbc6274cacb5b4e5f.png,3ed4431aad269ef7059929043bd45597.png,60377934f7cf618b52457273db65aace.png,9074d1305c0e7feb16037261986c7f4b.png,f3bde4659477f82338fcb2b134272321.png"
,
"name"
:
"GameAtom"
,
"atlas"
:
{
"f3bde4659477f82338fcb2b134272321.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
26
,
"h"
:
26
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
26
,
"sh"
:
26
,
"ro"
:
false
},
"3ed4431aad269ef7059929043bd45597.png"
:
{
"x"
:
30
,
"y"
:
2
,
"w"
:
19
,
"h"
:
19
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
19
,
"sh"
:
19
,
"ro"
:
false
},
"60377934f7cf618b52457273db65aace.png"
:
{
"x"
:
30
,
"y"
:
23
,
"w"
:
19
,
"h"
:
18
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
19
,
"sh"
:
18
,
"ro"
:
false
},
"2b727ace1b5c959dbc6274cacb5b4e5f.png"
:
{
"x"
:
2
,
"y"
:
30
,
"w"
:
12
,
"h"
:
11
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
12
,
"sh"
:
11
,
"ro"
:
true
},
"9074d1305c0e7feb16037261986c7f4b.png"
:
{
"x"
:
15
,
"y"
:
30
,
"w"
:
7
,
"h"
:
7
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
7
,
"sh"
:
7
,
"ro"
:
false
}
}
"name"
:
"GameAtom"
},
{
"keys"
:
"GOM0.png,GOM1.png,GameOverModalBack.png"
,
"name"
:
"GameOverModal"
,
"atlas"
:
{
"GameOverModalBack.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
576
,
"h"
:
739
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
576
,
"sh"
:
739
,
"ro"
:
false
},
"GOM1.png"
:
{
"x"
:
580
,
"y"
:
2
,
"w"
:
369
,
"h"
:
97
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
369
,
"sh"
:
97
,
"ro"
:
true
},
"GOM0.png"
:
{
"x"
:
580
,
"y"
:
373
,
"w"
:
163
,
"h"
:
50
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
163
,
"sh"
:
50
,
"ro"
:
true
}
}
"name"
:
"GameOverModal"
},
{
"keys"
:
"GQM0.png,GQM1.png,GQMB.png"
,
"name"
:
"GameQuitModal"
,
"atlas"
:
{
"GQMB.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
601
,
"h"
:
467
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
601
,
"sh"
:
467
,
"ro"
:
false
},
"GQM1.png"
:
{
"x"
:
2
,
"y"
:
471
,
"w"
:
249
,
"h"
:
97
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
249
,
"sh"
:
97
,
"ro"
:
false
},
"GQM0.png"
:
{
"x"
:
253
,
"y"
:
471
,
"w"
:
231
,
"h"
:
91
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
231
,
"sh"
:
91
,
"ro"
:
false
}
}
"name"
:
"GameQuitModal"
},
{
"keys"
:
"GameResumeModalBack.png,cancelBtn.png,useRightNowBtn.png"
,
"name"
:
"GameResumeModal"
,
"atlas"
:
{
"GameResumeModalBack.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
601
,
"h"
:
547
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
601
,
"sh"
:
547
,
"ro"
:
false
},
"useRightNowBtn.png"
:
{
"x"
:
2
,
"y"
:
551
,
"w"
:
369
,
"h"
:
97
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
369
,
"sh"
:
97
,
"ro"
:
false
},
"cancelBtn.png"
:
{
"x"
:
373
,
"y"
:
551
,
"w"
:
230
,
"h"
:
66
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
230
,
"sh"
:
66
,
"ro"
:
false
}
}
"name"
:
"GameResumeModal"
},
{
"keys"
:
"back.png,bottomAtom.png,gele1.png,goBackBtn.png,player.png,scoreboard-t.png"
,
"name"
:
"GameScene"
,
"atlas"
:
{
"back.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
750
,
"h"
:
1624
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
750
,
"sh"
:
1624
,
"ro"
:
false
},
"bottomAtom.png"
:
{
"x"
:
754
,
"y"
:
2
,
"w"
:
750
,
"h"
:
340
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
750
,
"sh"
:
340
,
"ro"
:
true
},
"gele1.png"
:
{
"x"
:
754
,
"y"
:
754
,
"w"
:
279
,
"h"
:
204
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
279
,
"sh"
:
204
,
"ro"
:
false
},
"player.png"
:
{
"x"
:
754
,
"y"
:
960
,
"w"
:
132
,
"h"
:
201
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
132
,
"sh"
:
201
,
"ro"
:
true
},
"goBackBtn.png"
:
{
"x"
:
957
,
"y"
:
960
,
"w"
:
138
,
"h"
:
68
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
138
,
"sh"
:
68
,
"ro"
:
true
},
"scoreboard-t.png"
:
{
"x"
:
1035
,
"y"
:
754
,
"w"
:
86
,
"h"
:
38
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
86
,
"sh"
:
38
,
"ro"
:
true
}
}
"name"
:
"GameScene"
},
{
"keys"
:
"2120075482341d7d94d8164b1a0f6d43.png,3ed4431aad269ef7059929043bd45597.png,4f4612689c9fde32a8c28c129e9f6e7d.png,60377934f7cf618b52457273db65aace.png,63b0a84f0f9b10842b5f83fa5e923534.png,f3bde4659477f82338fcb2b134272321.png"
,
"name"
:
"JumpEnd"
,
"atlas"
:
{
"2120075482341d7d94d8164b1a0f6d43.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
274
,
"h"
:
294
,
"ox"
:
25
,
"oy"
:
21
,
"sw"
:
323
,
"sh"
:
323
,
"ro"
:
false
},
"f3bde4659477f82338fcb2b134272321.png"
:
{
"x"
:
278
,
"y"
:
2
,
"w"
:
26
,
"h"
:
26
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
26
,
"sh"
:
26
,
"ro"
:
false
},
"4f4612689c9fde32a8c28c129e9f6e7d.png"
:
{
"x"
:
278
,
"y"
:
30
,
"w"
:
25
,
"h"
:
25
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
25
,
"sh"
:
25
,
"ro"
:
false
},
"63b0a84f0f9b10842b5f83fa5e923534.png"
:
{
"x"
:
278
,
"y"
:
57
,
"w"
:
25
,
"h"
:
25
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
25
,
"sh"
:
25
,
"ro"
:
false
},
"3ed4431aad269ef7059929043bd45597.png"
:
{
"x"
:
278
,
"y"
:
84
,
"w"
:
19
,
"h"
:
19
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
19
,
"sh"
:
19
,
"ro"
:
false
},
"60377934f7cf618b52457273db65aace.png"
:
{
"x"
:
278
,
"y"
:
105
,
"w"
:
19
,
"h"
:
18
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
19
,
"sh"
:
18
,
"ro"
:
false
}
}
"name"
:
"JumpEnd"
},
{
"keys"
:
"Guide1.png,NGSB.jpg,nextStep.png,startGameBtn.png"
,
"name"
:
"NewGuyScene"
,
"atlas"
:
{
"Guide1.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
750
,
"h"
:
1624
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
750
,
"sh"
:
1624
,
"ro"
:
false
},
"nextStep.png"
:
{
"x"
:
754
,
"y"
:
2
,
"w"
:
203
,
"h"
:
60
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
203
,
"sh"
:
60
,
"ro"
:
true
},
"startGameBtn.png"
:
{
"x"
:
754
,
"y"
:
207
,
"w"
:
203
,
"h"
:
60
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
203
,
"sh"
:
60
,
"ro"
:
true
}
}
"name"
:
"NewGuyScene"
},
{
"keys"
:
"2120075482341d7d94d8164b1a0f6d43.png"
,
"name"
:
"PerfectJumpEnd"
,
"atlas"
:
{
"2120075482341d7d94d8164b1a0f6d43.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
274
,
"h"
:
294
,
"ox"
:
25
,
"oy"
:
21
,
"sw"
:
323
,
"sh"
:
323
,
"ro"
:
false
}
}
"name"
:
"PerfectJumpEnd"
},
{
"keys"
:
"closebtn.png,giftBoxIcon.png,waitingBg.png,waitingRot.png"
,
"name"
:
"common"
,
"atlas"
:
{
"waitingBg.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
160
,
"h"
:
180
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
160
,
"sh"
:
180
,
"ro"
:
false
},
"giftBoxIcon.png"
:
{
"x"
:
164
,
"y"
:
2
,
"w"
:
127
,
"h"
:
125
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
127
,
"sh"
:
125
,
"ro"
:
true
},
"waitingRot.png"
:
{
"x"
:
2
,
"y"
:
184
,
"w"
:
56
,
"h"
:
56
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
56
,
"sh"
:
56
,
"ro"
:
false
},
"closebtn.png"
:
{
"x"
:
60
,
"y"
:
184
,
"w"
:
52
,
"h"
:
52
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
52
,
"sh"
:
52
,
"ro"
:
false
}
}
"name"
:
"common"
},
{
"keys"
:
"786bf3500cf0986c9678f6b8a8cf24f6.png,b5d5c1070b13deb0230b0efe5c58ee9d.png,ca7b2a497afc6147cc076d55600154bd.png,d64a974a921d32ed81463c918bae137e.png,f49a78c8287be1a92ee75ce3a2b7a512.png"
,
"name"
:
"countDown"
,
"atlas"
:
{
"ca7b2a497afc6147cc076d55600154bd.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
109
,
"h"
:
175
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
109
,
"sh"
:
175
,
"ro"
:
false
},
"786bf3500cf0986c9678f6b8a8cf24f6.png"
:
{
"x"
:
113
,
"y"
:
2
,
"w"
:
98
,
"h"
:
172
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
98
,
"sh"
:
172
,
"ro"
:
false
},
"d64a974a921d32ed81463c918bae137e.png"
:
{
"x"
:
2
,
"y"
:
179
,
"w"
:
110
,
"h"
:
172
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
110
,
"sh"
:
172
,
"ro"
:
true
},
"f49a78c8287be1a92ee75ce3a2b7a512.png"
:
{
"x"
:
213
,
"y"
:
2
,
"w"
:
104
,
"h"
:
105
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
104
,
"sh"
:
105
,
"ro"
:
false
},
"b5d5c1070b13deb0230b0efe5c58ee9d.png"
:
{
"x"
:
213
,
"y"
:
109
,
"w"
:
53
,
"h"
:
53
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
53
,
"sh"
:
53
,
"ro"
:
false
}
}
"name"
:
"countDown"
},
{
"keys"
:
"548342251013e2f832a40380d1855bf5.png,af75d547153d9118b05d4dd8fbcfe022.png,fd0f936244fb973bddf520819997f5ba.png"
,
"name"
:
"handLottie"
,
"atlas"
:
{
"fd0f936244fb973bddf520819997f5ba.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
120
,
"h"
:
87
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
120
,
"sh"
:
87
,
"ro"
:
false
},
"af75d547153d9118b05d4dd8fbcfe022.png"
:
{
"x"
:
2
,
"y"
:
91
,
"w"
:
92
,
"h"
:
92
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
92
,
"sh"
:
92
,
"ro"
:
false
},
"548342251013e2f832a40380d1855bf5.png"
:
{
"x"
:
124
,
"y"
:
2
,
"w"
:
46
,
"h"
:
46
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
46
,
"sh"
:
46
,
"ro"
:
false
}
}
"name"
:
"handLottie"
},
{
"keys"
:
"nx1.jpg,ny1.jpg,nz1.jpg,px1.jpg,py1.jpg,pz1.jpg"
,
...
...
@@ -715,6 +69,5 @@ export const ResJson = {
"name"
:
"spine"
}
],
// eslint-disable-next-line
"path"
:
"https://yun.duiba.com.cn/db_games/activity/template/1669973871/resource/"
"path"
:
"./resource/"
}
\ No newline at end of file
src/modules/RES.ts
View file @
09f8472b
...
...
@@ -173,9 +173,9 @@ export namespace RES {
* @param comFun 加载回调
* @param thisObj this指向
*/
export
function
getResAsync
(
str
:
string
,
comFun
?:
(
res
:
any
,
str
:
string
)
=>
void
,
thisObj
?:
any
):
Promise
<
any
>
{
export
function
getResAsync
(
str
:
string
,
comFun
?:
(
res
:
any
,
str
:
string
)
=>
void
,
thisObj
?:
any
,
loadType
?:
string
):
Promise
<
any
>
{
// var arr = str.split(".");
var
type
=
str
.
substring
(
str
.
lastIndexOf
(
"."
)
+
1
,
str
.
length
);
var
type
=
loadType
||
str
.
substring
(
str
.
lastIndexOf
(
"."
)
+
1
,
str
.
length
);
//如果是图片
if
(
type
==
"png"
||
type
==
"jpg"
)
{
//原先就有了,加载过的,且已加载完成的
...
...
@@ -252,7 +252,6 @@ export namespace RES {
}
}
else
if
(
type
==
'spi'
)
{
console
.
log
(
str
)
if
(
spineDataHash
[
str
])
{
comFun
&&
comFun
.
call
(
thisObj
,
spineDataHash
[
str
],
str
)
return
new
Promise
((
r
)
=>
{
...
...
@@ -356,9 +355,9 @@ export namespace RES {
* @param str
* @return 已加载好得素材或null
*/
export
function
getRes
<
T
extends
string
>
(
str
:
T
):
GetResType
<
T
>
{
export
function
getRes
<
T
extends
string
>
(
str
:
T
,
type
?:
string
):
GetResType
<
T
>
{
if
(
!
str
)
return
null
;
var
type
=
str
.
substring
(
str
.
lastIndexOf
(
"."
)
+
1
,
str
.
length
);
var
type
=
type
||
str
.
substring
(
str
.
lastIndexOf
(
"."
)
+
1
,
str
.
length
);
if
(
type
==
"png"
||
type
==
"jpg"
)
{
return
textureHash
[
str
]
||
FYGE
.
TextureCache
[
str
]
||
null
;
}
...
...
src/scenes/GameScene/GameScene.tsx
View file @
09f8472b
...
...
@@ -496,7 +496,7 @@ export class GameScene extends Dream.RenderContainer {
const
stackHeadBox
=
this
.
GameEleStack
.
stackHead
const
{
x
:
preX
,
y
:
preY
}
=
stackHeadBox
const
dir
=
this
.
dir
=
-
1
//
Math.random() > 0.5 ? 1 : -1
const
dir
=
this
.
dir
=
Math
.
random
()
>
0.5
?
1
:
-
1
// 刷新
const
isWithGift
=
this
.
isWithGift
=
this
.
isCouldHaveGift
&&
Math
.
random
()
<
GameConfig
.
finalGiftPart
this
.
isCouldHaveGift
=
false
...
...
src/scenes/GameScene/Player.tsx
View file @
09f8472b
...
...
@@ -8,6 +8,7 @@ import { PerfectJumpEnd } from "../../lotties/PerfectJumpEnd";
import
{
fadeOutUpFactory
}
from
"../../modules/animations"
;
import
{
RES
}
from
"../../modules/RES"
;
import
{
UsePreload
}
from
"../../modules/UseDecorator/usePreload"
;
import
{
getTbSpi
}
from
"../../tools/simpleTools"
;
export
enum
PlayAniEnum
{
Stand
=
'daiji'
,
...
...
@@ -30,7 +31,11 @@ export type PlayerIns = {
@
UsePreload
({
preAction
:
async
function
()
{
if
(
!
window
)
{
await
RES
.
getResAsync
(
getTbSpi
(),
()
=>
{},
null
,
'spi'
)
}
else
{
await
RES
.
loadGroup
(
'spine'
)
}
},
loadingComponent
:
null
})
...
...
@@ -78,7 +83,7 @@ export class Player extends Dream.RenderContainer<{
}
render
()
{
const
PlayerSpineData
=
RES
.
getRes
(
'rabbit.
spi'
)
const
PlayerSpineData
=
RES
.
getRes
(
!
window
?
getTbSpi
()
:
'rabbit.spi'
,
'
spi'
)
return
(
<
DreamContainer
inlineProps=
{
{
...
...
src/tools/simpleTools.ts
View file @
09f8472b
// @ts-ignore
const
app
=
getApp
()
const
app
=
typeof
getApp
==
'function'
&&
getApp
()
const
audioIns
=
app
?.
audioContext
if
(
audioIns
)
{
audioIns
.
onPlay
(()
=>
{
...
...
@@ -12,5 +12,20 @@ if (audioIns) {
}
export
function
PlayAudio
()
{
console
.
log
(
'app ====='
,
app
)
audioIns
&&
audioIns
.
play
()
}
export
const
getTbSpi
=
(
function
()
{
let
spiSrc
=
''
return
function
()
{
if
(
spiSrc
)
return
spiSrc
// @ts-ignore
const
app
=
typeof
getApp
==
'function'
&&
getApp
()
if
(
app
)
{
return
spiSrc
=
app
.
rabbitSpiUrl
}
else
{
throw
new
Error
(
'no app !!!!!'
)
}
}
})()
\ 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