Commit 09f8472b authored by Master Q's avatar Master Q

音频文件和 游戏 spi 文件要放到 淘宝cdn 上

parent b4122601
...@@ -2,709 +2,63 @@ export const ResJson = { ...@@ -2,709 +2,63 @@ export const ResJson = {
"groups": [ "groups": [
{ {
"keys": "box1.png,box2.png,box3.png,box4.png,box5.png,box6.png,box7.png,box8.png", "keys": "box1.png,box2.png,box3.png,box4.png,box5.png,box6.png,box7.png,box8.png",
"name": "Boxes", "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
}
}
}, },
{ {
"keys": "DFM1.png,DFMB.png", "keys": "DFM1.png,DFMB.png",
"name": "DrawFailModal", "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
}
}
}, },
{ {
"keys": "DSM1.png,DSMB.png", "keys": "DSM1.png,DSMB.png",
"name": "DrawSucModal", "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
}
}
}, },
{ {
"keys": "FGM1.png,FGMB.png", "keys": "FGM1.png,FGMB.png",
"name": "FinalGiftModal", "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
}
}
}, },
{ {
"keys": "2b727ace1b5c959dbc6274cacb5b4e5f.png,3ed4431aad269ef7059929043bd45597.png,60377934f7cf618b52457273db65aace.png,9074d1305c0e7feb16037261986c7f4b.png,f3bde4659477f82338fcb2b134272321.png", "keys": "2b727ace1b5c959dbc6274cacb5b4e5f.png,3ed4431aad269ef7059929043bd45597.png,60377934f7cf618b52457273db65aace.png,9074d1305c0e7feb16037261986c7f4b.png,f3bde4659477f82338fcb2b134272321.png",
"name": "GameAtom", "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
}
}
}, },
{ {
"keys": "GOM0.png,GOM1.png,GameOverModalBack.png", "keys": "GOM0.png,GOM1.png,GameOverModalBack.png",
"name": "GameOverModal", "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
}
}
}, },
{ {
"keys": "GQM0.png,GQM1.png,GQMB.png", "keys": "GQM0.png,GQM1.png,GQMB.png",
"name": "GameQuitModal", "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
}
}
}, },
{ {
"keys": "GameResumeModalBack.png,cancelBtn.png,useRightNowBtn.png", "keys": "GameResumeModalBack.png,cancelBtn.png,useRightNowBtn.png",
"name": "GameResumeModal", "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
}
}
}, },
{ {
"keys": "back.png,bottomAtom.png,gele1.png,goBackBtn.png,player.png,scoreboard-t.png", "keys": "back.png,bottomAtom.png,gele1.png,goBackBtn.png,player.png,scoreboard-t.png",
"name": "GameScene", "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
}
}
}, },
{ {
"keys": "2120075482341d7d94d8164b1a0f6d43.png,3ed4431aad269ef7059929043bd45597.png,4f4612689c9fde32a8c28c129e9f6e7d.png,60377934f7cf618b52457273db65aace.png,63b0a84f0f9b10842b5f83fa5e923534.png,f3bde4659477f82338fcb2b134272321.png", "keys": "2120075482341d7d94d8164b1a0f6d43.png,3ed4431aad269ef7059929043bd45597.png,4f4612689c9fde32a8c28c129e9f6e7d.png,60377934f7cf618b52457273db65aace.png,63b0a84f0f9b10842b5f83fa5e923534.png,f3bde4659477f82338fcb2b134272321.png",
"name": "JumpEnd", "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
}
}
}, },
{ {
"keys": "Guide1.png,NGSB.jpg,nextStep.png,startGameBtn.png", "keys": "Guide1.png,NGSB.jpg,nextStep.png,startGameBtn.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
},
"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
}
}
}, },
{ {
"keys": "2120075482341d7d94d8164b1a0f6d43.png", "keys": "2120075482341d7d94d8164b1a0f6d43.png",
"name": "PerfectJumpEnd", "name": "PerfectJumpEnd"
"atlas": {
"2120075482341d7d94d8164b1a0f6d43.png": {
"x": 2,
"y": 2,
"w": 274,
"h": 294,
"ox": 25,
"oy": 21,
"sw": 323,
"sh": 323,
"ro": false
}
}
}, },
{ {
"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": "786bf3500cf0986c9678f6b8a8cf24f6.png,b5d5c1070b13deb0230b0efe5c58ee9d.png,ca7b2a497afc6147cc076d55600154bd.png,d64a974a921d32ed81463c918bae137e.png,f49a78c8287be1a92ee75ce3a2b7a512.png", "keys": "786bf3500cf0986c9678f6b8a8cf24f6.png,b5d5c1070b13deb0230b0efe5c58ee9d.png,ca7b2a497afc6147cc076d55600154bd.png,d64a974a921d32ed81463c918bae137e.png,f49a78c8287be1a92ee75ce3a2b7a512.png",
"name": "countDown", "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
}
}
}, },
{ {
"keys": "548342251013e2f832a40380d1855bf5.png,af75d547153d9118b05d4dd8fbcfe022.png,fd0f936244fb973bddf520819997f5ba.png", "keys": "548342251013e2f832a40380d1855bf5.png,af75d547153d9118b05d4dd8fbcfe022.png,fd0f936244fb973bddf520819997f5ba.png",
"name": "handLottie", "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
}
}
}, },
{ {
"keys": "nx1.jpg,ny1.jpg,nz1.jpg,px1.jpg,py1.jpg,pz1.jpg", "keys": "nx1.jpg,ny1.jpg,nz1.jpg,px1.jpg,py1.jpg,pz1.jpg",
...@@ -715,6 +69,5 @@ export const ResJson = { ...@@ -715,6 +69,5 @@ export const ResJson = {
"name": "spine" "name": "spine"
} }
], ],
// eslint-disable-next-line "path": "./resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/template/1669973871/resource/"
} }
\ No newline at end of file
...@@ -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;
} }
......
...@@ -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
......
...@@ -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={{
......
// @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
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