{ "sourceFile": "assets/scripts/Game/GameMain.ts", "activeCommit": 0, "commits": [ { "activePatchIndex": 177, "patches": [ { "date": 1694486060260, "content": "Index: \n===================================================================\n--- \n+++ \n" }, { "date": 1694486098308, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,6 @@\n import { _decorator, Component } from 'cc';\n+import { GameManager } from '../Manager/GameManager';\n const { ccclass, property } = _decorator;\n \n @ccclass('GameMain')\n export class GameMain extends Component {\n@@ -12,8 +13,9 @@\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n initUI() {\n+ GameManager.getInstance().addScore(20);\n \n }\n \n update(deltaTime: number) {\n" }, { "date": 1694488465399, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -13,10 +13,9 @@\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n initUI() {\n- GameManager.getInstance().addScore(20);\n-\n+ \n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694488566074, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -3,8 +3,11 @@\n const { ccclass, property } = _decorator;\n \n @ccclass('GameMain')\n export class GameMain extends Component {\n+\n+ @property(Node)\n+ rootNodeList: Node[] = [];\n \n start() {\n \n }\n@@ -13,9 +16,9 @@\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n initUI() {\n- \n+\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694488601121, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,13 +1,16 @@\n-import { _decorator, Component } from 'cc';\n+import { _decorator, Component, Prefab } from 'cc';\n import { GameManager } from '../Manager/GameManager';\n const { ccclass, property } = _decorator;\n \n @ccclass('GameMain')\n export class GameMain extends Component {\n \n @property(Node)\n rootNodeList: Node[] = [];\n+\n+ @property(Prefab)\n+ itemPrefabList: Prefab[] = [];\n \n start() {\n \n }\n" }, { "date": 1694488672751, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -18,9 +18,9 @@\n /**\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n- initUI() {\n+ initUI() { \n \n }\n \n update(deltaTime: number) {\n" }, { "date": 1694488711525, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,5 @@\n-import { _decorator, Component, Prefab } from 'cc';\n+import { _decorator, Component, Prefab, Node } from 'cc';\n import { GameManager } from '../Manager/GameManager';\n const { ccclass, property } = _decorator;\n \n @ccclass('GameMain')\n" }, { "date": 1694489042425, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -22,8 +22,12 @@\n initUI() { \n \n }\n \n+ randomNumbers() {\n+ \n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694489071354, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -9,8 +9,10 @@\n rootNodeList: Node[] = [];\n \n @property(Prefab)\n itemPrefabList: Prefab[] = [];\n+\n+ randomNumList: [] = [];\n \n start() {\n \n }\n@@ -23,9 +25,9 @@\n \n }\n \n randomNumbers() {\n- \n+\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694489077992, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -10,9 +10,9 @@\n \n @property(Prefab)\n itemPrefabList: Prefab[] = [];\n \n- randomNumList: [] = [];\n+ randomNumList: number[] = [];\n \n start() {\n \n }\n" }, { "date": 1694489145343, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -24,10 +24,11 @@\n initUI() { \n \n }\n \n- randomNumbers() {\n-\n+ randomNumbers(count) {\n+ let numbers: number[] = [];\n+ \n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694489380149, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -25,10 +25,15 @@\n \n }\n \n randomNumbers(count) {\n- let numbers: number[] = [];\n- \n+ let numbers = [];\n+ while (numbers.length < count) {\n+ let random = Math.floor(Math.random() * 10) + 1;\n+ if (numbers) {\n+ \n+ }\n+ }\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694489461062, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -25,13 +25,13 @@\n \n }\n \n randomNumbers(count) {\n- let numbers = [];\n+ let numbers: number[] = [];\n while (numbers.length < count) {\n let random = Math.floor(Math.random() * 10) + 1;\n if (numbers) {\n- \n+\n }\n }\n }\n \n" }, { "date": 1694489668381, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -28,9 +28,9 @@\n randomNumbers(count) {\n let numbers: number[] = [];\n while (numbers.length < count) {\n let random = Math.floor(Math.random() * 10) + 1;\n- if (numbers) {\n+ if (numbers.includes) {\n \n }\n }\n }\n" }, { "date": 1694489755200, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -28,12 +28,13 @@\n randomNumbers(count) {\n let numbers: number[] = [];\n while (numbers.length < count) {\n let random = Math.floor(Math.random() * 10) + 1;\n- if (numbers.includes) {\n-\n+ if (!numbers.includes(random)) {\n+ numbers.push(random);\n }\n }\n+ return numbers;\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694490183461, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -26,14 +26,19 @@\n }\n \n randomNumbers(count) {\n let numbers: number[] = [];\n- while (numbers.length < count) {\n+ while (count < 7 ? numbers.length < count : numbers.length < count - 1) {\n let random = Math.floor(Math.random() * 10) + 1;\n if (!numbers.includes(random)) {\n numbers.push(random);\n }\n }\n+\n+ if (count >= 7) {\n+ numbers.push(numbers[Math.floor(Math.random() * numbers.length)]);\n+ }\n+\n return numbers;\n }\n \n update(deltaTime: number) {\n" }, { "date": 1694490276046, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -21,9 +21,12 @@\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n initUI() { \n+ this.randomNumList = [];\n+ this.randomNumList = this.randomNumbers(7);\n \n+ console.log(\"=========== randomList =\", this.randomNumList);\n }\n \n randomNumbers(count) {\n let numbers: number[] = [];\n" }, { "date": 1694490430359, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -29,9 +29,10 @@\n }\n \n randomNumbers(count) {\n let numbers: number[] = [];\n- while (count < 7 ? numbers.length < count : numbers.length < count - 1) {\n+ let randomCount = count < 7 ? count: count - 1;\n+ while () {\n let random = Math.floor(Math.random() * 10) + 1;\n if (!numbers.includes(random)) {\n numbers.push(random);\n }\n" }, { "date": 1694490451215, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -30,9 +30,9 @@\n \n randomNumbers(count) {\n let numbers: number[] = [];\n let randomCount = count < 7 ? count: count - 1;\n- while () {\n+ while (numbers < randomCount) {\n let random = Math.floor(Math.random() * 10) + 1;\n if (!numbers.includes(random)) {\n numbers.push(random);\n }\n" }, { "date": 1694490551761, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -30,9 +30,9 @@\n \n randomNumbers(count) {\n let numbers: number[] = [];\n let randomCount = count < 7 ? count: count - 1;\n- while (numbers < randomCount) {\n+ while (numbers.length < randomCount) {\n let random = Math.floor(Math.random() * 10) + 1;\n if (!numbers.includes(random)) {\n numbers.push(random);\n }\n" }, { "date": 1694490905128, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -10,9 +10,9 @@\n \n @property(Prefab)\n itemPrefabList: Prefab[] = [];\n \n- randomNumList: number[] = [];\n+ randomFruitList: number[] = [];\n \n start() {\n \n }\n@@ -21,12 +21,12 @@\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n initUI() { \n- this.randomNumList = [];\n- this.randomNumList = this.randomNumbers(7);\n+ this.randomFruitList = [];\n+ this.randomFruitList = this.randomNumbers(7);\n \n- console.log(\"=========== randomList =\", this.randomNumList);\n+ console.log(\"=========== randomList =\", this.randomFruitList);\n }\n \n randomNumbers(count) {\n let numbers: number[] = [];\n" }, { "date": 1694490960985, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -44,8 +44,12 @@\n \n return numbers;\n }\n \n+ randomSelectFruit() {\n+ \n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694490988496, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -11,8 +11,9 @@\n @property(Prefab)\n itemPrefabList: Prefab[] = [];\n \n randomFruitList: number[] = [];\n+ selectFruitList: number[] = [];\n \n start() {\n \n }\n@@ -45,9 +46,9 @@\n return numbers;\n }\n \n randomSelectFruit() {\n- \n+\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694491513608, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -10,10 +10,12 @@\n \n @property(Prefab)\n itemPrefabList: Prefab[] = [];\n \n+\n randomFruitList: number[] = [];\n selectFruitList: number[] = [];\n+ positionList: number[] = [];\n \n start() {\n \n }\n@@ -45,10 +47,24 @@\n \n return numbers;\n }\n \n- randomSelectFruit() {\n-\n+ randomSelectFruit(levelNum) {\n+ let numbers: number[] = [];\n+ if (levelNum < 3) {\n+ numbers.push(this.randomFruitList[Math.floor(Math.random() * this.randomFruitList.length)]);\n+ } else {\n+ let firstIndex = Math.floor(Math.random() * this.randomFruitList.length);\n+ let twoIndex = -1;\n+ while (twoIndex == -1) {\n+ let index = Math.floor(Math.random() * this.randomFruitList.length);\n+ if (index != firstIndex) {\n+ twoIndex = index;\n+ }\n+ }\n+ numbers.push(this.randomFruitList[firstIndex], this.randomFruitList[twoIndex]);\n+ }\n+ return numbers;\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694491520823, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -47,9 +47,9 @@\n \n return numbers;\n }\n \n- randomSelectFruit(levelNum) {\n+ randomSelectFruit(levelNum: number) {\n let numbers: number[] = [];\n if (levelNum < 3) {\n numbers.push(this.randomFruitList[Math.floor(Math.random() * this.randomFruitList.length)]);\n } else {\n" }, { "date": 1694491526837, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -30,9 +30,9 @@\n \n console.log(\"=========== randomList =\", this.randomFruitList);\n }\n \n- randomNumbers(count) {\n+ randomNumbers(count: number) {\n let numbers: number[] = [];\n let randomCount = count < 7 ? count: count - 1;\n while (numbers.length < randomCount) {\n let random = Math.floor(Math.random() * 10) + 1;\n" }, { "date": 1694491603954, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -26,10 +26,12 @@\n */\n initUI() { \n this.randomFruitList = [];\n this.randomFruitList = this.randomNumbers(7);\n+ this.selectFruitList = this.randomSelectFruit(3);\n \n console.log(\"=========== randomList =\", this.randomFruitList);\n+ console.log(\"=========== selectFruitList =\", this.selectFruitList);\n }\n \n randomNumbers(count: number) {\n let numbers: number[] = [];\n" }, { "date": 1694491881402, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -67,8 +67,19 @@\n }\n return numbers;\n }\n \n+ randomPosition(count: number) {\n+ let numbers: number[] = [];\n+ while (numbers.length < count) {\n+ let random = Math.floor(Math.random() * 9);\n+ if (!numbers.includes(random)) {\n+ numbers.push(random);\n+ }\n+ }\n+ return numbers;\n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694491961283, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -27,8 +27,9 @@\n initUI() { \n this.randomFruitList = [];\n this.randomFruitList = this.randomNumbers(7);\n this.selectFruitList = this.randomSelectFruit(3);\n+ this.positionList = this.randomPosition(7);\n \n console.log(\"=========== randomList =\", this.randomFruitList);\n console.log(\"=========== selectFruitList =\", this.selectFruitList);\n }\n" }, { "date": 1694491990065, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -25,8 +25,10 @@\n * 每次GameManager.StartGame()时都会调用\n */\n initUI() { \n this.randomFruitList = [];\n+ this.selectFruitList = [];\n+ this.positionList = [];\n this.randomFruitList = this.randomNumbers(7);\n this.selectFruitList = this.randomSelectFruit(3);\n this.positionList = this.randomPosition(7);\n \n" }, { "date": 1694492011887, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -33,8 +33,9 @@\n this.positionList = this.randomPosition(7);\n \n console.log(\"=========== randomList =\", this.randomFruitList);\n console.log(\"=========== selectFruitList =\", this.selectFruitList);\n+ console.log(\"=========== positionList =\", this.positionList);\n }\n \n randomNumbers(count: number) {\n let numbers: number[] = [];\n" }, { "date": 1694492277215, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -82,8 +82,12 @@\n }\n return numbers;\n }\n \n+ generateFruits() {\n+ \n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694492378497, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -83,11 +83,17 @@\n return numbers;\n }\n \n generateFruits() {\n- \n+\n }\n \n+ clearAllRootChildren() {\n+ for (let i = 0; i < this.rootNodeList.length; i++) {\n+ this.rootNodeList[i].destroyAllChildren();\n+ }\n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694492527055, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,5 @@\n-import { _decorator, Component, Prefab, Node } from 'cc';\n+import { _decorator, Component, Prefab, Node, instantiate } from 'cc';\n import { GameManager } from '../Manager/GameManager';\n const { ccclass, property } = _decorator;\n \n @ccclass('GameMain')\n@@ -83,9 +83,13 @@\n return numbers;\n }\n \n generateFruits() {\n-\n+ this.clearAllRootChildren();\n+ for (let i = 0; i < this.randomFruitList.length; i++) {\n+ let item = instantiate(this.itemPrefabList[this.randomFruitList[i] - 1]);\n+ this.rootNodeList[this.positionList[i]].addChild(item);\n+ }\n }\n \n clearAllRootChildren() {\n for (let i = 0; i < this.rootNodeList.length; i++) {\n" }, { "date": 1694492544490, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -31,8 +31,10 @@\n this.randomFruitList = this.randomNumbers(7);\n this.selectFruitList = this.randomSelectFruit(3);\n this.positionList = this.randomPosition(7);\n \n+ this.generateFruits();\n+\n console.log(\"=========== randomList =\", this.randomFruitList);\n console.log(\"=========== selectFruitList =\", this.selectFruitList);\n console.log(\"=========== positionList =\", this.positionList);\n }\n" }, { "date": 1694494171616, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -14,8 +14,10 @@\n \n randomFruitList: number[] = [];\n selectFruitList: number[] = [];\n positionList: number[] = [];\n+ randomFruitCount: number = 0;\n+ selectCount: number = 0;\n \n start() {\n \n }\n@@ -27,8 +29,9 @@\n initUI() { \n this.randomFruitList = [];\n this.selectFruitList = [];\n this.positionList = [];\n+ this.getRandomByLevelNum(1);\n this.randomFruitList = this.randomNumbers(7);\n this.selectFruitList = this.randomSelectFruit(3);\n this.positionList = this.randomPosition(7);\n \n@@ -38,8 +41,21 @@\n console.log(\"=========== selectFruitList =\", this.selectFruitList);\n console.log(\"=========== positionList =\", this.positionList);\n }\n \n+ getRandomByLevelNum(levelNum) {\n+ if (levelNum == 1) {\n+ this.randomFruitCount = 3;\n+ this.selectCount = 1;\n+ } else if (levelNum === 2) {\n+ this.randomFruitCount = 5;\n+ this.selectCount = 1;\n+ } else {\n+ this.randomFruitCount = 7;\n+ this.selectCount = 2;\n+ }\n+ }\n+\n randomNumbers(count: number) {\n let numbers: number[] = [];\n let randomCount = count < 7 ? count: count - 1;\n while (numbers.length < randomCount) {\n" }, { "date": 1694494244538, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -30,11 +30,11 @@\n this.randomFruitList = [];\n this.selectFruitList = [];\n this.positionList = [];\n this.getRandomByLevelNum(1);\n- this.randomFruitList = this.randomNumbers(7);\n- this.selectFruitList = this.randomSelectFruit(3);\n- this.positionList = this.randomPosition(7);\n+ this.randomFruitList = this.randomNumbers(this.randomFruitCount);\n+ this.selectFruitList = this.randomSelectFruit(t);\n+ this.positionList = this.randomPosition(this.randomFruitCount);\n \n this.generateFruits();\n \n console.log(\"=========== randomList =\", this.randomFruitList);\n@@ -44,15 +44,12 @@\n \n getRandomByLevelNum(levelNum) {\n if (levelNum == 1) {\n this.randomFruitCount = 3;\n- this.selectCount = 1;\n } else if (levelNum === 2) {\n this.randomFruitCount = 5;\n- this.selectCount = 1;\n } else {\n this.randomFruitCount = 7;\n- this.selectCount = 2;\n }\n }\n \n randomNumbers(count: number) {\n" }, { "date": 1694494275889, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -29,11 +29,12 @@\n initUI() { \n this.randomFruitList = [];\n this.selectFruitList = [];\n this.positionList = [];\n- this.getRandomByLevelNum(1);\n+ let levelNum = 1;\n+ this.getRandomByLevelNum(levelNum);\n this.randomFruitList = this.randomNumbers(this.randomFruitCount);\n- this.selectFruitList = this.randomSelectFruit(t);\n+ this.selectFruitList = this.randomSelectFruit(levelNum);\n this.positionList = this.randomPosition(this.randomFruitCount);\n \n this.generateFruits();\n \n" }, { "date": 1694495616884, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,5 @@\n-import { _decorator, Component, Prefab, Node, instantiate } from 'cc';\n+import { _decorator, Component, Prefab, Node, instantiate, tween } from 'cc';\n import { GameManager } from '../Manager/GameManager';\n const { ccclass, property } = _decorator;\n \n @ccclass('GameMain')\n@@ -112,8 +112,42 @@\n this.rootNodeList[i].destroyAllChildren();\n }\n }\n \n+ // setTimeoutToTimes(time, times, tagNode, callback) {\n+ // let repeatTimes = 1;\n+ // if(times){\n+ // repeatTimes = times;\n+ // };\n+\n+ // if(tagNode){\n+ // let action = cc.tween(tagNode)\n+ // .delay(time)\n+ // .call(() => { \n+ // if(callback){\n+ // callback();\n+ // }\n+ // });\n+ // let act = cc.tween(tagNode)\n+ // .repeat(repeatTimes, action)\n+ // .start();\n+ // return act;\n+ // }else{\n+ // console.warn(\"setTimeout tagNode is Null\");\n+ // return null;\n+ // }\n+ // }\n+\n+ setTimeOutToTimes(time: number, times: number, tagNode: Node, callback: any) {\n+ let repeatTimes = 1;\n+ if (times) { repeatTimes = times; }\n+\n+ if (tagNode) {\n+ let action = tween(tagNode).delay(time).call(() => { if (callback) { callback() } });\n+ let act = tween(tagNode).repeat(repeatTimes, action).start();\n+ }\n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694495785688, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -30,14 +30,21 @@\n this.randomFruitList = [];\n this.selectFruitList = [];\n this.positionList = [];\n let levelNum = 1;\n+ let time = 3;\n this.getRandomByLevelNum(levelNum);\n this.randomFruitList = this.randomNumbers(this.randomFruitCount);\n this.selectFruitList = this.randomSelectFruit(levelNum);\n this.positionList = this.randomPosition(this.randomFruitCount);\n \n this.generateFruits();\n+ this.setTimeOutToTimes(1, time, this.node, () => {\n+ time--;\n+ if (time <= 0) {\n+ \n+ }\n+ });\n \n console.log(\"=========== randomList =\", this.randomFruitList);\n console.log(\"=========== selectFruitList =\", this.selectFruitList);\n console.log(\"=========== positionList =\", this.positionList);\n" }, { "date": 1694495887644, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -37,14 +37,11 @@\n this.selectFruitList = this.randomSelectFruit(levelNum);\n this.positionList = this.randomPosition(this.randomFruitCount);\n \n this.generateFruits();\n- this.setTimeOutToTimes(1, time, this.node, () => {\n- time--;\n- if (time <= 0) {\n- \n- }\n- });\n+ setTimeout(() => {\n+ \n+ }, time * 1000);\n \n console.log(\"=========== randomList =\", this.randomFruitList);\n console.log(\"=========== selectFruitList =\", this.selectFruitList);\n console.log(\"=========== positionList =\", this.positionList);\n" }, { "date": 1694495899983, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -36,16 +36,16 @@\n this.randomFruitList = this.randomNumbers(this.randomFruitCount);\n this.selectFruitList = this.randomSelectFruit(levelNum);\n this.positionList = this.randomPosition(this.randomFruitCount);\n \n+ console.log(\"=========== randomList =\", this.randomFruitList);\n+ console.log(\"=========== selectFruitList =\", this.selectFruitList);\n+ console.log(\"=========== positionList =\", this.positionList);\n+\n this.generateFruits();\n setTimeout(() => {\n- \n+\n }, time * 1000);\n-\n- console.log(\"=========== randomList =\", this.randomFruitList);\n- console.log(\"=========== selectFruitList =\", this.selectFruitList);\n- console.log(\"=========== positionList =\", this.positionList);\n }\n \n getRandomByLevelNum(levelNum) {\n if (levelNum == 1) {\n" }, { "date": 1694495920512, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -116,39 +116,16 @@\n this.rootNodeList[i].destroyAllChildren();\n }\n }\n \n- // setTimeoutToTimes(time, times, tagNode, callback) {\n- // let repeatTimes = 1;\n- // if(times){\n- // repeatTimes = times;\n- // };\n-\n- // if(tagNode){\n- // let action = cc.tween(tagNode)\n- // .delay(time)\n- // .call(() => { \n- // if(callback){\n- // callback();\n- // }\n- // });\n- // let act = cc.tween(tagNode)\n- // .repeat(repeatTimes, action)\n- // .start();\n- // return act;\n- // }else{\n- // console.warn(\"setTimeout tagNode is Null\");\n- // return null;\n- // }\n- // }\n-\n setTimeOutToTimes(time: number, times: number, tagNode: Node, callback: any) {\n let repeatTimes = 1;\n if (times) { repeatTimes = times; }\n \n if (tagNode) {\n let action = tween(tagNode).delay(time).call(() => { if (callback) { callback() } });\n let act = tween(tagNode).repeat(repeatTimes, action).start();\n+ return act;\n }\n }\n \n update(deltaTime: number) {\n" }, { "date": 1694495942266, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -127,8 +127,12 @@\n return act;\n }\n }\n \n+ hideFruit() {\n+ \n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694496039058, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -128,9 +128,11 @@\n }\n }\n \n hideFruit() {\n- \n+ for (let i = 0; i < this.rootNodeList.length; i++) {\n+ this.rootNodeList[i].children[0].active = false;\n+ }\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694496049825, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -42,9 +42,9 @@\n console.log(\"=========== positionList =\", this.positionList);\n \n this.generateFruits();\n setTimeout(() => {\n-\n+ this.hideFruit();\n }, time * 1000);\n }\n \n getRandomByLevelNum(levelNum) {\n" }, { "date": 1694496143133, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -129,9 +129,11 @@\n }\n \n hideFruit() {\n for (let i = 0; i < this.rootNodeList.length; i++) {\n- this.rootNodeList[i].children[0].active = false;\n+ if (this.rootNodeList[i].children.length > 0) {\n+ this.rootNodeList[i].children[0].active = false;\n+ }\n }\n }\n \n update(deltaTime: number) {\n" }, { "date": 1694496612606, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,5 @@\n-import { _decorator, Component, Prefab, Node, instantiate, tween } from 'cc';\n+import { _decorator, Component, Prefab, Node, instantiate, tween, Label } from 'cc';\n import { GameManager } from '../Manager/GameManager';\n const { ccclass, property } = _decorator;\n \n @ccclass('GameMain')\n@@ -10,9 +10,15 @@\n \n @property(Prefab)\n itemPrefabList: Prefab[] = [];\n \n+ @property(Node)\n+ maskNode: Node = null;\n \n+ @property(Label)\n+ timeLabel: Label = null;\n+\n+\n randomFruitList: number[] = [];\n selectFruitList: number[] = [];\n positionList: number[] = [];\n randomFruitCount: number = 0;\n" }, { "date": 1694496691902, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -141,8 +141,12 @@\n }\n }\n }\n \n+ startCountdown() {\n+ \n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694496788803, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -142,9 +142,15 @@\n }\n }\n \n startCountdown() {\n- \n+ let time = 3;\n+ let cdTween = this.setTimeOutToTimes(1, time, this.node, () => {\n+ time--;\n+ if (time <= 0) {\n+ \n+ }\n+ });\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694496822649, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -146,9 +146,11 @@\n let time = 3;\n let cdTween = this.setTimeOutToTimes(1, time, this.node, () => {\n time--;\n if (time <= 0) {\n- \n+ cdTween.stop();\n+ cdTween.removeSelf();\n+ cdTween = null;\n }\n });\n }\n \n" }, { "date": 1694496849492, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -144,8 +144,9 @@\n \n startCountdown() {\n let time = 3;\n let cdTween = this.setTimeOutToTimes(1, time, this.node, () => {\n+ this.timeLabel.string = time + \"\";\n time--;\n if (time <= 0) {\n cdTween.stop();\n cdTween.removeSelf();\n" }, { "date": 1694496865266, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -150,8 +150,9 @@\n if (time <= 0) {\n cdTween.stop();\n cdTween.removeSelf();\n cdTween = null;\n+ this.maskNode.active = false;\n }\n });\n }\n \n" }, { "date": 1694496901492, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -49,8 +49,10 @@\n \n this.generateFruits();\n setTimeout(() => {\n this.hideFruit();\n+ this.maskNode.active = true;\n+ this.startCountdown();\n }, time * 1000);\n }\n \n getRandomByLevelNum(levelNum) {\n" }, { "date": 1694497006554, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -50,8 +50,10 @@\n this.generateFruits();\n setTimeout(() => {\n this.hideFruit();\n this.maskNode.active = true;\n+ let item = 3;\n+ this.timeLabel.string = time + \"\";\n this.startCountdown();\n }, time * 1000);\n }\n \n" }, { "date": 1694497011722, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -50,9 +50,9 @@\n this.generateFruits();\n setTimeout(() => {\n this.hideFruit();\n this.maskNode.active = true;\n- let item = 3;\n+ let time = 3;\n this.timeLabel.string = time + \"\";\n this.startCountdown();\n }, time * 1000);\n }\n" }, { "date": 1694497023796, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -145,10 +145,9 @@\n }\n }\n }\n \n- startCountdown() {\n- let time = 3;\n+ startCountdown(time) {\n let cdTween = this.setTimeOutToTimes(1, time, this.node, () => {\n this.timeLabel.string = time + \"\";\n time--;\n if (time <= 0) {\n" }, { "date": 1694497043985, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -52,9 +52,9 @@\n this.hideFruit();\n this.maskNode.active = true;\n let time = 3;\n this.timeLabel.string = time + \"\";\n- this.startCountdown();\n+ this.startCountdown(time);\n }, time * 1000);\n }\n \n getRandomByLevelNum(levelNum) {\n" }, { "date": 1694497087421, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -147,10 +147,10 @@\n }\n \n startCountdown(time) {\n let cdTween = this.setTimeOutToTimes(1, time, this.node, () => {\n+ time--;\n this.timeLabel.string = time + \"\";\n- time--;\n if (time <= 0) {\n cdTween.stop();\n cdTween.removeSelf();\n cdTween = null;\n" }, { "date": 1694497193819, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -154,12 +154,18 @@\n cdTween.stop();\n cdTween.removeSelf();\n cdTween = null;\n this.maskNode.active = false;\n+ // 开始选择\n+ this.startBlink();\n }\n });\n }\n \n+ startBlink() {\n+ \n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694504412036, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -122,9 +122,9 @@\n }\n \n clearAllRootChildren() {\n for (let i = 0; i < this.rootNodeList.length; i++) {\n- this.rootNodeList[i].destroyAllChildren();\n+ this.rootNodeList[i].children[1];\n }\n }\n \n setTimeOutToTimes(time: number, times: number, tagNode: Node, callback: any) {\n@@ -161,9 +161,9 @@\n });\n }\n \n startBlink() {\n- \n+\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694504583481, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -161,9 +161,11 @@\n });\n }\n \n startBlink() {\n-\n+ for (let i = 0; i < this.positionList.length; i++) {\n+ this.rootNodeList[this.positionList[i]].emit(\"show\");\n+ }\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694504590639, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -162,9 +162,9 @@\n }\n \n startBlink() {\n for (let i = 0; i < this.positionList.length; i++) {\n- this.rootNodeList[this.positionList[i]].emit(\"show\");\n+ this.rootNodeList[this.positionList[i]].emit(\"show\", i);\n }\n }\n \n update(deltaTime: number) {\n" }, { "date": 1694504937829, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -140,9 +140,9 @@\n \n hideFruit() {\n for (let i = 0; i < this.rootNodeList.length; i++) {\n if (this.rootNodeList[i].children.length > 0) {\n- this.rootNodeList[i].children[0].active = false;\n+ this.rootNodeList[i].children[1].active = false;\n }\n }\n }\n \n" }, { "date": 1694504996184, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -139,9 +139,9 @@\n }\n \n hideFruit() {\n for (let i = 0; i < this.rootNodeList.length; i++) {\n- if (this.rootNodeList[i].children.length > 0) {\n+ if (this.rootNodeList[i].children.length > 1) {\n this.rootNodeList[i].children[1].active = false;\n }\n }\n }\n" }, { "date": 1694506540411, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -161,11 +161,14 @@\n });\n }\n \n startBlink() {\n- for (let i = 0; i < this.positionList.length; i++) {\n- this.rootNodeList[this.positionList[i]].emit(\"show\", i);\n- }\n+ let tw = tween(this).call(() => {\n+ for (let i = 0; i < this.positionList.length; i++) {\n+ this.rootNodeList[this.positionList[i]].emit(\"show\", i);\n+ }\n+ }).delay(3);\n+ tween(this).repeatForever(tw).start();\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694507366946, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,6 +1,7 @@\n import { _decorator, Component, Prefab, Node, instantiate, tween, Label } from 'cc';\n import { GameManager } from '../Manager/GameManager';\n+import { EventUtils } from './EventUtils';\n const { ccclass, property } = _decorator;\n \n @ccclass('GameMain')\n export class GameMain extends Component {\n@@ -16,14 +17,25 @@\n \n @property(Label)\n timeLabel: Label = null;\n \n+ @property(Node)\n+ refrigeratorNode: Node = null;\n \n+\n randomFruitList: number[] = [];\n selectFruitList: number[] = [];\n positionList: number[] = [];\n randomFruitCount: number = 0;\n selectCount: number = 0;\n+\n+ onLoad() {\n+ EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n+ }\n+\n+ onDestroy() {\n+ EventUtils.off(\"stopBlink\", this.onStopBlink, this);\n+ }\n \n start() {\n \n }\n@@ -169,8 +181,15 @@\n }).delay(3);\n tween(this).repeatForever(tw).start();\n }\n \n+ onStopBlink() {\n+\n+ for (let i = 0; i < this.positionList.length; i++) {\n+ this.rootNodeList[this.positionList[i]].emit(\"show\", i);\n+ }\n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694507403343, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -173,14 +173,14 @@\n });\n }\n \n startBlink() {\n- let tw = tween(this).call(() => {\n+ let tw = tween(this.refrigeratorNode).call(() => {\n for (let i = 0; i < this.positionList.length; i++) {\n this.rootNodeList[this.positionList[i]].emit(\"show\", i);\n }\n }).delay(3);\n- tween(this).repeatForever(tw).start();\n+ tween(this.refrigeratorNode).repeatForever(tw).start();\n }\n \n onStopBlink() {\n \n" }, { "date": 1694507429743, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,5 @@\n-import { _decorator, Component, Prefab, Node, instantiate, tween, Label } from 'cc';\n+import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween } from 'cc';\n import { GameManager } from '../Manager/GameManager';\n import { EventUtils } from './EventUtils';\n const { ccclass, property } = _decorator;\n \n@@ -182,11 +182,11 @@\n tween(this.refrigeratorNode).repeatForever(tw).start();\n }\n \n onStopBlink() {\n-\n+ Tween.stopAllByTarget(this.refrigeratorNode);\n for (let i = 0; i < this.positionList.length; i++) {\n- this.rootNodeList[this.positionList[i]].emit(\"show\", i);\n+ this.rootNodeList[this.positionList[i]].emit(\"hide\");\n }\n }\n \n update(deltaTime: number) {\n" }, { "date": 1694508062810, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,7 +1,8 @@\n import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween } from 'cc';\n import { GameManager } from '../Manager/GameManager';\n import { EventUtils } from './EventUtils';\n+import { GameDataManager } from './GameDataManager';\n const { ccclass, property } = _decorator;\n \n @ccclass('GameMain')\n export class GameMain extends Component {\n@@ -36,29 +37,31 @@\n EventUtils.off(\"stopBlink\", this.onStopBlink, this);\n }\n \n start() {\n- \n+ GameDataManager.randomFruitList\n+ GameDataManager.selectFruitList\n+ GameDataManager.positionList\n }\n \n /**\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n initUI() { \n- this.randomFruitList = [];\n- this.selectFruitList = [];\n- this.positionList = [];\n+ GameDataManager.randomFruitList = [];\n+ GameDataManager.selectFruitList = [];\n+ GameDataManager.positionList = [];\n let levelNum = 1;\n let time = 3;\n this.getRandomByLevelNum(levelNum);\n- this.randomFruitList = this.randomNumbers(this.randomFruitCount);\n- this.selectFruitList = this.randomSelectFruit(levelNum);\n- this.positionList = this.randomPosition(this.randomFruitCount);\n+ GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n+ GameDataManager.selectFruitList = this.randomSelectFruit(levelNum);\n+ GameDataManager.positionList = this.randomPosition(this.randomFruitCount);\n \n- console.log(\"=========== randomList =\", this.randomFruitList);\n- console.log(\"=========== selectFruitList =\", this.selectFruitList);\n- console.log(\"=========== positionList =\", this.positionList);\n+ console.log(\"=========== randomList =\", GameDataManager.randomFruitList);\n+ console.log(\"=========== selectFruitList =\", GameDataManager.selectFruitList);\n+ console.log(\"=========== positionList =\", GameDataManager.positionList);\n \n this.generateFruits();\n setTimeout(() => {\n this.hideFruit();\n@@ -98,19 +101,19 @@\n \n randomSelectFruit(levelNum: number) {\n let numbers: number[] = [];\n if (levelNum < 3) {\n- numbers.push(this.randomFruitList[Math.floor(Math.random() * this.randomFruitList.length)]);\n+ numbers.push(GameDataManager.randomFruitList[Math.floor(Math.random() * GameDataManager.randomFruitList.length)]);\n } else {\n- let firstIndex = Math.floor(Math.random() * this.randomFruitList.length);\n+ let firstIndex = Math.floor(Math.random() * GameDataManager.randomFruitList.length);\n let twoIndex = -1;\n while (twoIndex == -1) {\n- let index = Math.floor(Math.random() * this.randomFruitList.length);\n+ let index = Math.floor(Math.random() * GameDataManager.randomFruitList.length);\n if (index != firstIndex) {\n twoIndex = index;\n }\n }\n- numbers.push(this.randomFruitList[firstIndex], this.randomFruitList[twoIndex]);\n+ numbers.push(GameDataManager.randomFruitList[firstIndex], GameDataManager.randomFruitList[twoIndex]);\n }\n return numbers;\n }\n \n@@ -126,11 +129,11 @@\n }\n \n generateFruits() {\n this.clearAllRootChildren();\n- for (let i = 0; i < this.randomFruitList.length; i++) {\n- let item = instantiate(this.itemPrefabList[this.randomFruitList[i] - 1]);\n- this.rootNodeList[this.positionList[i]].addChild(item);\n+ for (let i = 0; i < GameDataManager.randomFruitList.length; i++) {\n+ let item = instantiate(this.itemPrefabList[GameDataManager.randomFruitList[i] - 1]);\n+ this.rootNodeList[GameDataManager.positionList[i]].addChild(item);\n }\n }\n \n clearAllRootChildren() {\n@@ -174,19 +177,19 @@\n }\n \n startBlink() {\n let tw = tween(this.refrigeratorNode).call(() => {\n- for (let i = 0; i < this.positionList.length; i++) {\n- this.rootNodeList[this.positionList[i]].emit(\"show\", i);\n+ for (let i = 0; i < GameDataManager.positionList.length; i++) {\n+ this.rootNodeList[GameDataManager.positionList[i]].emit(\"show\", i);\n }\n }).delay(3);\n tween(this.refrigeratorNode).repeatForever(tw).start();\n }\n \n onStopBlink() {\n Tween.stopAllByTarget(this.refrigeratorNode);\n- for (let i = 0; i < this.positionList.length; i++) {\n- this.rootNodeList[this.positionList[i]].emit(\"hide\");\n+ for (let i = 0; i < GameDataManager.positionList.length; i++) {\n+ this.rootNodeList[GameDataManager.positionList[i]].emit(\"hide\");\n }\n }\n \n update(deltaTime: number) {\n" }, { "date": 1694508073197, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -37,11 +37,9 @@\n EventUtils.off(\"stopBlink\", this.onStopBlink, this);\n }\n \n start() {\n- GameDataManager.randomFruitList\n- GameDataManager.selectFruitList\n- GameDataManager.positionList\n+ \n }\n \n /**\n * 初始化逻辑\n" }, { "date": 1694508146359, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -48,9 +48,9 @@\n initUI() { \n GameDataManager.randomFruitList = [];\n GameDataManager.selectFruitList = [];\n GameDataManager.positionList = [];\n- let levelNum = 1;\n+ let levelNum = 3;\n let time = 3;\n this.getRandomByLevelNum(levelNum);\n GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n GameDataManager.selectFruitList = this.randomSelectFruit(levelNum);\n" }, { "date": 1694508419050, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -178,9 +178,9 @@\n let tw = tween(this.refrigeratorNode).call(() => {\n for (let i = 0; i < GameDataManager.positionList.length; i++) {\n this.rootNodeList[GameDataManager.positionList[i]].emit(\"show\", i);\n }\n- }).delay(3);\n+ }).delay(7);\n tween(this.refrigeratorNode).repeatForever(tw).start();\n }\n \n onStopBlink() {\n" }, { "date": 1694508469626, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -178,9 +178,9 @@\n let tw = tween(this.refrigeratorNode).call(() => {\n for (let i = 0; i < GameDataManager.positionList.length; i++) {\n this.rootNodeList[GameDataManager.positionList[i]].emit(\"show\", i);\n }\n- }).delay(7);\n+ }).delay(GameDataManager.positionList.length);\n tween(this.refrigeratorNode).repeatForever(tw).start();\n }\n \n onStopBlink() {\n" }, { "date": 1694508670502, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -169,8 +169,9 @@\n cdTween = null;\n this.maskNode.active = false;\n // 开始选择\n this.startBlink();\n+ this.startSelect();\n }\n });\n }\n \n@@ -189,8 +190,12 @@\n this.rootNodeList[GameDataManager.positionList[i]].emit(\"hide\");\n }\n }\n \n+ startSelect() {\n+ \n+ }\n+\n update(deltaTime: number) {\n \n }\n }\n" }, { "date": 1694508685630, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -48,8 +48,9 @@\n initUI() { \n GameDataManager.randomFruitList = [];\n GameDataManager.selectFruitList = [];\n GameDataManager.positionList = [];\n+ GameDataManager.currentSelect = -1;\n let levelNum = 3;\n let time = 3;\n this.getRandomByLevelNum(levelNum);\n GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n@@ -191,9 +192,9 @@\n }\n }\n \n startSelect() {\n- \n+\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694508866939, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -44,9 +44,9 @@\n /**\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n- initUI() { \n+ initUI(gameData) { \n GameDataManager.randomFruitList = [];\n GameDataManager.selectFruitList = [];\n GameDataManager.positionList = [];\n GameDataManager.currentSelect = -1;\n" }, { "date": 1694508895885, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -49,10 +49,10 @@\n GameDataManager.randomFruitList = [];\n GameDataManager.selectFruitList = [];\n GameDataManager.positionList = [];\n GameDataManager.currentSelect = -1;\n- let levelNum = 3;\n- let time = 3;\n+ let levelNum = gameData[\"id\"] || 1;\n+ let time = gameData[\"time\"] || 3;\n this.getRandomByLevelNum(levelNum);\n GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n GameDataManager.selectFruitList = this.randomSelectFruit(levelNum);\n GameDataManager.positionList = this.randomPosition(this.randomFruitCount);\n" }, { "date": 1694509175678, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -44,9 +44,10 @@\n /**\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n- initUI(gameData) { \n+ initUI(gameData) {\n+ this.onStopBlink();\n GameDataManager.randomFruitList = [];\n GameDataManager.selectFruitList = [];\n GameDataManager.positionList = [];\n GameDataManager.currentSelect = -1;\n" }, { "date": 1694509206806, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -46,8 +46,9 @@\n * 每次GameManager.StartGame()时都会调用\n */\n initUI(gameData) {\n this.onStopBlink();\n+ this.clearAllRootChildren();\n GameDataManager.randomFruitList = [];\n GameDataManager.selectFruitList = [];\n GameDataManager.positionList = [];\n GameDataManager.currentSelect = -1;\n" }, { "date": 1694509215283, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -129,9 +129,9 @@\n return numbers;\n }\n \n generateFruits() {\n- this.clearAllRootChildren();\n+ // this.clearAllRootChildren();\n for (let i = 0; i < GameDataManager.randomFruitList.length; i++) {\n let item = instantiate(this.itemPrefabList[GameDataManager.randomFruitList[i] - 1]);\n this.rootNodeList[GameDataManager.positionList[i]].addChild(item);\n }\n" }, { "date": 1694509348384, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -53,8 +53,9 @@\n GameDataManager.positionList = [];\n GameDataManager.currentSelect = -1;\n let levelNum = gameData[\"id\"] || 1;\n let time = gameData[\"time\"] || 3;\n+ let countdownTime = gameData[\"countdown\"] || 3;\n this.getRandomByLevelNum(levelNum);\n GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n GameDataManager.selectFruitList = this.randomSelectFruit(levelNum);\n GameDataManager.positionList = this.randomPosition(this.randomFruitCount);\n" }, { "date": 1694509387704, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -67,11 +67,10 @@\n this.generateFruits();\n setTimeout(() => {\n this.hideFruit();\n this.maskNode.active = true;\n- let time = 3;\n this.timeLabel.string = time + \"\";\n- this.startCountdown(time);\n+ this.startCountdown(countdownTime);\n }, time * 1000);\n }\n \n getRandomByLevelNum(levelNum) {\n" }, { "date": 1694509528332, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -138,9 +138,9 @@\n }\n \n clearAllRootChildren() {\n for (let i = 0; i < this.rootNodeList.length; i++) {\n- this.rootNodeList[i].children[1];\n+ this.rootNodeList[i].children[1].destroy();\n }\n }\n \n setTimeOutToTimes(time: number, times: number, tagNode: Node, callback: any) {\n" }, { "date": 1694509553220, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -129,9 +129,8 @@\n return numbers;\n }\n \n generateFruits() {\n- // this.clearAllRootChildren();\n for (let i = 0; i < GameDataManager.randomFruitList.length; i++) {\n let item = instantiate(this.itemPrefabList[GameDataManager.randomFruitList[i] - 1]);\n this.rootNodeList[GameDataManager.positionList[i]].addChild(item);\n }\n" }, { "date": 1694509648784, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -27,8 +27,11 @@\n selectFruitList: number[] = [];\n positionList: number[] = [];\n randomFruitCount: number = 0;\n selectCount: number = 0;\n+ waitingTime: number = 0;\n+ countdownTime: number = 0;\n+ levelNum: number = 0;\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n }\n" }, { "date": 1694509668059, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -54,14 +54,14 @@\n GameDataManager.randomFruitList = [];\n GameDataManager.selectFruitList = [];\n GameDataManager.positionList = [];\n GameDataManager.currentSelect = -1;\n- let levelNum = gameData[\"id\"] || 1;\n+ this.levelNum = gameData[\"id\"] || 1;\n let time = gameData[\"time\"] || 3;\n let countdownTime = gameData[\"countdown\"] || 3;\n- this.getRandomByLevelNum(levelNum);\n+ this.getRandomByLevelNum(this.levelNum);\n GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n- GameDataManager.selectFruitList = this.randomSelectFruit(levelNum);\n+ GameDataManager.selectFruitList = this.randomSelectFruit(this.levelNum);\n GameDataManager.positionList = this.randomPosition(this.randomFruitCount);\n \n console.log(\"=========== randomList =\", GameDataManager.randomFruitList);\n console.log(\"=========== selectFruitList =\", GameDataManager.selectFruitList);\n" }, { "date": 1694509692555, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -55,9 +55,9 @@\n GameDataManager.selectFruitList = [];\n GameDataManager.positionList = [];\n GameDataManager.currentSelect = -1;\n this.levelNum = gameData[\"id\"] || 1;\n- let time = gameData[\"time\"] || 3;\n+ this.waitingTime = gameData[\"time\"] || 3;\n let countdownTime = gameData[\"countdown\"] || 3;\n this.getRandomByLevelNum(this.levelNum);\n GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n GameDataManager.selectFruitList = this.randomSelectFruit(this.levelNum);\n@@ -70,11 +70,11 @@\n this.generateFruits();\n setTimeout(() => {\n this.hideFruit();\n this.maskNode.active = true;\n- this.timeLabel.string = time + \"\";\n+ this.timeLabel.string = this.waitingTime + \"\";\n this.startCountdown(countdownTime);\n- }, time * 1000);\n+ }, this.waitingTime * 1000);\n }\n \n getRandomByLevelNum(levelNum) {\n if (levelNum == 1) {\n" }, { "date": 1694509705835, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -56,9 +56,9 @@\n GameDataManager.positionList = [];\n GameDataManager.currentSelect = -1;\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n- let countdownTime = gameData[\"countdown\"] || 3;\n+ this.countdownTime = gameData[\"countdown\"] || 3;\n this.getRandomByLevelNum(this.levelNum);\n GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n GameDataManager.selectFruitList = this.randomSelectFruit(this.levelNum);\n GameDataManager.positionList = this.randomPosition(this.randomFruitCount);\n@@ -71,9 +71,9 @@\n setTimeout(() => {\n this.hideFruit();\n this.maskNode.active = true;\n this.timeLabel.string = this.waitingTime + \"\";\n- this.startCountdown(countdownTime);\n+ this.startCountdown(this.countdownTime);\n }, this.waitingTime * 1000);\n }\n \n getRandomByLevelNum(levelNum) {\n" }, { "date": 1694509776440, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -196,9 +196,9 @@\n }\n }\n \n startSelect() {\n-\n+ GameDataManager.currentSelect = this.selectFruitList[0];\n }\n \n update(deltaTime: number) {\n \n" }, { "date": 1694510172124, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,7 @@\n import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween } from 'cc';\n+import { EventCustom } from '../Common/EventCustom';\n+import { Global } from '../Common/Global';\n import { GameManager } from '../Manager/GameManager';\n import { EventUtils } from './EventUtils';\n import { GameDataManager } from './GameDataManager';\n const { ccclass, property } = _decorator;\n@@ -199,10 +201,11 @@\n startSelect() {\n GameDataManager.currentSelect = this.selectFruitList[0];\n }\n \n- update(deltaTime: number) {\n-\n+ showTips(str) {\n+ let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n+ this.node.dispatchEvent(tip);\n }\n }\n \n \n" }, { "date": 1694510642790, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -199,8 +199,10 @@\n }\n \n startSelect() {\n GameDataManager.currentSelect = this.selectFruitList[0];\n+ let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n+ this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n showTips(str) {\n let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n" }, { "date": 1694510732660, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -142,9 +142,11 @@\n }\n \n clearAllRootChildren() {\n for (let i = 0; i < this.rootNodeList.length; i++) {\n- this.rootNodeList[i].children[1].destroy();\n+ if (this.rootNodeList[i].children[1]) {\n+ this.rootNodeList[i].children[1].destroy();\n+ }\n }\n }\n \n setTimeOutToTimes(time: number, times: number, tagNode: Node, callback: any) {\n" }, { "date": 1694511006331, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -201,8 +201,9 @@\n }\n \n startSelect() {\n GameDataManager.currentSelect = this.selectFruitList[0];\n+ console.log(\"\")\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n" }, { "date": 1694511052896, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -201,9 +201,9 @@\n }\n \n startSelect() {\n GameDataManager.currentSelect = this.selectFruitList[0];\n- console.log(\"\")\n+ console.log(\"```````````` 选择 =\", GameDataManager.currentSelect);\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n" }, { "date": 1694511123812, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -200,9 +200,9 @@\n }\n }\n \n startSelect() {\n- GameDataManager.currentSelect = this.selectFruitList[0];\n+ GameDataManager.currentSelect = GameDataManager.selectFruitList[0];\n console.log(\"```````````` 选择 =\", GameDataManager.currentSelect);\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n" }, { "date": 1694511867289, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -24,19 +24,20 @@\n @property(Node)\n refrigeratorNode: Node = null;\n \n \n- randomFruitList: number[] = [];\n- selectFruitList: number[] = [];\n- positionList: number[] = [];\n+ // randomFruitList: number[] = [];\n+ // selectFruitList: number[] = [];\n+ // positionList: number[] = [];\n randomFruitCount: number = 0;\n selectCount: number = 0;\n waitingTime: number = 0;\n countdownTime: number = 0;\n levelNum: number = 0;\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n+\n }\n \n onDestroy() {\n EventUtils.off(\"stopBlink\", this.onStopBlink, this);\n" }, { "date": 1694511969024, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -35,13 +35,14 @@\n levelNum: number = 0;\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n-\n+ EventUtils.on(\"gameResult\", this.onGameResult, this);\n }\n \n onDestroy() {\n EventUtils.off(\"stopBlink\", this.onStopBlink, this);\n+ EventUtils.off(\"gameResult\", this.onGameResult, this);\n }\n \n start() {\n \n@@ -207,8 +208,12 @@\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n+ onGameResult(isCorrect, frultType) {\n+\n+ }\n+\n showTips(str) {\n let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n this.node.dispatchEvent(tip);\n }\n" }, { "date": 1694511982009, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -208,9 +208,9 @@\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n- onGameResult(isCorrect, frultType) {\n+ onGameResult(isCorrect, fruitType) {\n \n }\n \n showTips(str) {\n" }, { "date": 1694512012640, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -209,9 +209,13 @@\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n onGameResult(isCorrect, fruitType) {\n-\n+ if (isCorrect) {\n+ \n+ } else {\n+ \n+ }\n }\n \n showTips(str) {\n let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n" }, { "date": 1694512018549, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -203,18 +203,17 @@\n }\n \n startSelect() {\n GameDataManager.currentSelect = GameDataManager.selectFruitList[0];\n- console.log(\"```````````` 选择 =\", GameDataManager.currentSelect);\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n onGameResult(isCorrect, fruitType) {\n if (isCorrect) {\n \n } else {\n- \n+\n }\n }\n \n showTips(str) {\n" }, { "date": 1694512737269, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -23,9 +23,12 @@\n \n @property(Node)\n refrigeratorNode: Node = null;\n \n+ @property(Node)\n+ resultMaskNode: Node = null;\n \n+\n // randomFruitList: number[] = [];\n // selectFruitList: number[] = [];\n // positionList: number[] = [];\n randomFruitCount: number = 0;\n" }, { "date": 1694512787399, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -211,8 +211,10 @@\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n onGameResult(isCorrect, fruitType) {\n+ this.resultMaskNode.active = true;\n+ this.refrigeratorNode.emit(\"init\", isCorrect);\n if (isCorrect) {\n \n } else {\n \n" }, { "date": 1694512818783, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -213,13 +213,15 @@\n \n onGameResult(isCorrect, fruitType) {\n this.resultMaskNode.active = true;\n this.refrigeratorNode.emit(\"init\", isCorrect);\n- if (isCorrect) {\n+ setTimeout(() => {\n+ if (isCorrect) {\n \n- } else {\n-\n- }\n+ } else {\n+ \n+ }\n+ }, 0.5 * 1000);\n }\n \n showTips(str) {\n let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n" }, { "date": 1694513571095, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -211,9 +211,8 @@\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n onGameResult(isCorrect, fruitType) {\n- this.resultMaskNode.active = true;\n this.refrigeratorNode.emit(\"init\", isCorrect);\n setTimeout(() => {\n if (isCorrect) {\n \n" }, { "date": 1694513897743, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -212,15 +212,15 @@\n }\n \n onGameResult(isCorrect, fruitType) {\n this.refrigeratorNode.emit(\"init\", isCorrect);\n- setTimeout(() => {\n- if (isCorrect) {\n+ // setTimeout(() => {\n+ // if (isCorrect) {\n \n- } else {\n+ // } else {\n \n- }\n- }, 0.5 * 1000);\n+ // }\n+ // }, 0.5 * 1000);\n }\n \n showTips(str) {\n let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n" }, { "date": 1694513922683, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -211,9 +211,9 @@\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n onGameResult(isCorrect, fruitType) {\n- this.refrigeratorNode.emit(\"init\", isCorrect);\n+ this.resultMaskNode.emit(\"init\", isCorrect);\n // setTimeout(() => {\n // if (isCorrect) {\n \n // } else {\n" }, { "date": 1694514148438, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -198,12 +198,12 @@\n tween(this.refrigeratorNode).repeatForever(tw).start();\n }\n \n onStopBlink() {\n- Tween.stopAllByTarget(this.refrigeratorNode);\n- for (let i = 0; i < GameDataManager.positionList.length; i++) {\n- this.rootNodeList[GameDataManager.positionList[i]].emit(\"hide\");\n- }\n+ // Tween.stopAllByTarget(this.refrigeratorNode);\n+ // for (let i = 0; i < GameDataManager.positionList.length; i++) {\n+ // this.rootNodeList[GameDataManager.positionList[i]].emit(\"hide\");\n+ // }\n }\n \n startSelect() {\n GameDataManager.currentSelect = GameDataManager.selectFruitList[0];\n" }, { "date": 1694514206318, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -198,12 +198,12 @@\n tween(this.refrigeratorNode).repeatForever(tw).start();\n }\n \n onStopBlink() {\n- // Tween.stopAllByTarget(this.refrigeratorNode);\n- // for (let i = 0; i < GameDataManager.positionList.length; i++) {\n- // this.rootNodeList[GameDataManager.positionList[i]].emit(\"hide\");\n- // }\n+ Tween.stopAllByTarget(this.refrigeratorNode);\n+ for (let i = 0; i < GameDataManager.positionList.length; i++) {\n+ this.rootNodeList[GameDataManager.positionList[i]].emit(\"hide\");\n+ }\n }\n \n startSelect() {\n GameDataManager.currentSelect = GameDataManager.selectFruitList[0];\n" }, { "date": 1694514544847, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -211,16 +211,14 @@\n this.showTips(\"请点击\" + name + \"出现的地方\");\n }\n \n onGameResult(isCorrect, fruitType) {\n- this.resultMaskNode.emit(\"init\", isCorrect);\n- // setTimeout(() => {\n- // if (isCorrect) {\n+ EventUtils.dispatchEvent(\"SingleResult\", isCorrect)\n+ if (isCorrect) {\n \n- // } else {\n- \n- // }\n- // }, 0.5 * 1000);\n+ } else {\n+\n+ }\n }\n \n showTips(str) {\n let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n" }, { "date": 1694514836285, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -213,9 +213,9 @@\n \n onGameResult(isCorrect, fruitType) {\n EventUtils.dispatchEvent(\"SingleResult\", isCorrect)\n if (isCorrect) {\n- \n+ GameManager.getInstance().addScore(20);\n } else {\n \n }\n }\n" }, { "date": 1694514957309, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -55,14 +55,14 @@\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n initUI(gameData) {\n- this.onStopBlink();\n- this.clearAllRootChildren();\n- GameDataManager.randomFruitList = [];\n- GameDataManager.selectFruitList = [];\n- GameDataManager.positionList = [];\n- GameDataManager.currentSelect = -1;\n+ // this.onStopBlink();\n+ // this.clearAllRootChildren();\n+ // GameDataManager.randomFruitList = [];\n+ // GameDataManager.selectFruitList = [];\n+ // GameDataManager.positionList = [];\n+ // GameDataManager.currentSelect = -1;\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n this.getRandomByLevelNum(this.levelNum);\n@@ -82,8 +82,17 @@\n this.startCountdown(this.countdownTime);\n }, this.waitingTime * 1000);\n }\n \n+ createLevelData() {\n+ this.onStopBlink();\n+ this.clearAllRootChildren();\n+ GameDataManager.randomFruitList = [];\n+ GameDataManager.selectFruitList = [];\n+ GameDataManager.positionList = [];\n+ GameDataManager.currentSelect = -1;\n+ }\n+\n getRandomByLevelNum(levelNum) {\n if (levelNum == 1) {\n this.randomFruitCount = 3;\n } else if (levelNum === 2) {\n@@ -214,8 +223,11 @@\n onGameResult(isCorrect, fruitType) {\n EventUtils.dispatchEvent(\"SingleResult\", isCorrect)\n if (isCorrect) {\n GameManager.getInstance().addScore(20);\n+ setTimeout(() => {\n+\n+ }, 1 * 1000);\n } else {\n \n }\n }\n" }, { "date": 1694514972831, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -64,8 +64,19 @@\n // GameDataManager.currentSelect = -1;\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n+ \n+ }\n+\n+ createLevelData() {\n+ this.onStopBlink();\n+ this.clearAllRootChildren();\n+ GameDataManager.randomFruitList = [];\n+ GameDataManager.selectFruitList = [];\n+ GameDataManager.positionList = [];\n+ GameDataManager.currentSelect = -1;\n+\n this.getRandomByLevelNum(this.levelNum);\n GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n GameDataManager.selectFruitList = this.randomSelectFruit(this.levelNum);\n GameDataManager.positionList = this.randomPosition(this.randomFruitCount);\n@@ -82,17 +93,8 @@\n this.startCountdown(this.countdownTime);\n }, this.waitingTime * 1000);\n }\n \n- createLevelData() {\n- this.onStopBlink();\n- this.clearAllRootChildren();\n- GameDataManager.randomFruitList = [];\n- GameDataManager.selectFruitList = [];\n- GameDataManager.positionList = [];\n- GameDataManager.currentSelect = -1;\n- }\n-\n getRandomByLevelNum(levelNum) {\n if (levelNum == 1) {\n this.randomFruitCount = 3;\n } else if (levelNum === 2) {\n" }, { "date": 1694514989813, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -64,8 +64,9 @@\n // GameDataManager.currentSelect = -1;\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n+ this.createLevelData();\n \n }\n \n createLevelData() {\n" }, { "date": 1694515007775, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -227,9 +227,9 @@\n EventUtils.dispatchEvent(\"SingleResult\", isCorrect)\n if (isCorrect) {\n GameManager.getInstance().addScore(20);\n setTimeout(() => {\n-\n+ this.createLevelData();\n }, 1 * 1000);\n } else {\n \n }\n" }, { "date": 1694515298488, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -228,11 +228,13 @@\n if (isCorrect) {\n GameManager.getInstance().addScore(20);\n setTimeout(() => {\n this.createLevelData();\n- }, 1 * 1000);\n+ }, 1.5 * 1000);\n } else {\n-\n+ setTimeout(() => {\n+ this.createLevelData();\n+ }, 1.5 * 1000);\n }\n }\n \n showTips(str) {\n" }, { "date": 1694515598350, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -217,20 +217,29 @@\n }\n }\n \n startSelect() {\n- GameDataManager.currentSelect = GameDataManager.selectFruitList[0];\n- let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n- this.showTips(\"请点击\" + name + \"出现的地方\");\n+ if (GameDataManager.selectFruitList.length > 0) {\n+ GameDataManager.currentSelect = GameDataManager.selectFruitList[0];\n+ let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n+ GameDataManager.selectFruitList.slice(0, 1);\n+ this.showTips(\"请点击\" + name + \"出现的地方\");\n+ } else {\n+\n+ }\n }\n \n onGameResult(isCorrect, fruitType) {\n EventUtils.dispatchEvent(\"SingleResult\", isCorrect)\n if (isCorrect) {\n- GameManager.getInstance().addScore(20);\n- setTimeout(() => {\n- this.createLevelData();\n- }, 1.5 * 1000);\n+ if (this.levelNum < 3) {\n+ GameManager.getInstance().addScore(20);\n+ setTimeout(() => {\n+ this.createLevelData();\n+ }, 1.5 * 1000);\n+ } else {\n+ this.startSelect();\n+ }\n } else {\n setTimeout(() => {\n this.createLevelData();\n }, 1.5 * 1000);\n" }, { "date": 1694515701606, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -236,9 +236,12 @@\n setTimeout(() => {\n this.createLevelData();\n }, 1.5 * 1000);\n } else {\n- this.startSelect();\n+ GameManager.getInstance().addScore(10);\n+ setTimeout(() => {\n+ this.startSelect();\n+ }, 1.5 * 1000);\n }\n } else {\n setTimeout(() => {\n this.createLevelData();\n" }, { "date": 1694515719920, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -223,9 +223,9 @@\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n GameDataManager.selectFruitList.slice(0, 1);\n this.showTips(\"请点击\" + name + \"出现的地方\");\n } else {\n-\n+ this.createLevelData();\n }\n }\n \n onGameResult(isCorrect, fruitType) {\n" }, { "date": 1694515776516, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -242,11 +242,17 @@\n this.startSelect();\n }, 1.5 * 1000);\n }\n } else {\n- setTimeout(() => {\n- this.createLevelData();\n- }, 1.5 * 1000);\n+ if (this.levelNum < 3) {\n+ setTimeout(() => {\n+ this.createLevelData();\n+ }, 1.5 * 1000);\n+ } else {\n+ setTimeout(() => {\n+ this.startSelect();\n+ }, 1.5 * 1000);\n+ }\n }\n }\n \n showTips(str) {\n" }, { "date": 1694516011333, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -192,8 +192,9 @@\n if (time <= 0) {\n cdTween.stop();\n cdTween.removeSelf();\n cdTween = null;\n+ this.timeLabel.string = \"\";\n this.maskNode.active = false;\n // 开始选择\n this.startBlink();\n this.startSelect();\n" }, { "date": 1694516152979, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -35,8 +35,9 @@\n selectCount: number = 0;\n waitingTime: number = 0;\n countdownTime: number = 0;\n levelNum: number = 0;\n+ _currentScore: number = 0;\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n EventUtils.on(\"gameResult\", this.onGameResult, this);\n@@ -234,8 +235,9 @@\n if (isCorrect) {\n if (this.levelNum < 3) {\n GameManager.getInstance().addScore(20);\n setTimeout(() => {\n+\n this.createLevelData();\n }, 1.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n" }, { "date": 1694516174287, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -65,8 +65,9 @@\n // GameDataManager.currentSelect = -1;\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n+ this._currentScore = 0;\n this.createLevelData();\n \n }\n \n" }, { "date": 1694516290465, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -36,8 +36,9 @@\n waitingTime: number = 0;\n countdownTime: number = 0;\n levelNum: number = 0;\n _currentScore: number = 0;\n+ _gameData: object = {};\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n EventUtils.on(\"gameResult\", this.onGameResult, this);\n@@ -62,8 +63,9 @@\n // GameDataManager.randomFruitList = [];\n // GameDataManager.selectFruitList = [];\n // GameDataManager.positionList = [];\n // GameDataManager.currentSelect = -1;\n+ this._gameData = gameData;\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n this._currentScore = 0;\n@@ -235,11 +237,13 @@\n EventUtils.dispatchEvent(\"SingleResult\", isCorrect)\n if (isCorrect) {\n if (this.levelNum < 3) {\n GameManager.getInstance().addScore(20);\n+ this._currentScore += 20;\n setTimeout(() => {\n-\n- this.createLevelData();\n+ if (this._currentScore < this._gameData[\"targetScore\"]) {\n+ this.createLevelData();\n+ }\n }, 1.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n setTimeout(() => {\n" }, { "date": 1694516314809, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -228,9 +228,11 @@\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n GameDataManager.selectFruitList.slice(0, 1);\n this.showTips(\"请点击\" + name + \"出现的地方\");\n } else {\n- this.createLevelData();\n+ if (this._currentScore < this._gameData[\"targetScore\"]) {\n+ this.createLevelData();\n+ }\n }\n }\n \n onGameResult(isCorrect, fruitType) {\n" }, { "date": 1694516613721, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -93,9 +93,9 @@\n this.generateFruits();\n setTimeout(() => {\n this.hideFruit();\n this.maskNode.active = true;\n- this.timeLabel.string = this.waitingTime + \"\";\n+ this.timeLabel.string = this.countdownTime + \"\";\n this.startCountdown(this.countdownTime);\n }, this.waitingTime * 1000);\n }\n \n" }, { "date": 1694516839231, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -225,9 +225,9 @@\n startSelect() {\n if (GameDataManager.selectFruitList.length > 0) {\n GameDataManager.currentSelect = GameDataManager.selectFruitList[0];\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n- GameDataManager.selectFruitList.slice(0, 1);\n+ GameDataManager.selectFruitList.splice(0, 1);\n this.showTips(\"请点击\" + name + \"出现的地方\");\n } else {\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.createLevelData();\n" }, { "date": 1694517296122, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -90,8 +90,9 @@\n console.log(\"=========== selectFruitList =\", GameDataManager.selectFruitList);\n console.log(\"=========== positionList =\", GameDataManager.positionList);\n \n this.generateFruits();\n+ this.showTips(\"请记住水果出现的地方\");\n setTimeout(() => {\n this.hideFruit();\n this.maskNode.active = true;\n this.timeLabel.string = this.countdownTime + \"\";\n" }, { "date": 1694517302274, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -90,9 +90,9 @@\n console.log(\"=========== selectFruitList =\", GameDataManager.selectFruitList);\n console.log(\"=========== positionList =\", GameDataManager.positionList);\n \n this.generateFruits();\n- this.showTips(\"请记住水果出现的地方\");\n+ this.showTips(\"请记住水果出现的地方。\");\n setTimeout(() => {\n this.hideFruit();\n this.maskNode.active = true;\n this.timeLabel.string = this.countdownTime + \"\";\n" }, { "date": 1694517601486, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -190,8 +190,9 @@\n }\n }\n \n startCountdown(time) {\n+ this.showTips(\"倒计时结束后,选择水果出现的正确位置\");\n let cdTween = this.setTimeOutToTimes(1, time, this.node, () => {\n time--;\n this.timeLabel.string = time + \"\";\n if (time <= 0) {\n" }, { "date": 1694573947106, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -57,14 +57,8 @@\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n initUI(gameData) {\n- // this.onStopBlink();\n- // this.clearAllRootChildren();\n- // GameDataManager.randomFruitList = [];\n- // GameDataManager.selectFruitList = [];\n- // GameDataManager.positionList = [];\n- // GameDataManager.currentSelect = -1;\n this._gameData = gameData;\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n" }, { "date": 1694573954624, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -52,12 +52,8 @@\n start() {\n \n }\n \n- /**\n- * 初始化逻辑\n- * 每次GameManager.StartGame()时都会调用\n- */\n initUI(gameData) {\n this._gameData = gameData;\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n" }, { "date": 1694573960506, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -59,9 +59,8 @@\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n this._currentScore = 0;\n this.createLevelData();\n- \n }\n \n createLevelData() {\n this.onStopBlink();\n" }, { "date": 1694573966803, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -26,12 +26,8 @@\n \n @property(Node)\n resultMaskNode: Node = null;\n \n-\n- // randomFruitList: number[] = [];\n- // selectFruitList: number[] = [];\n- // positionList: number[] = [];\n randomFruitCount: number = 0;\n selectCount: number = 0;\n waitingTime: number = 0;\n countdownTime: number = 0;\n" }, { "date": 1694573992107, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -26,8 +26,11 @@\n \n @property(Node)\n resultMaskNode: Node = null;\n \n+ @property(Node)\n+ carFruitRoot: Node = null;\n+\n randomFruitCount: number = 0;\n selectCount: number = 0;\n waitingTime: number = 0;\n countdownTime: number = 0;\n" }, { "date": 1694582256674, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -238,8 +238,9 @@\n }, 1.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n setTimeout(() => {\n+ this.startBlink();\n this.startSelect();\n }, 1.5 * 1000);\n }\n } else {\n@@ -249,8 +250,9 @@\n }, 1.5 * 1000);\n } else {\n setTimeout(() => {\n this.startSelect();\n+ this.startBlink();\n }, 1.5 * 1000);\n }\n }\n }\n" }, { "date": 1694582375931, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -36,8 +36,9 @@\n countdownTime: number = 0;\n levelNum: number = 0;\n _currentScore: number = 0;\n _gameData: object = {};\n+ _currentCarRootIndex: number = 0;\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n EventUtils.on(\"gameResult\", this.onGameResult, this);\n" }, { "date": 1694582381396, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -36,9 +36,9 @@\n countdownTime: number = 0;\n levelNum: number = 0;\n _currentScore: number = 0;\n _gameData: object = {};\n- _currentCarRootIndex: number = 0;\n+ _currentCarRootIndex: number = 1;\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n EventUtils.on(\"gameResult\", this.onGameResult, this);\n" }, { "date": 1694582475395, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -257,8 +257,12 @@\n }\n }\n }\n \n+ generateCarFruit(index, fruitType) {\n+ \n+ }\n+\n showTips(str) {\n let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n this.node.dispatchEvent(tip);\n }\n" }, { "date": 1694582606006, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -258,9 +258,13 @@\n }\n }\n \n generateCarFruit(index, fruitType) {\n- \n+ let fruitItem = instantiate(this.itemPrefabList[fruitType - 1]);\n+ let root = this.carFruitRoot.getChildByName(\"root_\" + index);\n+ if (root && fruitItem) {\n+ root.addChild(fruitItem);\n+ }\n }\n \n showTips(str) {\n let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n" }, { "date": 1694582675256, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -234,8 +234,10 @@\n this._currentScore += 20;\n setTimeout(() => {\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.createLevelData();\n+ this.generateCarFruit(this._currentCarRootIndex, fruitType);\n+ this._currentCarRootIndex++;\n }\n }, 1.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n@@ -247,8 +249,10 @@\n } else {\n if (this.levelNum < 3) {\n setTimeout(() => {\n this.createLevelData();\n+ this.generateCarFruit(this._currentCarRootIndex, fruitType);\n+ this._currentCarRootIndex++;\n }, 1.5 * 1000);\n } else {\n setTimeout(() => {\n this.startSelect();\n" }, { "date": 1694582741305, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -263,9 +263,9 @@\n }\n \n generateCarFruit(index, fruitType) {\n let fruitItem = instantiate(this.itemPrefabList[fruitType - 1]);\n- let root = this.carFruitRoot.getChildByName(\"root_\" + index);\n+ let root = this.carFruitRoot.getChildByName(\"root\" + index);\n if (root && fruitItem) {\n root.addChild(fruitItem);\n }\n }\n" }, { "date": 1694582836224, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -264,8 +264,10 @@\n \n generateCarFruit(index, fruitType) {\n let fruitItem = instantiate(this.itemPrefabList[fruitType - 1]);\n let root = this.carFruitRoot.getChildByName(\"root\" + index);\n+ console.log(\"~~~~~~~~~~~ index\", index, \" fruitType\", fruitType);\n+ console.log(\"~~~~~~~~~~~ \", fruitItem, root);\n if (root && fruitItem) {\n root.addChild(fruitItem);\n }\n }\n" }, { "date": 1694582933465, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -243,8 +243,10 @@\n GameManager.getInstance().addScore(10);\n setTimeout(() => {\n this.startBlink();\n this.startSelect();\n+ this.generateCarFruit(this._currentCarRootIndex, fruitType);\n+ this._currentCarRootIndex++;\n }, 1.5 * 1000);\n }\n } else {\n if (this.levelNum < 3) {\n" }, { "date": 1694583232546, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -68,8 +68,9 @@\n GameDataManager.randomFruitList = [];\n GameDataManager.selectFruitList = [];\n GameDataManager.positionList = [];\n GameDataManager.currentSelect = -1;\n+ GameDataManager.isClick = false;\n \n this.getRandomByLevelNum(this.levelNum);\n GameDataManager.randomFruitList = this.randomNumbers(this.randomFruitCount);\n GameDataManager.selectFruitList = this.randomSelectFruit(this.levelNum);\n" }, { "date": 1694583257699, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -193,8 +193,9 @@\n this.maskNode.active = false;\n // 开始选择\n this.startBlink();\n this.startSelect();\n+ GameDataManager.isClick = true;\n }\n });\n }\n \n" }, { "date": 1694590027966, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -259,9 +259,8 @@\n }, 1.5 * 1000);\n } else {\n setTimeout(() => {\n this.startSelect();\n- this.startBlink();\n }, 1.5 * 1000);\n }\n }\n }\n" }, { "date": 1694590039829, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -243,9 +243,8 @@\n }, 1.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n setTimeout(() => {\n- this.startBlink();\n this.startSelect();\n this.generateCarFruit(this._currentCarRootIndex, fruitType);\n this._currentCarRootIndex++;\n }, 1.5 * 1000);\n" }, { "date": 1694590046794, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -220,8 +220,9 @@\n GameDataManager.currentSelect = GameDataManager.selectFruitList[0];\n let name = GameDataManager.fruitNameList[GameDataManager.currentSelect - 1];\n GameDataManager.selectFruitList.splice(0, 1);\n this.showTips(\"请点击\" + name + \"出现的地方\");\n+ this.startBlink();\n } else {\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.createLevelData();\n }\n" }, { "date": 1694590690630, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,5 @@\n-import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween } from 'cc';\n+import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween, UIOpacity } from 'cc';\n import { EventCustom } from '../Common/EventCustom';\n import { Global } from '../Common/Global';\n import { GameManager } from '../Manager/GameManager';\n import { EventUtils } from './EventUtils';\n@@ -41,8 +41,9 @@\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n EventUtils.on(\"gameResult\", this.onGameResult, this);\n+ this.refrigeratorNode.getComponent(UIOpacity).opacity = 1;\n }\n \n onDestroy() {\n EventUtils.off(\"stopBlink\", this.onStopBlink, this);\n@@ -58,9 +59,12 @@\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n this._currentScore = 0;\n- this.createLevelData();\n+ Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n+ tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 255 }).call(() => {\n+ this.createLevelData();\n+ }).start()\n }\n \n createLevelData() {\n this.onStopBlink();\n" }, { "date": 1694590701082, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -60,8 +60,9 @@\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n this._currentScore = 0;\n Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n+ this.refrigeratorNode.getComponent(UIOpacity).opacity = 1;\n tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 255 }).call(() => {\n this.createLevelData();\n }).start()\n }\n" }, { "date": 1694590866600, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -244,16 +244,24 @@\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.createLevelData();\n this.generateCarFruit(this._currentCarRootIndex, fruitType);\n this._currentCarRootIndex++;\n+ } else {\n+ Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n+ tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n }\n }, 1.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n setTimeout(() => {\n- this.startSelect();\n- this.generateCarFruit(this._currentCarRootIndex, fruitType);\n- this._currentCarRootIndex++;\n+ if (this._currentScore < this._gameData[\"targetScore\"]) {\n+ this.startSelect();\n+ this.generateCarFruit(this._currentCarRootIndex, fruitType);\n+ this._currentCarRootIndex++;\n+ } else {\n+ Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n+ tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n+ }\n }, 1.5 * 1000);\n }\n } else {\n if (this.levelNum < 3) {\n" }, { "date": 1694591194651, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -266,10 +266,8 @@\n } else {\n if (this.levelNum < 3) {\n setTimeout(() => {\n this.createLevelData();\n- this.generateCarFruit(this._currentCarRootIndex, fruitType);\n- this._currentCarRootIndex++;\n }, 1.5 * 1000);\n } else {\n setTimeout(() => {\n this.startSelect();\n" }, { "date": 1694591361585, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -240,24 +240,24 @@\n if (this.levelNum < 3) {\n GameManager.getInstance().addScore(20);\n this._currentScore += 20;\n setTimeout(() => {\n+ this.generateCarFruit(this._currentCarRootIndex, fruitType);\n+ this._currentCarRootIndex++;\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.createLevelData();\n- this.generateCarFruit(this._currentCarRootIndex, fruitType);\n- this._currentCarRootIndex++;\n } else {\n Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n }\n }, 1.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n setTimeout(() => {\n+ this.generateCarFruit(this._currentCarRootIndex, fruitType);\n+ this._currentCarRootIndex++;\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.startSelect();\n- this.generateCarFruit(this._currentCarRootIndex, fruitType);\n- this._currentCarRootIndex++;\n } else {\n Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n }\n" }, { "date": 1694591468367, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -27,8 +27,11 @@\n @property(Node)\n resultMaskNode: Node = null;\n \n @property(Node)\n+ carNode: Node = null;\n+\n+ @property(Node)\n carFruitRoot: Node = null;\n \n randomFruitCount: number = 0;\n selectCount: number = 0;\n" }, { "date": 1694591561361, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,5 @@\n-import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween, UIOpacity } from 'cc';\n+import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween, UIOpacity, v2, v3 } from 'cc';\n import { EventCustom } from '../Common/EventCustom';\n import { Global } from '../Common/Global';\n import { GameManager } from '../Manager/GameManager';\n import { EventUtils } from './EventUtils';\n@@ -45,8 +45,9 @@\n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n EventUtils.on(\"gameResult\", this.onGameResult, this);\n this.refrigeratorNode.getComponent(UIOpacity).opacity = 1;\n+ this.carNode.setPosition(v3(3000, this.carNode.position.y, 0));\n }\n \n onDestroy() {\n EventUtils.off(\"stopBlink\", this.onStopBlink, this);\n" }, { "date": 1694591825047, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -70,8 +70,18 @@\n this.createLevelData();\n }).start()\n }\n \n+ setRefrigerator() {\n+\n+ }\n+\n+ sesCar() {\n+ Tween.stopAllByTarget(this.carNode);\n+ this.carNode.setPosition(v3(3000, this.carNode.position.y, 0));\n+ tween(this.carNode).to(1, { position: v3(520, this.carNode.position.y, 0) }).start();\n+ }\n+\n createLevelData() {\n this.onStopBlink();\n this.clearAllRootChildren();\n GameDataManager.randomFruitList = [];\n" }, { "date": 1694591940544, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -75,8 +75,13 @@\n \n }\n \n sesCar() {\n+ for (let i = 0; i < this.carFruitRoot.children.length; i++) {\n+ if (this.carFruitRoot.children[i].children.length > 0) {\n+ this.carFruitRoot.children[i].children[0].destroy();\n+ } \n+ }\n Tween.stopAllByTarget(this.carNode);\n this.carNode.setPosition(v3(3000, this.carNode.position.y, 0));\n tween(this.carNode).to(1, { position: v3(520, this.carNode.position.y, 0) }).start();\n }\n" }, { "date": 1694591985470, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -63,20 +63,21 @@\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n this._currentScore = 0;\n+ this.setRefrigerator();\n+ this.setCar();\n+ }\n+\n+ setRefrigerator() {\n Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n this.refrigeratorNode.getComponent(UIOpacity).opacity = 1;\n tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 255 }).call(() => {\n this.createLevelData();\n- }).start()\n+ }).start();\n }\n \n- setRefrigerator() {\n-\n- }\n-\n- sesCar() {\n+ setCar() {\n for (let i = 0; i < this.carFruitRoot.children.length; i++) {\n if (this.carFruitRoot.children[i].children.length > 0) {\n this.carFruitRoot.children[i].children[0].destroy();\n } \n" }, { "date": 1694592052887, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -265,10 +265,9 @@\n this._currentCarRootIndex++;\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.createLevelData();\n } else {\n- Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n- tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n+ this.endAnim();\n }\n }, 1.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n@@ -277,10 +276,9 @@\n this._currentCarRootIndex++;\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.startSelect();\n } else {\n- Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n- tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n+ this.endAnim();\n }\n }, 1.5 * 1000);\n }\n } else {\n@@ -295,8 +293,13 @@\n }\n }\n }\n \n+ endAnim() {\n+ Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n+ tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n+ }\n+\n generateCarFruit(index, fruitType) {\n let fruitItem = instantiate(this.itemPrefabList[fruitType - 1]);\n let root = this.carFruitRoot.getChildByName(\"root\" + index);\n console.log(\"~~~~~~~~~~~ index\", index, \" fruitType\", fruitType);\n" }, { "date": 1694592128255, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -296,8 +296,11 @@\n \n endAnim() {\n Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n+\n+ Tween.stopAllByTarget(this.carNode);\n+ tween(this.carNode).to(0.5, { position: v3(-3000, this.carNode.position.y, 0 )}).start();\n }\n \n generateCarFruit(index, fruitType) {\n let fruitItem = instantiate(this.itemPrefabList[fruitType - 1]);\n" }, { "date": 1694592426155, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -63,8 +63,9 @@\n this.levelNum = gameData[\"id\"] || 1;\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n this._currentScore = 0;\n+ this._currentCarRootIndex = 1;\n this.setRefrigerator();\n this.setCar();\n }\n \n" }, { "date": 1694593382448, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -52,12 +52,8 @@\n onDestroy() {\n EventUtils.off(\"stopBlink\", this.onStopBlink, this);\n EventUtils.off(\"gameResult\", this.onGameResult, this);\n }\n- \n- start() {\n- \n- }\n \n initUI(gameData) {\n this._gameData = gameData;\n this.levelNum = gameData[\"id\"] || 1;\n" }, { "date": 1694593737789, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -80,8 +80,9 @@\n } \n }\n Tween.stopAllByTarget(this.carNode);\n this.carNode.setPosition(v3(3000, this.carNode.position.y, 0));\n+ this.carNode.emit(\"init\");\n tween(this.carNode).to(1, { position: v3(520, this.carNode.position.y, 0) }).start();\n }\n \n createLevelData() {\n" }, { "date": 1694593769789, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -297,8 +297,9 @@\n tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n \n Tween.stopAllByTarget(this.carNode);\n tween(this.carNode).to(0.5, { position: v3(-3000, this.carNode.position.y, 0 )}).start();\n+ this.carNode.emit(\"init\");\n }\n \n generateCarFruit(index, fruitType) {\n let fruitItem = instantiate(this.itemPrefabList[fruitType - 1]);\n" }, { "date": 1694593782831, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -293,12 +293,12 @@\n }\n \n endAnim() {\n Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n- tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 1 }).start();\n+ tween(this.refrigeratorNode.getComponent(UIOpacity)).to(1, { opacity: 1 }).start();\n \n Tween.stopAllByTarget(this.carNode);\n- tween(this.carNode).to(0.5, { position: v3(-3000, this.carNode.position.y, 0 )}).start();\n+ tween(this.carNode).to(1, { position: v3(-3000, this.carNode.position.y, 0 )}).start();\n this.carNode.emit(\"init\");\n }\n \n generateCarFruit(index, fruitType) {\n" }, { "date": 1694594205792, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -67,9 +67,9 @@\n \n setRefrigerator() {\n Tween.stopAllByTarget(this.refrigeratorNode.getComponent(UIOpacity));\n this.refrigeratorNode.getComponent(UIOpacity).opacity = 1;\n- tween(this.refrigeratorNode.getComponent(UIOpacity)).to(0.5, { opacity: 255 }).call(() => {\n+ tween(this.refrigeratorNode.getComponent(UIOpacity)).to(1, { opacity: 255 }).delay(0.5).call(() => {\n this.createLevelData();\n }).start();\n }\n \n@@ -81,9 +81,9 @@\n }\n Tween.stopAllByTarget(this.carNode);\n this.carNode.setPosition(v3(3000, this.carNode.position.y, 0));\n this.carNode.emit(\"init\");\n- tween(this.carNode).to(1, { position: v3(520, this.carNode.position.y, 0) }).start();\n+ tween(this.carNode).to(1.5, { position: v3(520, this.carNode.position.y, 0) }).start();\n }\n \n createLevelData() {\n this.onStopBlink();\n" }, { "date": 1694594382163, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,5 @@\n-import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween, UIOpacity, v2, v3 } from 'cc';\n+import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween, UIOpacity, v2, v3, AudioSource } from 'cc';\n import { EventCustom } from '../Common/EventCustom';\n import { Global } from '../Common/Global';\n import { GameManager } from '../Manager/GameManager';\n import { EventUtils } from './EventUtils';\n@@ -32,8 +32,10 @@\n \n @property(Node)\n carFruitRoot: Node = null;\n \n+ audio: AudioSource = null;\n+\n randomFruitCount: number = 0;\n selectCount: number = 0;\n waitingTime: number = 0;\n countdownTime: number = 0;\n" }, { "date": 1694594404990, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -46,8 +46,9 @@\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n EventUtils.on(\"gameResult\", this.onGameResult, this);\n+ this.audio = this.node.getComponent(AudioSource);\n this.refrigeratorNode.getComponent(UIOpacity).opacity = 1;\n this.carNode.setPosition(v3(3000, this.carNode.position.y, 0));\n }\n \n" }, { "date": 1694594442923, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -1,5 +1,5 @@\n-import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween, UIOpacity, v2, v3, AudioSource } from 'cc';\n+import { _decorator, Component, Prefab, Node, instantiate, tween, Label, Tween, UIOpacity, v2, v3, AudioSource, AudioClip } from 'cc';\n import { EventCustom } from '../Common/EventCustom';\n import { Global } from '../Common/Global';\n import { GameManager } from '../Manager/GameManager';\n import { EventUtils } from './EventUtils';\n@@ -32,8 +32,11 @@\n \n @property(Node)\n carFruitRoot: Node = null;\n \n+ @property(AudioClip)\n+ audioClipList: AudioClip[] = [];\n+\n audio: AudioSource = null;\n \n randomFruitCount: number = 0;\n selectCount: number = 0;\n" }, { "date": 1694594485344, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -219,9 +219,9 @@\n cdTween.removeSelf();\n cdTween = null;\n this.timeLabel.string = \"\";\n this.maskNode.active = false;\n- // 开始选择\n+\n this.startBlink();\n this.startSelect();\n GameDataManager.isClick = true;\n }\n" }, { "date": 1694594553510, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -219,9 +219,8 @@\n cdTween.removeSelf();\n cdTween = null;\n this.timeLabel.string = \"\";\n this.maskNode.active = false;\n-\n this.startBlink();\n this.startSelect();\n GameDataManager.isClick = true;\n }\n@@ -260,8 +259,9 @@\n \n onGameResult(isCorrect, fruitType) {\n EventUtils.dispatchEvent(\"SingleResult\", isCorrect)\n if (isCorrect) {\n+ this.audio.playOneShot(this.audioClipList[0]);\n if (this.levelNum < 3) {\n GameManager.getInstance().addScore(20);\n this._currentScore += 20;\n setTimeout(() => {\n" }, { "date": 1694594562922, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -285,8 +285,9 @@\n }\n }, 1.5 * 1000);\n }\n } else {\n+ this.audio.playOneShot(this.audioClipList[1]);\n if (this.levelNum < 3) {\n setTimeout(() => {\n this.createLevelData();\n }, 1.5 * 1000);\n" }, { "date": 1694594652432, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -49,16 +49,18 @@\n \n onLoad() {\n EventUtils.on(\"stopBlink\", this.onStopBlink, this);\n EventUtils.on(\"gameResult\", this.onGameResult, this);\n+ EventUtils.on(\"gameOver\", this.onGameOver, this);\n this.audio = this.node.getComponent(AudioSource);\n this.refrigeratorNode.getComponent(UIOpacity).opacity = 1;\n this.carNode.setPosition(v3(3000, this.carNode.position.y, 0));\n }\n \n onDestroy() {\n EventUtils.off(\"stopBlink\", this.onStopBlink, this);\n EventUtils.off(\"gameResult\", this.onGameResult, this);\n+ EventUtils.off(\"gameOver\", this.onGameOver, this);\n }\n \n initUI(gameData) {\n this._gameData = gameData;\n" }, { "date": 1694594683590, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -319,8 +319,12 @@\n root.addChild(fruitItem);\n }\n }\n \n+ onGameOver() {\n+ this.audio.playOneShot(this.audioClipList[2]);\n+ }\n+\n showTips(str) {\n let tip = new EventCustom(Global.EventType_ShowTips, true, str);\n this.node.dispatchEvent(tip);\n }\n" }, { "date": 1694594852744, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -68,8 +68,9 @@\n this.waitingTime = gameData[\"time\"] || 3;\n this.countdownTime = gameData[\"countdown\"] || 3;\n this._currentScore = 0;\n this._currentCarRootIndex = 1;\n+ GameDataManager.isClick = false;\n this.setRefrigerator();\n this.setCar();\n }\n \n" }, { "date": 1694595296004, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -267,16 +267,18 @@\n if (this.levelNum < 3) {\n GameManager.getInstance().addScore(20);\n this._currentScore += 20;\n setTimeout(() => {\n- this.generateCarFruit(this._currentCarRootIndex, fruitType);\n- this._currentCarRootIndex++;\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.createLevelData();\n } else {\n this.endAnim();\n }\n }, 1.5 * 1000);\n+ setTimeout(() => {\n+ this.generateCarFruit(this._currentCarRootIndex, fruitType);\n+ this._currentCarRootIndex++;\n+ }, 0.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n setTimeout(() => {\n this.generateCarFruit(this._currentCarRootIndex, fruitType);\n" }, { "date": 1694595307314, "content": "Index: \n===================================================================\n--- \n+++ \n@@ -280,16 +280,18 @@\n }, 0.5 * 1000);\n } else {\n GameManager.getInstance().addScore(10);\n setTimeout(() => {\n- this.generateCarFruit(this._currentCarRootIndex, fruitType);\n- this._currentCarRootIndex++;\n if (this._currentScore < this._gameData[\"targetScore\"]) {\n this.startSelect();\n } else {\n this.endAnim();\n }\n }, 1.5 * 1000);\n+ setTimeout(() => {\n+ this.generateCarFruit(this._currentCarRootIndex, fruitType);\n+ this._currentCarRootIndex++;\n+ }, 0.5 * 1000);\n }\n } else {\n this.audio.playOneShot(this.audioClipList[1]);\n if (this.levelNum < 3) {\n" } ], "date": 1694486060260, "name": "Commit-0", "content": "import { _decorator, Component } from 'cc';\nconst { ccclass, property } = _decorator;\n\n@ccclass('GameMain')\nexport class GameMain extends Component {\n \n start() {\n \n }\n\n /**\n * 初始化逻辑\n * 每次GameManager.StartGame()时都会调用\n */\n initUI() {\n\n }\n\n update(deltaTime: number) {\n\n }\n}\n\n\n" } ] }