Commit d3961078 authored by unknown's avatar unknown

数阵推理好了

parent 54ac77fd
{
"ver": "1.0.21",
"importer": "image",
"imported": true,
"uuid": "998dba9a-5916-4ce3-b3c4-5c96e38914cf",
"files": [
".png",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "998dba9a-5916-4ce3-b3c4-5c96e38914cf@6c48a",
"displayName": "对勾",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "998dba9a-5916-4ce3-b3c4-5c96e38914cf"
},
"ver": "1.0.21",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "998dba9a-5916-4ce3-b3c4-5c96e38914cf@f9941",
"displayName": "对勾",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 3.5,
"offsetY": -14,
"trimX": 8,
"trimY": 28,
"width": 93,
"height": 72,
"rawWidth": 102,
"rawHeight": 100,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"isUuid": true,
"imageUuidOrDatabaseUri": "998dba9a-5916-4ce3-b3c4-5c96e38914cf@6c48a",
"atlasUuid": ""
},
"ver": "1.0.9",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "998dba9a-5916-4ce3-b3c4-5c96e38914cf@f9941"
}
}
......@@ -24,19 +24,22 @@
},
{
"__id__": 12
},
{
"__id__": 18
}
],
"_active": true,
"_components": [
{
"__id__": 18
"__id__": 24
},
{
"__id__": 20
"__id__": 26
}
],
"_prefab": {
"__id__": 22
"__id__": 28
},
"_lpos": {
"__type__": "cc.Vec3",
......@@ -407,6 +410,136 @@
},
"fileId": "3e6UQRrQ9L8ItAXFoN39//"
},
{
"__type__": "cc.Node",
"_name": "对勾",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 19
},
{
"__id__": 21
}
],
"_prefab": {
"__id__": 23
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 26,
"y": -31.295,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.5,
"y": 0.5,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"__prefab": {
"__id__": 20
},
"_contentSize": {
"__type__": "cc.Size",
"width": 93,
"height": 72
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f7NISe7HdAD68SLfhnddy8"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"__prefab": {
"__id__": 22
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "998dba9a-5916-4ce3-b3c4-5c96e38914cf@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "e71ctEmpxFC4KlSYRZNz/a"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "b3axG7xP5JTZOX+nP0YoT6"
},
{
"__type__": "cc.UITransform",
"_name": "",
......@@ -416,7 +549,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 19
"__id__": 25
},
"_contentSize": {
"__type__": "cc.Size",
......@@ -443,7 +576,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 21
"__id__": 27
},
"clickNode": {
"__id__": 2
......@@ -454,6 +587,9 @@
"numLab": {
"__id__": 15
},
"tickSprNode": {
"__id__": 18
},
"_id": ""
},
{
......
......@@ -29,7 +29,7 @@
"_prefab": null,
"autoReleaseAssets": false,
"_globals": {
"__id__": 161
"__id__": 177
},
"_id": "94d615be-2f2a-47b1-a1a0-aa1f51c47468"
},
......@@ -216,21 +216,24 @@
},
{
"__id__": 75
},
{
"__id__": 154
}
],
"_active": true,
"_components": [
{
"__id__": 154
"__id__": 170
},
{
"__id__": 156
"__id__": 172
},
{
"__id__": 158
"__id__": 174
},
{
"__id__": 160
"__id__": 176
}
],
"_prefab": null,
......@@ -318,7 +321,7 @@
"_priority": 1073741824,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 411.7,
"_orthoHeight": 375.00000000000006,
"_near": 1,
"_far": 2000,
"_color": {
......@@ -2011,7 +2014,7 @@
"__id__": 133
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 152
......@@ -4079,17 +4082,427 @@
"checkEvents": [],
"_id": "a3Jz5lSStHLIKj4nBY6Ls4"
},
{
"__type__": "cc.Node",
"_name": "resetBtn",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [
{
"__id__": 155
},
{
"__id__": 160
}
],
"_active": true,
"_components": [
{
"__id__": 165
},
{
"__id__": 167
},
{
"__id__": 169
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 527.627,
"y": -215.945,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "b9lM0CyR9LvJSOEsfS06UU"
},
{
"__type__": "cc.Node",
"_name": "bgSpr",
"_objFlags": 0,
"_parent": {
"__id__": 154
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 156
},
{
"__id__": 158
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "00Zx11BVJLnYebPP1QPqZe"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
"__id__": 155
},
"_enabled": true,
"__prefab": {
"__id__": 157
},
"_contentSize": {
"__type__": "cc.Size",
"width": 120,
"height": 60
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "d7GMl4RxtLxLPLrEQHf1hn"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "55pCbtzR5GbojKMArZkfim"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 155
},
"_enabled": true,
"__prefab": {
"__id__": 159
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 120
},
"_spriteFrame": {
"__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "c8RHPwI6FCm4W+3zXcot9B"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "20UGQn4U9GUoln0NJQTkbG"
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 0,
"_parent": {
"__id__": 154
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 161
},
{
"__id__": 163
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "a2WB81BX9Pzos0xqklC/XL"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 160
},
"_enabled": true,
"__prefab": {
"__id__": 162
},
"_contentSize": {
"__type__": "cc.Size",
"width": 80,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "fbvrhJ+LhH0r7GnBH75gDc"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c68UOAlNhN171Umca6yVvF"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 160
},
"_enabled": true,
"__prefab": {
"__id__": 164
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "还原",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 40,
"_fontSize": 40,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": "6eEXxbJT9Pa4ZjeGYpIO/i"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2frm37uaJHQr0AEEaYyM82"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 154
},
"_enabled": true,
"__prefab": {
"__id__": 166
},
"_contentSize": {
"__type__": "cc.Size",
"width": 120,
"height": 60
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "a5fBoUcjNP3ZokJRkarVAF"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "55pCbtzR5GbojKMArZkfim"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 154
},
"_enabled": true,
"__prefab": null,
"clickEvents": [
{
"__id__": 168
}
],
"_interactable": true,
"_transition": 3,
"_normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_hoverColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_pressedColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_normalSprite": null,
"_hoverSprite": null,
"_pressedSprite": null,
"_disabledSprite": null,
"_duration": 0.1,
"_zoomScale": 0.85,
"_target": null,
"_id": "8bmpPFUKNHZI5+5Nv5bz+M"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 7
},
"component": "",
"_componentId": "a5e262EmSxF7qOHRkohlP7Q",
"handler": "onResetBtnClick",
"customEventData": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 154
},
"_enabled": true,
"__prefab": null,
"_alignFlags": 36,
"_target": null,
"_left": 0,
"_right": 79.37300000000005,
"_top": 0,
"_bottom": 129.055,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "02X5X72ZZA9LoTK5bjN2s8"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": {
"__id__": 171
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1334,
......@@ -4115,7 +4528,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 157
"__id__": 173
},
"_cameraComponent": {
"__id__": 9
......@@ -4136,7 +4549,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 159
"__id__": 175
},
"_alignFlags": 45,
"_target": null,
......@@ -4193,16 +4606,16 @@
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 162
"__id__": 178
},
"shadows": {
"__id__": 163
"__id__": 179
},
"_skybox": {
"__id__": 164
"__id__": 180
},
"fog": {
"__id__": 165
"__id__": 181
}
},
{
......
......@@ -9,6 +9,7 @@ import { BeginCountdownView } from '../../commonView/script/BeginCountdownView';
import { ChallengeFailView } from '../../commonView/script/ChallengeFailView';
import { ChallengeSuccView } from '../../commonView/script/ChallengeSuccView';
import { GameDescView } from '../../commonView/script/GameDescView';
import { SwitchOkView } from '../../commonView/script/SwitchOkView';
import { numMatReaCfg, NumMatReaLVItf } from './NumMatReasonCfg';
import { NumMatItem } from './NumMatReasonItem';
const { ccclass, property } = _decorator;
......@@ -94,7 +95,7 @@ export class NumMatReasonCtr extends Component {
//@ts-ignore
this.isShowGameDescViewOnce = false;
}
else{
else {
this.isShowGameDescViewOnce = true;
}
}
......@@ -130,13 +131,18 @@ export class NumMatReasonCtr extends Component {
}, VIEW_INDEX.UPPER);
}
gameEnd(isWin: boolean){
gameEnd(isWin: boolean) {
this.gameState = GAME_STATE.END;
if (isWin) {
viewMgr.openView(VIEW_DEF.ChallengeSuccView, (node) => {
AudioMgr.playEffect(succMus);
node?.getComponent(ChallengeSuccView)?.init();
}, VIEW_INDEX.TOP);
AudioMgr.playEffect(succMus);
viewMgr.openView(VIEW_DEF.SwitchOkView, (node) => {
node.getComponent(SwitchOkView)!.endCb = () => {
viewMgr.openView(VIEW_DEF.ChallengeSuccView, (node) => {
node?.getComponent(ChallengeSuccView)?.init();
}, VIEW_INDEX.TOP);
};
node.getComponent(SwitchOkView)?.init(1.5);
});
}
else {
viewMgr.openView(VIEW_DEF.ChallengeFailView, (node) => {
......@@ -171,13 +177,17 @@ export class NumMatReasonCtr extends Component {
}
onItemClick(item: NumMatItem) {
if (this.gameState == GAME_STATE.READY || this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) {
return;
}
if (item.getPosIfo().xIdx == this.column - 1 || item.getPosIfo().yIdx == this.row - 1) return;
if (this.gameState == GAME_STATE.SELECT) {
item.setBgColor(this.levelData.selColor);
item.setTextColor(this.levelData.selNumColor);
item.isSelected = true;
item.isSelected = !item.isSelected;
item.setBgColor(item.isSelected ? this.levelData.selColor : this.levelData.idleColor);
item.setTextColor(item.isSelected ? this.levelData.selNumColor : this.levelData.idleNumColor);
// item.isSelected = true;
}
else if(this.gameState == GAME_STATE.ERASE) {
else if (this.gameState == GAME_STATE.ERASE) {
item.setBgColor(this.levelData.idleColor);
item.setTextColor(this.levelData.idleNumColor);
item.isSelected = false;
......@@ -193,7 +203,7 @@ export class NumMatReasonCtr extends Component {
}
onEditClick(err: any, flag: string) {
if(this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) return;
if (this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) return;
switch (flag) {
case "select":
this.gameState = GAME_STATE.SELECT;
......@@ -216,6 +226,23 @@ export class NumMatReasonCtr extends Component {
}
}
onResetBtnClick() {
if (this.gameState == GAME_STATE.READY || this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) {
return;
}
for (let i = 0; i < this.itemPosIfoArr.length; ++i) {
if (this.itemPosIfoArr[i].xIdx < this.column - 1 && this.itemPosIfoArr[i].yIdx < this.row - 1) {
this.itemPosIfoArr[i].target.getComponent(NumMatItem)?.setTextColor(this.levelData.idleNumColor);
this.itemPosIfoArr[i].target.getComponent(NumMatItem)?.setBgColor(this.levelData.idleColor);
this.itemPosIfoArr[i].target.getComponent(NumMatItem)!.isSelected = false;
}
else {
this.itemPosIfoArr[i].target.getComponent(NumMatItem)?.setTextColor(this.levelData.wrongNumColor);
this.itemPosIfoArr[i].target.getComponent(NumMatItem)?.setBgColor(this.levelData.wrongColor);
}
}
}
update(deltaTime: number) {
// [4]
this.countdownTime(deltaTime);
......@@ -243,6 +270,7 @@ export class NumMatReasonCtr extends Component {
node.setPosition(this.itemPosIfoArr[i].pos);
node.getComponent(NumMatItem)?.setPosIfo(this.itemPosIfoArr[i]);
node.getComponent(NumMatItem)?.setText(tempNumArr[i].toString());
node.getComponent(NumMatItem)!.tickSprNode.active = false;
if (i == this.itemPosIfoArr.length - 1) {
node.active = false;
}
......@@ -322,7 +350,7 @@ export class NumMatReasonCtr extends Component {
//确定是不是已经成功了
checkIsWin() {
if(this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) return;
if (this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) return;
for (let r = 0; r < this.row - 1; ++r) {
let items = this.getRowItems(r);
let value = 0;
......@@ -344,7 +372,7 @@ export class NumMatReasonCtr extends Component {
//把已经正确的行列的颜色换过
updateItemColor() {
if(this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) return;
if (this.gameState == GAME_STATE.END || this.gameState == GAME_STATE.PAUSE) return;
for (let r = 0; r < this.row - 1; ++r) {
let items = this.getRowItems(r);
let value = 0;
......@@ -354,10 +382,12 @@ export class NumMatReasonCtr extends Component {
if (value != this.numArr[r][this.numArr[r].length - 1]) {
items[items.length - 1].setTextColor(this.levelData.wrongNumColor);
items[items.length - 1].setBgColor(this.levelData.wrongColor);
items[items.length - 1].tickSprNode.active = false;
}
else {
items[items.length - 1].setTextColor(this.levelData.rightNumColor);
items[items.length - 1].setBgColor(this.levelData.rightColor);
items[items.length - 1].tickSprNode.active = true;
}
}
for (let c = 0; c < this.column - 1; ++c) {
......@@ -369,10 +399,12 @@ export class NumMatReasonCtr extends Component {
if (value != this.numArr[this.numArr.length - 1][c]) {
items[items.length - 1].setTextColor(this.levelData.wrongNumColor);
items[items.length - 1].setBgColor(this.levelData.wrongColor);
items[items.length - 1].tickSprNode.active = false;
}
else {
items[items.length - 1].setTextColor(this.levelData.rightNumColor);
items[items.length - 1].setBgColor(this.levelData.rightColor);
items[items.length - 1].tickSprNode.active = true;
}
}
}
......
......@@ -22,6 +22,9 @@ export class NumMatItem extends Component {
@property(Label)
numLab: Label = null!;
@property(Node)
tickSprNode: Node = null!;
private posIfo: ItemPosIfo = null!;
private _isSelected = false;
......
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