Commit a86004fd authored by 李维's avatar 李维

完成游戏逻辑

parent de1aa037
{
"ver": "1.1.2",
"uuid": "8a470ecf-3623-4d7e-9bb5-f39450a8446c",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{"frameRate":24,"name":"L5R4海鸥","version":"5.5","compatibleVersion":"5.5","armature":[{"type":"Armature","frameRate":24,"name":"Armature","aabb":{"x":-147.75,"y":-103,"width":328,"height":188},"bone":[{"name":"root"},{"length":74,"name":"bone","parent":"root","transform":{"x":-7.875,"y":15.8,"skX":-87.6793,"skY":-87.6793}},{"length":74.5,"name":"shenti","parent":"bone","transform":{"x":-9.43235,"y":17.29615,"skX":-71.4262,"skY":-71.4262}},{"length":146,"name":"youchibang","parent":"shenti","transform":{"x":15.0258,"y":11.95205,"skX":135.9673,"skY":135.9673}},{"length":128,"name":"zuochibang","parent":"shenti","transform":{"x":35.76145,"y":7.2473,"skX":21.9709,"skY":21.9709}},{"length":3.5,"name":"yanjing","parent":"shenti","transform":{"x":73.29435,"y":18.1535,"skX":117.1995,"skY":117.1995}},{"length":88.5,"name":"weiba","parent":"shenti","transform":{"x":17.4055,"y":12.08725,"skX":123.9684,"skY":123.9684}},{"length":41.5,"name":"youjiao","parent":"shenti","transform":{"x":5.58545,"y":-16.42195,"skX":-145.6958,"skY":-145.6958}},{"length":34.5,"name":"zuojiao","parent":"shenti","transform":{"x":24.9638,"y":-26.014,"skX":-141.9707,"skY":-141.9707}},{"length":52.5,"name":"shangzui","parent":"shenti","transform":{"x":85.2248,"y":2.4402,"skX":-18.9364,"skY":-18.9364}},{"length":36,"name":"xiazui","parent":"shenti","transform":{"x":83.6462,"y":-2.25565,"skX":-41.1311,"skY":-41.1311}}],"slot":[{"name":"zuochibang","parent":"zuochibang"},{"name":"weiba","parent":"weiba"},{"name":"zuojiao","parent":"zuojiao"},{"name":"shenti","parent":"shenti"},{"name":"youjiao","parent":"youjiao"},{"name":"xiazui","parent":"xiazui"},{"name":"shetou","parent":"root"},{"name":"shangzui","parent":"shangzui"},{"name":"yanjing","parent":"yanjing"},{"name":"youchibang","parent":"youchibang"}],"skin":[{"slot":[{"name":"youjiao","display":[{"name":"L5R4海鸥/youjiao","transform":{"x":21.05,"y":2.09,"skX":-55.2,"skY":-55.2}}]},{"name":"xiazui","display":[{"name":"L5R4海鸥/xiazui","transform":{"x":19.87,"y":-0.19,"skX":-159.76,"skY":-159.76}}]},{"name":"shetou","display":[{"name":"L5R4海鸥/shetou","transform":{"x":-82,"y":-1.75}}]},{"name":"shangzui","display":[{"name":"L5R4海鸥/shangzui","transform":{"x":31.02,"y":-0.81,"skX":178.04,"skY":178.04}}]},{"name":"yanjing","display":[{"name":"L5R4海鸥/yanjing","transform":{"x":1.76,"y":-0.87,"skX":41.91,"skY":41.91}}]},{"name":"zuochibang","display":[{"name":"L5R4海鸥/zuochibang","transform":{"x":77.47,"y":-2.46,"skX":137.13,"skY":137.13}}]},{"name":"weiba","display":[{"name":"L5R4海鸥/weiba","transform":{"x":58.44,"y":2.4,"skX":35.14,"skY":35.14}}]},{"name":"zuojiao","display":[{"name":"L5R4海鸥/zuojiao","transform":{"x":20.34,"y":1.95,"skX":-58.92,"skY":-58.92}}]},{"name":"youchibang","display":[{"name":"L5R4海鸥/youchibang","transform":{"x":92.27,"y":4.2,"skX":23.14,"skY":23.14}}]},{"name":"shenti","display":[{"name":"L5R4海鸥/shenti","transform":{"x":32.38,"y":7.63,"skX":159.11,"skY":159.11}}]}]}],"animation":[{"duration":24,"playTimes":0,"name":"open","bone":[{"name":"shenti","translateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"x":3.56,"y":-0.14},{"duration":0}]},{"name":"youchibang","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":37.97},{"duration":0}]},{"name":"zuochibang","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":-49.15},{"duration":0}]},{"name":"weiba","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":-5.81},{"duration":0}]},{"name":"youjiao","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":-11.82},{"duration":0}]},{"name":"zuojiao","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":-11.82},{"duration":0}]},{"name":"shangzui","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":5.9},{"duration":0}]},{"name":"xiazui","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":-4.39},{"duration":0}]}]},{"duration":24,"playTimes":0,"name":"close","bone":[{"name":"shenti","translateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"x":3.56,"y":-0.14},{"duration":0}]},{"name":"youchibang","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":37.97},{"duration":0}]},{"name":"zuochibang","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":-49.15},{"duration":0}]},{"name":"weiba","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":-5.81},{"duration":0}]},{"name":"youjiao","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":-11.82},{"duration":0}]},{"name":"zuojiao","rotateFrame":[{"duration":12,"tweenEasing":0},{"duration":12,"tweenEasing":0,"rotate":-11.82},{"duration":0}]},{"name":"shangzui","rotateFrame":[{"duration":12,"tweenEasing":0,"rotate":-9.84},{"duration":12,"tweenEasing":0,"rotate":-11.23},{"duration":0,"rotate":-9.84}]},{"name":"xiazui","rotateFrame":[{"duration":12,"tweenEasing":0,"rotate":14.6},{"duration":12,"tweenEasing":0,"rotate":15.53},{"duration":0,"rotate":14.6}]}]}],"defaultActions":[{"gotoAndPlay":"open"}]}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "73023898-a54d-4cf0-8259-5a69bb3292fa",
"subMetas": {}
}
\ No newline at end of file
{"SubTexture":[{"width":135,"y":107,"height":117,"name":"L5R4海鸥/zuochibang","x":1},{"width":107,"y":226,"height":78,"name":"L5R4海鸥/weiba","x":131},{"width":44,"y":161,"height":51,"name":"L5R4海鸥/zuojiao","x":138},{"width":128,"y":226,"height":82,"name":"L5R4海鸥/shenti","x":1},{"width":44,"y":107,"height":52,"name":"L5R4海鸥/youjiao","x":138},{"width":44,"y":1,"height":22,"name":"L5R4海鸥/xiazui","x":192},{"width":24,"y":214,"height":7,"name":"L5R4海鸥/shetou","x":138},{"width":71,"y":107,"height":21,"name":"L5R4海鸥/shangzui","x":184},{"width":7,"y":214,"height":8,"name":"L5R4海鸥/yanjing","x":164},{"width":189,"y":1,"height":104,"name":"L5R4海鸥/youchibang","x":1}],"width":256,"imagePath":"L5R4海鸥_tex.png","height":512,"name":"L5R4海鸥"}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "dc8d05cd-65b3-4f24-ae17-d07b18046752",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "fc51ccdb-3fbf-436c-aac4-f6d2722658a3",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 256,
"height": 512,
"platformSettings": {},
"subMetas": {
"L5R4海鸥_tex": {
"ver": "1.0.4",
"uuid": "600cd994-b608-4157-8958-4f5e6fc577b0",
"rawTextureUuid": "fc51ccdb-3fbf-436c-aac4-f6d2722658a3",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 101.5,
"trimX": 1,
"trimY": 1,
"width": 254,
"height": 307,
"rawWidth": 256,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "c8a42c3c-e9f6-4809-8945-6fe1455f3d68",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{"frameRate":24,"name":"L5R4鲨鱼动效","version":"5.5","compatibleVersion":"5.5","armature":[{"type":"Armature","frameRate":24,"name":"Armature","aabb":{"x":-678.5,"y":-418.5,"width":1318.5,"height":806.5},"bone":[{"name":"root"},{"length":20.5,"name":"右上鲨鱼海浪","parent":"root","transform":{"x":423.15,"y":-356.075,"skX":-87.3818,"skY":-87.3818}},{"length":42.5,"name":"右中鲨鱼海浪","parent":"root","transform":{"x":563.875,"y":-44.375,"skX":-90,"skY":-90}},{"length":27.5,"name":"右中间海浪","parent":"root","transform":{"x":560.1,"y":87.85,"skX":-84.0618,"skY":-84.0618}},{"length":39.5,"name":"右下鲨鱼海浪","parent":"root","transform":{"x":556.35,"y":253.125,"skX":-90,"skY":-90}},{"length":31,"name":"顶部海浪","parent":"root","transform":{"x":-184.2,"y":-350.425,"skX":-88.2546,"skY":-88.2546}},{"length":32,"name":"左上鲨鱼海浪","parent":"root","transform":{"x":-479.825,"y":-175.675,"skX":-86.6597,"skY":-86.6597}},{"length":50,"name":"左上海浪","parent":"root","transform":{"x":-592.225,"y":-289.025,"skX":-85.6888,"skY":-85.6888}},{"length":41.5,"name":"左下鲨鱼海浪","parent":"root","transform":{"x":-448.675,"y":163.4,"skX":-87.3818,"skY":-87.3818}},{"length":39,"name":"image_shark_3","parent":"root","transform":{"x":382.55,"y":-366.5,"skX":-78.9678,"skY":-78.9678}},{"length":68.5,"name":"image_shark_2_0","parent":"root","transform":{"x":521.4,"y":-105.8,"skX":-82.1089,"skY":-82.1089}},{"length":38,"name":"image_shark_1","parent":"root","transform":{"x":491.15,"y":221.025,"skX":-98.5382,"skY":-98.5382}},{"length":41.5,"name":"image_shark_2","parent":"root","transform":{"x":-449.6,"y":116.175,"skX":-93.9239,"skY":-93.9239}},{"length":43,"name":"image_shark_1_0","parent":"root","transform":{"x":-578.075,"y":-213.45,"skX":-98.8221,"skY":-98.8221}}],"slot":[{"name":"顶部海浪","parent":"顶部海浪"},{"name":"左上海浪","parent":"左上海浪"},{"name":"image_shark_1_0","parent":"image_shark_1_0"},{"name":"左上鲨鱼海浪","parent":"左上鲨鱼海浪"},{"name":"image_shark_3","parent":"image_shark_3"},{"name":"右上鲨鱼海浪","parent":"右上鲨鱼海浪"},{"name":"image_shark_2_0","parent":"image_shark_2_0"},{"name":"右中鲨鱼海浪","parent":"右中鲨鱼海浪"},{"name":"image_shark_1","parent":"image_shark_1"},{"name":"右下鲨鱼海浪","parent":"右下鲨鱼海浪"},{"name":"右中间海浪","parent":"右中间海浪"},{"name":"image_shark_2","parent":"image_shark_2"},{"name":"左下鲨鱼海浪","parent":"左下鲨鱼海浪"}],"skin":[{"slot":[{"name":"image_shark_1_0","display":[{"name":"L5R4鲨鱼动效/image_shark_1_0","transform":{"x":20.04,"y":9.76,"skX":98.82,"skY":98.82}}]},{"name":"image_shark_3","display":[{"name":"L5R4鲨鱼动效/image_shark_3","transform":{"x":22.71,"y":-3.71,"skX":78.97,"skY":78.97}}]},{"name":"右下鲨鱼海浪","display":[{"name":"L5R4鲨鱼动效/右下鲨鱼海浪","transform":{"x":-41.13,"y":-84.35,"skX":90,"skY":90}}]},{"name":"image_shark_2_0","display":[{"name":"L5R4鲨鱼动效/image_shark_2_0","transform":{"x":40.72,"y":-6.3,"skX":82.11,"skY":82.11}}]},{"name":"左上鲨鱼海浪","display":[{"name":"L5R4鲨鱼动效/左上鲨鱼海浪","transform":{"x":22.94,"y":1.24,"skX":86.66,"skY":86.66}}]},{"name":"右中鲨鱼海浪","display":[{"name":"L5R4鲨鱼动效/右中鲨鱼海浪","transform":{"x":42.88,"y":-89.88,"skX":90,"skY":90}}]},{"name":"右中间海浪","display":[{"name":"L5R4鲨鱼动效/右中间海浪","transform":{"x":-1.45,"y":-48.71,"skX":84.06,"skY":84.06}}]},{"name":"右上鲨鱼海浪","display":[{"name":"L5R4鲨鱼动效/右上鲨鱼海浪","transform":{"x":-53.81,"y":12.57,"skX":87.38,"skY":87.38}}]},{"name":"左下鲨鱼海浪","display":[{"name":"L5R4鲨鱼动效/左下鲨鱼海浪","transform":{"x":55.2,"y":-54.9,"skX":87.38,"skY":87.38}}]},{"name":"image_shark_1","display":[{"name":"L5R4鲨鱼动效/image_shark_1","transform":{"x":18.69,"y":8.72,"skX":98.54,"skY":98.54}}]},{"name":"顶部海浪","display":[{"name":"L5R4鲨鱼动效/顶部海浪","transform":{"x":-4.51,"y":-2.66,"skX":88.25,"skY":88.25}}]},{"name":"image_shark_2","display":[{"name":"L5R4鲨鱼动效/image_shark_2","transform":{"x":13.88,"y":4.81,"skX":93.92,"skY":93.92}}]},{"name":"左上海浪","display":[{"name":"L5R4鲨鱼动效/左上海浪","transform":{"x":13.04,"y":43.62,"skX":85.69,"skY":85.69}}]}]}],"animation":[{"duration":32,"playTimes":0,"name":"newAnimation","bone":[{"name":"image_shark_3","translateFrame":[{"duration":4,"tweenEasing":0},{"duration":17,"tweenEasing":0,"x":-31.93},{"duration":11,"tweenEasing":0,"x":143.76},{"duration":0}],"scaleFrame":[{"duration":4,"tweenEasing":0},{"tweenEasing":0},{"duration":16,"tweenEasing":0,"y":-1},{"tweenEasing":0,"y":-1},{"duration":10}]},{"name":"image_shark_2_0","translateFrame":[{"duration":12,"tweenEasing":0},{"duration":19,"tweenEasing":0,"x":-75.36},{"tweenEasing":0,"x":33.02},{"duration":0}],"scaleFrame":[{"duration":12,"tweenEasing":0},{"tweenEasing":0},{"duration":18,"tweenEasing":0,"y":-1},{"tweenEasing":0,"y":-1},{"duration":0}]},{"name":"image_shark_1","translateFrame":[{"duration":12,"tweenEasing":0},{"duration":18,"tweenEasing":0,"x":99.62},{"duration":2,"tweenEasing":0,"x":-61.83},{"duration":0}],"scaleFrame":[{"duration":12,"tweenEasing":0},{"tweenEasing":0},{"duration":17,"tweenEasing":0,"y":-1},{"tweenEasing":0,"y":-1},{}]},{"name":"image_shark_2","translateFrame":[{"duration":12,"tweenEasing":0},{"duration":19,"tweenEasing":0,"x":52.46},{"tweenEasing":0,"x":-42.9},{"duration":0,"x":-69.43}],"scaleFrame":[{"duration":12,"tweenEasing":0},{"tweenEasing":0},{"duration":18,"tweenEasing":0,"y":-1},{"tweenEasing":0,"y":-1},{"duration":0}]},{"name":"image_shark_1_0","translateFrame":[{"duration":12,"tweenEasing":0},{"duration":19,"tweenEasing":0,"x":152.71},{"tweenEasing":0,"x":9.64},{"duration":0}],"scaleFrame":[{"duration":12,"tweenEasing":0},{"tweenEasing":0},{"duration":18,"tweenEasing":0,"y":-1},{"tweenEasing":0,"y":-1},{"duration":0}]}]}],"defaultActions":[{"gotoAndPlay":"newAnimation"}],"canvas":{"width":1280,"height":960}}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "0eb87535-836d-4748-87b6-e99ae96aaaf8",
"subMetas": {}
}
\ No newline at end of file
{"SubTexture":[{"width":446,"y":369,"height":94,"name":"L5R4鲨鱼动效/顶部海浪","x":339},{"width":185,"y":260,"height":96,"name":"L5R4鲨鱼动效/左上海浪","x":692},{"width":91,"y":1,"height":69,"name":"L5R4鲨鱼动效/image_shark_1_0","x":845},{"width":326,"y":179,"height":79,"name":"L5R4鲨鱼动效/左上鲨鱼海浪","x":692},{"width":73,"y":1,"height":58,"name":"L5R4鲨鱼动效/image_shark_3","x":938},{"width":414,"y":1,"height":176,"name":"L5R4鲨鱼动效/右上鲨鱼海浪","x":335},{"width":92,"y":1,"height":107,"name":"L5R4鲨鱼动效/image_shark_2_0","x":751},{"width":332,"y":1,"height":242,"name":"L5R4鲨鱼动效/右中鲨鱼海浪","x":1},{"width":72,"y":61,"height":55,"name":"L5R4鲨鱼动效/image_shark_1","x":938},{"width":336,"y":369,"height":188,"name":"L5R4鲨鱼动效/右下鲨鱼海浪","x":1},{"width":257,"y":245,"height":118,"name":"L5R4鲨鱼动效/右中间海浪","x":1},{"width":63,"y":245,"height":73,"name":"L5R4鲨鱼动效/image_shark_2","x":260},{"width":355,"y":179,"height":188,"name":"L5R4鲨鱼动效/左下鲨鱼海浪","x":335}],"width":1024,"imagePath":"L5R4鲨鱼动效_tex.png","height":1024,"name":"L5R4鲨鱼动效"}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "baa1e055-eb3a-448c-88e9-2572f2476aa2",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "3fc16914-c7b9-47f7-aac5-53a5e07b9342",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1024,
"height": 1024,
"platformSettings": {},
"subMetas": {
"L5R4鲨鱼动效_tex": {
"ver": "1.0.4",
"uuid": "df8f3993-151c-41f2-ae5b-3611b428db0f",
"rawTextureUuid": "3fc16914-c7b9-47f7-aac5-53a5e07b9342",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -2.5,
"offsetY": 233,
"trimX": 1,
"trimY": 1,
"width": 1017,
"height": 556,
"rawWidth": 1024,
"rawHeight": 1024,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
......@@ -79,15 +79,16 @@ cc.Class({
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
_timeoutID: null,
isStop: true,
start() {},
init(audio_url, testTime) {
this.audioBeforeTest = audio_url;
this.testTime = testTime;
},
showVoice(node, testLetter) {
this.isStop = false;
return new Promise((resolve, reject) => {
let voice = this.node;
voice.active = true;
......@@ -120,6 +121,9 @@ cc.Class({
let cat = cc.find("cat", catBase);
asyncPlayDragonBoneAnimation(cat, "begin", 0);
playAudioByUrl(url, () => {
if(this.isStop) {
return
}
asyncPlayDragonBoneAnimation(cat, "record", 0);
cc.tween(progressBar)
.to(this.testTime, { progress: 0 })
......@@ -128,7 +132,7 @@ cc.Class({
console.log("startTest->" + testLetter);
window.courseware && window.courseware.startTest(testLetter); //开始录音
setTimeout(async () => {
this._timeoutID = setTimeout(async () => {
if (!window.courseware) {
let testData = {
dtLastResponse: "2021-09-17 13:36:26:109",
......@@ -275,6 +279,7 @@ cc.Class({
}
}); //结束录音
}, this.testTime * 1000);
console.log(this._timeoutID)
});
});
},
......@@ -345,6 +350,15 @@ cc.Class({
voice.active = false;
},
stopTesting() {
console.log(this._timeoutID)
if(this._timeoutID) {
clearTimeout(this._timeoutID);
}
this.isStop = true;
this.hideVoice();
},
playLocalAudio(audioName) {
const audio = cc
.find(`audioClips/${audioName}`, this.node)
......@@ -355,7 +369,12 @@ cc.Class({
resolve(id);
});
});
}
},
onDestroy() {
if(this._timeoutID) {
clearTimeout(this._timeoutID);
}
},
// update (dt) {},
});
......@@ -26,9 +26,9 @@ const MSG_PLAYER_TO_TREE = "msg_player_to_tree";
const MSG_PLAYER_TO_HOME = "msg_player_to_home";
const MSG_PROFIX_END = "__END__";
const DEBUG = true;
const TOTAL_SCORE = 10; // 总分 - 双方分数之和等于 TOTAL_SCORE
const AI_SUCCESS_RATE = 1; // ai评测成功率
const AUTO_GAME = true; // 自动游戏-调试使用
const TOTAL_SCORE = 42; // 总分 - 双方分数之和等于 TOTAL_SCORE
const AI_SUCCESS_RATE = 0.65; // ai评测成功率
const AUTO_GAME = false; // 自动游戏-调试使用
@ccclass
export default class SceneComponent extends MyCocosSceneComponent {
......@@ -47,6 +47,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
isRoomOwner; // 是否为房主
recordWaitCount; // 录音等待倒计时
withAiPlayer=false; // 对手是否AI
gameEnd = false;
addPreloadImage() {
// TODO 根据自己的配置预加载图片资源
......@@ -67,6 +68,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initView();
this.initListener();
this.initEvents();
// 测试停止游戏
window.stopGame = () => {
this.runEvent(MSG_TIMEOUT, {})
}
}
// 初始化数据
......@@ -155,6 +161,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initOfflineLayer();
this.initPronunciationTestLayer();
this.initCoolCat();
this.initSeagull();
this.initBox();
this.initTurntable();
this.initGemstone();
this.initScore();
......@@ -194,7 +202,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initSide();
this.timerHandle = this.initTimer();
this.initPlayerInfo();
// 自动游戏模式 - 调试使用
if(AUTO_GAME) {
this.turntable.stopBlink();
......@@ -255,6 +262,35 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.coolCat = cc.find("Canvas/coolcatLand/coolcat");
}
seagull = null;
seagullMap = null;
// 初始化海鸥
initSeagull() {
this.seagull = cc.find("Canvas/seagull");
this.seagullMap = cc.find("Canvas/seagull/map");
}
// 海鸥带走
seagullGo() {
const pos = this.boxMap.convertToWorldSpaceAR(cc.v2(0, 0));
const pos1 = worldPosToLocalPos(pos, this.seagull)
return new Promise((resovle, reject)=>{
cc.tween(this.seagull).to(2, {x: pos1.x, y: pos1.y, scale: 0.8}).call(()=>{
this.boxMap.parent = this.seagullMap;
asyncPlayDragonBoneAnimation(this.seagull, 'close', 0);
cc.tween(this.seagull).to(2, {x: -2000, y: 2000, scale: 1}).call(()=>{
resovle(true);
}).start();
}).start();
})
}
boxMap = null;
// 初始化宝箱
initBox() {
this.boxMap = cc.find("Canvas/center_map/boxGroup/map");
}
// 小人上树
playerToTree(playerNode) {
const wordPos = this.treeNode.convertToWorldSpaceAR(cc.v2(0, 0))
......@@ -539,6 +575,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 注册全局游戏事件,需要玩家之间同步执行的方法
// 无论是自己方 还是对方,只需要调用即可,方法内处理消息发送和执行
runEvent(eventName, param) {
// && eventName.indexOf(MSG_FINISH)==-1 && eventName.indexOf(MSG_TIMEOUT)==-1
if(this.gameEnd && eventName != MSG_FINISH) {
// 游戏结束,但会排除结束消息
console.log(`收到${eventName} - 游戏已经结束`)
return;
}
if(this.eventsMap[eventName] == undefined) {
cc.log("该事件没有注册过");
return;
......@@ -557,6 +599,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 执行服务器发来的消息广播 和runEvent不同的地方只是 这个方法不会再次转发消息
runServerEvent(eventName, param) {
if(this.gameEnd && eventName != MSG_FINISH) {
// 游戏结束,但会排除结束消息
console.log(`收到${eventName} - 游戏已经结束`)
return;
}
if(this.eventsMap[eventName] == undefined) {
cc.log("该事件没有注册过");
return;
......@@ -770,16 +817,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
// 时间到
this.registerEvent(MSG_TIMEOUT, (param, next) => {
this.registerEvent(MSG_TIMEOUT, async (param, next) => {
// console.log("时间到")
this.turntable.disable();
this.turntable.stopBlink();
setTimeout(() => {
next()
}, 2000);
}, ()=>{
this.pronunciationTestLayer.stopTesting();
this.stopTimer();
this.gameEnd = true;
await this.seagullGo();
this.runEvent(MSG_FINISH, {})
})
},)
// 结束
this.registerEvent(MSG_FINISH, (param, next) => {
......@@ -805,6 +852,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.eventsMap[MSG_GO + MSG_PROFIX_END].fn(event.param);
}, 1)
break;
case MSG_TIMEOUT:
this,this.scheduleOnce(()=>{
if(this.eventsMap[MSG_TIMEOUT + MSG_PROFIX_END] && this.eventsMap[MSG_TIMEOUT + MSG_PROFIX_END].fn) {
this.eventsMap[MSG_TIMEOUT + MSG_PROFIX_END].fn(event.param);
}
}, 1)
break;
case MSG_PLAYER_TO_HOME:
this,this.scheduleOnce(()=>{
......@@ -883,11 +938,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
gem.__isDone = true;
}
// 走棋
gameFlowGo() {
}
// 初始化用户信息 头像 名字
initPlayerInfo() {
const red = cc.find("Canvas/playerLand/red/header/image");
......
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