浏览代码

添加胜利失败

baowen 16 小时之前
父节点
当前提交
b837fc9e6c

文件差异内容过多而无法显示
+ 287 - 264
assets/editor/prefab/SuperFindPanel.prefab


+ 36 - 0
assets/editor/script/AddCountPanel.ts

@@ -0,0 +1,36 @@
+import { _decorator, Component, Node } from 'cc';
+import { Difficulty, SuperFind } from '../../script/Manager/LocalDataMgr';
+import EventMgr from '../../script/Manager/EventMgr';
+const { ccclass, property } = _decorator;
+
+@ccclass('AddCountPanel')
+export class AddCountPanel extends Component {
+    @property(Node)
+    btnClose:Node = null
+    start() {
+        this.btnClose.on(Node.EventType.TOUCH_END,this.close,this)
+    }
+
+    close()
+    {
+        this.node.active = false
+    }
+
+    AddCount(event,customEventData)
+    {
+        let count = Number(customEventData)
+        Difficulty.difficutyData.difficutyCount += count
+        if(Difficulty.difficutyData.difficutyCount > 30)
+        {
+            Difficulty.difficutyData.difficutyCount = 30
+        }
+        Difficulty.createOrDeleteOtherScale();
+        Difficulty.saveDifficutyData();
+        SuperFind.setTitle()
+        EventMgr.ins.dispatchEvent("refreshLevelInfo")
+        this.node.active = false
+        EventMgr.ins.dispatchEvent("regenerate")
+    }
+}
+
+

+ 9 - 0
assets/editor/script/AddCountPanel.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.24",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "575bd902-ccc2-4005-9e52-0c60132d328b",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 3 - 1
assets/editor/script/LevelContainer.ts

@@ -210,7 +210,7 @@ export class LevelContainer extends Component {
         if (this._onLevelComplete) {
             this._onLevelComplete();
         }
-
+        EventMgr.ins.dispatchEvent("win")
         // 可以在这里添加完成动画或音效
         console.log("关卡完成!所有物品都已找到");
     }
@@ -327,12 +327,14 @@ export class LevelContainer extends Component {
     lastLevel() {
         SuperFind.lastLevel()
         this.updateLevel()
+        EventMgr.ins.dispatchEvent("restart")
     }
 
     nextLevel()
     {
         SuperFind.nextLevel()
         this.updateLevel()
+        EventMgr.ins.dispatchEvent("restart")
     }
 
     updateLevel()

+ 34 - 0
assets/editor/script/SuperFindPanel.ts

@@ -5,6 +5,7 @@ import { SelectMapPanel } from './SelectMapPanel';
 import { LevelContainer } from './LevelContainer';
 import { defaultSkin, Difficulty, Skin, SuperFind} from '../../script/Manager/LocalDataMgr';
 import EventMgr from '../../script/Manager/EventMgr';
+import { AddCountPanel } from './AddCountPanel';
 const { ccclass, property } = _decorator;
 
 @ccclass('SuperFindPanel')
@@ -19,6 +20,12 @@ export class SuperFindPanel extends Component {
     selMapPanel: SelectMapPanel = null
     @property(LevelContainer)
     lvlContainer: LevelContainer = null
+    @property(AddCountPanel)
+    addCountPanel:AddCountPanel = null
+    @property(Node)
+    win:Node = null
+    @property(Node)
+    lose:Node = null
 
     @property(Node)
     editBtns:Node = null
@@ -44,6 +51,8 @@ export class SuperFindPanel extends Component {
     protected start(): void {
         this.init()
         EventMgr.ins.addEventListener("refreshLevelInfo",this.refreshInfo,this)
+        EventMgr.ins.addEventListener("restart",this.restartCountDown,this)
+        EventMgr.ins.addEventListener("win",this.OpenWin,this)
         this.restartCountDown()
         if(sys.platform == sys.Platform.BYTEDANCE_MINI_GAME)
         {
@@ -83,6 +92,30 @@ export class SuperFindPanel extends Component {
         this.lvlContainer.swtichEditMode(true)
         this.noEditBtns.active = false
     }
+    OpenAddCountPanel()
+    {
+        this.addCountPanel.node.active = true
+    }
+    OpenWin()
+    {
+        this.win.active = true
+    }
+    OpenLose()
+    {
+        this.lose.active = true
+    }
+    CloseWin()
+    {
+        this.win.active = false
+    }
+    CloseLose()
+    {
+        this.lose.active = false
+    }
+    CloseAddCountPanel()
+    {
+        this.addCountPanel.node.active = false
+    }
     CloseEditBtns()
     {
         this.editBtns.active = false
@@ -144,6 +177,7 @@ export class SuperFindPanel extends Component {
         if (this._gameTime <= 0) {
             this.unschedule(this.countDown)
             this.countDownLabel.string = "0秒"
+            this.OpenLose()
             return
         }
         this.countDownLabel.string = this._gameTime.toString() + "秒"

部分文件因为文件数量过多而无法显示