Bladeren bron

怪物巢穴预览添加id增减

zhoupeng 1 jaar geleden
bovenliggende
commit
2ca4ccd43d

+ 751 - 3
airPlay/assets/Scene/nestShow.fire

@@ -79,18 +79,24 @@
       },
       {
         "__id__": 21
+      },
+      {
+        "__id__": 32
+      },
+      {
+        "__id__": 39
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 32
+        "__id__": 46
       },
       {
-        "__id__": 33
+        "__id__": 47
       },
       {
-        "__id__": 34
+        "__id__": 48
       }
     ],
     "_prefab": null,
@@ -1449,6 +1455,748 @@
     "_N$stayOnTop": false,
     "_id": "55MMf/THZIiLZUdVPbzp6+"
   },
+  {
+    "__type__": "cc.Node",
+    "_name": "$left_btn",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [
+      {
+        "__id__": 33
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 38
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 39.5,
+      "height": 40
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        -445.7,
+        384.6,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "39617JAX5JRbJ2TGrIYEz4"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Background",
+    "_objFlags": 512,
+    "_parent": {
+      "__id__": 32
+    },
+    "_children": [
+      {
+        "__id__": 34
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 36
+      },
+      {
+        "__id__": 37
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 39.5,
+      "height": 40
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        0
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "78YsZmEnBM+6DnxPeeKTtq"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Label",
+    "_objFlags": 512,
+    "_parent": {
+      "__id__": 33
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 35
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 40
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "d31jz8u0lH05Wb/XcLemgQ"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 34
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_string": "<",
+    "_N$string": "<",
+    "_fontSize": 20,
+    "_lineHeight": 40,
+    "_enableWrapText": false,
+    "_N$file": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_batchAsBitmap": false,
+    "_styleFlags": 0,
+    "_underlineHeight": 0,
+    "_N$horizontalAlign": 1,
+    "_N$verticalAlign": 1,
+    "_N$fontFamily": "Arial",
+    "_N$overflow": 1,
+    "_N$cacheMode": 1,
+    "_id": "afMde1VNFPMqZ5rTDRg4pM"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 33
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_type": 1,
+    "_sizeMode": 0,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_atlas": null,
+    "_id": "2czQFWeV9Of6LEGMeQnkD7"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 33
+    },
+    "_enabled": true,
+    "alignMode": 0,
+    "_target": null,
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 100,
+    "_originalHeight": 40,
+    "_id": "casH3WS5RK750/VQUZjUr/"
+  },
+  {
+    "__type__": "cc.Button",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 32
+    },
+    "_enabled": true,
+    "_normalMaterial": null,
+    "_grayMaterial": null,
+    "duration": 0.1,
+    "zoomScale": 1.2,
+    "clickEvents": [],
+    "_N$interactable": true,
+    "_N$enableAutoGrayEffect": false,
+    "_N$transition": 3,
+    "transition": 3,
+    "_N$normalColor": {
+      "__type__": "cc.Color",
+      "r": 230,
+      "g": 230,
+      "b": 230,
+      "a": 255
+    },
+    "_N$pressedColor": {
+      "__type__": "cc.Color",
+      "r": 200,
+      "g": 200,
+      "b": 200,
+      "a": 255
+    },
+    "pressedColor": {
+      "__type__": "cc.Color",
+      "r": 200,
+      "g": 200,
+      "b": 200,
+      "a": 255
+    },
+    "_N$hoverColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "hoverColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_N$disabledColor": {
+      "__type__": "cc.Color",
+      "r": 120,
+      "g": 120,
+      "b": 120,
+      "a": 200
+    },
+    "_N$normalSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_N$pressedSprite": {
+      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
+    },
+    "pressedSprite": {
+      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
+    },
+    "_N$hoverSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "hoverSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_N$disabledSprite": {
+      "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
+    },
+    "_N$target": {
+      "__id__": 33
+    },
+    "_id": "8cBGFhL5BPWr6YEfEsVpy/"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "$right_btn",
+    "_objFlags": 0,
+    "_parent": {
+      "__id__": 2
+    },
+    "_children": [
+      {
+        "__id__": 40
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 45
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 39.5,
+      "height": 40
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        -385.655,
+        384.6,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "8ca10n1NxAQbMW0/TyKj84"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Background",
+    "_objFlags": 512,
+    "_parent": {
+      "__id__": 39
+    },
+    "_children": [
+      {
+        "__id__": 41
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 43
+      },
+      {
+        "__id__": 44
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 39.5,
+      "height": 40
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        0
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "bfzW7LGcdJsZ7OFEC0sBAU"
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Label",
+    "_objFlags": 512,
+    "_parent": {
+      "__id__": 40
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 42
+      }
+    ],
+    "_prefab": null,
+    "_opacity": 255,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 40
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_trs": {
+      "__type__": "TypedArray",
+      "ctor": "Float64Array",
+      "array": [
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        1,
+        1,
+        1,
+        1
+      ]
+    },
+    "_eulerAngles": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_skewX": 0,
+    "_skewY": 0,
+    "_is3DNode": false,
+    "_groupIndex": 0,
+    "groupIndex": 0,
+    "_id": "76xa82SiRCOZIrjJYnkyqd"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 41
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_string": ">",
+    "_N$string": ">",
+    "_fontSize": 20,
+    "_lineHeight": 40,
+    "_enableWrapText": false,
+    "_N$file": null,
+    "_isSystemFontUsed": true,
+    "_spacingX": 0,
+    "_batchAsBitmap": false,
+    "_styleFlags": 0,
+    "_underlineHeight": 0,
+    "_N$horizontalAlign": 1,
+    "_N$verticalAlign": 1,
+    "_N$fontFamily": "Arial",
+    "_N$overflow": 1,
+    "_N$cacheMode": 1,
+    "_id": "81wLffFL9Cj4w5M5/5l5KZ"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 40
+    },
+    "_enabled": true,
+    "_materials": [
+      {
+        "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
+      }
+    ],
+    "_srcBlendFactor": 770,
+    "_dstBlendFactor": 771,
+    "_spriteFrame": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_type": 1,
+    "_sizeMode": 0,
+    "_fillType": 0,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_atlas": null,
+    "_id": "16GRZ916dNdJMH/fQA2AlR"
+  },
+  {
+    "__type__": "cc.Widget",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 40
+    },
+    "_enabled": true,
+    "alignMode": 0,
+    "_target": null,
+    "_alignFlags": 45,
+    "_left": 0,
+    "_right": 0,
+    "_top": 0,
+    "_bottom": 0,
+    "_verticalCenter": 0,
+    "_horizontalCenter": 0,
+    "_isAbsLeft": true,
+    "_isAbsRight": true,
+    "_isAbsTop": true,
+    "_isAbsBottom": true,
+    "_isAbsHorizontalCenter": true,
+    "_isAbsVerticalCenter": true,
+    "_originalWidth": 100,
+    "_originalHeight": 40,
+    "_id": "ces2UL1MlEkIxI0a9EXLif"
+  },
+  {
+    "__type__": "cc.Button",
+    "_name": "",
+    "_objFlags": 0,
+    "node": {
+      "__id__": 39
+    },
+    "_enabled": true,
+    "_normalMaterial": null,
+    "_grayMaterial": null,
+    "duration": 0.1,
+    "zoomScale": 1.2,
+    "clickEvents": [],
+    "_N$interactable": true,
+    "_N$enableAutoGrayEffect": false,
+    "_N$transition": 3,
+    "transition": 3,
+    "_N$normalColor": {
+      "__type__": "cc.Color",
+      "r": 230,
+      "g": 230,
+      "b": 230,
+      "a": 255
+    },
+    "_N$pressedColor": {
+      "__type__": "cc.Color",
+      "r": 200,
+      "g": 200,
+      "b": 200,
+      "a": 255
+    },
+    "pressedColor": {
+      "__type__": "cc.Color",
+      "r": 200,
+      "g": 200,
+      "b": 200,
+      "a": 255
+    },
+    "_N$hoverColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "hoverColor": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_N$disabledColor": {
+      "__type__": "cc.Color",
+      "r": 120,
+      "g": 120,
+      "b": 120,
+      "a": 200
+    },
+    "_N$normalSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_N$pressedSprite": {
+      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
+    },
+    "pressedSprite": {
+      "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
+    },
+    "_N$hoverSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "hoverSprite": {
+      "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
+    },
+    "_N$disabledSprite": {
+      "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
+    },
+    "_N$target": {
+      "__id__": 40
+    },
+    "_id": "c0+7fg8x9MF7OL9b0BCfq9"
+  },
   {
     "__type__": "cc.Canvas",
     "_name": "",

+ 52 - 4
airPlay/assets/Scene/test.ts

@@ -8,6 +8,7 @@ import { Utils } from "../Script/game/common/utils";
 import { Barrage } from "../Script/game/nest/barrage";
 import { EffectMgr } from "../Script/game/nest/effectMgr";
 import { NestPlay } from "../Script/game/nest/nestPlay";
+import { GameLogicMgr } from "../Script/game/update/logic";
 import { Draw } from "./test/draw";
 
 const {ccclass, property} = cc._decorator;
@@ -28,35 +29,82 @@ export default class test extends cc.Component {
 	/*自动生成*/
     @property({type:cc.Node, displayName:""})
     private $ui_node:cc.Node = null;
+	/*自动生成*/
+    @property({type:cc.Button, displayName:""})
+    private $refresh_btn:cc.Button = null;
+	/*自动生成*/
+    @property({type:cc.EditBox, displayName:""})
+    private $nest_edit:cc.EditBox = null;
 
     /*自动生成*/
     @property({type:cc.Button, displayName:""})
-    private $refresh_btn:cc.Button = null;
+    private $left_btn:cc.Button = null;
     
     /*自动生成*/
-    @property({type:cc.EditBox, displayName:""})
-    private $nest_edit:cc.EditBox = null;
+    @property({type:cc.Button, displayName:""})
+    private $right_btn:cc.Button = null;
+    
     
 	/*===========================自动绑定组件结束===========================*/
 
     /*===========================自动生成按钮事件开始==========================*/
+
 	onRefreshTouchEnd(){
         let id = this.$nest_edit.string;
         this.createNest(id);
     }
+	onLeftTouchEnd(){
+        let id = this.$nest_edit.string;
+        let index = this._nestKeys.findIndex((v)=>{return v === id});
+        
+        if(index == -1) {
+            index = 0;
+        } else if(index > 0) {
+            index --;
+        } 
+        this.$nest_edit.string= this._nestKeys[index];
+        this.createNest(this._nestKeys[index]);
+    }
+
+	onRightTouchEnd(){
+        let id = this.$nest_edit.string;
+        let index = this._nestKeys.findIndex((v)=>{return v === id});
+        if(index == -1) {
+            index = this._nestKeys.length-1;
+        }
+        else if(index < this._nestKeys.length-1) {
+            index ++;
+        } 
+
+        this.$nest_edit.string= this._nestKeys[index];
+        this.createNest(this._nestKeys[index]);
+    }
 
 
 	/*===========================自动生成按钮事件结束==========================*/
 
+    private _nestKeys: string[];
     protected async onLoad() {
         await ConfigMgr.inst.init();
+
+        this._nestKeys = ConfigMgr.inst.getCfgKeys(EConfigConst.nest);
+
         this.$content_node.addComponent(Draw);
         this.$nest_edit.string = '101';
 
 
         Barrage.inst.layer = this.$layer_node;
         EffectMgr.inst.layer = this.$ui_node;
-        
+
+        // let id = GameLogicMgr.inst.setGameTimeout(()=>{
+        //     cc.log('1111');
+        // }, 1);
+
+        // let id2 =GameLogicMgr.inst.setGameTimeout(()=>{
+        //     cc.log('1111');
+        //     GameLogicMgr.inst.clearGameTimeout(id);
+        // }, 0.1);
+        // console.log(id,id2);
     }
 
     createNest(id: string){

+ 0 - 1
airPlay/assets/Script/game/nest/barrage.ts

@@ -143,7 +143,6 @@ export class Barrage extends GameSysLogic{
         let dirction = data.dirction;
 
 
-        dirction = dirction.sub(worldPos).normalize();
         let paramJson = Utils.strToJson(bulletData.data.param);
         let num = paramJson[2];
         let angle = paramJson[1];

+ 13 - 9
airPlay/assets/Script/game/nest/nestPlay.ts

@@ -4,6 +4,7 @@ import { ConfigMgr } from "../cfg/configMgr";
 import { NestItem } from "../cfg/nestItem";
 import { Utils } from "../common/utils";
 import { MonsterModel } from "../monster/monsterModel";
+import { GameLogicMgr } from "../update/logic";
 
 const patternArr = [
     'monster',
@@ -47,7 +48,7 @@ const {ccclass, property, executeInEditMode, playOnFocus} = cc._decorator;
 @ccclass
 export class NestPlay extends cc.Component {
     monsterNode: cc.Node;
-    timeArr = [];
+    timeArr: number[] = [];
     monsterCnt: number;
     num: number;
     monster: cc.Prefab;
@@ -86,9 +87,9 @@ export class NestPlay extends cc.Component {
         cc.log('[nestPlay] [init]',`[num:${this.num}] [time:${this.time}]`);
 
         if(delay > 0) {
-            let tId = setTimeout(() => {
+            let tId = GameLogicMgr.inst.setGameTimeout(() => {
                 this.createMonster();
-            }, delay * 1000);
+            }, delay);
 
             this.timeArr.push(tId);
         }
@@ -99,6 +100,9 @@ export class NestPlay extends cc.Component {
 
     protected onDestroy(): void {
         this.monster.decRef();
+        this.timeArr.forEach(v=>{
+            GameLogicMgr.inst.clearGameTimeout(v);
+        });
     }
 
     createMonster(){
@@ -153,7 +157,7 @@ export class NestPlay extends cc.Component {
     createMonster3(){
         this.monsterCnt = 0;
         for (let index = 0; index < this.num; index++) { 
-            let tId = setTimeout(() => {
+            let tId = GameLogicMgr.inst.setGameTimeout(() => {
                 this.monsterCnt++;
 
                 cc.log('[nestPlay] [create]',`[num:${this.monsterCnt} / ${this.num}]`);
@@ -223,7 +227,7 @@ export class NestPlay extends cc.Component {
                 callAni();
 
 
-            }, 1000 * this.time * index);
+            }, this.time * index);
             this.timeArr.push(tId);
         }
     }
@@ -231,7 +235,7 @@ export class NestPlay extends cc.Component {
     createMonster2(){
         this.monsterCnt = 0;
         for (let index = 0; index < this.num; index++) {
-            let tId = setTimeout(() => {
+            let tId = GameLogicMgr.inst.setGameTimeout(() => {
                 this.monsterCnt++;
 
                 cc.log('[nestPlay] [create]',`[num:${this.monsterCnt} / ${this.num}]`);
@@ -274,7 +278,7 @@ export class NestPlay extends cc.Component {
                     });
                 }
                 callAni();
-            }, 1000 * this.time * index);
+            }, this.time * index);
             this.timeArr.push(tId);
         }
     }
@@ -283,7 +287,7 @@ export class NestPlay extends cc.Component {
     createMonster1(){
         this.monsterCnt = 0;
         for (let index = 0; index < this.num; index++) {
-            let tId = setTimeout(() => {
+            let tId = GameLogicMgr.inst.setGameTimeout(() => {
 
                 let aniNode = new cc.Node('AniItem');
                 ResMgr.inst.createNode(this.monster, aniNode);
@@ -301,7 +305,7 @@ export class NestPlay extends cc.Component {
                         aniNode.destroy();
                     }
                 });
-            }, 1000 * this.time * index);
+            }, this.time * index);
 
             this.timeArr.push(tId);
         }

+ 25 - 0
airPlay/assets/Script/game/update/logic.ts

@@ -54,6 +54,19 @@ export class GameLogicMgr {
             // v['update'](dt);
             v.gameUpdate(dt);
         });
+
+        let toDel = [];
+        this.timer.forEach((v,k)=>{
+            v.time -= dt;
+            if(v.time <= 0) {
+                v.call && v.call();
+                toDel.push(k);
+            }
+        })
+
+        toDel.forEach(v=>{
+            this.timer.delete(v);
+        })
     }
 
     updateSec(dt) {
@@ -76,5 +89,17 @@ export class GameLogicMgr {
     removeSysLogic(logic: GameSysLogic){
         this.sysLogics.delete(logic.logicId);
     }
+
+    timer:Map<number, {time: number, call: Function}> = new Map();
+    idBase_timer = 0;
+    setGameTimeout(call:Function, time: number){
+        let id = this.idBase_timer++;
+        this.timer.set(id, {time, call})
+        return id;
+    }
+
+    clearGameTimeout(id){
+        this.timer.delete(id);
+    }
 };
 

+ 3 - 3
airPlay/build-templates/web-desktop/json/smallLevel.json

@@ -4,7 +4,7 @@
         "interval2":"[5;5]",
         "nest2":"[[104;2][105;2]]",
         "interval3":"[5;5]",
-        "nest3":"[[106;3][107;3][108;3]]",
+        "nest3":"[[106;3][107;4][108;3]]",
         "interval4":"",
         "nest4":"",
         "interval5":"",
@@ -34,8 +34,8 @@
         "interval4":"[5;5]",
         "nest4":"[[120;4][121;4][122;4][123;4]]",
         "interval5":"[3;5]",
-        "nest5":"[[124;8]]",
+        "nest5":"[[124;7]]",
         "interval6":"[2;5]",
-        "nest6":"[[125;4][126;4]]"
+        "nest6":"[[125;5][126;5]]"
     }
 }

BIN
airPlay/client-editor/excel/关卡.xls


+ 3 - 3
airPlay/preview-templates/json/smallLevel.json

@@ -4,7 +4,7 @@
         "interval2":"[5;5]",
         "nest2":"[[104;2][105;2]]",
         "interval3":"[5;5]",
-        "nest3":"[[106;3][107;3][108;3]]",
+        "nest3":"[[106;3][107;4][108;3]]",
         "interval4":"",
         "nest4":"",
         "interval5":"",
@@ -34,8 +34,8 @@
         "interval4":"[5;5]",
         "nest4":"[[120;4][121;4][122;4][123;4]]",
         "interval5":"[3;5]",
-        "nest5":"[[124;8]]",
+        "nest5":"[[124;7]]",
         "interval6":"[2;5]",
-        "nest6":"[[125;4][126;4]]"
+        "nest6":"[[125;5][126;5]]"
     }
 }