Commit d299bf9a authored by Master Q's avatar Master Q

G

parent c05d2240
...@@ -70,7 +70,8 @@ ...@@ -70,7 +70,8 @@
canvas.width = document.body.clientWidth * (window.devicePixelRatio || 1) canvas.width = document.body.clientWidth * (window.devicePixelRatio || 1)
canvas.height = document.body.clientHeight * (window.devicePixelRatio || 1) canvas.height = document.body.clientHeight * (window.devicePixelRatio || 1)
new Main(canvas, { new Main(canvas, {
isFirstGame: false isFirstGame: false,
skinName: 'c'
}) })
}) })
......
人物.png renwu.png
size: 256,256 size: 512,512
format: RGBA8888 format: RGBA8888
filter: Linear,Linear filter: Linear,Linear
repeat: none repeat: none
arm l arm l
rotate: false rotate: true
xy: 226, 154 xy: 313, 486
size: 23, 49 size: 23, 49
orig: 23, 49 orig: 23, 49
offset: 0, 0 offset: 0, 0
index: -1 index: -1
arm r arm r
rotate: false rotate: true
xy: 226, 205 xy: 354, 456
size: 28, 49 size: 28, 49
orig: 28, 50 orig: 28, 50
offset: 0, 0 offset: 0, 0
index: -1 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 body
rotate: false rotate: false
xy: 161, 206 xy: 60, 381
size: 63, 48 size: 63, 48
orig: 63, 49 orig: 63, 49
offset: 0, 0 offset: 0, 0
index: -1 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 ear l
rotate: false rotate: false
xy: 97, 201 xy: 243, 367
size: 62, 53 size: 62, 53
orig: 62, 53 orig: 62, 53
offset: 0, 0 offset: 0, 0
index: -1 index: -1
ear r ear r
rotate: true rotate: true
xy: 161, 160 xy: 395, 406
size: 44, 63 size: 44, 63
orig: 44, 63 orig: 44, 63
offset: 0, 0 offset: 0, 0
index: -1 index: -1
eye l eye l
rotate: false rotate: false
xy: 122, 145 xy: 171, 489
size: 24, 20 size: 24, 20
orig: 26, 22 orig: 26, 22
offset: 1, 1 offset: 1, 1
index: -1 index: -1
eye r eye r
rotate: false rotate: false
xy: 97, 144 xy: 197, 488
size: 23, 21 size: 23, 21
orig: 25, 23 orig: 25, 23
offset: 1, 1 offset: 1, 1
index: -1 index: -1
eye sadl eye sadl
rotate: true rotate: true
xy: 33, 126 xy: 121, 491
size: 18, 23 size: 18, 23
orig: 18, 23 orig: 18, 23
offset: 0, 0 offset: 0, 0
index: -1 index: -1
eye sadr eye sadr
rotate: true rotate: true
xy: 2, 125 xy: 146, 491
size: 18, 23 size: 18, 23
orig: 18, 23 orig: 18, 23
offset: 0, 0 offset: 0, 0
index: -1 index: -1
eye xiaol eye xiaol
rotate: true rotate: false
xy: 148, 146 xy: 21, 498
size: 19, 11 size: 19, 11
orig: 19, 11 orig: 19, 11
offset: 0, 0 offset: 0, 0
index: -1 index: -1
eye xiaor eye xiaor
rotate: true rotate: false
xy: 79, 125 xy: 42, 498
size: 19, 11 size: 19, 11
orig: 19, 11 orig: 19, 11
offset: 0, 0 offset: 0, 0
index: -1 index: -1
eyebrow l eyebrow l
rotate: false rotate: false
xy: 45, 111 xy: 2, 504
size: 8, 5 size: 8, 5
orig: 10, 8 orig: 10, 8
offset: 1, 1 offset: 1, 1
index: -1 index: -1
eyebrow r eyebrow r
rotate: false rotate: false
xy: 45, 118 xy: 12, 503
size: 7, 6 size: 7, 6
orig: 10, 8 orig: 10, 8
offset: 2, 1 offset: 2, 1
index: -1 index: -1
face face
rotate: false rotate: false
xy: 2, 174 xy: 2, 299
size: 93, 80 size: 93, 80
orig: 93, 81 orig: 93, 81
offset: 0, 0 offset: 0, 0
index: -1 index: -1
foot l foot l
rotate: true rotate: false
xy: 138, 167 xy: 222, 488
size: 32, 21 size: 32, 21
orig: 33, 22 orig: 33, 22
offset: 1, 0 offset: 1, 0
index: -1 index: -1
leg l leg l
rotate: true rotate: true
xy: 97, 167 xy: 114, 431
size: 32, 39 size: 32, 39
orig: 32, 39 orig: 32, 39
offset: 0, 0 offset: 0, 0
index: -1 index: -1
mouth mouth
rotate: false rotate: false
xy: 58, 116 xy: 63, 498
size: 17, 11 size: 17, 11
orig: 17, 19 orig: 17, 19
offset: 0, 8 offset: 0, 8
index: -1 index: -1
mouth sad mouth sad
rotate: false rotate: false
xy: 27, 113 xy: 82, 498
size: 16, 11 size: 16, 11
orig: 16, 12 orig: 16, 12
offset: 0, 1 offset: 0, 1
index: -1 index: -1
mouth smile mouth smile
rotate: true rotate: true
xy: 58, 129 xy: 100, 494
size: 15, 19 size: 15, 19
orig: 15, 19 orig: 15, 19
offset: 0, 0 offset: 0, 0
index: -1 index: -1
sai l sai l
rotate: false rotate: false
xy: 33, 146 xy: 54, 470
size: 30, 26 size: 30, 26
orig: 34, 30 orig: 34, 30
offset: 2, 2 offset: 2, 2
index: -1 index: -1
sai r sai r
rotate: false rotate: false
xy: 65, 146 xy: 86, 466
size: 30, 26 size: 30, 26
orig: 34, 30 orig: 34, 30
offset: 2, 2 offset: 2, 2
index: -1 index: -1
tail tail
rotate: false rotate: false
xy: 2, 145 xy: 271, 458
size: 29, 27 size: 29, 27
orig: 29, 27 orig: 29, 27
offset: 0, 0 offset: 0, 0
index: -1 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
This source diff could not be displayed because it is too large. You can view the blob instead.
scripts/rabbit/rabbit.png

42 KB | W: | H:

scripts/rabbit/rabbit.png

143 KB | W: | H:

scripts/rabbit/rabbit.png
scripts/rabbit/rabbit.png
scripts/rabbit/rabbit.png
scripts/rabbit/rabbit.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -2,15 +2,186 @@ export const ResJson = { ...@@ -2,15 +2,186 @@ export const ResJson = {
"groups": [ "groups": [
{ {
"keys": "GSB.png,clockBack.png,platform.png,rabbit.png,scoreBoardBack.png,sp_boom.png,sp_milk.png", "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", "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", "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", "keys": "rabbit0.spi",
...@@ -21,5 +192,6 @@ export const ResJson = { ...@@ -21,5 +192,6 @@ export const ResJson = {
"name": "svga" "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
...@@ -49,6 +49,7 @@ export const DreamSpine: OriginalElementWidthEvents<{ ...@@ -49,6 +49,7 @@ export const DreamSpine: OriginalElementWidthEvents<{
aniName aniName
}) => { }) => {
const SpinePlayer = new FYGE.Spine(spineData) const SpinePlayer = new FYGE.Spine(spineData)
SpinePlayer.fps = 90
setSpineSkin(SpinePlayer, skinName) setSpineSkin(SpinePlayer, skinName)
setSpineAni(SpinePlayer, aniName) setSpineAni(SpinePlayer, aniName)
return SpinePlayer return SpinePlayer
......
...@@ -4,7 +4,7 @@ import { layers } from "../../modules/layers"; ...@@ -4,7 +4,7 @@ import { layers } from "../../modules/layers";
// 一行中 最多一个炸弹,这样配合 概率就不会导致出现死局 // 一行中 最多一个炸弹,这样配合 概率就不会导致出现死局
export const GameConfig = { export const GameConfig = {
debugger: true, debugger: false,
sp_p: 0.3, // 出现道具的 概率 sp_p: 0.3, // 出现道具的 概率
sp_b: 0.8, // 出现炸弹的概率 sp_b: 0.8, // 出现炸弹的概率
offsetYLen: 180, offsetYLen: 180,
...@@ -40,11 +40,11 @@ export const GameConfig = { ...@@ -40,11 +40,11 @@ export const GameConfig = {
[0, 1, 1, 1, 0], [0, 1, 1, 1, 0],
[5, 0, 0, 0, 1], [5, 0, 0, 0, 1],
[1, 0, 1, 1, 1], [1, 0, 1, 1, 1],
[0, 1, 0, 0, 5], [0, 4, 0, 0, 5],
[1, 0, 1, 0, 0], [1, 0, 1, 0, 0],
[0, 1, 0, 5, 0], [0, 1, 0, 5, 0],
[5, 0, 1, 0, 0], [4, 1, 0, 1, 0],
[0, 0, 3, 0, 5], [0, 0, 1, 0, 5],
[1, 1, 0, 5, 1], [1, 1, 0, 5, 1],
[0, 1, 0, 0, 0], [0, 1, 0, 0, 0],
[1, 0, 0, 4, 0], [1, 0, 0, 4, 0],
......
...@@ -6,7 +6,7 @@ import Dream from "../../Dream"; ...@@ -6,7 +6,7 @@ import Dream from "../../Dream";
import { layers } from "../../modules/layers"; import { layers } from "../../modules/layers";
import { RES } from "../../modules/RES"; import { RES } from "../../modules/RES";
import { UsePreload } from "../../modules/UseDecorator/usePreload"; import { UsePreload } from "../../modules/UseDecorator/usePreload";
import { PromiseAwait } from "../../tools/Tools"; import { PromiseAwait, PromiseAwaitCacheMap } from "../../tools/Tools";
import { GameConfig } from "./GameConfig"; import { GameConfig } from "./GameConfig";
import { G_Events } from "./GameEvents"; import { G_Events } from "./GameEvents";
import { Platform } from "./Platform"; import { Platform } from "./Platform";
...@@ -77,19 +77,21 @@ export class GameScene extends Dream.RenderContainer { ...@@ -77,19 +77,21 @@ export class GameScene extends Dream.RenderContainer {
unMount(): void { unMount(): void {
this.removeEvents() this.removeEvents()
PromiseAwaitCacheMap.clear()
} }
initEvents() { initEvents() {
// 测试地图 // 测试地图
document.body.addEventListener('keydown', (e) => { // document.body.addEventListener('keydown', (e) => {
const keyCode = e.code // const keyCode = e.code
console.log(keyCode) // console.log(keyCode)
if (keyCode == 'ArrowDown') { // if (keyCode == 'ArrowDown') {
this.onGameStart() // this.onGameStart()
} else { // } else {
this.onGameOver() // this.onGameOver()
} // }
}) // })
} }
removeEvents() { removeEvents() {
...@@ -97,6 +99,7 @@ export class GameScene extends Dream.RenderContainer { ...@@ -97,6 +99,7 @@ export class GameScene extends Dream.RenderContainer {
} }
onGameStart() { onGameStart() {
GameConfig.speed = 100
GameConfig.DecisionLine = [ GameConfig.DecisionLine = [
180, 180,
layers.stageHeight - 10 layers.stageHeight - 10
...@@ -139,8 +142,9 @@ export class GameScene extends Dream.RenderContainer { ...@@ -139,8 +142,9 @@ export class GameScene extends Dream.RenderContainer {
* @param init 是否是初始化 * @param init 是否是初始化
*/ */
renderMap(init: boolean = false) { renderMap(init: boolean = false) {
console.info('=========render map ===========') const index = Math.random() * GameConfig.mapList.length >> 0
const mapConfig = GameConfig.mapList[Math.random() * GameConfig.mapList.length >> 0] console.info('=========render map ===========:', index)
const mapConfig = GameConfig.mapList[index]
const { const {
rowNum, rowNum,
offsetYLen offsetYLen
...@@ -332,7 +336,7 @@ export class GameScene extends Dream.RenderContainer { ...@@ -332,7 +336,7 @@ export class GameScene extends Dream.RenderContainer {
rabbitCloneContainer.position.set(rabbitContainer.x + 750, rabbitContainer.y) rabbitCloneContainer.position.set(rabbitContainer.x + 750, rabbitContainer.y)
} }
const sp = shouldY - ray const sp = shouldY - ray
const downTime = 300 // 200 * (sp > 0 ? sp : 1) const downTime = 200 // 200 * (sp > 0 ? sp : 1)
FYGE.Tween.get(rabbitContainer, { FYGE.Tween.get(rabbitContainer, {
onChange: () => { onChange: () => {
// rabbitContainer.x = (rabbitContainer.x + 750) % 750 // rabbitContainer.x = (rabbitContainer.x + 750) % 750
...@@ -341,7 +345,7 @@ export class GameScene extends Dream.RenderContainer { ...@@ -341,7 +345,7 @@ export class GameScene extends Dream.RenderContainer {
}) })
.to({ .to({
x: _willX * offsetXLen x: _willX * offsetXLen
}, 600 + downTime) }, 400 + downTime)
FYGE.Tween.get(rabbitContainer, { FYGE.Tween.get(rabbitContainer, {
onChange: () => { onChange: () => {
...@@ -349,8 +353,8 @@ export class GameScene extends Dream.RenderContainer { ...@@ -349,8 +353,8 @@ export class GameScene extends Dream.RenderContainer {
} }
}) })
.to({ .to({
y: Math.min(ry + sp * offsetYLen, ry) - 100 y: Math.min(ry + sp * offsetYLen, ry) - 50
}, 600, FYGE.Ease.quadOut) }, 400, FYGE.Ease.quadOut)
.to({ .to({
y: ry + sp * offsetYLen y: ry + sp * offsetYLen
}, downTime, FYGE.Ease.quadIn) }, downTime, FYGE.Ease.quadIn)
......
...@@ -114,6 +114,10 @@ export function throttleDecorator(time: number = 1000) { ...@@ -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) { ...@@ -123,18 +127,22 @@ export function throttleDecorator(time: number = 1000) {
*/ */
export function PromiseAwait(target: any, property: string, descriptor: PropertyDescriptor) { export function PromiseAwait(target: any, property: string, descriptor: PropertyDescriptor) {
const func: Function = descriptor.value 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[]) { descriptor.value = async function(...args:any[]) {
if (waitPromise) return waitPromise const cache = PromiseAwaitCacheMap.get(func)
waitPromise = new Promise(resolve => { if (cache) return cache.waitPromise
waitPromiseResolve = resolve // @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 // @ts-ignore
const res = await func.apply(this, args) const res = await func.apply(this, args)
waitPromiseResolve(res) shouldCache.waitPromiseResolve(res)
waitPromise = null PromiseAwaitCacheMap.delete(func)
return res return res
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment