Commit cb905f8c authored by Tt's avatar Tt

基础版本完成

parent 7c4e1c17
This diff is collapsed.
This diff is collapsed.
......@@ -21,15 +21,16 @@ export class AI {
if (event.type == "SERVER_updateStatus") {
this._status = JSON.parse(JSON.stringify(event.status));
} else if (event.type == "SERVER_playerRoll") {
//玩家需要转盘,待转完之后 进行后续动作
this._status.letter = event.letter;
if (this.playerData.color == this._status.current) {
// await asyncDelay(Math.random() * 3 + 12);
await asyncDelay(15);
//TODO:正常8 调试加速 减少AI等待时间
await asyncDelay(4);
}
} else if (event.type == "SERVER_playerRight") {
this._status.letter = "";
this._status[event.color] = event.idx;
this.changeSide();
} else if (event.type == "SERVER_playerWrong") {
this._status.letter = "";
......@@ -37,29 +38,23 @@ export class AI {
}
if (this.playerData.color == this._status.current) {
await asyncDelay(Math.random() * 3 + 4);
if (this._status.letter == "") {
//TODO:调试加速 2 Math.random() * 3 + 2
await asyncDelay(Math.random() * 3 + 2);
this.networkHelper.sendFrame({
type: "roll",
uuid: this.playerData.uuid,
});
} else {
//调试加速 2 Math.random() * 3 + 4
await asyncDelay(Math.random() * 3 + 4);
const idx = this.getNextRightIdx();
if (Math.random() < 0.9) {
this.networkHelper.sendFrame({
type: "right",
idx: idx,
uuid: this.playerData.uuid,
color: this.playerData.color,
});
} else {
this.networkHelper.sendFrame({
type: "wrong",
uuid: this.playerData.uuid,
color: this.playerData.color,
});
}
this.networkHelper.sendFrame({
type: "right",
idx: idx,
uuid: this.playerData.uuid,
color: this.playerData.color,
});
}
}
}
......
......@@ -113,7 +113,8 @@ export class GameServer {
this._aiPlayerList.push(new AI(this.networkHelper, playerInfo));
this.addPlayer(playerInfo);
}
}, RandomInt(10000, 15000))
//TODO:调试加速
}, 1000)//RandomInt(10000, 15000)
);
}
}
......@@ -127,7 +128,12 @@ export class GameServer {
console.log('letterList: ', letterList);
if (letterList.length > 0) {
if (this.gameStatus.letter == "") {
const letter = letterList[RandomInt(letterList.length)];
// let max = Math.max(letterList.length - 2, 0);
// let letter = letterList[max];//[RandomInt(letterList.length) % 3];//转盘只有1-3
// if (this.gameStatus.current != 'Blue') {
// letter = letterList[0]
// }
let letter = letterList[RandomInt(letterList.length) % 3];
this.gameStatus.letter = letter;
this.networkHelper.sendFrame({
type: "SERVER_playerRoll",
......@@ -164,7 +170,7 @@ export class GameServer {
this.gameStatus[data.color] = data.idx;
const jump = this.jumpList.find(jump => parseInt(jump.from) == parseInt(data.idx));
const letterList = this.getLetterList();
console.log("letterList = " + JSON.stringify(letterList));
// console.log("letterList = " + JSON.stringify(letterList));
if (letterList.length > 0) {
if (jump) {
this.gameStatus[data.color] = parseInt(jump.to);
......@@ -210,10 +216,10 @@ export class GameServer {
getLetterList() {
const board = cc.find("Canvas/bg/chessBoard/boardItems");
const color = this.gameStatus.current;
console.log("color = " + color);
console.log("this.gameStatus = " + JSON.stringify(this.gameStatus));
// console.log("color = " + color);
// console.log("this.gameStatus = " + JSON.stringify(this.gameStatus));
const startIdx = this.gameStatus[color];
console.log("startIdx = " + startIdx);
// console.log("startIdx = " + startIdx);
const letterList = [];
for (let i = startIdx + 1; i < board.children.length - 1; i++) {
......
assets/BoardGame2/textures/dice.png

111 KB | W: | H:

assets/BoardGame2/textures/dice.png

149 KB | W: | H:

assets/BoardGame2/textures/dice.png
assets/BoardGame2/textures/dice.png
assets/BoardGame2/textures/dice.png
assets/BoardGame2/textures/dice.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -7,8 +7,8 @@
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 483,
"height": 483,
"width": 450,
"height": 452,
"platformSettings": {},
"subMetas": {
"dice": {
......@@ -22,10 +22,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 457,
"height": 455,
"rawWidth": 457,
"rawHeight": 455,
"width": 450,
"height": 452,
"rawWidth": 450,
"rawHeight": 452,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "1.1.2",
"uuid": "3ed49fb7-ac97-4b54-9058-af3ec40bfac0",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0ae07756-57b0-4bc3-bcf8-d91a4253cfea",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1068,
"height": 416,
"platformSettings": {},
"subMetas": {
"bg_good-job": {
"ver": "1.0.4",
"uuid": "90c9d15b-f8e8-4faf-b9af-8a0b8fd47ae9",
"rawTextureUuid": "0ae07756-57b0-4bc3-bcf8-d91a4253cfea",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1068,
"height": 416,
"rawWidth": 1068,
"rawHeight": 416,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "108abd9f-2004-4f49-bf3a-ba602723b04c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 623,
"height": 617,
"platformSettings": {},
"subMetas": {
"bg_light": {
"ver": "1.0.4",
"uuid": "472f9171-b785-4580-83dd-aa8b1a16b910",
"rawTextureUuid": "108abd9f-2004-4f49-bf3a-ba602723b04c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0.5,
"trimX": 4,
"trimY": 0,
"width": 615,
"height": 616,
"rawWidth": 623,
"rawHeight": 617,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "dd02cfee-d5fc-40ac-998c-3b57972284f8",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 534,
"height": 208,
"platformSettings": {},
"subMetas": {
"bg_nice-try": {
"ver": "1.0.4",
"uuid": "4afa0360-f0c8-4621-b03e-380547a1544b",
"rawTextureUuid": "dd02cfee-d5fc-40ac-998c-3b57972284f8",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 534,
"height": 208,
"rawWidth": 534,
"rawHeight": 208,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "5dc663fd-973c-434c-a5b0-88a6191e4b35",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 813,
"height": 51,
"platformSettings": {},
"subMetas": {
"progress_0": {
"ver": "1.0.4",
"uuid": "7eba1162-3304-4a71-8cd9-203a4da25bef",
"rawTextureUuid": "5dc663fd-973c-434c-a5b0-88a6191e4b35",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 813,
"height": 51,
"rawWidth": 813,
"rawHeight": 51,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "66e25578-813b-43fa-a111-89148badfb16",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 813,
"height": 51,
"platformSettings": {},
"subMetas": {
"progress_1": {
"ver": "1.0.4",
"uuid": "e374f9a6-1bf3-42be-8356-98f1d58ad852",
"rawTextureUuid": "66e25578-813b-43fa-a111-89148badfb16",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 5,
"trimX": 12,
"trimY": 5,
"width": 789,
"height": 31,
"rawWidth": 813,
"rawHeight": 51,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 38,
"borderRight": 16,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "3e664f49-4d71-4a55-9a1c-68ca5f5f18ef",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 960,
"platformSettings": {},
"subMetas": {
"view_voice": {
"ver": "1.0.4",
"uuid": "b9852ca1-785e-4373-a4f6-e6af46976053",
"rawTextureUuid": "3e664f49-4d71-4a55-9a1c-68ca5f5f18ef",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1280,
"height": 960,
"rawWidth": 1280,
"rawHeight": 960,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "313a7446-e6fb-4d05-a1c6-ad2f36466432",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 440,
"height": 440,
"platformSettings": {},
"subMetas": {
"voice_bg": {
"ver": "1.0.4",
"uuid": "83b2a9f3-c0a8-41c0-8202-8ab7c35bfbe0",
"rawTextureUuid": "313a7446-e6fb-4d05-a1c6-ad2f36466432",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 440,
"height": 440,
"rawWidth": 440,
"rawHeight": 440,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ 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