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
d299bf9a
Commit
d299bf9a
authored
Dec 20, 2022
by
Master Q
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
G
parent
c05d2240
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
417 additions
and
63 deletions
+417
-63
index.html
index.html
+2
-1
rabbit0.spi
resource/spine/rabbit0.spi
+0
-0
rabbit.atlas
scripts/rabbit/rabbit.atlas
+197
-29
rabbit.json
scripts/rabbit/rabbit.json
+1
-1
rabbit.png
scripts/rabbit/rabbit.png
+0
-0
rabbit.spi
scripts/rabbit/rabbit.spi
+0
-0
ResJson.ts
src/ResJson.ts
+176
-4
DreamSpine.tsx
src/components/DreamSpine/DreamSpine.tsx
+1
-0
GameConfig.ts
src/scenes/GameScene/GameConfig.ts
+4
-4
GameScene.tsx
src/scenes/GameScene/GameScene.tsx
+20
-16
Tools.ts
src/tools/Tools.ts
+16
-8
No files found.
index.html
View file @
d299bf9a
...
...
@@ -70,7 +70,8 @@
canvas
.
width
=
document
.
body
.
clientWidth
*
(
window
.
devicePixelRatio
||
1
)
canvas
.
height
=
document
.
body
.
clientHeight
*
(
window
.
devicePixelRatio
||
1
)
new
Main
(
canvas
,
{
isFirstGame
:
false
isFirstGame
:
false
,
skinName
:
'c'
})
})
...
...
resource/spine/rabbit0.spi
View file @
d299bf9a
No preview for this file type
scripts/rabbit/rabbit.atlas
View file @
d299bf9a
人物
.png
size:
256,256
renwu
.png
size:
512,512
format: RGBA8888
filter: Linear,Linear
repeat: none
arm l
rotate:
fals
e
xy:
226, 154
rotate:
tru
e
xy:
313, 486
size: 23, 49
orig: 23, 49
offset: 0, 0
index: -1
arm r
rotate:
fals
e
xy:
226, 205
rotate:
tru
e
xy:
354, 456
size: 28, 49
orig: 28, 50
offset: 0, 0
index: -1
bainai/bn_armL
rotate: true
xy: 462, 485
size: 24, 47
orig: 24, 47
offset: 0, 0
index: -1
bainai/bn_armR
rotate: true
xy: 169, 461
size: 25, 48
orig: 25, 48
offset: 0, 0
index: -1
bainai/bn_body
rotate: false
xy: 185, 374
size: 56, 49
orig: 56, 49
offset: 0, 0
index: -1
bainai/bn_legL
rotate: true
xy: 155, 426
size: 33, 48
orig: 52, 48
offset: 0, 0
index: -1
bainai/bn_legR
rotate: true
xy: 255, 422
size: 34, 47
orig: 39, 47
offset: 0, 0
index: -1
bainai/bn_wing
rotate: false
xy: 374, 332
size: 127, 61
orig: 129, 63
offset: 1, 1
index: -1
body
rotate: false
xy:
161, 206
xy:
60, 381
size: 63, 48
orig: 63, 49
offset: 0, 0
index: -1
chunzhen/cz_armL
rotate: true
xy: 2, 472
size: 24, 50
orig: 24, 50
offset: 0, 0
index: -1
chunzhen/cz_armR
rotate: true
xy: 118, 465
size: 24, 49
orig: 24, 49
offset: 0, 0
index: -1
chunzhen/cz_body
rotate: false
xy: 2, 384
size: 56, 47
orig: 56, 47
offset: 0, 0
index: -1
chunzhen/cz_hat
rotate: false
xy: 50, 433
size: 62, 31
orig: 64, 34
offset: 1, 2
index: -1
chunzhen/cz_legL
rotate: true
xy: 205, 425
size: 33, 48
orig: 33, 49
offset: 0, 0
index: -1
chunzhen/cz_legR
rotate: true
xy: 405, 453
size: 31, 48
orig: 32, 48
offset: 0, 0
index: -1
ear l
rotate: false
xy:
97, 201
xy:
243, 367
size: 62, 53
orig: 62, 53
offset: 0, 0
index: -1
ear r
rotate: true
xy:
161, 160
xy:
395, 406
size: 44, 63
orig: 44, 63
offset: 0, 0
index: -1
eye l
rotate: false
xy: 1
22, 145
xy: 1
71, 489
size: 24, 20
orig: 26, 22
offset: 1, 1
index: -1
eye r
rotate: false
xy:
97, 144
xy:
197, 488
size: 23, 21
orig: 25, 23
offset: 1, 1
index: -1
eye sadl
rotate: true
xy:
33, 126
xy:
121, 491
size: 18, 23
orig: 18, 23
offset: 0, 0
index: -1
eye sadr
rotate: true
xy:
2, 125
xy:
146, 491
size: 18, 23
orig: 18, 23
offset: 0, 0
index: -1
eye xiaol
rotate:
tru
e
xy:
148, 146
rotate:
fals
e
xy:
21, 498
size: 19, 11
orig: 19, 11
offset: 0, 0
index: -1
eye xiaor
rotate:
tru
e
xy:
79, 125
rotate:
fals
e
xy:
42, 498
size: 19, 11
orig: 19, 11
offset: 0, 0
index: -1
eyebrow l
rotate: false
xy:
45, 111
xy:
2, 504
size: 8, 5
orig: 10, 8
offset: 1, 1
index: -1
eyebrow r
rotate: false
xy:
45, 118
xy:
12, 503
size: 7, 6
orig: 10, 8
offset: 2, 1
index: -1
face
rotate: false
xy: 2,
174
xy: 2,
299
size: 93, 80
orig: 93, 81
offset: 0, 0
index: -1
foot l
rotate:
tru
e
xy:
138, 167
rotate:
fals
e
xy:
222, 488
size: 32, 21
orig: 33, 22
offset: 1, 0
index: -1
leg l
rotate: true
xy:
97, 167
xy:
114, 431
size: 32, 39
orig: 32, 39
offset: 0, 0
index: -1
mouth
rotate: false
xy:
58, 116
xy:
63, 498
size: 17, 11
orig: 17, 19
offset: 0, 8
index: -1
mouth sad
rotate: false
xy:
27, 113
xy:
82, 498
size: 16, 11
orig: 16, 12
offset: 0, 1
index: -1
mouth smile
rotate: true
xy:
58, 129
xy:
100, 494
size: 15, 19
orig: 15, 19
offset: 0, 0
index: -1
sai l
rotate: false
xy:
33, 146
xy:
54, 470
size: 30, 26
orig: 34, 30
offset: 2, 2
index: -1
sai r
rotate: false
xy:
65, 14
6
xy:
86, 46
6
size: 30, 26
orig: 34, 30
offset: 2, 2
index: -1
tail
rotate: false
xy: 2
, 145
xy: 2
71, 458
size: 29, 27
orig: 29, 27
offset: 0, 0
index: -1
telunsu/tls_armL
rotate: true
xy: 364, 486
size: 23, 47
orig: 23, 47
offset: 0, 0
index: -1
telunsu/tls_armR
rotate: true
xy: 413, 486
size: 23, 47
orig: 23, 47
offset: 0, 0
index: -1
telunsu/tls_body
rotate: false
xy: 125, 376
size: 58, 48
orig: 58, 48
offset: 0, 0
index: -1
telunsu/tls_legL
rotate: true
xy: 304, 422
size: 34, 44
orig: 36, 44
offset: 2, 0
index: -1
telunsu/tls_legR
rotate: true
xy: 350, 419
size: 35, 43
orig: 35, 43
offset: 0, 0
index: -1
telunsu/tls_skirt
rotate: true
xy: 460, 395
size: 55, 49
orig: 55, 49
offset: 0, 0
index: -1
zhenguoli/zgl_armL
rotate: true
xy: 219, 460
size: 25, 50
orig: 25, 50
offset: 0, 0
index: -1
zhenguoli/zgl_armR
rotate: true
xy: 302, 458
size: 26, 50
orig: 26, 50
offset: 0, 0
index: -1
zhenguoli/zgl_body
rotate: true
xy: 307, 360
size: 57, 65
orig: 57, 65
offset: 0, 0
index: -1
zhenguoli/zgl_legL
rotate: true
xy: 455, 452
size: 31, 49
orig: 31, 49
offset: 0, 0
index: -1
zhenguoli/zgl_legR
rotate: true
xy: 2, 439
size: 31, 46
orig: 31, 47
offset: 0, 0
index: -1
zhenguoli/zgl_rabon
rotate: false
xy: 256, 487
size: 55, 22
orig: 55, 22
offset: 0, 0
index: -1
scripts/rabbit/rabbit.json
View file @
d299bf9a
This source diff could not be displayed because it is too large. You can
view the blob
instead.
scripts/rabbit/rabbit.png
View replaced file @
c05d2240
View file @
d299bf9a
42 KB
|
W:
|
H:
143 KB
|
W:
|
H:
2-up
Swipe
Onion skin
scripts/rabbit/rabbit.spi
View file @
d299bf9a
No preview for this file type
src/ResJson.ts
View file @
d299bf9a
...
...
@@ -2,15 +2,186 @@ export const ResJson = {
"groups"
:
[
{
"keys"
:
"GSB.png,clockBack.png,platform.png,rabbit.png,scoreBoardBack.png,sp_boom.png,sp_milk.png"
,
"name"
:
"GameScene"
"name"
:
"GameScene"
,
"atlas"
:
{
"GSB.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
750
,
"h"
:
1624
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
750
,
"sh"
:
1624
,
"ro"
:
false
},
"rabbit.png"
:
{
"x"
:
754
,
"y"
:
2
,
"w"
:
110
,
"h"
:
218
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
110
,
"sh"
:
218
,
"ro"
:
false
},
"scoreBoardBack.png"
:
{
"x"
:
754
,
"y"
:
222
,
"w"
:
193
,
"h"
:
81
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
193
,
"sh"
:
81
,
"ro"
:
true
},
"platform.png"
:
{
"x"
:
754
,
"y"
:
417
,
"w"
:
142
,
"h"
:
52
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
142
,
"sh"
:
52
,
"ro"
:
true
},
"sp_boom.png"
:
{
"x"
:
754
,
"y"
:
561
,
"w"
:
94
,
"h"
:
99
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
94
,
"sh"
:
99
,
"ro"
:
true
},
"sp_milk.png"
:
{
"x"
:
754
,
"y"
:
657
,
"w"
:
93
,
"h"
:
93
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
93
,
"sh"
:
93
,
"ro"
:
false
},
"clockBack.png"
:
{
"x"
:
754
,
"y"
:
752
,
"w"
:
80
,
"h"
:
91
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
80
,
"sh"
:
91
,
"ro"
:
true
}
}
},
{
"keys"
:
"Guide1.png,Guide2.png,Guide3.png,Guide4.png"
,
"name"
:
"NewGuyScene"
"name"
:
"NewGuyScene"
,
"atlas"
:
{
"Guide1.png"
:
{
"x"
:
2
,
"y"
:
2
,
"w"
:
750
,
"h"
:
1624
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
750
,
"sh"
:
1624
,
"ro"
:
false
},
"Guide2.png"
:
{
"x"
:
754
,
"y"
:
2
,
"w"
:
750
,
"h"
:
1624
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
750
,
"sh"
:
1624
,
"ro"
:
false
},
"Guide3.png"
:
{
"x"
:
1506
,
"y"
:
2
,
"w"
:
750
,
"h"
:
1624
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
750
,
"sh"
:
1624
,
"ro"
:
false
},
"Guide4.png"
:
{
"x"
:
2
,
"y"
:
1628
,
"w"
:
750
,
"h"
:
1624
,
"ox"
:
0
,
"oy"
:
0
,
"sw"
:
750
,
"sh"
:
1624
,
"ro"
:
true
}
}
},
{
"keys"
:
"closebtn.png,giftBoxIcon.png,waitingBg.png,waitingRot.png"
,
"name"
:
"common"
"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
}
}
},
{
"keys"
:
"rabbit0.spi"
,
...
...
@@ -21,5 +192,6 @@ export const ResJson = {
"name"
:
"svga"
}
],
"path"
:
"./resource/"
// eslint-disable-next-line
"path"
:
"https://yun.duiba.com.cn/db_games/activity/template/1671522711/resource/"
}
\ No newline at end of file
src/components/DreamSpine/DreamSpine.tsx
View file @
d299bf9a
...
...
@@ -49,6 +49,7 @@ export const DreamSpine: OriginalElementWidthEvents<{
aniName
})
=>
{
const
SpinePlayer
=
new
FYGE
.
Spine
(
spineData
)
SpinePlayer
.
fps
=
90
setSpineSkin
(
SpinePlayer
,
skinName
)
setSpineAni
(
SpinePlayer
,
aniName
)
return
SpinePlayer
...
...
src/scenes/GameScene/GameConfig.ts
View file @
d299bf9a
...
...
@@ -4,7 +4,7 @@ import { layers } from "../../modules/layers";
// 一行中 最多一个炸弹,这样配合 概率就不会导致出现死局
export
const
GameConfig
=
{
debugger
:
tru
e
,
debugger
:
fals
e
,
sp_p
:
0.3
,
// 出现道具的 概率
sp_b
:
0.8
,
// 出现炸弹的概率
offsetYLen
:
180
,
...
...
@@ -40,11 +40,11 @@ export const GameConfig = {
[
0
,
1
,
1
,
1
,
0
],
[
5
,
0
,
0
,
0
,
1
],
[
1
,
0
,
1
,
1
,
1
],
[
0
,
1
,
0
,
0
,
5
],
[
0
,
4
,
0
,
0
,
5
],
[
1
,
0
,
1
,
0
,
0
],
[
0
,
1
,
0
,
5
,
0
],
[
5
,
0
,
1
,
0
,
0
],
[
0
,
0
,
3
,
0
,
5
],
[
4
,
1
,
0
,
1
,
0
],
[
0
,
0
,
1
,
0
,
5
],
[
1
,
1
,
0
,
5
,
1
],
[
0
,
1
,
0
,
0
,
0
],
[
1
,
0
,
0
,
4
,
0
],
...
...
src/scenes/GameScene/GameScene.tsx
View file @
d299bf9a
...
...
@@ -6,7 +6,7 @@ import Dream from "../../Dream";
import
{
layers
}
from
"../../modules/layers"
;
import
{
RES
}
from
"../../modules/RES"
;
import
{
UsePreload
}
from
"../../modules/UseDecorator/usePreload"
;
import
{
PromiseAwait
}
from
"../../tools/Tools"
;
import
{
PromiseAwait
,
PromiseAwaitCacheMap
}
from
"../../tools/Tools"
;
import
{
GameConfig
}
from
"./GameConfig"
;
import
{
G_Events
}
from
"./GameEvents"
;
import
{
Platform
}
from
"./Platform"
;
...
...
@@ -77,19 +77,21 @@ export class GameScene extends Dream.RenderContainer {
unMount
():
void
{
this
.
removeEvents
()
PromiseAwaitCacheMap
.
clear
()
}
initEvents
()
{
// 测试地图
document
.
body
.
addEventListener
(
'keydown'
,
(
e
)
=>
{
const
keyCode
=
e
.
code
console
.
log
(
keyCode
)
if
(
keyCode
==
'ArrowDown'
)
{
this
.
onGameStart
()
}
else
{
this
.
onGameOver
()
}
})
//
document.body.addEventListener('keydown', (e) => {
//
const keyCode = e.code
//
console.log(keyCode)
//
if (keyCode == 'ArrowDown') {
//
this.onGameStart()
//
} else {
//
this.onGameOver()
//
}
//
})
}
removeEvents
()
{
...
...
@@ -97,6 +99,7 @@ export class GameScene extends Dream.RenderContainer {
}
onGameStart
()
{
GameConfig
.
speed
=
100
GameConfig
.
DecisionLine
=
[
180
,
layers
.
stageHeight
-
10
...
...
@@ -139,8 +142,9 @@ export class GameScene extends Dream.RenderContainer {
* @param init 是否是初始化
*/
renderMap
(
init
:
boolean
=
false
)
{
console
.
info
(
'=========render map ==========='
)
const
mapConfig
=
GameConfig
.
mapList
[
Math
.
random
()
*
GameConfig
.
mapList
.
length
>>
0
]
const
index
=
Math
.
random
()
*
GameConfig
.
mapList
.
length
>>
0
console
.
info
(
'=========render map ===========:'
,
index
)
const
mapConfig
=
GameConfig
.
mapList
[
index
]
const
{
rowNum
,
offsetYLen
...
...
@@ -332,7 +336,7 @@ export class GameScene extends Dream.RenderContainer {
rabbitCloneContainer
.
position
.
set
(
rabbitContainer
.
x
+
750
,
rabbitContainer
.
y
)
}
const
sp
=
shouldY
-
ray
const
downTime
=
3
00
// 200 * (sp > 0 ? sp : 1)
const
downTime
=
2
00
// 200 * (sp > 0 ? sp : 1)
FYGE
.
Tween
.
get
(
rabbitContainer
,
{
onChange
:
()
=>
{
// rabbitContainer.x = (rabbitContainer.x + 750) % 750
...
...
@@ -341,7 +345,7 @@ export class GameScene extends Dream.RenderContainer {
})
.
to
({
x
:
_willX
*
offsetXLen
},
6
00
+
downTime
)
},
4
00
+
downTime
)
FYGE
.
Tween
.
get
(
rabbitContainer
,
{
onChange
:
()
=>
{
...
...
@@ -349,8 +353,8 @@ export class GameScene extends Dream.RenderContainer {
}
})
.
to
({
y
:
Math
.
min
(
ry
+
sp
*
offsetYLen
,
ry
)
-
10
0
},
6
00
,
FYGE
.
Ease
.
quadOut
)
y
:
Math
.
min
(
ry
+
sp
*
offsetYLen
,
ry
)
-
5
0
},
4
00
,
FYGE
.
Ease
.
quadOut
)
.
to
({
y
:
ry
+
sp
*
offsetYLen
},
downTime
,
FYGE
.
Ease
.
quadIn
)
...
...
src/tools/Tools.ts
View file @
d299bf9a
...
...
@@ -114,6 +114,10 @@ export function throttleDecorator(time: number = 1000) {
}
}
export
const
PromiseAwaitCacheMap
=
new
Map
<
Function
,
{
waitPromise
:
Promise
<
any
>
,
waitPromiseResolve
:
(
value
:
any
)
=>
void
}
>
()
/**
* 只有装饰方法 执行完了之后 才可以第二次执行
...
...
@@ -123,18 +127,22 @@ export function throttleDecorator(time: number = 1000) {
*/
export
function
PromiseAwait
(
target
:
any
,
property
:
string
,
descriptor
:
PropertyDescriptor
)
{
const
func
:
Function
=
descriptor
.
value
// let isPromiseFulfilled = true
let
waitPromise
:
Promise
<
any
>
|
null
=
null
let
waitPromiseResolve
:
(
value
:
unknown
)
=>
void
descriptor
.
value
=
async
function
(...
args
:
any
[])
{
if
(
waitPromise
)
return
waitPromise
waitPromise
=
new
Promise
(
resolve
=>
{
waitPromiseResolve
=
resolve
const
cache
=
PromiseAwaitCacheMap
.
get
(
func
)
if
(
cache
)
return
cache
.
waitPromise
// @ts-ignore
let
shouldCache
:
{
waitPromise
:
Promise
<
any
>
,
waitPromiseResolve
:
(
value
:
any
)
=>
void
}
=
{}
shouldCache
.
waitPromise
=
new
Promise
(
resolve
=>
{
shouldCache
.
waitPromiseResolve
=
resolve
})
PromiseAwaitCacheMap
.
set
(
func
,
shouldCache
)
// @ts-ignore
const
res
=
await
func
.
apply
(
this
,
args
)
waitPromiseResolve
(
res
)
waitPromise
=
null
shouldCache
.
waitPromiseResolve
(
res
)
PromiseAwaitCacheMap
.
delete
(
func
)
return
res
}
}
...
...
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