Commit a65acba6 authored by 杨一航's avatar 杨一航

add

parent d839df51
{
"ver": "2.0.1",
"uuid": "27d2950b-be88-42a5-92ad-b052a8abe60d",
"downloadMode": 0,
"duration": 1.032,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "cd0f3fe8-0035-4260-a348-7258fa68d0da",
"downloadMode": 0,
"duration": 0.984,
"subMetas": {}
}
\ No newline at end of file
......@@ -27,6 +27,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Node)
pp = null
@property(cc.Node)
btn_record: cc.Node = null
@property(cc.Node)
cover = null
@property(cc.Node)
recordCat = null
......@@ -63,8 +65,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
private _catSpeaking: boolean;
private _audioNode: cc.Node;
private _canChosendCard: boolean = true;
_wordData: { monkey: string[]; tiger: string[]; pencil: string[]; music: string[]; honey: string[]; baby: string[]; };
_wordData: any;
private _otherWord: any;
private _isRecording: any;
onLoad() {
......@@ -108,7 +111,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
// 猫咪读条音频(匹配界面开始匹配前): audioUrl_loading
// 猫咪读条音频(匹配界面开始匹配前): audioUrl_loading
// 猫咪选牌提示音频: audioUrl_start
// 猫咪选牌超时自动选择音频: audioUrl_waiting_firstRound
// 开始猜词提示音频: audioUrl_filled
......@@ -119,6 +123,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 猫咪胜利结束音频(两轮游戏都结束): audioUrl_win
// 猫咪失败结束音频(两轮游戏都结束): audioUrl_lose
this._audioResList.push({ url: this.data.audioUrl_loading });
this._audioResList.push({ url: this.data.audioUrl_start });
this._audioResList.push({ url: this.data.audioUrl_waiting_firstRound });
......@@ -189,7 +195,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.inputNode.on("click", this._reqestWord, this);
this.pp.active = false;
this.pp.on("click", this.openCoursView, this);
this.btn_record.active = false;
this.btn_record.on("click", this.openCoursView, this);
this.initwordAnswerData();
}
......@@ -259,7 +267,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.networkHelper = new NetworkHelper();
this.initNetworkListener();
do {
this.playerId = await this.networkHelper.init("op_L5_R1_bingo", 2);
this.playerId = await this.networkHelper.init("op_L5_R3_guessing", 2);
if (this.playerId === null) {
this.log("onDestroy");
this.networkHelper.onDestroy();
......@@ -392,9 +400,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else {
this.unschedule(this.longTimeNoAction)
this.schedule(this.longTimeNoAction, 15, 6, 15);
this.schedule(this.longTimeNoAction, 15, 6, 15)
console.log("===============");
console.log(data.list);
data.list.forEach((val) => {
if (val.uuid != this.playerId) {
this._otherWord = val.word;
}
})
console.log("other word= " + this._otherWord);
console.log("===============");
}
}
else if (type == MsgType.USER_REQ_EV) {
......@@ -490,8 +506,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this._sendMsg(MsgType.USER_PREPARE_REQ, {});
this._keyboard.showOut();
this.inputNode.active = true;
this.pp.addComponent(cc.Button);
this.btn_record.active = true;
}
let cards = this.cardRoot.children;
......@@ -644,108 +659,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
}
_updateProgrss(redScore, blueScore, round) {
let realRedScore = (Math.floor(redScore / 100) + redScore % 100);
let realBlueScore = (Math.floor(blueScore / 100) + blueScore % 100);
if (round == 1) {
this._redLightList.children.forEach((node) => {
node.active = +node.name <= redScore % 100
})
this._blueLightList.children.forEach((node) => {
node.active = +node.name <= blueScore % 100
})
} else {
this._redLightList.children.forEach((node) => {
node.active = +node.name <= Math.floor(redScore / 100)
})
this._blueLightList.children.forEach((node) => {
node.active = +node.name <= Math.floor(blueScore / 100)
})
}
}
async _updateCards(list, delay?) {
for (let i = 0; i < list.length; ++i) {
let data = list[i];
let word = data.word;
let uuid = data.uuid;
let cardBg = this._wordCardRoot.children[i];
if (cardBg.getChildByName("word")) {
continue;
} else {
if (delay) {
await asyncDelay(0.2)
}
let wordNode = this.getSprNode(word)
wordNode.parent = cardBg;
wordNode.name = "word";
wordNode.x = 0;
wordNode.y = 0;
wordNode.zIndex = 10;
let side = this._getSideByUuid(uuid);
if (side == "Red") {
let coverBg = this.getSprNode("RedBox");
coverBg.parent = cardBg;
coverBg.name = "cover"
coverBg.x = 0;
coverBg.y = 0;
} else if (side == "Blue") {
let coverBg = this.getSprNode("BlueBox");
coverBg.parent = cardBg;
coverBg.name = "cover"
coverBg.x = 0;
coverBg.y = 0;
}
}
}
}
async _reInitCards() {
for (let i = 0; i < 16; ++i) {
let cardBg = this._wordCardRoot.children[i];
let cover = cardBg.getChildByName("cover");
cover && (cover.parent = null);
}
}
async _updateRound2Cards(list) {
list.forEach((val) => {
let index = val.index;
let uuid = val.uuid;
let cardBg = this._wordCardRoot.children[index];
if (cardBg.getChildByName("cover1")) {
} else {
let side = this._getSideByUuid(uuid);
if (side == "Red") {
let coverBg = this.getSprNode("RedBox");
coverBg.parent = cardBg;
coverBg.name = "cover1"
coverBg.zIndex = 5;
coverBg.x = 0;
coverBg.y = 0;
} else if (side == "Blue") {
let coverBg = this.getSprNode("BlueBox");
coverBg.parent = cardBg;
coverBg.name = "cover1";
coverBg.zIndex = 5
coverBg.x = 0;
coverBg.y = 0;
}
}
})
}
_getSideByUuid(uuid) {
let side = "";
this._playerList.forEach((player) => {
......@@ -837,13 +751,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
async openCoursView(node, word) {
if (this._isRecording) return;
this._isRecording = true
this.btn_record.getChildByName("lb").getComponent(cc.Label).string = "录音中。。。";
this.unschedule(this.longTimeNoAction)
this.schedule(this.longTimeNoAction, 15, 6, 15)
this.cover.active = true;
this.recordCat.active = false;
// this.cat.active = false;
this._clockNode.active = false;
// this._clockNode.active = false;
let probar = this.cover.getChildByName("bg").getChildByName("probar");
let pass = this.cover.getChildByName("bg").getChildByName("pass");
let loss = this.cover.getChildByName("bg").getChildByName("loss");
......@@ -899,7 +816,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// await asyncDelay(0.5);
if (!cc.sys.isBrowser && window["courseware"]?.startRecord) {
window["courseware"]?.startRecord((res, b) => {
window["courseware"]?.stopRecord((res, b) => {
if (typeof res == "string") {
res = JSON.parse(res);
......@@ -919,24 +836,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
async _coursewareEnd(text: string) {
this._isRecording = false;
this.btn_record.getChildByName("lb").getComponent(cc.Label).string = "点击向我提问";
this.cover.active = false;
let strs: Array<string> = this._wordData[this._otherWord];
if (strs.indexOf(text)) {
this.pp.getChildByName("lb").getComponent(cc.Label).string = "Yes";
console.log("匹配问题?")
console.log(strs)
if (strs.indexOf(text) > -1) {
this.playLocalAudio("right")
} else {
this.pp.getChildByName("lb").getComponent(cc.Label).string = "No";
this.playLocalAudio("wrong")
}
let tips = `点击气泡框按照下列方式问:
Is your word (正确单词)
Can you eat it?
It is (颜色)?
It is a/an animal/fruit?`;
asyncDelay(2).then(() => {
this.pp.getChildByName("lb").getComponent(cc.Label).string = tips;
})
}
initwordAnswerData() {
......
......@@ -176,7 +176,11 @@ export class GameServer {
} else {
clearInterval(this._timer)
this._senMsg({
type: MsgType.ROUND_END_EV,
data: { round: 2, uuid: "none", isWin: false, list: this._gameData.getAnswerList() }
})
}
......@@ -225,7 +229,13 @@ export class GameServer {
this._userPrepareCount = 0;
this._lastTime = Date.now();
this._shecduleTimer();
this._timer = setInterval(this._shecduleTimer.bind(this), 1000)
this._timer = setInterval(this._shecduleTimer.bind(this), 1000);
this._senMsg({
type: MsgType.ROUND_START_EV,
data: { round: this._gameData.Round, list: this._gameData.getAnswerList() }
});
}
}
......
......@@ -11,7 +11,7 @@
"height": 151,
"platformSettings": {},
"subMetas": {
"notes": {
"music": {
"ver": "1.0.4",
"uuid": "6334925f-7619-4254-a1d1-0889d833499f",
"rawTextureUuid": "e4d8a837-6c88-45fa-96b9-e4cebcc01c76",
......
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