Commit 6eb5ec8c authored by 范雪寒's avatar 范雪寒

feat:

parent 1155d1ba
No preview for this file type
......@@ -107,8 +107,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
"width": 2560,
"height": 1920
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -119,8 +119,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
640,
360,
1280,
960,
0,
0,
0,
......@@ -354,17 +354,21 @@
"__id__": 112
},
{
"__id__": 127
"__id__": 126
},
{
"__id__": 142
"__id__": 141
},
{
"__id__": 149
"__id__": 148
}
],
"_active": true,
"_components": [],
"_components": [
{
"__id__": 150
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
......@@ -4721,10 +4725,10 @@
"__id__": 121
},
{
"__id__": 123
"__id__": 122
},
{
"__id__": 125
"__id__": 124
}
],
"_active": true,
......@@ -5158,11 +5162,7 @@
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 122
}
],
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
......@@ -5211,38 +5211,6 @@
"groupIndex": 0,
"_id": "0bfyX/nTdPJIpfRKUryv4/"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 121
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "961b4c40-b93f-4af5-af66-e3683eb2b5b6"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "3eBvzgQ0pNBaDuTKh285uq"
},
{
"__type__": "cc.Node",
"_name": "faceBlue",
......@@ -5254,7 +5222,7 @@
"_active": true,
"_components": [
{
"__id__": 124
"__id__": 123
}
],
"_prefab": null,
......@@ -5310,7 +5278,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 123
"__id__": 122
},
"_enabled": true,
"_materials": [
......@@ -5348,7 +5316,7 @@
"_active": false,
"_components": [
{
"__id__": 126
"__id__": 125
}
],
"_prefab": null,
......@@ -5404,7 +5372,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 125
"__id__": 124
},
"_enabled": true,
"_materials": [
......@@ -5448,19 +5416,19 @@
},
"_children": [
{
"__id__": 128
"__id__": 127
},
{
"__id__": 134
"__id__": 133
},
{
"__id__": 136
"__id__": 135
},
{
"__id__": 138
"__id__": 137
},
{
"__id__": 140
"__id__": 139
}
],
"_active": true,
......@@ -5518,17 +5486,17 @@
"_name": "life_red",
"_objFlags": 0,
"_parent": {
"__id__": 127
"__id__": 126
},
"_children": [
{
"__id__": 129
"__id__": 128
}
],
"_active": true,
"_components": [
{
"__id__": 133
"__id__": 132
}
],
"_prefab": null,
......@@ -5584,17 +5552,17 @@
"_name": "mask",
"_objFlags": 0,
"_parent": {
"__id__": 128
"__id__": 127
},
"_children": [
{
"__id__": 130
"__id__": 129
}
],
"_active": true,
"_components": [
{
"__id__": 132
"__id__": 131
}
],
"_prefab": null,
......@@ -5650,13 +5618,13 @@
"_name": "prograssbar",
"_objFlags": 0,
"_parent": {
"__id__": 129
"__id__": 128
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 131
"__id__": 130
}
],
"_prefab": null,
......@@ -5712,7 +5680,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 130
"__id__": 129
},
"_enabled": true,
"_materials": [
......@@ -5744,7 +5712,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 129
"__id__": 128
},
"_enabled": true,
"_materials": [
......@@ -5764,7 +5732,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 128
"__id__": 127
},
"_enabled": true,
"_materials": [
......@@ -5796,13 +5764,13 @@
"_name": "dice_bg",
"_objFlags": 0,
"_parent": {
"__id__": 127
"__id__": 126
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 135
"__id__": 134
}
],
"_prefab": null,
......@@ -5858,7 +5826,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 134
"__id__": 133
},
"_enabled": true,
"_materials": [
......@@ -5890,13 +5858,13 @@
"_name": "faceFrame",
"_objFlags": 0,
"_parent": {
"__id__": 127
"__id__": 126
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 137
"__id__": 136
}
],
"_prefab": null,
......@@ -5952,7 +5920,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 136
"__id__": 135
},
"_enabled": true,
"_materials": [
......@@ -5984,13 +5952,13 @@
"_name": "faceRed",
"_objFlags": 0,
"_parent": {
"__id__": 127
"__id__": 126
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 139
"__id__": 138
}
],
"_prefab": null,
......@@ -6046,7 +6014,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 138
"__id__": 137
},
"_enabled": true,
"_materials": [
......@@ -6078,13 +6046,13 @@
"_name": "effect",
"_objFlags": 0,
"_parent": {
"__id__": 127
"__id__": 126
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 141
"__id__": 140
}
],
"_prefab": null,
......@@ -6140,7 +6108,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 140
"__id__": 139
},
"_enabled": true,
"_materials": [
......@@ -6184,13 +6152,13 @@
},
"_children": [
{
"__id__": 143
"__id__": 142
}
],
"_active": false,
"_components": [
{
"__id__": 148
"__id__": 147
}
],
"_prefab": null,
......@@ -6246,20 +6214,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 142
"__id__": 141
},
"_children": [
{
"__id__": 144
"__id__": 143
}
],
"_active": true,
"_components": [
{
"__id__": 146
"__id__": 145
},
{
"__id__": 147
"__id__": 146
}
],
"_prefab": null,
......@@ -6315,13 +6283,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 143
"__id__": 142
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 145
"__id__": 144
}
],
"_prefab": null,
......@@ -6377,7 +6345,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 144
"__id__": 143
},
"_enabled": true,
"_materials": [
......@@ -6410,7 +6378,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 143
"__id__": 142
},
"_enabled": true,
"_materials": [
......@@ -6442,7 +6410,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 143
"__id__": 142
},
"_enabled": true,
"alignMode": 0,
......@@ -6469,7 +6437,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 142
"__id__": 141
},
"_enabled": true,
"_normalMaterial": null,
......@@ -6542,7 +6510,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 143
"__id__": 142
},
"_id": "72uh6FFMhPZJXe9I3tJ4Qt"
},
......@@ -6557,7 +6525,7 @@
"_active": true,
"_components": [
{
"__id__": 150
"__id__": 149
}
],
"_prefab": null,
......@@ -6613,10 +6581,10 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 149
"__id__": 148
},
"_enabled": true,
"alignMode": 1,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
......@@ -6635,6 +6603,33 @@
"_originalHeight": 0,
"_id": "9fr0grwX5J57n69Cqpwnin"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 2560,
"_originalHeight": 1920,
"_id": "17YA8Nu1dLN6R6o3Ie/SyN"
},
{
"__type__": "cc.Node",
"_name": "endBg",
......@@ -6664,8 +6659,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
"width": 2560,
"height": 1920
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -6733,8 +6728,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
"width": 2560,
"height": 1920
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -7245,8 +7240,8 @@
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
"width": 2560,
"height": 1920
},
"_fitWidth": true,
"_fitHeight": true,
......
......@@ -18,11 +18,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadAudio() {
// TODO 根据自己的配置预加载音频资源
this._audioResList.push({ url: this.data.gameStartAudio });
this._audioResList.push({ url: this.data.gameLoadingAudio });
this._audioResList.push({ url: this.data.waitingWheel });
this._audioResList.push({ url: this.data.waitingPiece });
this._audioResList.push({ url: this.data.waitingTurn });
this._audioResList.push({ url: this.data.gameStartAudio });
this._audioResList.push({ url: this.data.gameLoadingAudio });
this._audioResList.push({ url: this.data.waitingWheel });
this._audioResList.push({ url: this.data.waitingPiece });
this._audioResList.push({ url: this.data.waitingTurn });
}
addPreloadAnima() {
......@@ -80,6 +80,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
const bg = cc.find('Canvas/bg');
bg.scale = Math.min(canvas.width / bg.width, canvas.height / bg.height);
const chessBoardBg = cc.find('Canvas/bg/chessBoard/bg');
const offsetX = chessBoardBg.width * chessBoardBg.scaleX / 2 + (canvas.width - chessBoardBg.width * chessBoardBg.scaleX) / 4;
const lifeblue = cc.find('Canvas/bg/Lifeblue');
lifeblue.x = -offsetX;
const lifered = cc.find('Canvas/bg/Lifered');
lifered.x = offsetX;
}
loadingLayer;
......@@ -327,6 +335,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
for (let i = startIdx + 1; i < board.children.length; i++) {
const targetNode = board.children[i];
const itemData = targetNode.getComponent('ItemData');
if (itemData.letter.toLowerCase() == this._status.letter.toLowerCase()) {
return targetNode;
}
......@@ -539,9 +548,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
console.log('SERVER_playerWin: ' + JSON.stringify(item.data));
const node = cc.find(`Canvas/bg/chessBoard/piece${this._status.current}`);
const playerMe = this.allPlayerList.find(player => player.uuid == this.playerId);
const rightBlock = this.getRightBlock();
const board = cc.find('Canvas/bg/chessBoard/boardItems');
const idx = board.children.length;
const rightBlock = board.children[idx - 1];
this.pieceFindRightBlock(rightBlock, idx);
if (playerMe.color == this._status.current) {
this.showWin();
......
......@@ -10,7 +10,7 @@ export default class SceneComponent extends cc.Component {
// 生命周期 onLoad
onLoad() {
this.initSize();
// this.initSize();
}
_designSize; // 设计分辨率
......
......@@ -112,15 +112,25 @@ export class GameServer {
}
} else if (data.type == 'right') {
this.gameStatus[data.color] = data.idx;
this.changeSide();
this.networkHelper.sendFrame({
type: 'SERVER_playerRight',
idx: data.idx,
uuid: data.uuid,
color: data.color
});
const letterList = this.getLetterList();
console.log('letterList = ' + JSON.stringify(letterList));
if (letterList.length > 0) {
this.changeSide();
this.networkHelper.sendFrame({
type: 'SERVER_playerRight',
idx: data.idx,
uuid: data.uuid,
color: data.color
});
} else {
this.networkHelper.sendFrame({
type: 'SERVER_playerWin',
color: this.gameStatus.current
});
}
} else if (data.type == 'wrong') {
this.gameStatus[data.color] = data.idx;
console.log('data = ' + JSON.stringify(data));
// this.gameStatus[data.color] = data.idx;
this.changeSide();
this.networkHelper.sendFrame({
type: 'SERVER_playerWrong',
......@@ -137,7 +147,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));
const startIdx = this.gameStatus[color];
console.log('startIdx = ' + startIdx);
const letterList = [];
for (let i = startIdx + 1; i < board.children.length; i++) {
......
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