zhoupeng 1 سال پیش
والد
کامیت
e10fd2e7c7

+ 1 - 1
airPlay/assets/Script/game/bullet.ts

@@ -11,7 +11,7 @@ const {ccclass, property} = cc._decorator;
 @ccclass
 export default class bullet extends LQCollide {
 
-    attack:number = 100;
+    attack:number = 10;
 
     /*===========================自动绑定组件开始===========================*/
 	/*自动生成*/

+ 4 - 4
airPlay/assets/Script/game/cfg/monsterItem.ts

@@ -1,10 +1,10 @@
 interface IMonsterItem {
     atk: string;
     hp: string;
-    art: string;
-    dead: string;
-    body: string;
-    name: string;
+    // art: string;
+    // dead: string;
+    // body: string;
+    // name: string;
 }
 
 export class MonsterItem {

+ 1 - 1
airPlay/assets/Script/game/cfg/nestItem.ts

@@ -5,7 +5,7 @@ interface INestItem {
     num: string;
     time: number;
     delay: number;
-    pattern: number;
+    pattern: string;
     shape: number,
     atktiming: string,
 }

+ 17 - 0
airPlay/assets/Script/game/monster/monsterModel.ts

@@ -1,8 +1,14 @@
+import { ConfigConst, EConfigConst } from "../cfg/ConfigDef";
+import { ConfigMgr } from "../cfg/configMgr";
+import { MonsterItem } from "../cfg/monsterItem";
+import { Utils } from "../common/utils";
+
 const {ccclass, property, executeInEditMode, playOnFocus} = cc._decorator;
 
 @ccclass
 export class MonsterModel extends cc.Component{
     hp:number = 1000;
+    atk:number = 100;
 
     beAttacked(harmNum: number){
         this.hp -= harmNum;
@@ -11,4 +17,15 @@ export class MonsterModel extends cc.Component{
     isOver(){
         return this.hp <= 0;
     }
+
+    init(id: string, level: number){
+        cc.log('[MonsterModel] [init]', `[id:${id}]-[level:${level}]`);
+        let monsterData= ConfigMgr.inst.getCfgClassById<MonsterItem>(EConfigConst.monster, id, MonsterItem);
+        let atk = Utils.pos2vec2(monsterData.data.atk);
+        let hp = Utils.pos2vec2(monsterData.data.hp);
+        
+        this.hp = hp.x + level * hp.y;
+        this.atk = atk.x + level * hp.y;
+        
+    }
 }

+ 37 - 3
airPlay/assets/Script/game/nest/nestPlay.ts

@@ -3,6 +3,7 @@ import { ConfigConst, EConfigConst } from "../cfg/ConfigDef";
 import { ConfigMgr } from "../cfg/configMgr";
 import { NestItem } from "../cfg/nestItem";
 import { Utils } from "../common/utils";
+import { MonsterModel } from "../monster/monsterModel";
 
 const patternArr = [
     'monster',
@@ -53,8 +54,13 @@ export class NestPlay extends cc.Component {
     monster: cc.Prefab;
     aniClip: cc.AnimationClip[];
     time: number;
+    pattern: any;
+    private _id: string;
+    private _level: number;
     
-    async init(id: string){
+    async init(id: string, level: number){
+        this._id = id;
+        this._level = level;
 
         let nestItem = ConfigMgr.inst.getCfgClassById<NestItem>(EConfigConst.nest, id, NestItem);
         let shapeId = Utils.intDefault(nestItem.data.shape);
@@ -62,10 +68,10 @@ export class NestPlay extends cc.Component {
         this.num = Utils.intDefault(nestItem.data.num, 1);
         let delay = Utils.intDefault(nestItem.data.delay);
         this.time = Utils.intDefault(nestItem.data.time) / 100;
-
         let type = Utils.intDefault(nestItem.data.type, 1);
-        let aniName = aniArr[type-1].map(v=>{return 'level/'+v});
+        this.pattern = Utils.strToJson(nestItem.data.pattern);
 
+        let aniName = aniArr[type-1].map(v=>{return 'level/'+v});
         let posJson = Utils.pos2vec2(nestItem.data.pos);
         this.node.setPosition(posJson);
         this.aniClip = await ResMgr.inst.loadAniArr(aniName, this.node);
@@ -98,6 +104,31 @@ export class NestPlay extends cc.Component {
         this.createMonster2();
     }
 
+    setPattern(monsterNode: cc.Node){
+        let arr = [];
+        this.pattern.forEach(v => {
+            for (let index = 0; index < v[0]; index++) {
+                arr.push(v[1]);
+            }
+        });
+        if(arr.length == 0){
+            cc.error('[nestPlay] [pattern] 配置空',`[nestId:${this._id}]`);
+            arr.push('1001');
+        }
+        let models = monsterNode.getComponentsInChildren(MonsterModel);
+        models.forEach((v, k)=>{
+            let id = '1001';
+            if(k < arr.length){
+                id = arr[k];
+            }
+            else{
+                id = arr[arr.length-1];
+            }
+
+            v.init(id, this._level);
+        });
+    }
+
     createMonster2(){
         this.monsterCnt = 0;
         for (let index = 0; index < this.num; index++) {
@@ -106,6 +137,9 @@ export class NestPlay extends cc.Component {
 
                 cc.log('[nestPlay] [create]',`[num:${this.monsterCnt} / ${this.num}]`);
                 let monsterNode = ResMgr.inst.createNode(this.monster, this.monsterNode);
+
+                this.setPattern(monsterNode);
+
                 let cnt = 0;
                 let callAni = ()=>{
 

+ 2 - 10
airPlay/assets/Script/levelMgr.ts

@@ -99,7 +99,7 @@ export class LevelMgr extends GameSysLogic {
         obj.forEach(v=>{
             let nestNode = Utils.createNode(levelView.$top_node, `nest-[level:${this.passCnt+1}]nest1`);
             let nestPlay = nestNode.addComponent(NestPlay);
-            let p = nestPlay.init(v[0]);
+            let p = nestPlay.init(v[0],v[1]);
             task.push(p);
 
             this.nestArr.push(nestPlay);
@@ -118,7 +118,7 @@ export class LevelMgr extends GameSysLogic {
             obj.forEach(v=>{
                 let nestNode = Utils.createNode(levelView.$top_node, `nest-[level:${this.passCnt+1}]${nestKey}`);
                 let nestPlay = nestNode.addComponent(NestPlay);
-                nestPlay.init(v[0]);
+                nestPlay.init(v[0],v[1]);
                 this.nestArr.push(nestPlay);
             });
         }
@@ -159,14 +159,6 @@ export class LevelMgr extends GameSysLogic {
         // this.state = LevelState.playing;
     }
 
-    nestCreate(levelData: SmallLevelItem){
-        
-    }
-
-    async fillNest(nestNode: cc.Node, id: string){
-        let nestPlay = nestNode.addComponent(NestPlay);
-        await nestPlay.init(id);
-    }
 
     skip(num: number){
         cc.log('skip-', num);

+ 1 - 1
airPlay/client-editor/excel.js

@@ -82,7 +82,7 @@ function _getJsonSaveData(excelData, itemSheet) {
             // } else if (lineData.length > title.length) {
             //     continue;
             // }
-            if(!lineData) continue;
+            if(!lineData || lineData.length == 0) continue;
             let saveLineData = {};
             for (let j = 1; j < title.length; j++) {
                 let key = title[j];

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


+ 64 - 8
airPlay/preview-templates/json/bullet.json

@@ -1,12 +1,68 @@
 {
-    "1":{
+    "1001":{
         "travel":1,
-        "param":1,
-        "speed":1,
-        "end":1,
-        "volume":1,
-        "effect1":1,
-        "bullet2":1,
-        "cd":1
+        "param":"",
+        "speed":500,
+        "end":"[2;300]",
+        "volume":5,
+        "effect1":10,
+        "bullet2":"[]",
+        "cd":5,
+        "备注":"直线"
+    },
+    "2001":{
+        "travel":2,
+        "param":"",
+        "speed":500,
+        "end":"[2;300]",
+        "volume":5,
+        "effect1":10,
+        "bullet2":"[]",
+        "cd":5,
+        "备注":"三叉戟"
+    },
+    "2002":{
+        "travel":2,
+        "param":"",
+        "speed":500,
+        "end":"[2;300]",
+        "volume":5,
+        "effect1":10,
+        "bullet2":"[]",
+        "cd":2,
+        "备注":"120°扇形"
+    },
+    "2003":{
+        "travel":2,
+        "param":"",
+        "speed":500,
+        "end":"[2;300]",
+        "volume":5,
+        "effect1":10,
+        "bullet2":"[]",
+        "cd":1,
+        "备注":"360°扩撒"
+    },
+    "3001":{
+        "travel":3,
+        "param":"",
+        "speed":500,
+        "end":"[2;300]",
+        "volume":5,
+        "effect1":10,
+        "bullet2":"[]",
+        "cd":2,
+        "备注":"旋转"
+    },
+    "4001":{
+        "travel":4,
+        "param":"",
+        "speed":500,
+        "end":"[2;300]",
+        "volume":5,
+        "effect1":10,
+        "bullet2":"[3;100;2003]",
+        "cd":1,
+        "备注":"爆炸"
     }
 }

+ 8 - 36
airPlay/preview-templates/json/monster.json

@@ -1,42 +1,14 @@
 {
-    "1":{
+    "1001":{
         "atk":"[100;10]",
-        "hp":"[100;10]",
-        "art":"",
-        "dead":"",
-        "body":"",
-        "name":""
+        "hp":"[100;10]"
     },
-    "2":{
-        "atk":"[100;10]",
-        "hp":"[100;10]",
-        "art":"",
-        "dead":"",
-        "body":"",
-        "name":""
-    },
-    "3":{
-        "atk":"[100;10]",
-        "hp":"[100;10]",
-        "art":"",
-        "dead":"",
-        "body":"",
-        "name":""
+    "2001":{
+        "atk":"[150;15]",
+        "hp":"[150;15]"
     },
-    "4":{
-        "atk":"[100;10]",
-        "hp":"[100;10]",
-        "art":"",
-        "dead":"",
-        "body":"",
-        "name":""
-    },
-    "5":{
-        "atk":"[100;10]",
-        "hp":"[100;10]",
-        "art":"",
-        "dead":"",
-        "body":"",
-        "name":""
+    "3001":{
+        "atk":"[200;20]",
+        "hp":"[200;20]"
     }
 }

+ 10 - 10
airPlay/preview-templates/json/nest.json

@@ -64,7 +64,7 @@
         "type":1,
         "shape":102,
         "atktiming":"",
-        "pattern":"[[1;1002]]",
+        "pattern":"[[1;2001]]",
         "bullet":"[[1;2002]]",
         "time":20,
         "num":3
@@ -94,8 +94,8 @@
         "type":7,
         "shape":103,
         "atktiming":"",
-        "pattern":"[[1;1003]]",
-        "bullet":"[[1;1003]]",
+        "pattern":"[[1;3001]]",
+        "bullet":"[[1;3001]]",
         "time":0,
         "num":1
     },
@@ -144,7 +144,7 @@
         "type":2,
         "shape":102,
         "atktiming":"",
-        "pattern":"[[1;1002]]",
+        "pattern":"[[1;2001]]",
         "bullet":"[[1;2001;0;3001;2]]",
         "time":1,
         "num":1
@@ -154,7 +154,7 @@
         "type":2,
         "shape":102,
         "atktiming":"",
-        "pattern":"[[1;1002]]",
+        "pattern":"[[1;2001]]",
         "bullet":"[[1;2001;0;3001;2]]",
         "time":1,
         "num":1
@@ -234,7 +234,7 @@
         "type":16,
         "shape":103,
         "atktiming":"",
-        "pattern":"[[1;1003]]",
+        "pattern":"[[1;3001]]",
         "bullet":"[[1;4001]]",
         "time":0,
         "num":1
@@ -244,8 +244,8 @@
         "type":17,
         "shape":102,
         "atktiming":"",
-        "pattern":"[[1;1002]]",
-        "bullet":"[[1;1002]]",
+        "pattern":"[[1;2001]]",
+        "bullet":"[[1;2001]]",
         "time":0,
         "num":1
     },
@@ -254,8 +254,8 @@
         "type":18,
         "shape":102,
         "atktiming":"",
-        "pattern":"[[1;1002]]",
-        "bullet":"[[1;1002]]",
+        "pattern":"[[1;2001]]",
+        "bullet":"[[1;2001]]",
         "time":0,
         "num":1
     }