Commit 63e616d2 authored by liujiangnan's avatar liujiangnan

feat

parent 23386ec1
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
// import { getSprNode } from "./util"; // import { getSprNode } from "./util";
import { getSprNode, playAudioByUrl, showBtnAnima, getScaleRateBy2Node, localPosTolocalPos, randomSortByArr, loadDragonBones, playAudio, showTrebleFirework, getSprNodeByUrl, setSprNodeMaxLen, delayCall, asyncDelay, RandomInt, exchangeNodePos, onHomeworkFinish, callNetworkApi, loopLog, removeFromArr} from "../script/hw_elimination_letter_util"; import { getSprNode, playAudioByUrl, showBtnAnima, getScaleRateBy2Node, localPosTolocalPos, randomSortByArr, loadDragonBones, playAudio, showTrebleFirework, getSprNodeByUrl, setSprNodeMaxLen, delayCall, asyncDelay, RandomInt, exchangeNodePos, onHomeworkFinish, callNetworkApi, loopLog, removeFromArr} from "../script/hw_elimination_letter_util";
...@@ -116,7 +110,7 @@ cc.Class({ ...@@ -116,7 +110,7 @@ cc.Class({
if (flag === 'true') { if (flag === 'true') {
if (this.isGameStart !== true) { if (this.isGameStart !== true) {
const res = await asyncCallNetworkApiGet('/api/douyin/v1/getwords', {roomid: this.roomId, uid: this.uid}); const res = await asyncCallNetworkApiGet('/api/douyin/v1/getwords', {roomid: this.roomId, uid: this.uid});
this.data = JSON.parse(res); this.data = JSON.parse(res.replace("http://", "https://"));
this.preloadItem(); this.preloadItem();
this.isGameStart = true; this.isGameStart = true;
} }
...@@ -141,362 +135,6 @@ cc.Class({ ...@@ -141,362 +135,6 @@ cc.Class({
this.preload(); this.preload();
}, },
getDefaultData() {
return {
"code": 200,
"msg": "success",
"rows": [
{
"id": 4,
"pid": 3,
"text_en": "juicy peach",
"text_cn": "铅笔盒",
"audio_url": "http://teach.cdn.ireadabc.com/011a31a3142088e22b8af86694b7237a.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/45e0da7481f33625d0da39db1fe37f10.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/37c45828a0e536f96a6c13fedd40b4d7.webp\"]",
"phonetic": "[hə'ləu]",
"description": null,
"mlk": null,
"data": null,
"seq": 1,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 4,
"pid": 3,
"text_en": "pencil",
"text_cn": "铅笔",
"audio_url": "http://teach.cdn.ireadabc.com/011a31a3142088e22b8af86694b7237a.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/45e0da7481f33625d0da39db1fe37f10.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/37c45828a0e536f96a6c13fedd40b4d7.webp\"]",
"phonetic": "[hə'ləu]",
"description": null,
"mlk": null,
"data": null,
"seq": 1,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 4,
"pid": 3,
"text_en": "pen",
"text_cn": "钢笔",
"audio_url": "http://teach.cdn.ireadabc.com/011a31a3142088e22b8af86694b7237a.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/45e0da7481f33625d0da39db1fe37f10.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/37c45828a0e536f96a6c13fedd40b4d7.webp\"]",
"phonetic": "[hə'ləu]",
"description": null,
"mlk": null,
"data": null,
"seq": 1,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 4,
"pid": 3,
"text_en": "hello",
"text_cn": "你好",
"audio_url": "http://teach.cdn.ireadabc.com/011a31a3142088e22b8af86694b7237a.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/45e0da7481f33625d0da39db1fe37f10.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/37c45828a0e536f96a6c13fedd40b4d7.webp\"]",
"phonetic": "[hə'ləu]",
"description": null,
"mlk": null,
"data": null,
"seq": 1,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 5,
"pid": 3,
"text_en": "aah",
"text_cn": "",
"audio_url": "http://teach.cdn.ireadabc.com/62c0d10077ef857fe850c9c9b9931b3a.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/5513a098c5b10965b6b7ab0d4e7c30f0.mp3",
"image_url": null,
"phonetic": "[eɪ]",
"description": null,
"mlk": null,
"data": null,
"seq": 2,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 6,
"pid": 3,
"text_en": "ooh",
"text_cn": "",
"audio_url": "http://teach.cdn.ireadabc.com/10651ce6c6f1e3099c4377eabb707bb0.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/eed22a86c773bd9762a0368f145039c6.mp3",
"image_url": null,
"phonetic": "[u:]",
"description": null,
"mlk": null,
"data": null,
"seq": 3,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 7,
"pid": 3,
"text_en": "I",
"text_cn": "",
"audio_url": "http://teach.cdn.ireadabc.com/344070143e6a32e3795ecf48140ef804.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/b9feda7d0e05f9b9d6fb1be3acd6ebef.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/2d47ee18a14fc1f3b41b834b390a60c7.jpg\"]",
"phonetic": "[ai]",
"description": null,
"mlk": null,
"data": null,
"seq": 4,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 8,
"pid": 3,
"text_en": "am",
"text_cn": "",
"audio_url": "http://teach.cdn.ireadabc.com/701b543846b71cb2788877bdaf0fc15c.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/45100afa502326955d0f03cac87f1a5b.mp3",
"image_url": null,
"phonetic": "[em]",
"description": null,
"mlk": null,
"data": null,
"seq": 5,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 9,
"pid": 3,
"text_en": "I'm",
"text_cn": "我是",
"audio_url": "http://teach.cdn.ireadabc.com/7020107405bc4111cc30f6da4d388ee3.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/456947562e81b109b3984e437be623fe.mp3",
"image_url": null,
"phonetic": "[aɪm]",
"description": null,
"mlk": null,
"data": null,
"seq": 6,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 10,
"pid": 3,
"text_en": "I am",
"text_cn": "我是",
"audio_url": "http://teach.cdn.ireadabc.com/a3f7dfb10f5a784c1e3915563c97a466.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/456947562e81b109b3984e437be623fe.mp3",
"image_url": null,
"phonetic": "[aim]",
"description": null,
"mlk": null,
"data": null,
"seq": 7,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 11,
"pid": 3,
"text_en": "goodbye",
"text_cn": "再见",
"audio_url": "http://teach.cdn.ireadabc.com/bd75e9da1d3ae389e4d35f1568dae0bc.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/f5ec05981dccd7f6cc0c2a998bc475fe.mp3",
"image_url": null,
"phonetic": "[ˌɡʊd'baɪ]",
"description": null,
"mlk": null,
"data": null,
"seq": 8,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-14T01:01:17.000Z",
"del": 0
},
{
"id": 12,
"pid": 3,
"text_en": "How are you",
"text_cn": "你好吗?你好!",
"audio_url": "http://teach.cdn.ireadabc.com/cb19f7375397051944354dfe7666f2c5.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/4590c0bc7c9f553e204e2d6bf1ebc856.mp3",
"image_url": null,
"phonetic": "",
"description": null,
"mlk": null,
"data": null,
"seq": 9,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-14T01:48:04.000Z",
"del": 0
},
{
"id": 13,
"pid": 3,
"text_en": "no",
"text_cn": "不是",
"audio_url": "http://teach.cdn.ireadabc.com/58dda4c0877c2d7edf2c347d0e84a336.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/d9372d51e4e65fc04c29095414bb2d23.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/223cefe90ac0d9e4e5341df726cb160e.jpg\",\"http://teach.cdn.ireadabc.com/836c69951ec8723f5eb78bf8ba493937.jpg\",\"http://teach.cdn.ireadabc.com/058eba570171bba280a2f4a734ec6efe.jpg\"]",
"phonetic": "[nəu]",
"description": null,
"mlk": null,
"data": null,
"seq": 10,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-14T01:48:04.000Z",
"del": 0
},
{
"id": 14,
"pid": 3,
"text_en": "yes",
"text_cn": "",
"audio_url": "http://teach.cdn.ireadabc.com/e5e7f6f1c32c35706ce9e475827d7b08.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/45100afa502326955d0f03cac87f1a5b.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/9d29f463dab95f42a35f7c06253c282e.jpg\",\"http://teach.cdn.ireadabc.com/c277886eed7dd79f8ebabef2ca01248a.jpg\"]",
"phonetic": "[jes]",
"description": null,
"mlk": null,
"data": null,
"seq": 11,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-14T01:48:04.000Z",
"del": 0
},
{
"id": 15,
"pid": 3,
"text_en": "sorry",
"text_cn": "对不起",
"audio_url": "http://teach.cdn.ireadabc.com/76650ca291bb7998887d4f6b0baf952f.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/ee034c541c5500658dcbe5f85c23e871.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/3158e6638685d62605e3fd89a0e812c2.webp\"]",
"phonetic": "['sɒri]",
"description": null,
"mlk": null,
"data": null,
"seq": 12,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 16,
"pid": 3,
"text_en": "fine",
"text_cn": "(身体)好的",
"audio_url": "http://teach.cdn.ireadabc.com/8725bcc0f7109926dd97fbd27f40bb95.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/3206464b31868018f31c242d2a41ecfd.mp3",
"image_url": null,
"phonetic": "[faɪn]",
"description": null,
"mlk": null,
"data": null,
"seq": 13,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-14T01:48:58.000Z",
"del": 0
},
{
"id": 17,
"pid": 3,
"text_en": "thank",
"text_cn": "谢谢",
"audio_url": "http://teach.cdn.ireadabc.com/7e43048127e86051eda9b34efcb2bb4e.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/cb0c9111738c2cd3359acf26b5553348.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/e32fdd572cc6e1a9442c187272563520.jpg\",\"http://teach.cdn.ireadabc.com/7a699b04d038fc2f5a9b8e1c16caf9df.jpg\",\"http://teach.cdn.ireadabc.com/b3c8c910388eb207930e28c6d2d9b3d9.jpeg\"]",
"phonetic": "[θæŋk]",
"description": null,
"mlk": null,
"data": null,
"seq": 14,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-10T03:31:34.000Z",
"del": 0
},
{
"id": 18,
"pid": 3,
"text_en": "you",
"text_cn": "",
"audio_url": "http://teach.cdn.ireadabc.com/36a87a3d8a0ba439b825b3babd5d9ab6.mp3",
"audio_cn_url": "http://teach.cdn.ireadabc.com/ea0576b48289b050998f306a154fc453.mp3",
"image_url": "[\"http://teach.cdn.ireadabc.com/9fd95054cb9323487970e3ca72e2ffc3.jpg\"]",
"phonetic": "[ju] ",
"description": null,
"mlk": null,
"data": null,
"seq": 15,
"has_child": 0,
"depth": 4,
"created_date": "2023-02-01T10:07:13.000Z",
"updated_date": "2023-02-14T01:48:59.000Z",
"del": 0
}
]
}
},
preload() { preload() {
const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList); const preloadArr = this._imageResList.concat(this._audioResList).concat(this._animaResList);
cc.assetManager.loadAny(preloadArr, null, null, (err, data) => { cc.assetManager.loadAny(preloadArr, null, null, (err, data) => {
...@@ -10133,9 +9771,9 @@ cc.Class({ ...@@ -10133,9 +9771,9 @@ cc.Class({
const image = data.texPngData.url//"http://staging-teach.cdn.ireadabc.com/5a0c5af3e952acd0ac83a6e5c6f03ff1.png"; const image = data.texPngData.url;
const ske = data.skeJsonData.url//"http://staging-teach.cdn.ireadabc.com/bd825dcceea298d1146be8067ae3d17f.json"; const ske = data.skeJsonData.url;
const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json"; const atlas = data.texJsonData.url;
cc.loader.load(image, (error, texture) => { cc.loader.load(image, (error, texture) => {
cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => { cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => {
...@@ -10447,9 +10085,9 @@ cc.Class({ ...@@ -10447,9 +10085,9 @@ cc.Class({
return return
} }
const image = data.texPngData.url//"http://staging-teach.cdn.ireadabc.com/5a0c5af3e952acd0ac83a6e5c6f03ff1.png"; const image = data.texPngData.url;
const ske = data.skeJsonData.url//"http://staging-teach.cdn.ireadabc.com/bd825dcceea298d1146be8067ae3d17f.json"; const ske = data.skeJsonData.url;
const atlas = data.texJsonData.url//"http://staging-teach.cdn.ireadabc.com/246f8991b729fa3e5a7f4802de828efa.json"; const atlas = data.texJsonData.url;
cc.loader.load(image, (error, texture) => { cc.loader.load(image, (error, texture) => {
cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => { cc.loader.load({url: atlas, type: 'txt'}, (error, atlasJson) => {
......
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