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
spc
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
Expand all
Hide 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
This diff is collapsed.
Click to expand it.
src/modules/RES.ts
View file @
09f8472b
...
@@ -173,9 +173,9 @@ export namespace RES {
...
@@ -173,9 +173,9 @@ export namespace RES {
* @param comFun 加载回调
* @param comFun 加载回调
* @param thisObj this指向
* @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 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"
)
{
if
(
type
==
"png"
||
type
==
"jpg"
)
{
//原先就有了,加载过的,且已加载完成的
//原先就有了,加载过的,且已加载完成的
...
@@ -252,7 +252,6 @@ export namespace RES {
...
@@ -252,7 +252,6 @@ export namespace RES {
}
}
}
}
else
if
(
type
==
'spi'
)
{
else
if
(
type
==
'spi'
)
{
console
.
log
(
str
)
if
(
spineDataHash
[
str
])
{
if
(
spineDataHash
[
str
])
{
comFun
&&
comFun
.
call
(
thisObj
,
spineDataHash
[
str
],
str
)
comFun
&&
comFun
.
call
(
thisObj
,
spineDataHash
[
str
],
str
)
return
new
Promise
((
r
)
=>
{
return
new
Promise
((
r
)
=>
{
...
@@ -356,9 +355,9 @@ export namespace RES {
...
@@ -356,9 +355,9 @@ export namespace RES {
* @param str
* @param str
* @return 已加载好得素材或null
* @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
;
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"
)
{
if
(
type
==
"png"
||
type
==
"jpg"
)
{
return
textureHash
[
str
]
||
FYGE
.
TextureCache
[
str
]
||
null
;
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 {
...
@@ -496,7 +496,7 @@ export class GameScene extends Dream.RenderContainer {
const
stackHeadBox
=
this
.
GameEleStack
.
stackHead
const
stackHeadBox
=
this
.
GameEleStack
.
stackHead
const
{
x
:
preX
,
y
:
preY
}
=
stackHeadBox
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
const
isWithGift
=
this
.
isWithGift
=
this
.
isCouldHaveGift
&&
Math
.
random
()
<
GameConfig
.
finalGiftPart
this
.
isCouldHaveGift
=
false
this
.
isCouldHaveGift
=
false
...
...
src/scenes/GameScene/Player.tsx
View file @
09f8472b
...
@@ -8,6 +8,7 @@ import { PerfectJumpEnd } from "../../lotties/PerfectJumpEnd";
...
@@ -8,6 +8,7 @@ import { PerfectJumpEnd } from "../../lotties/PerfectJumpEnd";
import
{
fadeOutUpFactory
}
from
"../../modules/animations"
;
import
{
fadeOutUpFactory
}
from
"../../modules/animations"
;
import
{
RES
}
from
"../../modules/RES"
;
import
{
RES
}
from
"../../modules/RES"
;
import
{
UsePreload
}
from
"../../modules/UseDecorator/usePreload"
;
import
{
UsePreload
}
from
"../../modules/UseDecorator/usePreload"
;
import
{
getTbSpi
}
from
"../../tools/simpleTools"
;
export
enum
PlayAniEnum
{
export
enum
PlayAniEnum
{
Stand
=
'daiji'
,
Stand
=
'daiji'
,
...
@@ -30,7 +31,11 @@ export type PlayerIns = {
...
@@ -30,7 +31,11 @@ export type PlayerIns = {
@
UsePreload
({
@
UsePreload
({
preAction
:
async
function
()
{
preAction
:
async
function
()
{
await
RES
.
loadGroup
(
'spine'
)
if
(
!
window
)
{
await
RES
.
getResAsync
(
getTbSpi
(),
()
=>
{},
null
,
'spi'
)
}
else
{
await
RES
.
loadGroup
(
'spine'
)
}
},
},
loadingComponent
:
null
loadingComponent
:
null
})
})
...
@@ -78,7 +83,7 @@ export class Player extends Dream.RenderContainer<{
...
@@ -78,7 +83,7 @@ export class Player extends Dream.RenderContainer<{
}
}
render
()
{
render
()
{
const
PlayerSpineData
=
RES
.
getRes
(
'rabbit.
spi'
)
const
PlayerSpineData
=
RES
.
getRes
(
!
window
?
getTbSpi
()
:
'rabbit.spi'
,
'
spi'
)
return
(
return
(
<
DreamContainer
inlineProps=
{
{
<
DreamContainer
inlineProps=
{
{
...
...
src/tools/simpleTools.ts
View file @
09f8472b
// @ts-ignore
// @ts-ignore
const
app
=
getApp
()
const
app
=
typeof
getApp
==
'function'
&&
getApp
()
const
audioIns
=
app
?.
audioContext
const
audioIns
=
app
?.
audioContext
if
(
audioIns
)
{
if
(
audioIns
)
{
audioIns
.
onPlay
(()
=>
{
audioIns
.
onPlay
(()
=>
{
...
@@ -12,5 +12,20 @@ if (audioIns) {
...
@@ -12,5 +12,20 @@ if (audioIns) {
}
}
export
function
PlayAudio
()
{
export
function
PlayAudio
()
{
console
.
log
(
'app ====='
,
app
)
audioIns
&&
audioIns
.
play
()
audioIns
&&
audioIns
.
play
()
}
}
\ No newline at end of file
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