├── project.json ├── assets ├── Res │ ├── Cell.jpg │ ├── Erase.jpg │ ├── Hint.jpg │ ├── Pause.png │ ├── Play.png │ ├── Undo.jpg │ ├── BoardBG.png │ ├── Pencil.jpg │ ├── HintNumber.png │ ├── Cell.jpg.meta │ ├── Undo.jpg.meta │ ├── Erase.jpg.meta │ ├── Hint.jpg.meta │ ├── Pause.png.meta │ ├── Pencil.jpg.meta │ ├── Play.png.meta │ ├── BoardBG.png.meta │ └── HintNumber.png.meta ├── resources │ ├── On.png │ ├── Off.png │ ├── On.png.meta │ └── Off.png.meta ├── Prefab.meta ├── Res.meta ├── Scene.meta ├── Script.meta ├── Script │ ├── Core.meta │ ├── Board.js.meta │ ├── Box.js.meta │ ├── Cell.js.meta │ ├── Game.js.meta │ ├── Number.js.meta │ ├── Result.js.meta │ ├── Core │ │ ├── Sudoku.js.meta │ │ ├── Utils.js.meta │ │ ├── Generator.js.meta │ │ ├── Generator.js │ │ ├── Sudoku.js │ │ └── Utils.js │ ├── Diffculty.js.meta │ ├── Function.js.meta │ ├── Box.js │ ├── Result.js │ ├── Function.js │ ├── Cell.js │ ├── Number.js │ ├── Diffculty.js │ ├── Game.js │ └── Board.js ├── resources.meta ├── Prefab │ ├── Cell.prefab.meta │ ├── PanelBox.prefab.meta │ └── Cell.prefab └── Scene │ └── Main.fire.meta ├── README.md ├── jsconfig.json ├── settings └── project.json └── .gitignore /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine": "cocos-creator-js", 3 | "packages": "packages" 4 | } -------------------------------------------------------------------------------- /assets/Res/Cell.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/Res/Cell.jpg -------------------------------------------------------------------------------- /assets/Res/Erase.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/Res/Erase.jpg -------------------------------------------------------------------------------- /assets/Res/Hint.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/Res/Hint.jpg -------------------------------------------------------------------------------- /assets/Res/Pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/Res/Pause.png -------------------------------------------------------------------------------- /assets/Res/Play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/Res/Play.png -------------------------------------------------------------------------------- /assets/Res/Undo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/Res/Undo.jpg -------------------------------------------------------------------------------- /assets/Res/BoardBG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/Res/BoardBG.png -------------------------------------------------------------------------------- /assets/Res/Pencil.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/Res/Pencil.jpg -------------------------------------------------------------------------------- /assets/resources/On.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/resources/On.png -------------------------------------------------------------------------------- /assets/Res/HintNumber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/Res/HintNumber.png -------------------------------------------------------------------------------- /assets/resources/Off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanielWuY/Sudoku/HEAD/assets/resources/Off.png -------------------------------------------------------------------------------- /assets/Prefab.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "4ae6ae5c-46c1-4c82-8713-dfc330b47bd1", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/Res.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "800826df-cf3b-4223-947b-b828167721af", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/Scene.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "6b2b1c51-1704-4e1f-85f0-7d46bc1983fc", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/Script.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "4b06b48e-4307-4a3d-8eee-58b95159fa7c", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/Script/Core.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "c4045e42-0b2f-4fd9-ba33-8a3dd296b44a", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/resources.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "7333314f-908b-43ce-ad26-b823bfc4ccd8", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/Prefab/Cell.prefab.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "23f39782-c7f2-4c5d-9944-13bc33ffa09f", 4 | "asyncLoadAssets": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Prefab/PanelBox.prefab.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "1a3e1943-f9a2-43b6-88db-17dac3076937", 4 | "asyncLoadAssets": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sudoku 2 | A Sudoku created by Cocos Creator. 3 | 4 | [![QQ20180429-201038.png](https://i.loli.net/2018/04/29/5ae5b790e3b9c.png)](https://i.loli.net/2018/04/29/5ae5b790e3b9c.png) 5 | -------------------------------------------------------------------------------- /assets/Scene/Main.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "a1cf7ba3-0b04-41a8-b71e-c19671d53feb", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Script/Board.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "001be9e3-8664-4143-a0d6-8ba82e77d6cb", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Box.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "717a8311-8b87-4530-a641-f19b48de42b9", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Cell.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "940ecf08-d500-4ef4-80f5-d3b240df58a5", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Game.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "2b688abb-c3e4-4e32-9696-b917df946399", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Number.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "25749b1a-f335-45eb-8e74-4723a6e90993", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Result.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "8174412f-829a-4843-8e1a-3b84d0fadb29", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Core/Sudoku.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "d17a5190-7a47-4cc4-8b8c-1289e15d338d", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Core/Utils.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "6c2c8579-7a9e-43c4-be8b-55e38689ab62", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Diffculty.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "4d59d931-ec79-4516-a309-11507b08cff7", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Function.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "ccaef3d6-46f6-4a8a-b2e3-d6b72a7fd37e", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Script/Core/Generator.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "c3aa60d7-2d45-4743-ae65-967a7c7ec55a", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "experimentalDecorators": true 6 | }, 7 | "exclude": [ 8 | "node_modules", 9 | ".vscode", 10 | "library", 11 | "local", 12 | "settings", 13 | "temp" 14 | ] 15 | } -------------------------------------------------------------------------------- /assets/Script/Box.js: -------------------------------------------------------------------------------- 1 | import { Cell } from './Cell'; 2 | 3 | const Box = cc.Class({ 4 | extends: cc.Component, 5 | 6 | properties: { 7 | cells: { 8 | type: [Cell], 9 | default: [], 10 | }, 11 | }, 12 | 13 | onLoad() { }, 14 | 15 | start() { }, 16 | 17 | getCell(cellIndex) { 18 | return this.cells[cellIndex].getComponent(Cell); 19 | } 20 | }); 21 | 22 | export { Box }; 23 | -------------------------------------------------------------------------------- /assets/Script/Result.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: {}, 5 | 6 | onLoad() { 7 | this.node.active = false; 8 | 9 | globalEvent.on('NEW', this._onNewGame, this); 10 | globalEvent.on('GAME_FINISH', this._onGameFinish, this); 11 | }, 12 | 13 | onDestroy() { 14 | globalEvent.off('NEW', this._onNewGame, this); 15 | globalEvent.off('GAME_FINISH', this._onGameFinish, this); 16 | }, 17 | 18 | start() { }, 19 | 20 | _onNewGame() { 21 | this.node.active = false; 22 | }, 23 | 24 | _onGameFinish() { 25 | this.node.active = true; 26 | } 27 | }); 28 | -------------------------------------------------------------------------------- /settings/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "cocos-analytics": { 3 | "appID": "13798", 4 | "appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2", 5 | "channel": "", 6 | "enable": false, 7 | "version": "" 8 | }, 9 | "collision-matrix": [ 10 | [ 11 | true 12 | ] 13 | ], 14 | "design-resolution-height": 1280, 15 | "design-resolution-width": 720, 16 | "excluded-modules": [], 17 | "fit-height": true, 18 | "fit-width": false, 19 | "group-list": [ 20 | "default" 21 | ], 22 | "simulator-orientation": true, 23 | "simulator-resolution": { 24 | "height": 750, 25 | "width": 1334 26 | }, 27 | "use-customize-simulator": false, 28 | "use-project-simulator-setting": false, 29 | "start-scene": "current" 30 | } -------------------------------------------------------------------------------- /assets/Res/Cell.jpg.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "ced59d7c-adfb-4eaf-9a09-9ac96f500151", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Cell": { 9 | "ver": "1.0.3", 10 | "uuid": "3cc56c33-1331-4149-8138-72b194b10157", 11 | "rawTextureUuid": "ced59d7c-adfb-4eaf-9a09-9ac96f500151", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 8, 20 | "height": 8, 21 | "rawWidth": 8, 22 | "rawHeight": 8, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Res/Undo.jpg.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "6e59cdcc-a6b8-47b8-aed5-a20b1394df33", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Undo": { 9 | "ver": "1.0.3", 10 | "uuid": "eb8d53d7-99a2-4392-820b-00baaad1415a", 11 | "rawTextureUuid": "6e59cdcc-a6b8-47b8-aed5-a20b1394df33", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 99, 20 | "height": 99, 21 | "rawWidth": 99, 22 | "rawHeight": 99, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Res/Erase.jpg.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "55c507b7-d6ce-43a4-9f1e-d88747947cfd", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Erase": { 9 | "ver": "1.0.3", 10 | "uuid": "b3251af2-2032-4207-856a-39e571658cb8", 11 | "rawTextureUuid": "55c507b7-d6ce-43a4-9f1e-d88747947cfd", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 99, 20 | "height": 100, 21 | "rawWidth": 99, 22 | "rawHeight": 100, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Res/Hint.jpg.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "a9841085-80a4-4372-bcf8-9af8825e7fb7", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Hint": { 9 | "ver": "1.0.3", 10 | "uuid": "c68820f8-aae3-4cd7-bedc-b3a627b92997", 11 | "rawTextureUuid": "a9841085-80a4-4372-bcf8-9af8825e7fb7", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 100, 20 | "height": 100, 21 | "rawWidth": 100, 22 | "rawHeight": 100, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Res/Pause.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "ac45fe89-9d2b-41e3-8ffc-9d718a91a2e8", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Pause": { 9 | "ver": "1.0.3", 10 | "uuid": "42d04afe-f607-4a9d-9476-c9f439c92fcd", 11 | "rawTextureUuid": "ac45fe89-9d2b-41e3-8ffc-9d718a91a2e8", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 99, 20 | "height": 100, 21 | "rawWidth": 99, 22 | "rawHeight": 100, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Res/Pencil.jpg.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "cb658345-6b75-4703-b00b-1ffbbb1f119d", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Pencil": { 9 | "ver": "1.0.3", 10 | "uuid": "11c08431-1ff4-4ba2-949f-a8e9fa9f8d4d", 11 | "rawTextureUuid": "cb658345-6b75-4703-b00b-1ffbbb1f119d", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 99, 20 | "height": 99, 21 | "rawWidth": 99, 22 | "rawHeight": 99, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Res/Play.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "1f204066-5705-4d0a-b20b-ed92bbdb65b1", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Play": { 9 | "ver": "1.0.3", 10 | "uuid": "63dbf4b4-1b19-4d99-9313-5ffccff67cb2", 11 | "rawTextureUuid": "1f204066-5705-4d0a-b20b-ed92bbdb65b1", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 100, 20 | "height": 99, 21 | "rawWidth": 100, 22 | "rawHeight": 99, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/resources/On.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "07c41288-53a8-41a4-ad6d-5104680c4ecf", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "On": { 9 | "ver": "1.0.3", 10 | "uuid": "91084777-0f64-4209-9802-15b3c54aa157", 11 | "rawTextureUuid": "07c41288-53a8-41a4-ad6d-5104680c4ecf", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 100, 20 | "height": 99, 21 | "rawWidth": 100, 22 | "rawHeight": 99, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Res/BoardBG.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "78a32aa2-6d6f-4a7b-83a6-096f38205d9c", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "BoardBG": { 9 | "ver": "1.0.3", 10 | "uuid": "463d5b68-8ddc-451f-b322-6412bd3ed04d", 11 | "rawTextureUuid": "78a32aa2-6d6f-4a7b-83a6-096f38205d9c", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 634, 20 | "height": 634, 21 | "rawWidth": 634, 22 | "rawHeight": 634, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/resources/Off.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "2f06b5be-1c6d-4962-a82d-a4027af406ce", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Off": { 9 | "ver": "1.0.3", 10 | "uuid": "cb7cb5e0-44c6-4bcd-ac1f-f96382bdf5a0", 11 | "rawTextureUuid": "2f06b5be-1c6d-4962-a82d-a4027af406ce", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 100, 20 | "height": 100, 21 | "rawWidth": 100, 22 | "rawHeight": 100, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Res/HintNumber.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "4634b13e-6660-4c4b-9913-3541e551feed", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "HintNumber": { 9 | "ver": "1.0.3", 10 | "uuid": "9bff2889-8060-4bf7-8ef2-a3e2bf1d979e", 11 | "rawTextureUuid": "4634b13e-6660-4c4b-9913-3541e551feed", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 60, 20 | "height": 60, 21 | "rawWidth": 60, 22 | "rawHeight": 60, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Script/Function.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: {}, 5 | 6 | onLoad() { }, 7 | 8 | onClickUndo(event, customEventData) { 9 | globalEvent.emit('UNDO'); 10 | }, 11 | 12 | onClickErase(event, customEventData) { 13 | globalEvent.emit('ERASE'); 14 | }, 15 | 16 | onClickMark() { 17 | globalEvent.emit('MARK'); 18 | }, 19 | 20 | onClickHint() { 21 | globalEvent.emit('HINT'); 22 | }, 23 | 24 | onClickNew() { 25 | globalEvent.emit('NEW'); 26 | }, 27 | 28 | onClickCancel() { 29 | globalEvent.emit('CANCEL'); 30 | }, 31 | 32 | onClickNewGameByDiff(event, customEventData) { 33 | globalEvent.emit('NEW_GAME_DIFF', customEventData); 34 | }, 35 | 36 | onClickPause() { 37 | globalEvent.emit('GAME_PAUSE'); 38 | }, 39 | 40 | onClickResume() { 41 | globalEvent.emit('GAME_RESUME'); 42 | } 43 | }); 44 | -------------------------------------------------------------------------------- /assets/Script/Cell.js: -------------------------------------------------------------------------------- 1 | const Cell = cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | labelNum: { 6 | type: cc.Label, 7 | default: null 8 | }, 9 | 10 | labelMarks: { 11 | type: [cc.Label], 12 | default: [] 13 | }, 14 | 15 | _boxIndex: null, 16 | _cellIndex: null 17 | }, 18 | 19 | onLoad() { 20 | this.clearMarks(); 21 | 22 | let clickEventHandler = new cc.Component.EventHandler(); 23 | clickEventHandler.target = this.node; 24 | clickEventHandler.component = "Cell"; 25 | clickEventHandler.handler = "onClickCell"; 26 | clickEventHandler.customEventData = { boxIndex: this._boxIndex, cellIndex: this._cellIndex }; 27 | 28 | let button = this.node.getComponent(cc.Button); 29 | button.clickEvents.push(clickEventHandler); 30 | }, 31 | 32 | start() { }, 33 | 34 | onClickCell(event, customEventData) { 35 | globalEvent.emit('CELL_SELECTED', customEventData); 36 | }, 37 | 38 | setIndex(boxIndex, cellIndex) { 39 | this._boxIndex = boxIndex; 40 | this._cellIndex = cellIndex; 41 | }, 42 | 43 | clearMarks() { 44 | for (let labelMark of this.labelMarks) { 45 | labelMark.node.active = false; 46 | } 47 | } 48 | }); 49 | 50 | export { Cell }; 51 | -------------------------------------------------------------------------------- /assets/Script/Number.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | number: { 6 | type: cc.Button, 7 | default: null 8 | }, 9 | 10 | _isMark: false 11 | }, 12 | 13 | onLoad() { 14 | let clickEventHandler = new cc.Component.EventHandler(); 15 | clickEventHandler.target = this.node; 16 | clickEventHandler.component = "Number"; 17 | clickEventHandler.handler = "onClickNumber"; 18 | clickEventHandler.customEventData = { 19 | 'number': (parseInt(this.node.name.substr(6)) || 0) + 1, 20 | }; 21 | 22 | let button = this.node.getComponent(cc.Button); 23 | button.clickEvents.push(clickEventHandler); 24 | 25 | this._isMark = false; 26 | this._setColor(); 27 | 28 | globalEvent.on('MARK', this._onMarked, this); 29 | }, 30 | 31 | onDestroy() { 32 | globalEvent.off('MARK', this._onMarked, this); 33 | }, 34 | 35 | start() { }, 36 | 37 | onClickNumber(event, customEventData) { 38 | globalEvent.emit('NUMBER_CLICKED', customEventData); 39 | }, 40 | 41 | _onMarked() { 42 | this._isMark = !this._isMark; 43 | this._setColor(); 44 | }, 45 | 46 | _setColor() { 47 | let label = this.number.node.getChildByName('Label'); 48 | if (this._isMark) { 49 | label.color = new cc.Color(187, 187, 187); 50 | } else { 51 | label.color = new cc.Color(3, 80, 165); 52 | } 53 | } 54 | }); 55 | -------------------------------------------------------------------------------- /assets/Script/Core/Generator.js: -------------------------------------------------------------------------------- 1 | import { Utils } from './Utils'; 2 | 3 | class Generator { 4 | constructor(){ 5 | this._retry_time = 0; 6 | } 7 | generate() { 8 | while (!this.internalGenerate()) { 9 | this._retry_time += 1; 10 | } 11 | console.log(`retry generate ${this._retry_time} times`); 12 | this._retry_time = 0; 13 | return this.matrix; 14 | } 15 | 16 | internalGenerate() { 17 | this.matrix = Utils.matrix.make(); 18 | this.orders = Utils.matrix.make().map(row => row.map((value, index) => index)).map(row => Utils.matrix.shuffle(row)) 19 | return Utils.matrix.makeRow().every((value, index) => this.fillNumber(index + 1)); 20 | } 21 | 22 | fillNumber(num) { 23 | return this.fillRow(num, 0); 24 | } 25 | 26 | fillRow(num, rowIndex) { 27 | if (rowIndex >= 9) { 28 | return true; 29 | } 30 | 31 | let row = this.matrix[rowIndex]; 32 | let order = this.orders[rowIndex]; 33 | for (let i = 0; i < order.length; i++) { 34 | let colIndex = order[i]; 35 | if (row[colIndex]) { 36 | continue; 37 | } 38 | 39 | if (!Utils.matrix.fillable(this.matrix, rowIndex, colIndex, num)) { 40 | continue; 41 | } 42 | 43 | row[colIndex] = num; 44 | 45 | if (!this.fillRow(num, rowIndex + 1)) { 46 | row[colIndex] = 0; 47 | return false; 48 | } 49 | 50 | return true; 51 | } 52 | return false; 53 | } 54 | } 55 | 56 | export { Generator }; 57 | -------------------------------------------------------------------------------- /assets/Script/Diffculty.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | panel: { 6 | type: cc.Layout, 7 | default: null 8 | }, 9 | mask: { 10 | type: cc.Layout, 11 | default: null 12 | } 13 | }, 14 | 15 | onLoad() { 16 | this.panel.node.y = -640; 17 | this.mask.node.active = false; 18 | 19 | globalEvent.on('NEW', this.onShow, this); 20 | globalEvent.on('CANCEL', this.onHide, this); 21 | globalEvent.on('NEW_GAME_DIFF', this.onHide, this); 22 | globalEvent.on('GAME_FINISH', this.onGameFinish, this); 23 | }, 24 | 25 | onDestroy() { 26 | globalEvent.off('NEW', this.onShow, this); 27 | globalEvent.off('CANCEL', this.onHide, this); 28 | globalEvent.off('NEW_GAME_DIFF', this.onHide, this); 29 | globalEvent.on('GAME_FINISH', this.onGameFinish, this); 30 | }, 31 | 32 | start() { }, 33 | 34 | onShow() { 35 | this.mask.node.active = true; 36 | let action = cc.moveTo(0.1, cc.p(0, 0)); 37 | this.panel.node.runAction(action); 38 | }, 39 | 40 | onHide() { 41 | this.panel.node.getChildByName('ButtonCancel').active = true; 42 | this.mask.node.active = false; 43 | let action = cc.moveTo(0.1, cc.p(0, -640)); 44 | this.panel.node.runAction(action); 45 | }, 46 | 47 | onGameFinish() { 48 | this.panel.node.getChildByName('ButtonCancel').active = false; 49 | } 50 | }); 51 | -------------------------------------------------------------------------------- /assets/Script/Game.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | usedTime: { 6 | type: cc.Label, 7 | default: null 8 | }, 9 | _usedTime: 0, 10 | _isPaused: false 11 | }, 12 | 13 | onLoad() { 14 | window.globalEvent = new cc.EventTarget(); 15 | globalEvent.on('GAME_START', this._onGameStart, this); 16 | globalEvent.on('GAME_PAUSE', this._onGamePause, this); 17 | globalEvent.on('GAME_RESUME', this._onGameResume, this); 18 | }, 19 | 20 | update(dt) { 21 | if (this._isPaused) { 22 | return; 23 | } 24 | 25 | this._usedTime += dt; 26 | this.usedTime.string = this._formatTimeString(); 27 | }, 28 | 29 | onDestroy() { 30 | globalEvent.off('GAME_START', this._onGameStart, this); 31 | globalEvent.off('GAME_PAUSE', this._onGamePause, this); 32 | globalEvent.off('GAME_RESUME', this._onGameResume, this); 33 | }, 34 | 35 | _onGameStart() { 36 | this._usedTime = 0; 37 | }, 38 | 39 | _onGamePause() { 40 | this._isPaused = true; 41 | }, 42 | 43 | _onGameResume() { 44 | this._isPaused = false; 45 | }, 46 | 47 | _formatTimeString() { 48 | let seconds = Math.ceil(this._usedTime); 49 | let hours = Math.floor(seconds / 3600); 50 | seconds %= 3600; 51 | let minutes = Math.floor(seconds / 60); 52 | seconds %= 60; 53 | 54 | if (hours < 10) { 55 | hours = '0' + hours; 56 | } 57 | if (minutes < 10) { 58 | minutes = '0' + minutes; 59 | } 60 | if (seconds < 10) { 61 | seconds = '0' + seconds; 62 | } 63 | 64 | return `${hours}:${minutes}:${seconds}`; 65 | }, 66 | }); 67 | -------------------------------------------------------------------------------- /assets/Script/Core/Sudoku.js: -------------------------------------------------------------------------------- 1 | import { Generator } from './Generator'; 2 | import { Utils } from './Utils'; 3 | 4 | const DIFFICULTY = { 5 | "easy": 62, 6 | "medium": 53, 7 | "hard": 44, 8 | "very-hard": 35, 9 | "insane": 26, 10 | "inhuman": 17, 11 | }; 12 | 13 | const HINT_NUM = { 14 | "easy": 1, 15 | "medium": 1, 16 | "hard": 2, 17 | "very-hard": 2, 18 | "insane": 3, 19 | "inhuman": 3, 20 | }; 21 | 22 | class Sudoku { 23 | constructor() { 24 | this.matrix = new Generator().generate(); 25 | } 26 | 27 | make(level = 'easy') { 28 | let keepCellIndexes = Utils.matrix.shuffle(Array.from({ length: 81 }, (value, index) => index)).slice(0, DIFFICULTY[level]); 29 | this.puzzleMatrix = this.matrix.map((row, rowIndex) => { 30 | return row.map((cell, colIndex) => { 31 | let index = rowIndex * 9 + colIndex; 32 | return keepCellIndexes.indexOf(index) !== -1 ? cell : 0; 33 | }) 34 | }) 35 | this.hintNum = HINT_NUM[level]; 36 | return this.puzzleMatrix; 37 | } 38 | 39 | check(boxIndex, cellIndex) { 40 | let { rowIndex, colIndex } = Utils.box.convertFromBoxIndex(boxIndex, cellIndex); 41 | let correct = this.matrix[rowIndex][colIndex] === this.puzzleMatrix[rowIndex][colIndex]; 42 | if (!correct) { 43 | return { correct, finish: false }; 44 | } 45 | 46 | let finish = this.puzzleMatrix.every((rowValue, rowIndex) => { 47 | return rowValue.every((cellValue, colIndex) => { 48 | return cellValue === this.matrix[rowIndex][colIndex]; 49 | }) 50 | }); 51 | 52 | return { correct, finish }; 53 | } 54 | } 55 | 56 | export { Sudoku }; 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #///////////////////////////////////////////////////////////////////////////// 2 | # Fireball Projects 3 | #///////////////////////////////////////////////////////////////////////////// 4 | 5 | library/ 6 | temp/ 7 | local/ 8 | build/ 9 | settings/builder.json 10 | 11 | #///////////////////////////////////////////////////////////////////////////// 12 | # Logs and databases 13 | #///////////////////////////////////////////////////////////////////////////// 14 | 15 | *.log 16 | *.sql 17 | *.sqlite 18 | 19 | #///////////////////////////////////////////////////////////////////////////// 20 | # files for debugger 21 | #///////////////////////////////////////////////////////////////////////////// 22 | 23 | *.sln 24 | *.csproj 25 | *.pidb 26 | *.unityproj 27 | *.suo 28 | 29 | #///////////////////////////////////////////////////////////////////////////// 30 | # OS generated files 31 | #///////////////////////////////////////////////////////////////////////////// 32 | 33 | .DS_Store 34 | ehthumbs.db 35 | Thumbs.db 36 | 37 | #///////////////////////////////////////////////////////////////////////////// 38 | # exvim files 39 | #///////////////////////////////////////////////////////////////////////////// 40 | 41 | *UnityVS.meta 42 | *.err 43 | *.err.meta 44 | *.exvim 45 | *.exvim.meta 46 | *.vimentry 47 | *.vimentry.meta 48 | *.vimproject 49 | *.vimproject.meta 50 | .vimfiles.*/ 51 | .exvim.*/ 52 | quick_gen_project_*_autogen.bat 53 | quick_gen_project_*_autogen.bat.meta 54 | quick_gen_project_*_autogen.sh 55 | quick_gen_project_*_autogen.sh.meta 56 | .exvim.app 57 | 58 | #///////////////////////////////////////////////////////////////////////////// 59 | # webstorm files 60 | #///////////////////////////////////////////////////////////////////////////// 61 | 62 | .idea/ 63 | 64 | #////////////////////////// 65 | # VS Code 66 | #////////////////////////// 67 | 68 | .vscode/ -------------------------------------------------------------------------------- /assets/Script/Core/Utils.js: -------------------------------------------------------------------------------- 1 | const matrixUtil = { 2 | make(value = 0) { 3 | return Array.from({ length: 9 }).map(() => this.makeRow(value)); 4 | }, 5 | 6 | makeRow(value = 0) { 7 | return Array.from({ length: 9 }).fill(value); 8 | }, 9 | 10 | shuffle(array) { 11 | for (let i = 0; i < array.length - 1; i++) { 12 | let randomIndex = (i + 1) + Math.floor(Math.random() * (array.length - 1 - i)); 13 | [array[i], array[randomIndex]] = [array[randomIndex], array[i]]; 14 | } 15 | return array; 16 | }, 17 | 18 | fillable(matrix, rowIndex, colIndex, num) { 19 | let { boxIndex } = boxUtil.convertToBoxIndex(rowIndex, colIndex); 20 | let boxCells = boxUtil.getBoxCells(matrix, boxIndex); 21 | for (let i = 0; i < 9; i++) { 22 | if (matrix[rowIndex][i] === num || matrix[i][colIndex] === num || boxCells[i] === num) { 23 | return false; 24 | } 25 | } 26 | return true; 27 | } 28 | }; 29 | 30 | const boxUtil = { 31 | convertToBoxIndex(rowIndex, colIndex) { 32 | let boxIndex = Math.floor(rowIndex / 3) * 3 + Math.floor(colIndex / 3); 33 | let cellIndex = rowIndex % 3 * 3 + colIndex % 3; 34 | return { boxIndex, cellIndex }; 35 | }, 36 | 37 | convertFromBoxIndex(boxIndex, cellIndex) { 38 | let rowIndex = Math.floor(boxIndex / 3) * 3 + Math.floor(cellIndex / 3); 39 | let colIndex = boxIndex % 3 * 3 + cellIndex % 3; 40 | return { rowIndex, colIndex }; 41 | }, 42 | 43 | getBoxCells(matrix, boxIndex) { 44 | let ret = []; 45 | let { rowIndex: startRowIndex, colIndex: startColIndex } = this.convertFromBoxIndex(boxIndex, 0); 46 | for (let i = 0; i < 9; i++) { 47 | let row = startRowIndex + Math.floor(i / 3); 48 | let col = startColIndex + i % 3; 49 | ret.push(matrix[row][col]); 50 | } 51 | return ret; 52 | } 53 | } 54 | 55 | export class Utils { 56 | static get matrix() { 57 | return matrixUtil; 58 | } 59 | 60 | static get box() { 61 | return boxUtil; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /assets/Script/Board.js: -------------------------------------------------------------------------------- 1 | import { Sudoku } from './Core/Sudoku' 2 | import { Utils } from './Core/Utils' 3 | import { Box } from './Box'; 4 | 5 | cc.Class({ 6 | extends: cc.Component, 7 | 8 | properties: { 9 | boxes: { 10 | type: [Box], 11 | default: [] 12 | }, 13 | panelResume: { 14 | type: cc.Layout, 15 | default: null 16 | }, 17 | btnResume: { 18 | type: cc.Button, 19 | default: null 20 | }, 21 | imageMark: { 22 | type: cc.Sprite, 23 | default: null 24 | }, 25 | labelHint: { 26 | type: cc.Label, 27 | default: null 28 | }, 29 | 30 | _sudoku: null, 31 | _lastSelected: null, 32 | _highlightCellIndexes: [], 33 | _steps: [], 34 | _isMarked: false 35 | }, 36 | 37 | onLoad() { 38 | this._initBoard(); 39 | 40 | globalEvent.on('CELL_SELECTED', this._onCellSelected, this); 41 | globalEvent.on('NUMBER_CLICKED', this._onNumberClicked, this); 42 | globalEvent.on('UNDO', this._onUndo, this); 43 | globalEvent.on('ERASE', this._onErase, this); 44 | globalEvent.on('MARK', this._onGameMark, this); 45 | globalEvent.on('HINT', this._onHint, this); 46 | globalEvent.on('NEW_GAME_DIFF', this._onNewGameByDiff, this); 47 | globalEvent.on('GAME_PAUSE', this._onGamePause, this); 48 | globalEvent.on('GAME_RESUME', this._onGameResume, this); 49 | }, 50 | 51 | start() { }, 52 | 53 | onDestroy() { 54 | globalEvent.off('CELL_SELECTED', this._onCellSelected, this); 55 | globalEvent.off('NUMBER_CLICKED', this._onNumberClicked, this); 56 | globalEvent.off('UNDO', this._onUndo, this); 57 | globalEvent.off('ERASE', this._onErase, this); 58 | globalEvent.off('MARK', this._onGameMark, this); 59 | globalEvent.off('HINT', this._onHint, this); 60 | globalEvent.off('NEW_GAME_DIFF', this._onNewGameByDiff, this); 61 | globalEvent.off('GAME_PAUSE', this._onGamePause, this); 62 | globalEvent.off('GAME_RESUME', this._onGameResume, this); 63 | }, 64 | 65 | _initBoard(diff = 'easy') { 66 | this._sudoku = new Sudoku(); 67 | this._sudoku.make(diff); 68 | this._sudoku.puzzleMatrix.forEach((rowValue, rowIndex) => { 69 | rowValue.forEach((cellValue, colIndex) => { 70 | let { boxIndex, cellIndex } = Utils.box.convertToBoxIndex(rowIndex, colIndex); 71 | let cell = this.boxes[boxIndex].getComponent(Box).getCell(cellIndex); 72 | cell.setIndex(boxIndex, cellIndex); 73 | cell.labelNum.string = cellValue ? cellValue : ''; 74 | cell.labelNum.node.color = cellValue ? new cc.Color(0, 0, 0) : new cc.Color(3, 80, 165); 75 | cell.getComponent(cc.Button).interactable = cellValue === 0; 76 | }) 77 | }); 78 | 79 | this._steps = []; 80 | this._unhighlightCells(); 81 | this._lastSelected = null; 82 | this._highlightCellIndexes = []; 83 | this._isMarked = false; 84 | this._setImageMark(); 85 | this.panelResume.node.active = false; 86 | this.labelHint.string = this._sudoku.hintNum; 87 | globalEvent.emit('GAME_START'); 88 | }, 89 | 90 | _onCellSelected(event) { 91 | this._unhighlightCells(); 92 | this._lastSelected = event.detail; 93 | this._highlightCells(); 94 | }, 95 | 96 | _fillNumber(number) { 97 | let cell = this.boxes[this._lastSelected.boxIndex].getComponent(Box).getCell(this._lastSelected.cellIndex); 98 | cell.clearMarks(); 99 | cell.labelNum.string = number; 100 | 101 | let { rowIndex, colIndex } = Utils.box.convertFromBoxIndex(this._lastSelected.boxIndex, this._lastSelected.cellIndex); 102 | this._steps.push([this._lastSelected, this._sudoku.puzzleMatrix[rowIndex][colIndex]]); 103 | this._sudoku.puzzleMatrix[rowIndex][colIndex] = number; 104 | 105 | let { correct, finish } = this._sudoku.check(this._lastSelected.boxIndex, this._lastSelected.cellIndex); 106 | cell.labelNum.node.color = correct ? new cc.Color(3, 80, 165) : new cc.Color(241, 26, 26); 107 | 108 | if (finish) { 109 | globalEvent.emit('GAME_FINISH'); 110 | } 111 | }, 112 | 113 | _fillMark(number) { 114 | let cell = this.boxes[this._lastSelected.boxIndex].getComponent(Box).getCell(this._lastSelected.cellIndex); 115 | cell.labelNum.string = ''; 116 | cell.labelMarks[number - 1].node.active = !cell.labelMarks[number - 1].node.active; 117 | 118 | let { rowIndex, colIndex } = Utils.box.convertFromBoxIndex(this._lastSelected.boxIndex, this._lastSelected.cellIndex); 119 | this._sudoku.puzzleMatrix[rowIndex][colIndex] = 0; 120 | }, 121 | 122 | _onNumberClicked(event) { 123 | if (!this._lastSelected) { 124 | return; 125 | } 126 | 127 | let number = parseInt(event.detail.number); 128 | 129 | if (this._isMarked) { 130 | this._fillMark(number); 131 | } else { 132 | this._fillNumber(number); 133 | } 134 | }, 135 | 136 | _onUndo() { 137 | if (this._isMarked) { 138 | return; 139 | } 140 | 141 | if (this._steps.length == 0) { 142 | return; 143 | } 144 | 145 | let [{ boxIndex, cellIndex }, oldValue] = this._steps.pop(); 146 | let { rowIndex, colIndex } = Utils.box.convertFromBoxIndex(boxIndex, cellIndex); 147 | this._sudoku.puzzleMatrix[rowIndex][colIndex] = parseInt(oldValue); 148 | 149 | let cell = this.boxes[boxIndex].getComponent(Box).getCell(cellIndex); 150 | cell.labelNum.string = oldValue || ''; 151 | let { correct, finish } = this._sudoku.check(boxIndex, cellIndex); 152 | cell.labelNum.node.color = correct ? new cc.Color(3, 80, 165) : new cc.Color(241, 26, 26); 153 | }, 154 | 155 | _onErase() { 156 | if (this._isMarked) { 157 | return; 158 | } 159 | 160 | if (!this._lastSelected) { 161 | return; 162 | } 163 | 164 | let cell = this.boxes[this._lastSelected.boxIndex].getComponent(Box).getCell(this._lastSelected.cellIndex); 165 | cell.labelNum.string = ''; 166 | 167 | let { rowIndex, colIndex } = Utils.box.convertFromBoxIndex(this._lastSelected.boxIndex, this._lastSelected.cellIndex); 168 | this._steps.push([this._lastSelected, this._sudoku.puzzleMatrix[rowIndex][colIndex]]); 169 | this._sudoku.puzzleMatrix[rowIndex][colIndex] = 0; 170 | }, 171 | 172 | _onNewGameByDiff(event) { 173 | this._initBoard(event.detail); 174 | }, 175 | 176 | _unhighlightCells() { 177 | if (!this._lastSelected) { 178 | return; 179 | } 180 | 181 | this._highlightCellIndexes.forEach(([boxIndex, cellIndex]) => { 182 | let cell = this.boxes[boxIndex].getComponent(Box).getCell(cellIndex); 183 | cell.node.color = new cc.Color(255, 255, 255); 184 | }); 185 | 186 | this._highlightCellIndexes = []; 187 | }, 188 | 189 | _highlightCells() { 190 | if (!this._lastSelected) { 191 | return; 192 | } 193 | 194 | let { rowIndex, colIndex } = Utils.box.convertFromBoxIndex(this._lastSelected.boxIndex, this._lastSelected.cellIndex); 195 | for (let i = 0; i < 9; i++) { 196 | let boxIndex, cellIndex; 197 | // highlight row 198 | ({ boxIndex, cellIndex } = Utils.box.convertToBoxIndex(rowIndex, i)); 199 | let cell = this.boxes[boxIndex].getComponent(Box).getCell(cellIndex); 200 | cell.node.color = new cc.Color(192, 192, 192); 201 | this._highlightCellIndexes.push([boxIndex, cellIndex]); 202 | 203 | // highlight col 204 | ({ boxIndex, cellIndex } = Utils.box.convertToBoxIndex(i, colIndex)); 205 | cell = this.boxes[boxIndex].getComponent(Box).getCell(cellIndex); 206 | cell.node.color = new cc.Color(192, 192, 192); 207 | this._highlightCellIndexes.push([boxIndex, cellIndex]); 208 | 209 | // highlight box 210 | cell = this.boxes[this._lastSelected.boxIndex].getComponent(Box).getCell(i); 211 | cell.node.color = new cc.Color(192, 192, 192); 212 | this._highlightCellIndexes.push([this._lastSelected.boxIndex, i]); 213 | } 214 | let cell = this.boxes[this._lastSelected.boxIndex].getComponent(Box).getCell(this._lastSelected.cellIndex); 215 | cell.node.color = new cc.Color(160, 160, 160); 216 | }, 217 | 218 | _onGamePause() { 219 | this.panelResume.node.active = true; 220 | }, 221 | 222 | _onGameResume() { 223 | this.panelResume.node.active = false; 224 | }, 225 | 226 | _onGameMark() { 227 | this._isMarked = !this._isMarked; 228 | this._setImageMark(); 229 | }, 230 | 231 | _setImageMark() { 232 | if (this._isMarked) { 233 | this.imageMark.spriteFrame = new cc.SpriteFrame(cc.url.raw('resources/On.png')); 234 | } else { 235 | this.imageMark.spriteFrame = new cc.SpriteFrame(cc.url.raw('resources/Off.png')); 236 | } 237 | }, 238 | 239 | _onHint() { 240 | if (this._sudoku.hintNum == 0) { 241 | return; 242 | } 243 | 244 | if (!this._lastSelected) { 245 | return; 246 | } 247 | 248 | this._sudoku.hintNum -= 1; 249 | this.labelHint.string = this._sudoku.hintNum; 250 | 251 | let { rowIndex, colIndex } = Utils.box.convertFromBoxIndex(this._lastSelected.boxIndex, this._lastSelected.cellIndex); 252 | this._fillNumber(this._sudoku.matrix[rowIndex][colIndex]); 253 | } 254 | }); 255 | -------------------------------------------------------------------------------- /assets/Prefab/Cell.prefab: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.Prefab", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_rawFiles": null, 7 | "data": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Node", 13 | "_name": "Cell0", 14 | "_objFlags": 0, 15 | "_parent": null, 16 | "_children": [ 17 | { 18 | "__id__": 2 19 | }, 20 | { 21 | "__id__": 5 22 | }, 23 | { 24 | "__id__": 8 25 | }, 26 | { 27 | "__id__": 11 28 | }, 29 | { 30 | "__id__": 14 31 | }, 32 | { 33 | "__id__": 17 34 | }, 35 | { 36 | "__id__": 20 37 | }, 38 | { 39 | "__id__": 23 40 | }, 41 | { 42 | "__id__": 26 43 | }, 44 | { 45 | "__id__": 29 46 | } 47 | ], 48 | "_tag": -1, 49 | "_active": true, 50 | "_components": [ 51 | { 52 | "__id__": 32 53 | }, 54 | { 55 | "__id__": 33 56 | }, 57 | { 58 | "__id__": 34 59 | } 60 | ], 61 | "_prefab": { 62 | "__id__": 35 63 | }, 64 | "_id": "", 65 | "_opacity": 255, 66 | "_color": { 67 | "__type__": "cc.Color", 68 | "r": 255, 69 | "g": 255, 70 | "b": 255, 71 | "a": 255 72 | }, 73 | "_cascadeOpacityEnabled": true, 74 | "_anchorPoint": { 75 | "__type__": "cc.Vec2", 76 | "x": 0.5, 77 | "y": 0.5 78 | }, 79 | "_contentSize": { 80 | "__type__": "cc.Size", 81 | "width": 70, 82 | "height": 70 83 | }, 84 | "_rotationX": 0, 85 | "_rotationY": 0, 86 | "_scaleX": 1, 87 | "_scaleY": 1, 88 | "_position": { 89 | "__type__": "cc.Vec2", 90 | "x": -70, 91 | "y": 70 92 | }, 93 | "_skewX": 0, 94 | "_skewY": 0, 95 | "_localZOrder": 0, 96 | "_globalZOrder": 0, 97 | "_opacityModifyRGB": false, 98 | "groupIndex": 0 99 | }, 100 | { 101 | "__type__": "cc.Node", 102 | "_name": "LabelNum", 103 | "_objFlags": 0, 104 | "_parent": { 105 | "__id__": 1 106 | }, 107 | "_children": [], 108 | "_tag": -1, 109 | "_active": true, 110 | "_components": [ 111 | { 112 | "__id__": 3 113 | } 114 | ], 115 | "_prefab": { 116 | "__id__": 4 117 | }, 118 | "_id": "", 119 | "_opacity": 255, 120 | "_color": { 121 | "__type__": "cc.Color", 122 | "r": 17, 123 | "g": 17, 124 | "b": 17, 125 | "a": 255 126 | }, 127 | "_cascadeOpacityEnabled": true, 128 | "_anchorPoint": { 129 | "__type__": "cc.Vec2", 130 | "x": 0.5, 131 | "y": 0.5 132 | }, 133 | "_contentSize": { 134 | "__type__": "cc.Size", 135 | "width": 70, 136 | "height": 70 137 | }, 138 | "_rotationX": 0, 139 | "_rotationY": 0, 140 | "_scaleX": 1, 141 | "_scaleY": 1, 142 | "_position": { 143 | "__type__": "cc.Vec2", 144 | "x": 0, 145 | "y": 0 146 | }, 147 | "_skewX": 0, 148 | "_skewY": 0, 149 | "_localZOrder": 0, 150 | "_globalZOrder": 0, 151 | "_opacityModifyRGB": false, 152 | "groupIndex": 0 153 | }, 154 | { 155 | "__type__": "cc.Label", 156 | "_name": "", 157 | "_objFlags": 0, 158 | "node": { 159 | "__id__": 2 160 | }, 161 | "_enabled": true, 162 | "_useOriginalSize": false, 163 | "_actualFontSize": 48, 164 | "_fontSize": 48, 165 | "_lineHeight": 40, 166 | "_enableWrapText": false, 167 | "_N$file": null, 168 | "_isSystemFontUsed": true, 169 | "_spacingX": 0, 170 | "_N$string": "8", 171 | "_N$horizontalAlign": 1, 172 | "_N$verticalAlign": 1, 173 | "_N$fontFamily": "Consolas", 174 | "_N$overflow": 1 175 | }, 176 | { 177 | "__type__": "cc.PrefabInfo", 178 | "root": { 179 | "__id__": 1 180 | }, 181 | "asset": { 182 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 183 | }, 184 | "fileId": "c0OQetts9IxJqKQWwj54f5", 185 | "sync": false 186 | }, 187 | { 188 | "__type__": "cc.Node", 189 | "_name": "LabelMark0", 190 | "_objFlags": 0, 191 | "_parent": { 192 | "__id__": 1 193 | }, 194 | "_children": [], 195 | "_tag": -1, 196 | "_active": true, 197 | "_components": [ 198 | { 199 | "__id__": 6 200 | } 201 | ], 202 | "_prefab": { 203 | "__id__": 7 204 | }, 205 | "_id": "", 206 | "_opacity": 255, 207 | "_color": { 208 | "__type__": "cc.Color", 209 | "r": 187, 210 | "g": 187, 211 | "b": 187, 212 | "a": 255 213 | }, 214 | "_cascadeOpacityEnabled": true, 215 | "_anchorPoint": { 216 | "__type__": "cc.Vec2", 217 | "x": 0.5, 218 | "y": 0.5 219 | }, 220 | "_contentSize": { 221 | "__type__": "cc.Size", 222 | "width": 13, 223 | "height": 23 224 | }, 225 | "_rotationX": 0, 226 | "_rotationY": 0, 227 | "_scaleX": 1, 228 | "_scaleY": 1, 229 | "_position": { 230 | "__type__": "cc.Vec2", 231 | "x": -23, 232 | "y": 23 233 | }, 234 | "_skewX": 0, 235 | "_skewY": 0, 236 | "_localZOrder": 0, 237 | "_globalZOrder": 0, 238 | "_opacityModifyRGB": false, 239 | "groupIndex": 0 240 | }, 241 | { 242 | "__type__": "cc.Label", 243 | "_name": "", 244 | "_objFlags": 0, 245 | "node": { 246 | "__id__": 5 247 | }, 248 | "_enabled": true, 249 | "_useOriginalSize": false, 250 | "_actualFontSize": 23, 251 | "_fontSize": 23, 252 | "_lineHeight": 23, 253 | "_enableWrapText": true, 254 | "_N$file": null, 255 | "_isSystemFontUsed": true, 256 | "_spacingX": 0, 257 | "_N$string": "1", 258 | "_N$horizontalAlign": 1, 259 | "_N$verticalAlign": 1, 260 | "_N$fontFamily": "Consolas", 261 | "_N$overflow": 0 262 | }, 263 | { 264 | "__type__": "cc.PrefabInfo", 265 | "root": { 266 | "__id__": 1 267 | }, 268 | "asset": { 269 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 270 | }, 271 | "fileId": "41Yyy6bdxNQrc4FTbOBc+L", 272 | "sync": false 273 | }, 274 | { 275 | "__type__": "cc.Node", 276 | "_name": "LabelMark1", 277 | "_objFlags": 0, 278 | "_parent": { 279 | "__id__": 1 280 | }, 281 | "_children": [], 282 | "_tag": -1, 283 | "_active": true, 284 | "_components": [ 285 | { 286 | "__id__": 9 287 | } 288 | ], 289 | "_prefab": { 290 | "__id__": 10 291 | }, 292 | "_id": "", 293 | "_opacity": 255, 294 | "_color": { 295 | "__type__": "cc.Color", 296 | "r": 187, 297 | "g": 187, 298 | "b": 187, 299 | "a": 255 300 | }, 301 | "_cascadeOpacityEnabled": true, 302 | "_anchorPoint": { 303 | "__type__": "cc.Vec2", 304 | "x": 0.5, 305 | "y": 0.5 306 | }, 307 | "_contentSize": { 308 | "__type__": "cc.Size", 309 | "width": 13, 310 | "height": 23 311 | }, 312 | "_rotationX": 0, 313 | "_rotationY": 0, 314 | "_scaleX": 1, 315 | "_scaleY": 1, 316 | "_position": { 317 | "__type__": "cc.Vec2", 318 | "x": 0, 319 | "y": 23 320 | }, 321 | "_skewX": 0, 322 | "_skewY": 0, 323 | "_localZOrder": 0, 324 | "_globalZOrder": 0, 325 | "_opacityModifyRGB": false, 326 | "groupIndex": 0 327 | }, 328 | { 329 | "__type__": "cc.Label", 330 | "_name": "", 331 | "_objFlags": 0, 332 | "node": { 333 | "__id__": 8 334 | }, 335 | "_enabled": true, 336 | "_useOriginalSize": false, 337 | "_actualFontSize": 23, 338 | "_fontSize": 23, 339 | "_lineHeight": 23, 340 | "_enableWrapText": true, 341 | "_N$file": null, 342 | "_isSystemFontUsed": true, 343 | "_spacingX": 0, 344 | "_N$string": "2", 345 | "_N$horizontalAlign": 1, 346 | "_N$verticalAlign": 1, 347 | "_N$fontFamily": "Consolas", 348 | "_N$overflow": 0 349 | }, 350 | { 351 | "__type__": "cc.PrefabInfo", 352 | "root": { 353 | "__id__": 1 354 | }, 355 | "asset": { 356 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 357 | }, 358 | "fileId": "c7QD2xhCZJp4QRft1OuZca", 359 | "sync": false 360 | }, 361 | { 362 | "__type__": "cc.Node", 363 | "_name": "LabelMark2", 364 | "_objFlags": 0, 365 | "_parent": { 366 | "__id__": 1 367 | }, 368 | "_children": [], 369 | "_tag": -1, 370 | "_active": true, 371 | "_components": [ 372 | { 373 | "__id__": 12 374 | } 375 | ], 376 | "_prefab": { 377 | "__id__": 13 378 | }, 379 | "_id": "", 380 | "_opacity": 255, 381 | "_color": { 382 | "__type__": "cc.Color", 383 | "r": 187, 384 | "g": 187, 385 | "b": 187, 386 | "a": 255 387 | }, 388 | "_cascadeOpacityEnabled": true, 389 | "_anchorPoint": { 390 | "__type__": "cc.Vec2", 391 | "x": 0.5, 392 | "y": 0.5 393 | }, 394 | "_contentSize": { 395 | "__type__": "cc.Size", 396 | "width": 13, 397 | "height": 23 398 | }, 399 | "_rotationX": 0, 400 | "_rotationY": 0, 401 | "_scaleX": 1, 402 | "_scaleY": 1, 403 | "_position": { 404 | "__type__": "cc.Vec2", 405 | "x": 23, 406 | "y": 23 407 | }, 408 | "_skewX": 0, 409 | "_skewY": 0, 410 | "_localZOrder": 0, 411 | "_globalZOrder": 0, 412 | "_opacityModifyRGB": false, 413 | "groupIndex": 0 414 | }, 415 | { 416 | "__type__": "cc.Label", 417 | "_name": "", 418 | "_objFlags": 0, 419 | "node": { 420 | "__id__": 11 421 | }, 422 | "_enabled": true, 423 | "_useOriginalSize": false, 424 | "_actualFontSize": 23, 425 | "_fontSize": 23, 426 | "_lineHeight": 23, 427 | "_enableWrapText": true, 428 | "_N$file": null, 429 | "_isSystemFontUsed": true, 430 | "_spacingX": 0, 431 | "_N$string": "3", 432 | "_N$horizontalAlign": 1, 433 | "_N$verticalAlign": 1, 434 | "_N$fontFamily": "Consolas", 435 | "_N$overflow": 0 436 | }, 437 | { 438 | "__type__": "cc.PrefabInfo", 439 | "root": { 440 | "__id__": 1 441 | }, 442 | "asset": { 443 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 444 | }, 445 | "fileId": "ffQU1Al2FJn5QNkOj+n77r", 446 | "sync": false 447 | }, 448 | { 449 | "__type__": "cc.Node", 450 | "_name": "LabelMark3", 451 | "_objFlags": 0, 452 | "_parent": { 453 | "__id__": 1 454 | }, 455 | "_children": [], 456 | "_tag": -1, 457 | "_active": true, 458 | "_components": [ 459 | { 460 | "__id__": 15 461 | } 462 | ], 463 | "_prefab": { 464 | "__id__": 16 465 | }, 466 | "_id": "", 467 | "_opacity": 255, 468 | "_color": { 469 | "__type__": "cc.Color", 470 | "r": 187, 471 | "g": 187, 472 | "b": 187, 473 | "a": 255 474 | }, 475 | "_cascadeOpacityEnabled": true, 476 | "_anchorPoint": { 477 | "__type__": "cc.Vec2", 478 | "x": 0.5, 479 | "y": 0.5 480 | }, 481 | "_contentSize": { 482 | "__type__": "cc.Size", 483 | "width": 13, 484 | "height": 23 485 | }, 486 | "_rotationX": 0, 487 | "_rotationY": 0, 488 | "_scaleX": 1, 489 | "_scaleY": 1, 490 | "_position": { 491 | "__type__": "cc.Vec2", 492 | "x": -23, 493 | "y": 0 494 | }, 495 | "_skewX": 0, 496 | "_skewY": 0, 497 | "_localZOrder": 0, 498 | "_globalZOrder": 0, 499 | "_opacityModifyRGB": false, 500 | "groupIndex": 0 501 | }, 502 | { 503 | "__type__": "cc.Label", 504 | "_name": "", 505 | "_objFlags": 0, 506 | "node": { 507 | "__id__": 14 508 | }, 509 | "_enabled": true, 510 | "_useOriginalSize": false, 511 | "_actualFontSize": 23, 512 | "_fontSize": 23, 513 | "_lineHeight": 23, 514 | "_enableWrapText": true, 515 | "_N$file": null, 516 | "_isSystemFontUsed": true, 517 | "_spacingX": 0, 518 | "_N$string": "4", 519 | "_N$horizontalAlign": 1, 520 | "_N$verticalAlign": 1, 521 | "_N$fontFamily": "Consolas", 522 | "_N$overflow": 0 523 | }, 524 | { 525 | "__type__": "cc.PrefabInfo", 526 | "root": { 527 | "__id__": 1 528 | }, 529 | "asset": { 530 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 531 | }, 532 | "fileId": "f9qnukr0RDyactS8OU5jP5", 533 | "sync": false 534 | }, 535 | { 536 | "__type__": "cc.Node", 537 | "_name": "LabelMark4", 538 | "_objFlags": 0, 539 | "_parent": { 540 | "__id__": 1 541 | }, 542 | "_children": [], 543 | "_tag": -1, 544 | "_active": true, 545 | "_components": [ 546 | { 547 | "__id__": 18 548 | } 549 | ], 550 | "_prefab": { 551 | "__id__": 19 552 | }, 553 | "_id": "", 554 | "_opacity": 255, 555 | "_color": { 556 | "__type__": "cc.Color", 557 | "r": 187, 558 | "g": 187, 559 | "b": 187, 560 | "a": 255 561 | }, 562 | "_cascadeOpacityEnabled": true, 563 | "_anchorPoint": { 564 | "__type__": "cc.Vec2", 565 | "x": 0.5, 566 | "y": 0.5 567 | }, 568 | "_contentSize": { 569 | "__type__": "cc.Size", 570 | "width": 13, 571 | "height": 23 572 | }, 573 | "_rotationX": 0, 574 | "_rotationY": 0, 575 | "_scaleX": 1, 576 | "_scaleY": 1, 577 | "_position": { 578 | "__type__": "cc.Vec2", 579 | "x": 0, 580 | "y": 0 581 | }, 582 | "_skewX": 0, 583 | "_skewY": 0, 584 | "_localZOrder": 0, 585 | "_globalZOrder": 0, 586 | "_opacityModifyRGB": false, 587 | "groupIndex": 0 588 | }, 589 | { 590 | "__type__": "cc.Label", 591 | "_name": "", 592 | "_objFlags": 0, 593 | "node": { 594 | "__id__": 17 595 | }, 596 | "_enabled": true, 597 | "_useOriginalSize": false, 598 | "_actualFontSize": 23, 599 | "_fontSize": 23, 600 | "_lineHeight": 23, 601 | "_enableWrapText": true, 602 | "_N$file": null, 603 | "_isSystemFontUsed": true, 604 | "_spacingX": 0, 605 | "_N$string": "5", 606 | "_N$horizontalAlign": 1, 607 | "_N$verticalAlign": 1, 608 | "_N$fontFamily": "Consolas", 609 | "_N$overflow": 0 610 | }, 611 | { 612 | "__type__": "cc.PrefabInfo", 613 | "root": { 614 | "__id__": 1 615 | }, 616 | "asset": { 617 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 618 | }, 619 | "fileId": "86ue5SYdtJV6FGnPr0qb2f", 620 | "sync": false 621 | }, 622 | { 623 | "__type__": "cc.Node", 624 | "_name": "LabelMark5", 625 | "_objFlags": 0, 626 | "_parent": { 627 | "__id__": 1 628 | }, 629 | "_children": [], 630 | "_tag": -1, 631 | "_active": true, 632 | "_components": [ 633 | { 634 | "__id__": 21 635 | } 636 | ], 637 | "_prefab": { 638 | "__id__": 22 639 | }, 640 | "_id": "", 641 | "_opacity": 255, 642 | "_color": { 643 | "__type__": "cc.Color", 644 | "r": 187, 645 | "g": 187, 646 | "b": 187, 647 | "a": 255 648 | }, 649 | "_cascadeOpacityEnabled": true, 650 | "_anchorPoint": { 651 | "__type__": "cc.Vec2", 652 | "x": 0.5, 653 | "y": 0.5 654 | }, 655 | "_contentSize": { 656 | "__type__": "cc.Size", 657 | "width": 13, 658 | "height": 23 659 | }, 660 | "_rotationX": 0, 661 | "_rotationY": 0, 662 | "_scaleX": 1, 663 | "_scaleY": 1, 664 | "_position": { 665 | "__type__": "cc.Vec2", 666 | "x": 23, 667 | "y": 0 668 | }, 669 | "_skewX": 0, 670 | "_skewY": 0, 671 | "_localZOrder": 0, 672 | "_globalZOrder": 0, 673 | "_opacityModifyRGB": false, 674 | "groupIndex": 0 675 | }, 676 | { 677 | "__type__": "cc.Label", 678 | "_name": "", 679 | "_objFlags": 0, 680 | "node": { 681 | "__id__": 20 682 | }, 683 | "_enabled": true, 684 | "_useOriginalSize": false, 685 | "_actualFontSize": 23, 686 | "_fontSize": 23, 687 | "_lineHeight": 23, 688 | "_enableWrapText": true, 689 | "_N$file": null, 690 | "_isSystemFontUsed": true, 691 | "_spacingX": 0, 692 | "_N$string": "6", 693 | "_N$horizontalAlign": 1, 694 | "_N$verticalAlign": 1, 695 | "_N$fontFamily": "Consolas", 696 | "_N$overflow": 0 697 | }, 698 | { 699 | "__type__": "cc.PrefabInfo", 700 | "root": { 701 | "__id__": 1 702 | }, 703 | "asset": { 704 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 705 | }, 706 | "fileId": "ac7raBk5xGDIZMhJygyDJQ", 707 | "sync": false 708 | }, 709 | { 710 | "__type__": "cc.Node", 711 | "_name": "LabelMark6", 712 | "_objFlags": 0, 713 | "_parent": { 714 | "__id__": 1 715 | }, 716 | "_children": [], 717 | "_tag": -1, 718 | "_active": true, 719 | "_components": [ 720 | { 721 | "__id__": 24 722 | } 723 | ], 724 | "_prefab": { 725 | "__id__": 25 726 | }, 727 | "_id": "", 728 | "_opacity": 255, 729 | "_color": { 730 | "__type__": "cc.Color", 731 | "r": 187, 732 | "g": 187, 733 | "b": 187, 734 | "a": 255 735 | }, 736 | "_cascadeOpacityEnabled": true, 737 | "_anchorPoint": { 738 | "__type__": "cc.Vec2", 739 | "x": 0.5, 740 | "y": 0.5 741 | }, 742 | "_contentSize": { 743 | "__type__": "cc.Size", 744 | "width": 13, 745 | "height": 23 746 | }, 747 | "_rotationX": 0, 748 | "_rotationY": 0, 749 | "_scaleX": 1, 750 | "_scaleY": 1, 751 | "_position": { 752 | "__type__": "cc.Vec2", 753 | "x": -23, 754 | "y": -23 755 | }, 756 | "_skewX": 0, 757 | "_skewY": 0, 758 | "_localZOrder": 0, 759 | "_globalZOrder": 0, 760 | "_opacityModifyRGB": false, 761 | "groupIndex": 0 762 | }, 763 | { 764 | "__type__": "cc.Label", 765 | "_name": "", 766 | "_objFlags": 0, 767 | "node": { 768 | "__id__": 23 769 | }, 770 | "_enabled": true, 771 | "_useOriginalSize": false, 772 | "_actualFontSize": 23, 773 | "_fontSize": 23, 774 | "_lineHeight": 23, 775 | "_enableWrapText": true, 776 | "_N$file": null, 777 | "_isSystemFontUsed": true, 778 | "_spacingX": 0, 779 | "_N$string": "7", 780 | "_N$horizontalAlign": 1, 781 | "_N$verticalAlign": 1, 782 | "_N$fontFamily": "Consolas", 783 | "_N$overflow": 0 784 | }, 785 | { 786 | "__type__": "cc.PrefabInfo", 787 | "root": { 788 | "__id__": 1 789 | }, 790 | "asset": { 791 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 792 | }, 793 | "fileId": "davxRngbdMT4O+1DeO7djY", 794 | "sync": false 795 | }, 796 | { 797 | "__type__": "cc.Node", 798 | "_name": "LabelMark7", 799 | "_objFlags": 0, 800 | "_parent": { 801 | "__id__": 1 802 | }, 803 | "_children": [], 804 | "_tag": -1, 805 | "_active": true, 806 | "_components": [ 807 | { 808 | "__id__": 27 809 | } 810 | ], 811 | "_prefab": { 812 | "__id__": 28 813 | }, 814 | "_id": "", 815 | "_opacity": 255, 816 | "_color": { 817 | "__type__": "cc.Color", 818 | "r": 187, 819 | "g": 187, 820 | "b": 187, 821 | "a": 255 822 | }, 823 | "_cascadeOpacityEnabled": true, 824 | "_anchorPoint": { 825 | "__type__": "cc.Vec2", 826 | "x": 0.5, 827 | "y": 0.5 828 | }, 829 | "_contentSize": { 830 | "__type__": "cc.Size", 831 | "width": 13, 832 | "height": 23 833 | }, 834 | "_rotationX": 0, 835 | "_rotationY": 0, 836 | "_scaleX": 1, 837 | "_scaleY": 1, 838 | "_position": { 839 | "__type__": "cc.Vec2", 840 | "x": 0, 841 | "y": -23 842 | }, 843 | "_skewX": 0, 844 | "_skewY": 0, 845 | "_localZOrder": 0, 846 | "_globalZOrder": 0, 847 | "_opacityModifyRGB": false, 848 | "groupIndex": 0 849 | }, 850 | { 851 | "__type__": "cc.Label", 852 | "_name": "", 853 | "_objFlags": 0, 854 | "node": { 855 | "__id__": 26 856 | }, 857 | "_enabled": true, 858 | "_useOriginalSize": false, 859 | "_actualFontSize": 23, 860 | "_fontSize": 23, 861 | "_lineHeight": 23, 862 | "_enableWrapText": true, 863 | "_N$file": null, 864 | "_isSystemFontUsed": true, 865 | "_spacingX": 0, 866 | "_N$string": "8", 867 | "_N$horizontalAlign": 1, 868 | "_N$verticalAlign": 1, 869 | "_N$fontFamily": "Consolas", 870 | "_N$overflow": 0 871 | }, 872 | { 873 | "__type__": "cc.PrefabInfo", 874 | "root": { 875 | "__id__": 1 876 | }, 877 | "asset": { 878 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 879 | }, 880 | "fileId": "15ea4UVZFJAKKrAy8TLeAj", 881 | "sync": false 882 | }, 883 | { 884 | "__type__": "cc.Node", 885 | "_name": "LabelMark8", 886 | "_objFlags": 0, 887 | "_parent": { 888 | "__id__": 1 889 | }, 890 | "_children": [], 891 | "_tag": -1, 892 | "_active": true, 893 | "_components": [ 894 | { 895 | "__id__": 30 896 | } 897 | ], 898 | "_prefab": { 899 | "__id__": 31 900 | }, 901 | "_id": "", 902 | "_opacity": 255, 903 | "_color": { 904 | "__type__": "cc.Color", 905 | "r": 187, 906 | "g": 187, 907 | "b": 187, 908 | "a": 255 909 | }, 910 | "_cascadeOpacityEnabled": true, 911 | "_anchorPoint": { 912 | "__type__": "cc.Vec2", 913 | "x": 0.5, 914 | "y": 0.5 915 | }, 916 | "_contentSize": { 917 | "__type__": "cc.Size", 918 | "width": 13, 919 | "height": 23 920 | }, 921 | "_rotationX": 0, 922 | "_rotationY": 0, 923 | "_scaleX": 1, 924 | "_scaleY": 1, 925 | "_position": { 926 | "__type__": "cc.Vec2", 927 | "x": 23, 928 | "y": -23 929 | }, 930 | "_skewX": 0, 931 | "_skewY": 0, 932 | "_localZOrder": 0, 933 | "_globalZOrder": 0, 934 | "_opacityModifyRGB": false, 935 | "groupIndex": 0 936 | }, 937 | { 938 | "__type__": "cc.Label", 939 | "_name": "", 940 | "_objFlags": 0, 941 | "node": { 942 | "__id__": 29 943 | }, 944 | "_enabled": true, 945 | "_useOriginalSize": false, 946 | "_actualFontSize": 23, 947 | "_fontSize": 23, 948 | "_lineHeight": 23, 949 | "_enableWrapText": true, 950 | "_N$file": null, 951 | "_isSystemFontUsed": true, 952 | "_spacingX": 0, 953 | "_N$string": "9", 954 | "_N$horizontalAlign": 1, 955 | "_N$verticalAlign": 1, 956 | "_N$fontFamily": "Consolas", 957 | "_N$overflow": 0 958 | }, 959 | { 960 | "__type__": "cc.PrefabInfo", 961 | "root": { 962 | "__id__": 1 963 | }, 964 | "asset": { 965 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 966 | }, 967 | "fileId": "82J6J5ZOJEEKCnyOp2EI96", 968 | "sync": false 969 | }, 970 | { 971 | "__type__": "cc.Sprite", 972 | "_name": "", 973 | "_objFlags": 0, 974 | "node": { 975 | "__id__": 1 976 | }, 977 | "_enabled": true, 978 | "_spriteFrame": null, 979 | "_type": 1, 980 | "_sizeMode": 0, 981 | "_fillType": 0, 982 | "_fillCenter": { 983 | "__type__": "cc.Vec2", 984 | "x": 0, 985 | "y": 0 986 | }, 987 | "_fillStart": 0, 988 | "_fillRange": 0, 989 | "_isTrimmedMode": true, 990 | "_srcBlendFactor": 770, 991 | "_dstBlendFactor": 771, 992 | "_atlas": null 993 | }, 994 | { 995 | "__type__": "cc.Button", 996 | "_name": "", 997 | "_objFlags": 0, 998 | "node": { 999 | "__id__": 1 1000 | }, 1001 | "_enabled": true, 1002 | "transition": 1, 1003 | "pressedColor": { 1004 | "__type__": "cc.Color", 1005 | "r": 255, 1006 | "g": 255, 1007 | "b": 255, 1008 | "a": 255 1009 | }, 1010 | "hoverColor": { 1011 | "__type__": "cc.Color", 1012 | "r": 255, 1013 | "g": 255, 1014 | "b": 255, 1015 | "a": 255 1016 | }, 1017 | "duration": 0.1, 1018 | "zoomScale": 1.2, 1019 | "clickEvents": [], 1020 | "_N$interactable": true, 1021 | "_N$enableAutoGrayEffect": true, 1022 | "_N$normalColor": { 1023 | "__type__": "cc.Color", 1024 | "r": 255, 1025 | "g": 255, 1026 | "b": 255, 1027 | "a": 255 1028 | }, 1029 | "_N$disabledColor": { 1030 | "__type__": "cc.Color", 1031 | "r": 120, 1032 | "g": 213, 1033 | "b": 120, 1034 | "a": 255 1035 | }, 1036 | "_N$normalSprite": null, 1037 | "_N$pressedSprite": null, 1038 | "pressedSprite": null, 1039 | "_N$hoverSprite": null, 1040 | "hoverSprite": null, 1041 | "_N$disabledSprite": null, 1042 | "_N$target": { 1043 | "__id__": 1 1044 | } 1045 | }, 1046 | { 1047 | "__type__": "940ec8I1QBO9ID107JA31il", 1048 | "_name": "", 1049 | "_objFlags": 0, 1050 | "node": { 1051 | "__id__": 1 1052 | }, 1053 | "_enabled": true, 1054 | "labelNum": { 1055 | "__id__": 3 1056 | }, 1057 | "labelMarks": [ 1058 | { 1059 | "__id__": 6 1060 | }, 1061 | { 1062 | "__id__": 9 1063 | }, 1064 | { 1065 | "__id__": 12 1066 | }, 1067 | { 1068 | "__id__": 15 1069 | }, 1070 | { 1071 | "__id__": 18 1072 | }, 1073 | { 1074 | "__id__": 21 1075 | }, 1076 | { 1077 | "__id__": 24 1078 | }, 1079 | { 1080 | "__id__": 27 1081 | }, 1082 | { 1083 | "__id__": 30 1084 | } 1085 | ], 1086 | "_boxIndex": null, 1087 | "_cellIndex": null 1088 | }, 1089 | { 1090 | "__type__": "cc.PrefabInfo", 1091 | "root": { 1092 | "__id__": 1 1093 | }, 1094 | "asset": { 1095 | "__uuid__": "23f39782-c7f2-4c5d-9944-13bc33ffa09f" 1096 | }, 1097 | "fileId": "2efOdas+RAy5kIfONjusS0", 1098 | "sync": false 1099 | } 1100 | ] --------------------------------------------------------------------------------