Commit 5cb77a3c authored by Tt's avatar Tt

1

parent dec51142
{ {"ver":"1.1.2","uuid":"c35bb2f6-f24a-4850-ae44-643f2fdc7541","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}}
"ver": "1.1.2", \ No newline at end of file
"uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {
"ios": false,
"android": false
},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
...@@ -4,33 +4,37 @@ import pg from "./pg"; ...@@ -4,33 +4,37 @@ import pg from "./pg";
import map from "./map"; import map from "./map";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
enum CELLTYPE {
SPEAK = 1, const CELLTYPE = {
MOVE_ADD = 2, SPEAK: 1,
ROLL_AGAIN = 3, MOVE_ADD: 2,
DELAY_TIME = 4, ROLL_AGAIN: 3,
JUMP_ROLL = 5, DELAY_TIME: 4,
WIN = 100, JUMP_ROLL: 5,
WIN: 100,
} }
@ccclass @ccclass
export default class SceneComponent extends MyCocosSceneComponent { export default class NewClass extends MyCocosSceneComponent {
addPreloadImage() { addPreloadImage() {
this.log("test addPreloadImage")
// TODO 根据自己的配置预加载图片资源 // TODO 根据自己的配置预加载图片资源
this._imageResList.push({ url: this.data.pic_url }); this.data && this._imageResList.push({ url: this.data.pic_url });
this._imageResList.push({ url: this.data.pic_url_2 }); this.data && this._imageResList.push({ url: this.data.pic_url_2 });
} }
addPreloadAudio() { addPreloadAudio() {
this.log("test addPreloadAudio")
// TODO 根据自己的配置预加载音频资源 // TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.audio_url }); this.data && this._audioResList.push({ url: this.data.audio_url });
} }
addPreloadAnima() { addPreloadAnima() {
this.log("test addPreloadAnima")
} }
onLoadEnd() { onLoadEnd() {
this.log("test onLoadEnd")
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考 // TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData(); this.initData();
this.initView(); this.initView();
...@@ -39,35 +43,17 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -39,35 +43,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
_cantouch = null; _cantouch = null;
initData() { initData() {
this.log("test initData")
// 所有全局变量 默认都是null // 所有全局变量 默认都是null
this._cantouch = true; this._cantouch = true;
} }
//开发流程
//1.start状态
//2.开局效果
//3.骰子动效,stop效果。
//4.星星位移。
//--游戏开始就计算好后续的所有点数数组。
//--骰子及位移点数等添加到一个数组中,每次需要获取当前点和目标点时进行实时获取。
//--出现错误反向退回。
//--位移停止后触发目的地内容。
//5.触发目的地道具效果。
//--如各类道具,进行分类。统一调用一个方法输入,给予id
//--如:终点。可触发终点效果。
//--如:语音。触发语音效果。
//--如:加速。触发位移效果。
//6.语音录音部分。
//--动画组件,start end。
//7.机器人骰子及自动进程。
//--机器人难度处理,游戏开始就计算好后续的所有点数数组。
//--调用通用的内容进行位移。
//8.结算胜负
//9.重新开始
initView() { initView() {
this.log("test initView")
this.initTouzi(); this.initTouzi();
this.initChess(); this.initChess();
} }
initEvent() { initEvent() {
this.log("test initEvent")
pg.event.on("game_start", () => { this.onGameStart() }) pg.event.on("game_start", () => { this.onGameStart() })
pg.event.on("speak_success", () => { this.onSpeakScueess() }); pg.event.on("speak_success", () => { this.onSpeakScueess() });
...@@ -245,16 +231,16 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -245,16 +231,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
let touzi = icon.getComponent("touzi"); let touzi = icon.getComponent("touzi");
let hand = pg.view.find(touzi_ani, "hand"); let hand = pg.view.find(touzi_ani, "hand");
let btn_stop = pg.view.find(touzi_ani, "btn_stop"); let btn_stop = pg.view.find(touzi_ani, "btn_stop");
btn_stop.active = false; pg.view.visible(btn_stop, false);
this.lastPointId = this.playerPoint + 1; this.lastPointId = this.playerPoint + 1;
if (!runNum) { if (!runNum) {
runNum = 1 + Math.floor(Math.random() * 6); runNum = 1 + Math.floor(Math.random() * 6);
if (this.turnRobot) runNum = 1 + Math.floor(Math.random() * 5); if (this.turnRobot) runNum = 1 + Math.floor(Math.random() * 5);
} }
hand.active = false; pg.view.visible(hand, false);
clearTimeout(this.stopHandTimer); clearTimeout(this.stopHandTimer);
touzi.stopAni(runNum).then(() => { touzi.stopAni(runNum).then(() => {
touzi_ani.active = false; pg.view.visible(touzi_ani, false);
pg.event.emit("player_point_update", { isRobot: this.turnRobot, num: runNum }); pg.event.emit("player_point_update", { isRobot: this.turnRobot, num: runNum });
this.moveChess(runNum).then(() => { this.moveChess(runNum).then(() => {
this.checkCell(); this.checkCell();
...@@ -269,8 +255,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -269,8 +255,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
let touzi = icon.getComponent("touzi"); let touzi = icon.getComponent("touzi");
let hand = pg.view.find(touzi_ani, "hand"); let hand = pg.view.find(touzi_ani, "hand");
let btn_stop = pg.view.find(touzi_ani, "btn_stop"); let btn_stop = pg.view.find(touzi_ani, "btn_stop");
btn_stop.active = true; pg.view.visible(btn_stop, true);
touzi_ani.active = true; pg.view.visible(touzi_ani, true);
touzi.startAni(); touzi.startAni();
if (this.turnRobot) { if (this.turnRobot) {
setTimeout(() => { setTimeout(() => {
...@@ -278,7 +264,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -278,7 +264,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}, 300 + Math.random() * 200); }, 300 + Math.random() * 200);
} else { } else {
this.stopHandTimer = setTimeout(() => { this.stopHandTimer = setTimeout(() => {
hand.active = true; pg.view.visible(hand, true);
}, 5000); }, 5000);
} }
pg.hw.playLocalAudio("touzi", true).then((id: number) => { pg.hw.playLocalAudio("touzi", true).then((id: number) => {
......
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5", "uuid": "7091890a-4097-4c74-b388-e0be538f9c1c",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
This diff is collapsed.
{
"ver": "1.0.8",
"uuid": "408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -23,21 +23,11 @@ export default class NewClass extends cc.Component { ...@@ -23,21 +23,11 @@ export default class NewClass extends cc.Component {
this.count = 0; this.count = 0;
} }
start() {
}
update(dt) { update(dt) {
this.count++; this.count++;
// if (this.count >= 30) this.count = 0; // if (this.count >= 30) this.count = 0;
this.updateItems(); this.updateItems();
} }
updateItems() { updateItems() {
let cur = Math.floor(this.count / 30) % 4
for (let i = 0; i < 4; i++) {
let item = pg.view.find(this, "btn_audio" + i);
item.active = cur == i;
}
} }
} }
{ {
"ver": "1.0.8", "ver": "1.0.8",
"uuid": "bed01784-8114-4d5e-bd26-36345307676c", "uuid": "764039ec-62e7-416b-a01b-1f8dd451a870",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
"loadPluginInNative": true, "loadPluginInNative": true,
......
...@@ -59,9 +59,5 @@ export default class NewClass extends cc.Component { ...@@ -59,9 +59,5 @@ export default class NewClass extends cc.Component {
}); });
return posArray; return posArray;
} }
start() {
}
// update (dt) {} // update (dt) {}
} }
...@@ -22,12 +22,19 @@ export default class NewClass extends cc.Component { ...@@ -22,12 +22,19 @@ export default class NewClass extends cc.Component {
this.showAni(); this.showAni();
} }
showAni() { showAni() {
if (this.node && this.node.active) {
this.node.x += 400; this.node.x += 400;
this.node.y -= 200; this.node.y -= 200;
cc.tween(this.node).by(0.3, { x: -400, y: 200 }).start(); cc.tween(this.node).by(0.3, { x: -400, y: 200 }).call(() => {
setTimeout(() => { setTimeout(() => {
this.showAni(); this.showAni();
}, 2000); }, 1500);
}).start();
} else {
setTimeout(() => {
this.showAni();
}, 100);
}
} }
update(dt) { update(dt) {
......
export default [ export default [
{ "id": "1", "yellow_x": "-480", "yellow_y": "70", "blue_x": "-345", "blue_y": "70", "type": "0", "value": "0" }, { "id": "2", "yellow_x": "-480", "yellow_y": "290", "blue_x": "-345", "blue_y": "135", "type": "1", "value": "blackboard" }, { "id": "3", "yellow_x": "-270", "yellow_y": "290", "blue_x": "-270", "blue_y": "135", "type": "1", "value": "window" }, { "id": "4", "yellow_x": "-130", "yellow_y": "290", "blue_x": "-130", "blue_y": "135", "type": "1", "value": "door" }, { "id": "5", "yellow_x": "-10", "yellow_y": "290", "blue_x": "-10", "blue_y": "135", "type": "2", "value": "2" }, { "id": "6", "yellow_x": "150", "yellow_y": "290", "blue_x": "150", "blue_y": "135", "type": "1", "value": "window" }, { "id": "7", "yellow_x": "300", "yellow_y": "290", "blue_x": "300", "blue_y": "135", "type": "5", "value": "14" }, { "id": "8", "yellow_x": "500", "yellow_y": "290", "blue_x": "370", "blue_y": "135", "type": "1", "value": "door" }, { "id": "9", "yellow_x": "500", "yellow_y": "70", "blue_x": "370", "blue_y": "70", "type": "3", "value": "1" }, { "id": "10", "yellow_x": "500", "yellow_y": "-70", "blue_x": "370", "blue_y": "-70", "type": "1", "value": "door" }, { "id": "11", "yellow_x": "500", "yellow_y": "-280", "blue_x": "370", "blue_y": "-125", "type": "1", "value": "blackboard" }, { "id": "12", "yellow_x": "290", "yellow_y": "-280", "blue_x": "290", "blue_y": "-125", "type": "1", "value": "window" }, { "id": "13", "yellow_x": "150", "yellow_y": "-280", "blue_x": "150", "blue_y": "-125", "type": "2", "value": "3" }, { "id": "14", "yellow_x": "10", "yellow_y": "-280", "blue_x": "10", "blue_y": "-125", "type": "1", "value": "blackboard" }, { "id": "15", "yellow_x": "-130", "yellow_y": "-280", "blue_x": "-130", "blue_y": "-125", "type": "2", "value": "1" }, { "id": "16", "yellow_x": "-270", "yellow_y": "-280", "blue_x": "-270", "blue_y": "-125", "type": "1", "value": "window" }, { "id": "17", "yellow_x": "-410", "yellow_y": "-280", "blue_x": "-410", "blue_y": "-125", "type": "4", "value": "5" }, { "id": "18", "yellow_x": "-550", "yellow_y": "-280", "blue_x": "-550", "blue_y": "-125", "type": "1", "value": "door" }, { "id": "19", "yellow_x": "-775", "yellow_y": "-280", "blue_x": "-600", "blue_y": "-125", "type": "1", "value": "blackboard" }, { "id": "20", "yellow_x": "-775", "yellow_y": "-55", "blue_x": "-600", "blue_y": "-55", "type": "1", "value": "window" }, { "id": "21", "yellow_x": "-775", "yellow_y": "80", "blue_x": "-600", "blue_y": "80", "type": "4", "value": "5" }, { "id": "22", "yellow_x": "-775", "yellow_y": "220", "blue_x": "-600", "blue_y": "220", "type": "2", "value": "3" }, { "id": "23", "yellow_x": "-775", "yellow_y": "365", "blue_x": "-600", "blue_y": "365", "type": "1", "value": "door" }, { "id": "24", "yellow_x": "-775", "yellow_y": "550", "blue_x": "-600", "blue_y": "420", "type": "2", "value": "5" }, { "id": "25", "yellow_x": "-550", "yellow_y": "550", "blue_x": "-550", "blue_y": "420", "type": "1", "value": "window" }, { "id": "26", "yellow_x": "-410", "yellow_y": "550", "blue_x": "-410", "blue_y": "420", "type": "4", "value": "5" }, { "id": "27", "yellow_x": "-270", "yellow_y": "550", "blue_x": "-270", "blue_y": "420", "type": "2", "value": "2" }, { "id": "28", "yellow_x": "-130", "yellow_y": "550", "blue_x": "-130", "blue_y": "420", "type": "1", "value": "door" }, { "id": "29", "yellow_x": "10", "yellow_y": "550", "blue_x": "10", "blue_y": "420", "type": "1", "value": "blackboard" }, { "id": "30", "yellow_x": "150", "yellow_y": "550", "blue_x": "150", "blue_y": "420", "type": "3", "value": "1" }, { "id": "31", "yellow_x": "290", "yellow_y": "550", "blue_x": "290", "blue_y": "420", "type": "1", "value": "window" }, { "id": "32", "yellow_x": "430", "yellow_y": "550", "blue_x": "430", "blue_y": "420", "type": "2", "value": "1" }, { "id": "33", "yellow_x": "570", "yellow_y": "550", "blue_x": "570", "blue_y": "420", "type": "4", "value": "5" }, { "id": "34", "yellow_x": "790", "yellow_y": "550", "blue_x": "630", "blue_y": "420", "type": "1", "value": "blackboard" }, { "id": "35", "yellow_x": "790", "yellow_y": "360", "blue_x": "630", "blue_y": "360", "type": "1", "value": "door" }, { "id": "36", "yellow_x": "790", "yellow_y": "215", "blue_x": "630", "blue_y": "215", "type": "2", "value": "3" }, { "id": "37", "yellow_x": "790", "yellow_y": "70", "blue_x": "630", "blue_y": "70", "type": "5", "value": "43" }, { "id": "38", "yellow_x": "790", "yellow_y": "-75", "blue_x": "630", "blue_y": "-75", "type": "3", "value": "1" }, { "id": "39", "yellow_x": "790", "yellow_y": "-220", "blue_x": "630", "blue_y": "-220", "type": "1", "value": "window" }, { "id": "40", "yellow_x": "790", "yellow_y": "-365", "blue_x": "630", "blue_y": "-365", "type": "2", "value": "1" }, { "id": "41", "yellow_x": "790", "yellow_y": "-550", "blue_x": "630", "blue_y": "-405", "type": "1", "value": "blackboard" }, { "id": "42", "yellow_x": "570", "yellow_y": "-550", "blue_x": "570", "blue_y": "-405", "type": "1", "value": "window" }, { "id": "43", "yellow_x": "430", "yellow_y": "-550", "blue_x": "430", "blue_y": "-405", "type": "2", "value": "2" }, { "id": "44", "yellow_x": "290", "yellow_y": "-550", "blue_x": "290", "blue_y": "-405", "type": "1", "value": "door" }, { "id": "45", "yellow_x": "150", "yellow_y": "-550", "blue_x": "150", "blue_y": "-405", "type": "4", "value": "5" }, { "id": "46", "yellow_x": "10", "yellow_y": "-550", "blue_x": "10", "blue_y": "-405", "type": "1", "value": "blackboard" }, { "id": "47", "yellow_x": "-130", "yellow_y": "-550", "blue_x": "-130", "blue_y": "-405", "type": "1", "value": "window" }, { "id": "48", "yellow_x": "-270", "yellow_y": "-550", "blue_x": "-270", "blue_y": "-405", "type": "1", "value": "door" }, { "id": "49", "yellow_x": "-410", "yellow_y": "-550", "blue_x": "-410", "blue_y": "-405", "type": "2", "value": "2" }, { "id": "50", "yellow_x": "-550", "yellow_y": "-550", "blue_x": "-550", "blue_y": "-405", "type": "1", "value": "blackboard" }, { "id": "1", "yellow_x": "-480", "yellow_y": "70", "blue_x": "-345", "blue_y": "70", "type": "0", "value": "0" }, { "id": "2", "yellow_x": "-480", "yellow_y": "290", "blue_x": "-345", "blue_y": "135", "type": "1", "value": "blackboard" }, { "id": "3", "yellow_x": "-270", "yellow_y": "290", "blue_x": "-270", "blue_y": "135", "type": "1", "value": "window" }, { "id": "4", "yellow_x": "-130", "yellow_y": "290", "blue_x": "-130", "blue_y": "135", "type": "1", "value": "door" }, { "id": "5", "yellow_x": "-10", "yellow_y": "290", "blue_x": "-10", "blue_y": "135", "type": "2", "value": "2" }, { "id": "6", "yellow_x": "150", "yellow_y": "290", "blue_x": "150", "blue_y": "135", "type": "1", "value": "window" }, { "id": "7", "yellow_x": "300", "yellow_y": "290", "blue_x": "300", "blue_y": "135", "type": "5", "value": "14" }, { "id": "8", "yellow_x": "500", "yellow_y": "290", "blue_x": "370", "blue_y": "135", "type": "1", "value": "door" }, { "id": "9", "yellow_x": "500", "yellow_y": "70", "blue_x": "370", "blue_y": "70", "type": "3", "value": "1" }, { "id": "10", "yellow_x": "500", "yellow_y": "-70", "blue_x": "370", "blue_y": "-70", "type": "1", "value": "door" }, { "id": "11", "yellow_x": "500", "yellow_y": "-280", "blue_x": "370", "blue_y": "-125", "type": "1", "value": "blackboard" }, { "id": "12", "yellow_x": "290", "yellow_y": "-280", "blue_x": "290", "blue_y": "-125", "type": "1", "value": "window" }, { "id": "13", "yellow_x": "150", "yellow_y": "-280", "blue_x": "150", "blue_y": "-125", "type": "2", "value": "3" }, { "id": "14", "yellow_x": "10", "yellow_y": "-280", "blue_x": "10", "blue_y": "-125", "type": "1", "value": "blackboard" }, { "id": "15", "yellow_x": "-130", "yellow_y": "-280", "blue_x": "-130", "blue_y": "-125", "type": "2", "value": "1" }, { "id": "16", "yellow_x": "-270", "yellow_y": "-280", "blue_x": "-270", "blue_y": "-125", "type": "1", "value": "window" }, { "id": "17", "yellow_x": "-410", "yellow_y": "-280", "blue_x": "-410", "blue_y": "-125", "type": "4", "value": "5" }, { "id": "18", "yellow_x": "-550", "yellow_y": "-280", "blue_x": "-550", "blue_y": "-125", "type": "1", "value": "door" }, { "id": "19", "yellow_x": "-775", "yellow_y": "-280", "blue_x": "-600", "blue_y": "-125", "type": "1", "value": "blackboard" }, { "id": "20", "yellow_x": "-775", "yellow_y": "-55", "blue_x": "-600", "blue_y": "-55", "type": "1", "value": "window" }, { "id": "21", "yellow_x": "-775", "yellow_y": "80", "blue_x": "-600", "blue_y": "80", "type": "4", "value": "5" }, { "id": "22", "yellow_x": "-775", "yellow_y": "220", "blue_x": "-600", "blue_y": "220", "type": "2", "value": "3" }, { "id": "23", "yellow_x": "-775", "yellow_y": "365", "blue_x": "-600", "blue_y": "365", "type": "1", "value": "door" }, { "id": "24", "yellow_x": "-775", "yellow_y": "550", "blue_x": "-600", "blue_y": "420", "type": "2", "value": "5" }, { "id": "25", "yellow_x": "-550", "yellow_y": "550", "blue_x": "-550", "blue_y": "420", "type": "1", "value": "window" }, { "id": "26", "yellow_x": "-410", "yellow_y": "550", "blue_x": "-410", "blue_y": "420", "type": "4", "value": "5" }, { "id": "27", "yellow_x": "-270", "yellow_y": "550", "blue_x": "-270", "blue_y": "420", "type": "2", "value": "2" }, { "id": "28", "yellow_x": "-130", "yellow_y": "550", "blue_x": "-130", "blue_y": "420", "type": "1", "value": "door" }, { "id": "29", "yellow_x": "10", "yellow_y": "550", "blue_x": "10", "blue_y": "420", "type": "1", "value": "blackboard" }, { "id": "30", "yellow_x": "150", "yellow_y": "550", "blue_x": "150", "blue_y": "420", "type": "3", "value": "1" }, { "id": "31", "yellow_x": "290", "yellow_y": "550", "blue_x": "290", "blue_y": "420", "type": "1", "value": "window" }, { "id": "32", "yellow_x": "430", "yellow_y": "550", "blue_x": "430", "blue_y": "420", "type": "2", "value": "1" }, { "id": "33", "yellow_x": "570", "yellow_y": "550", "blue_x": "570", "blue_y": "420", "type": "4", "value": "5" }, { "id": "34", "yellow_x": "790", "yellow_y": "550", "blue_x": "630", "blue_y": "420", "type": "1", "value": "blackboard" }, { "id": "35", "yellow_x": "790", "yellow_y": "360", "blue_x": "630", "blue_y": "360", "type": "1", "value": "door" }, { "id": "36", "yellow_x": "790", "yellow_y": "215", "blue_x": "630", "blue_y": "215", "type": "2", "value": "3" }, { "id": "37", "yellow_x": "790", "yellow_y": "70", "blue_x": "630", "blue_y": "70", "type": "5", "value": "43" }, { "id": "38", "yellow_x": "790", "yellow_y": "-75", "blue_x": "630", "blue_y": "-75", "type": "3", "value": "1" }, { "id": "39", "yellow_x": "790", "yellow_y": "-220", "blue_x": "630", "blue_y": "-220", "type": "1", "value": "window" }, { "id": "40", "yellow_x": "790", "yellow_y": "-365", "blue_x": "630", "blue_y": "-365", "type": "2", "value": "1" }, { "id": "41", "yellow_x": "790", "yellow_y": "-550", "blue_x": "630", "blue_y": "-405", "type": "1", "value": "blackboard" }, { "id": "42", "yellow_x": "570", "yellow_y": "-550", "blue_x": "570", "blue_y": "-405", "type": "1", "value": "window" }, { "id": "43", "yellow_x": "430", "yellow_y": "-550", "blue_x": "430", "blue_y": "-405", "type": "2", "value": "2" }, { "id": "44", "yellow_x": "290", "yellow_y": "-550", "blue_x": "290", "blue_y": "-405", "type": "1", "value": "door" }, { "id": "45", "yellow_x": "150", "yellow_y": "-550", "blue_x": "150", "blue_y": "-405", "type": "4", "value": "5" }, { "id": "46", "yellow_x": "10", "yellow_y": "-550", "blue_x": "10", "blue_y": "-405", "type": "1", "value": "blackboard" }, { "id": "47", "yellow_x": "-130", "yellow_y": "-550", "blue_x": "-130", "blue_y": "-405", "type": "1", "value": "window" }, { "id": "48", "yellow_x": "-270", "yellow_y": "-550", "blue_x": "-270", "blue_y": "-405", "type": "1", "value": "door" }, { "id": "49", "yellow_x": "-410", "yellow_y": "-550", "blue_x": "-410", "blue_y": "-405", "type": "2", "value": "2" }, { "id": "50", "yellow_x": "-550", "yellow_y": "-550", "blue_x": "-550", "blue_y": "-405", "type": "1", "value": "blackboard" },
{ "id": "51", "yellow_x": "-690", "yellow_y": "-490", "blue_x": "-690", "blue_y": "-490", "type": "100", "value": "0" }] { "id": "51", "yellow_x": "-690", "yellow_y": "-490", "blue_x": "-690", "blue_y": "-490", "type": "100", "value": "0" }
\ No newline at end of file ]
\ No newline at end of file
...@@ -14,7 +14,8 @@ class Emitter { ...@@ -14,7 +14,8 @@ class Emitter {
return this; return this;
} }
on(event, fn) { on(event, fn) {
(this._callbacks[event] = this._callbacks[event] || []).push(fn); if (!this._callbacks[event]) this._callbacks[event] = [];
this._callbacks[event].push(fn);
}; };
once(event, fn) { once(event, fn) {
function on() { function on() {
...@@ -208,7 +209,7 @@ let pg = { ...@@ -208,7 +209,7 @@ let pg = {
if (!item) return pg.logger.w("图片更换失败,传入了错误的item"); if (!item) return pg.logger.w("图片更换失败,传入了错误的item");
let node = item.node ? item.node : item; let node = item.node ? item.node : item;
if (!res) { if (!res) {
node.active = false; if (node) node.active = false;
return pg.logger.w("图片更换失败,传入了错误的res"); return pg.logger.w("图片更换失败,传入了错误的res");
} }
if (!node) return pg.logger.w("图片更换失败,传入了错误的item"); if (!node) return pg.logger.w("图片更换失败,传入了错误的item");
......
...@@ -31,7 +31,7 @@ export default class NewClass extends cc.Component { ...@@ -31,7 +31,7 @@ export default class NewClass extends cc.Component {
pg.view.visible(icon_player_dice, true); pg.view.visible(icon_player_dice, true);
for (let i = 1; i <= 6; i++) { for (let i = 1; i <= 6; i++) {
let item = pg.view.find(icon_player_dice, "icon_" + i); let item = pg.view.find(icon_player_dice, "icon_" + i);
item.active = i == num; pg.view.visible(item, i == num);
} }
} else { } else {
let icon_player = pg.view.find(this.player, "icon_player"); let icon_player = pg.view.find(this.player, "icon_player");
...@@ -48,7 +48,7 @@ export default class NewClass extends cc.Component { ...@@ -48,7 +48,7 @@ export default class NewClass extends cc.Component {
pg.view.visible(icon_robot_dice, true); pg.view.visible(icon_robot_dice, true);
for (let i = 1; i <= 6; i++) { for (let i = 1; i <= 6; i++) {
let item = pg.view.find(icon_robot_dice, "icon_" + i); let item = pg.view.find(icon_robot_dice, "icon_" + i);
item.active = i == num; pg.view.visible(item, i == num);
} }
} else { } else {
let icon_robot = pg.view.find(this.robot, "icon_robot"); let icon_robot = pg.view.find(this.robot, "icon_robot");
......
...@@ -33,18 +33,19 @@ export default class NewClass extends cc.Component { ...@@ -33,18 +33,19 @@ export default class NewClass extends cc.Component {
this.bg_goodjob = pg.view.find(this, "bg_goodjob"); this.bg_goodjob = pg.view.find(this, "bg_goodjob");
this.bg_tryagain = pg.view.find(this, "bg_tryagain"); this.bg_tryagain = pg.view.find(this, "bg_tryagain");
this.text_tip.active = false; pg.view.visible(this.text_tip, false);
this.btn_audio_start.active = false; pg.view.visible(this.btn_audio_start, false);
this.btn_audio_stop.active = false; pg.view.visible(this.btn_audio_stop, false);
this.speak_ske.active = false; pg.view.visible(this.speak_ske, false);
this.bg_goodjob.active = false; pg.view.visible(this.bg_goodjob, false);
this.bg_tryagain.active = false; pg.view.visible(this.bg_tryagain, false);
pg.view.touchOn(this.btn_audio_start, this.onTouchStart, this); pg.view.touchOn(this.btn_audio_start, this.onTouchStart, this);
pg.view.touchOn(this.btn_audio_stop, this.onTouchStop, this); pg.view.touchOn(this.btn_audio_stop, this.onTouchStop, this);
this.tryCount = 0; this.tryCount = 0;
pg.event.on("speak_open", (data) => { pg.event.on("speak_open", (data) => {
cc.log("speak_open");
this.tryCount = 0; this.tryCount = 0;
this.open(data) this.open(data)
}) })
...@@ -56,33 +57,33 @@ export default class NewClass extends cc.Component { ...@@ -56,33 +57,33 @@ export default class NewClass extends cc.Component {
if (cell) { if (cell) {
this.val = cell.value; this.val = cell.value;
} }
this.text_tip.active = true; pg.view.visible(this.text_tip, true);
this.btn_audio_start.active = true; pg.view.visible(this.btn_audio_start, true);
this.btn_audio_stop.active = false; pg.view.visible(this.btn_audio_stop, false);
this.speak_ske.active = true; pg.view.visible(this.speak_ske, true);
this.bg_goodjob.active = false; pg.view.visible(this.bg_goodjob, false);
this.bg_tryagain.active = false; pg.view.visible(this.bg_tryagain, false);
} }
close() { close() {
this.text_tip.active = false; pg.view.visible(this.text_tip, false);
this.btn_audio_start.active = false; pg.view.visible(this.btn_audio_start, false);
this.btn_audio_stop.active = false; pg.view.visible(this.btn_audio_stop, false);
this.speak_ske.active = false; pg.view.visible(this.speak_ske, false);
this.bg_goodjob.active = false; pg.view.visible(this.bg_goodjob, false);
this.bg_tryagain.active = false; pg.view.visible(this.bg_tryagain, false);
} }
onTouchStart() { onTouchStart() {
pg.view.playDBAnimation(this.speak_ske, "newAnimation", 0); pg.view.playDBAnimation(this.speak_ske, "newAnimation", 0);
this.btn_audio_start.active = false; pg.view.visible(this.btn_audio_start, false);
this.btn_audio_stop.active = true; pg.view.visible(this.btn_audio_stop, true);
let win: any = window; let win: any = window;
win.courseware && win.courseware.startTest(this.val); //开始录音 win.courseware && win.courseware.startTest(this.val); //开始录音
} }
onTouchStop() { onTouchStop() {
this.btn_audio_start.active = false; pg.view.visible(this.btn_audio_start, false);
this.btn_audio_stop.active = false; pg.view.visible(this.btn_audio_stop, false);
let win: any = window; let win: any = window;
if (!win.courseware) { if (!win.courseware) {
setTimeout(() => { setTimeout(() => {
...@@ -118,25 +119,25 @@ export default class NewClass extends cc.Component { ...@@ -118,25 +119,25 @@ export default class NewClass extends cc.Component {
} }
onRealStop(score) { onRealStop(score) {
pg.view.playDBAnimation(this.speak_ske, "newAnimation", 1); pg.view.playDBAnimation(this.speak_ske, "newAnimation", 1);
this.text_tip.active = false; pg.view.visible(this.text_tip, false);
this.btn_audio_start.active = false; pg.view.visible(this.btn_audio_start, false);
this.btn_audio_stop.active = false; pg.view.visible(this.btn_audio_stop, false);
this.speak_ske.active = false; pg.view.visible(this.speak_ske, false);
this.bg_goodjob.active = false; pg.view.visible(this.bg_goodjob, false);
this.bg_tryagain.active = false; pg.view.visible(this.bg_tryagain, false);
setTimeout(() => { setTimeout(() => {
// let score = Math.random() * 100 - 50; // let score = Math.random() * 100 - 50;
pg.hw.playLocalAudio("goodjob"); pg.hw.playLocalAudio("goodjob");
if (score > 50) { if (score > 50) {
this.bg_goodjob.active = true; pg.view.visible(this.bg_goodjob, true);
setTimeout(() => { setTimeout(() => {
this.close(); this.close();
pg.event.emit("speak_success"); pg.event.emit("speak_success");
}, 2000); }, 2000);
} else { } else {
if (this.tryCount >= 1) { if (this.tryCount >= 1) {
this.bg_tryagain.active = true; pg.view.visible(this.bg_tryagain, true);
pg.hw.playLocalAudio("tryagain"); pg.hw.playLocalAudio("tryagain");
this.tryCount++; this.tryCount++;
//需要处理提供两次机会。重置一次到open状态 //需要处理提供两次机会。重置一次到open状态
...@@ -146,7 +147,7 @@ export default class NewClass extends cc.Component { ...@@ -146,7 +147,7 @@ export default class NewClass extends cc.Component {
}, 2000); }, 2000);
} else { } else {
this.bg_tryagain.active = true; pg.view.visible(this.bg_tryagain, true);
pg.hw.playLocalAudio("tryagain"); pg.hw.playLocalAudio("tryagain");
this.tryCount++; this.tryCount++;
setTimeout(() => { setTimeout(() => {
......
...@@ -30,8 +30,8 @@ export default class NewClass extends cc.Component { ...@@ -30,8 +30,8 @@ export default class NewClass extends cc.Component {
let btn_start = pg.view.find(this, "btn_start"); let btn_start = pg.view.find(this, "btn_start");
let btn_restart = pg.view.find(this, "btn_restart"); let btn_restart = pg.view.find(this, "btn_restart");
let bg_vs = pg.view.find(this, "bg_vs"); let bg_vs = pg.view.find(this, "bg_vs");
panel_gray.active = true; pg.view.visible(panel_gray, true);
btn_start.active = true; pg.view.visible(btn_start, true);
} }
onTouchStart() { onTouchStart() {
pg.hw.playLocalAudio("vs"); pg.hw.playLocalAudio("vs");
...@@ -39,13 +39,13 @@ export default class NewClass extends cc.Component { ...@@ -39,13 +39,13 @@ export default class NewClass extends cc.Component {
let btn_start = pg.view.find(this, "btn_start"); let btn_start = pg.view.find(this, "btn_start");
let btn_restart = pg.view.find(this, "btn_restart"); let btn_restart = pg.view.find(this, "btn_restart");
let bg_vs = pg.view.find(this, "bg_vs"); let bg_vs = pg.view.find(this, "bg_vs");
panel_gray.active = true; pg.view.visible(panel_gray, true);
btn_start.active = false; pg.view.visible(btn_start, false);
bg_vs.active = true; pg.view.visible(bg_vs, true);
pg.event.emit("game_start"); pg.event.emit("game_start");
setTimeout(() => { setTimeout(() => {
bg_vs.active = false; pg.view.visible(bg_vs, false);
panel_gray.active = false; pg.view.visible(panel_gray, false);
}, 2000); }, 2000);
} }
onTouchRestart() { onTouchRestart() {
...@@ -54,14 +54,14 @@ export default class NewClass extends cc.Component { ...@@ -54,14 +54,14 @@ export default class NewClass extends cc.Component {
let btn_start = pg.view.find(this, "btn_start"); let btn_start = pg.view.find(this, "btn_start");
let btn_restart = pg.view.find(this, "btn_restart"); let btn_restart = pg.view.find(this, "btn_restart");
let bg_vs = pg.view.find(this, "bg_vs"); let bg_vs = pg.view.find(this, "bg_vs");
panel_gray.active = true; pg.view.visible(panel_gray, true);
btn_start.active = false; pg.view.visible(btn_start, false);
btn_restart.active = false; pg.view.visible(btn_restart, false);
bg_vs.active = true; pg.view.visible(bg_vs, true);
setTimeout(() => { setTimeout(() => {
bg_vs.active = false; pg.view.visible(bg_vs, false);
panel_gray.active = false; pg.view.visible(panel_gray, false);
btn_restart.active = false; pg.view.visible(btn_restart, false);
pg.event.emit("game_start"); pg.event.emit("game_start");
}, 2000); }, 2000);
} }
...@@ -69,8 +69,8 @@ export default class NewClass extends cc.Component { ...@@ -69,8 +69,8 @@ export default class NewClass extends cc.Component {
let panel_gray = pg.view.find(this, "panel_gray"); let panel_gray = pg.view.find(this, "panel_gray");
let btn_restart = pg.view.find(this, "btn_restart"); let btn_restart = pg.view.find(this, "btn_restart");
let bg_vs = pg.view.find(this, "bg_vs"); let bg_vs = pg.view.find(this, "bg_vs");
panel_gray.active = true; pg.view.visible(panel_gray, true);
btn_restart.active = true; pg.view.visible(btn_restart, true);
} }
update(dt) { } update(dt) { }
} }
...@@ -67,21 +67,22 @@ export default class NewClass extends cc.Component { ...@@ -67,21 +67,22 @@ export default class NewClass extends cc.Component {
if (!number) return; if (!number) return;
if (this.num) { if (this.num) {
for (let i = 1; i <= 6; i++) { for (let i = 1; i <= 6; i++) {
this[`bg_${i}`].active = false; pg.view.visible(this[`bg_${i}`], false)
} }
for (let i = 1; i <= 6; i++) { for (let i = 1; i <= 6; i++) {
this[`bg_dice${i}`].active = i == number; pg.view.visible(this[`bg_dice${i}`], i == number)
} }
} else { } else {
for (let i = 1; i <= 6; i++) { for (let i = 1; i <= 6; i++) {
this[`bg_${i}`].active = i == number; pg.view.visible(this[`bg_${i}`], i == number)
} }
for (let i = 1; i <= 6; i++) { for (let i = 1; i <= 6; i++) {
this[`bg_dice${i}`].active = false; pg.view.visible(this[`bg_dice${i}`], false)
} }
} }
} }
update(dt) { update(dt) {
if (!this.node || !this.node.active) return;
if (this.playing) { if (this.playing) {
let i = Math.floor(Math.random() * 6) + 1; let i = Math.floor(Math.random() * 6) + 1;
this.updatePoint(i); this.updatePoint(i);
......
...@@ -105,11 +105,11 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -105,11 +105,11 @@ export class MyCocosSceneComponent extends cc.Component {
}); });
} }
log (str) { log(str) {
const node = cc.find('middleLayer'); const node = cc.find('middleLayer');
if(node){ if (node) {
node.getComponent('middleLayer').log(str); node.getComponent('middleLayer').log(str);
}else{ } else {
cc.log(str); cc.log(str);
} }
} }
...@@ -164,7 +164,7 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -164,7 +164,7 @@ export class MyCocosSceneComponent extends cc.Component {
playAudioByUrl(audio_url, cb = null) { playAudioByUrl(audio_url, cb = null) {
if (audio_url) { if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => { cc.assetManager.loadRemote(audio_url, (err, audioClip: any) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8); const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) { if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => { cc.audioEngine.setFinishCallback(audioId, () => {
......
...@@ -102,7 +102,7 @@ export function getDistance (start, end){ ...@@ -102,7 +102,7 @@ export function getDistance (start, end){
export function playAudioByUrl(audio_url, cb=null) { export function playAudioByUrl(audio_url, cb=null) {
if (audio_url) { if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => { cc.assetManager.loadRemote(audio_url, (err, audioClip:any) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8); const audioId = cc.audioEngine.play(audioClip, false, 0.8);
if (cb) { if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => { cc.audioEngine.setFinishCallback(audioId, () => {
......
...@@ -52,7 +52,7 @@ function execCmd(cmd, params, path) { ...@@ -52,7 +52,7 @@ function execCmd(cmd, params, path) {
} }
let creatorBasePath = 'C:\\CocosDashboard_1.0.6\\resources\\.editors\\Creator\\2.4.5\\CocosCreator.exe'; let creatorBasePath = 'D:\\work\\CocosDashboard_1.0.9\\resources\\.editors\\Creator\\2.4.5\\CocosCreator.exe';
if (process.platform !== 'win32') { if (process.platform !== 'win32') {
creatorBasePath = "/Applications/CocosCreator/Creator/2.4.5/CocosCreator.app/Contents/MacOS/CocosCreator"; creatorBasePath = "/Applications/CocosCreator/Creator/2.4.5/CocosCreator.app/Contents/MacOS/CocosCreator";
} }
...@@ -128,10 +128,10 @@ async function buildWebBundle() { ...@@ -128,10 +128,10 @@ async function buildWebBundle() {
await buildCocos(args); await buildCocos(args);
} }
function createConfigFile (projectName, type) { function createConfigFile(projectName, type) {
let iosVersion = ""; let iosVersion = "";
let androidVersion = ""; let androidVersion = "";
if(!type){ if (!type) {
const androidPaths = fs.readdirSync(`dist/android/${projectName}`); const androidPaths = fs.readdirSync(`dist/android/${projectName}`);
const androidConfigFileName = androidPaths.find(path => path.indexOf('config') == 0); const androidConfigFileName = androidPaths.find(path => path.indexOf('config') == 0);
androidVersion = androidConfigFileName.split('.')[1]; androidVersion = androidConfigFileName.split('.')[1];
...@@ -139,11 +139,11 @@ function createConfigFile (projectName, type) { ...@@ -139,11 +139,11 @@ function createConfigFile (projectName, type) {
const iosConfigFileName = iosPaths.find(path => path.indexOf('config') == 0); const iosConfigFileName = iosPaths.find(path => path.indexOf('config') == 0);
iosVersion = iosConfigFileName.split('.')[1]; iosVersion = iosConfigFileName.split('.')[1];
} else { } else {
if(type=="android"){ if (type == "android") {
const androidPaths = fs.readdirSync(`dist/android/${projectName}`); const androidPaths = fs.readdirSync(`dist/android/${projectName}`);
const androidConfigFileName = androidPaths.find(path => path.indexOf('config') == 0); const androidConfigFileName = androidPaths.find(path => path.indexOf('config') == 0);
androidVersion = androidConfigFileName.split('.')[1]; androidVersion = androidConfigFileName.split('.')[1];
}else{ } else {
const iosPaths = fs.readdirSync(`dist/ios/${projectName}`); const iosPaths = fs.readdirSync(`dist/ios/${projectName}`);
const iosConfigFileName = iosPaths.find(path => path.indexOf('config') == 0); const iosConfigFileName = iosPaths.find(path => path.indexOf('config') == 0);
iosVersion = iosConfigFileName.split('.')[1]; iosVersion = iosConfigFileName.split('.')[1];
...@@ -164,7 +164,7 @@ function createConfigFile (projectName, type) { ...@@ -164,7 +164,7 @@ function createConfigFile (projectName, type) {
fs.writeFileSync('dist/config.json', JSON.stringify(config)); fs.writeFileSync('dist/config.json', JSON.stringify(config));
} }
function compressAll (projectName) { function compressAll(projectName) {
const tarStream = new compressing.zip.Stream(); const tarStream = new compressing.zip.Stream();
tarStream.addEntry('dist/play'); tarStream.addEntry('dist/play');
tarStream.addEntry('dist/form'); tarStream.addEntry('dist/form');
...@@ -176,7 +176,7 @@ function compressAll (projectName) { ...@@ -176,7 +176,7 @@ function compressAll (projectName) {
tarStream.pipe(destStream); tarStream.pipe(destStream);
} }
function build_check () { function build_check() {
const dirNames = process.cwd().split(/\/|\\/); const dirNames = process.cwd().split(/\/|\\/);
const projectName = dirNames[dirNames.length - 1]; const projectName = dirNames[dirNames.length - 1];
const path = 'assets' const path = 'assets'
...@@ -211,20 +211,20 @@ function build_check () { ...@@ -211,20 +211,20 @@ function build_check () {
return projectName; return projectName;
} }
function changeSettingToWebDesktop () { function changeSettingToWebDesktop() {
const path = 'assets' const path = 'assets'
const folderName = getFolderName(path); const folderName = getFolderName(path);
editFolderMeta(path, folderName, false); editFolderMeta(path, folderName, false);
} }
function changeSettingsToBundle () { function changeSettingsToBundle() {
const path = 'assets' const path = 'assets'
const folderName = getFolderName(path); const folderName = getFolderName(path);
editFolderMeta(path, folderName, true); editFolderMeta(path, folderName, true);
} }
function replaceUuids () { function replaceUuids() {
console.log('build_step_0 开始~!'); console.log('build_step_0 开始~!');
const path = 'assets' const path = 'assets'
...@@ -303,7 +303,7 @@ function replaceUuids () { ...@@ -303,7 +303,7 @@ function replaceUuids () {
console.log('build_step_0 完成~!'); console.log('build_step_0 完成~!');
} }
function replaceIndexHtml () { function replaceIndexHtml() {
const data = fs.readFileSync('index.html'); const data = fs.readFileSync('index.html');
fs.writeFileSync('dist/play/index.html', data); fs.writeFileSync('dist/play/index.html', data);
} }
......
{ {
"title": "play", "title": "play",
"packageName": "org.cocos2d.demo", "packageName": "org.cocos2d.demo",
"startScene": "0737ce42-24f0-45c6-8e1a-8bdab4f74ba3", "startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"excludeScenes": [], "excludeScenes": [],
"includeSDKBox": false, "includeSDKBox": false,
"orientation": { "orientation": {
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
}, },
"ios": { "ios": {
"REMOTE_SERVER_ROOT": "", "REMOTE_SERVER_ROOT": "",
"packageName": "org.cocos2d.demo" "packageName": "org.cocos2d.demo",
"ios_enable_jit": true
}, },
"mac": { "mac": {
"REMOTE_SERVER_ROOT": "", "REMOTE_SERVER_ROOT": "",
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
"width": 1280 "width": 1280
}, },
"android-instant": { "android-instant": {
"REMOTE_SERVER_ROOT": "", "REMOTE_SERVER_ROOT": "http://192.168.43.126:7456/preview-android-instant/",
"host": "", "host": "",
"packageName": "org.cocos2d.demo", "packageName": "org.cocos2d.demo",
"pathPattern": "", "pathPattern": "",
...@@ -50,5 +51,7 @@ ...@@ -50,5 +51,7 @@
"scheme": "https", "scheme": "https",
"skipRecord": false "skipRecord": false
}, },
"appBundle": false "appBundle": false,
"agreements": {},
"includeAnySDK": false
} }
{ {
"last-module-event-record-time": 1600677246969, "last-module-event-record-time": 1640571810103,
"migrate-history": [ "migrate-history": [
"cloud-function" "cloud-function"
] ]
......
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