Browse Source

TouchMgrAndDifferentTowerAndGameMenu

0224995 1 month ago
parent
commit
1f03b47c92

File diff suppressed because it is too large
+ 444 - 157
assets/Scene/MainScene.scene


+ 11 - 0
assets/Script/DataItem/ItemData.ts

@@ -9,4 +9,15 @@ export interface GameResData extends DataBase{
 }
 export interface TowerData extends DataBase{
     chassis: string[],
+    fireAniImg: string,
+    fireAniCount: number,
+    bulletAniImg: string,
+    bulletAniCount: number,
+    cardImg: string[],
 }
+
+export interface LevelData extends DataBase{
+    towerid: number[],
+    totalwave: number,
+}
+

+ 1 - 1
assets/Script/Frames/DataManager.ts

@@ -51,7 +51,7 @@ class DataCtrl{
                         v = val.split(";");
                         let arr:number[] = [];
                         for(const info of v){
-                            arr.push(Number(v));
+                            arr.push(Number(info));
                         }
                         v = arr;
                         break;

+ 14 - 0
assets/Script/Game/GameFrameWork/Bullet.ts

@@ -0,0 +1,14 @@
+import { _decorator, Component, Node } from 'cc';
+const { ccclass, property } = _decorator;
+
+@ccclass('Bullet')
+export class Bullet extends Component {
+    start() {
+
+    }
+
+    update(deltaTime: number) {
+        
+    }
+}
+


+ 9 - 0
assets/Script/Game/GameFrameWork/Bullet.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "f47eb3d5-b6d9-4860-bf6d-9166d2b416fb",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 10 - 0
assets/Script/Game/GameFrameWork/BulletMgr.ts

@@ -0,0 +1,10 @@
+import { _decorator, Component, Node } from 'cc';
+import { ModulerBase } from './ModulerBase';
+const { ccclass, property } = _decorator;
+
+@ccclass('BulletMgr')
+export class BulletMgr extends ModulerBase {
+    
+}
+
+

+ 9 - 0
assets/Script/Game/GameFrameWork/BulletMgr.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "5f10edc2-b960-47ba-9cf1-be644d8f3a22",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 35 - 13
assets/Script/Game/GameFrameWork/CardMgr.ts

@@ -1,12 +1,29 @@
 import { _decorator, Component, Node, Sprite, UITransform, Vec2, Vec3, view } from 'cc';
 import { ModulerBase } from './ModulerBase';
+import { GameInfo } from '../../GameInfo';
+import { LevelData, TowerData } from '../../DataItem/ItemData';
+import { dataMgr } from '../../Frames/DataManager';
+import { resMgr } from '../../Frames/ResourcesMgr';
 const { ccclass, property } = _decorator;
 
 @ccclass('CardMgr')
 export class CardMgr extends ModulerBase {
-    private _cards: Sprite[] = [];
+    private _cards: {node: Node, data: TowerData}[] = [];
+
     init(): void {
-        this._cards = this.getComponentsInChildren(Sprite);
+
+        //显示有哪些卡片可用
+        const id: number = GameInfo.Instance.CurTheme * 1000 + GameInfo.Instance.CurLv;
+        const data: LevelData = dataMgr.getData(id, "LevelDt");
+        for(const id of data.towerid){
+            const node = new Node();
+            const towerDt: TowerData = dataMgr.getData(id, "TowerDt");
+            node.addComponent(Sprite).spriteFrame = 
+            resMgr.getSpriteFrame(towerDt.cardImg[1]);
+            node.parent = this.node.getChildByName("Content");
+            this._cards.push({node:node, data: towerDt});
+        }
+        
     }
     start() {
 
@@ -16,28 +33,33 @@ export class CardMgr extends ModulerBase {
         
     }
 
-    touchCard(pos: Vec2):boolean{
-        for(const sprite of this._cards){
-            const box = sprite.getComponent(UITransform).getBoundingBoxToWorld();
+    touchCard(pos: Vec2):TowerData{
+        for(const card of this._cards){
+            const box = card.node.getComponent(UITransform).getBoundingBoxToWorld();
             if(box.contains(pos)){
                 this.hide();
-                return true;
+                return card.data;
             }
         }
-        return false;
+        this.hide();
+        return null;;
 
     }
-    show(pos: Vec3): boolean{
+    //当前卡片是否显示
+    isShow(){
+        return this.node.active;
+    }
+
+    show(pos: Vec3){
         //view.getVisibleSize().width;
         //view.getVisibleSize().height;
-        if(this.node.active){
-            this.hide();
-            return true;
+        // if(this.node.active){
+        //     this.hide();
+        //     return true;
 
-        }
+        // }
         this.node.setPosition(pos);
         this.node.active = true;
-        return false;
     }
 
     hide(){

+ 20 - 2
assets/Script/Game/GameFrameWork/MapMgr.ts

@@ -1,8 +1,10 @@
-import { _decorator, Size, Sprite, TiledMap, TiledObjectGroup, Vec2, Vec3 } from 'cc';
+import { _decorator, Rect, Size, Sprite, TiledMap, TiledObjectGroup, Vec2, Vec3 } from 'cc';
 import { ModulerBase } from './ModulerBase';
 import { ObstacleMgr } from './ObstacleMgr';
 import { gameResMgr } from '../GameResMgr';
 import { TowerMgr } from './TowerMgr';
+import { TowerData } from '../../DataItem/ItemData';
+import { dataMgr } from '../../Frames/DataManager';
 const { ccclass, property } = _decorator;
 
 @ccclass('MapMgr')
@@ -14,6 +16,8 @@ export class MapMgr extends ModulerBase {
     private _mapBg: Sprite = null;
     private _pathBg: Sprite = null;
     tiledObjectGroup: TiledObjectGroup = null;
+    //存储可种植的炮台区域
+    private _canTowerRect: Rect[] = [];
 
     protected onLoad(): void {
         this._tiledMap = this.getComponent(TiledMap);
@@ -43,6 +47,7 @@ export class MapMgr extends ModulerBase {
     update(deltaTime: number) {
         
     }
+
     private _parseMap(){
         //获取瓦片地图的对象
         const objects = this._tiledMap.getObjectGroup("PATH").getObjects();
@@ -57,6 +62,8 @@ export class MapMgr extends ModulerBase {
             } 
             else if(obj.name.includes("Obj")){
                 //空地
+                const {x, y, width, height} = obj;
+                this._canTowerRect.push(new Rect(x, y - height, width, height));
             }
             else if(obj.name.includes("Ob")){
                 //障碍物 位置,哪个障碍物
@@ -74,7 +81,8 @@ export class MapMgr extends ModulerBase {
                 //通过id创建炮台位置
                 const pos = this.getCenterByObj(obj);
                 //通过id创建炮台
-                this.getModuler(TowerMgr).creatTower(pos, Number(id));
+                const data: TowerData = dataMgr.getData(Number(id), "TowerDt")
+                this.getModuler(TowerMgr).creatTower(pos, data);
             }
         }
     }
@@ -109,6 +117,16 @@ export class MapMgr extends ModulerBase {
     getPath(): Vec3[]{
         return this._pathPoints;
     }
+    //判断点击坐标是否可种植炮台
+    canCreatorTower(pos: Vec2): Vec3{
+        for(const rect of this._canTowerRect){
+            if(rect.contains(pos)){
+                return this.getCenterByPos(pos);
+            }
+        }
+        return null;
+    }
+
     // getPath(): Vec3[]{
     //     const objects = this._tiledMap.getObjectGroup("PATH").getObjects();
     //     const points: Vec3[] = []; 

+ 39 - 6
assets/Script/Game/GameFrameWork/TouchMgr.ts

@@ -1,25 +1,58 @@
-import { _decorator, Component, Node, Vec2, Vec3 } from 'cc';
+import { _decorator, Component, EventTouch, Node, Vec2, Vec3 } from 'cc';
 import { ModulerBase } from './ModulerBase';
 import { MapMgr } from './MapMgr';
 import { CardMgr } from './CardMgr';
 import { TowerMgr } from './TowerMgr';
+import { TowerUI } from './TowerUI';
 const { ccclass, property } = _decorator;
 
 @ccclass('TouchMgr')
 export class TouchMgr extends ModulerBase {
     private _towerPos: Vec3 = null;
     init(): void{
-        this.node.on(Node.EventType.TOUCH_START,(e)=>{
+        const cardMgr = this.getModuler(CardMgr);
+        const mapMgr = this.getModuler(MapMgr);
+        const towerUI = this.getModuler(TowerUI);
+        const towerMgr = this.getModuler(TowerMgr);
+        
+        this.node.on(Node.EventType.TOUCH_START,(e:EventTouch)=>{
+
             const touchPos: Vec2 = e.getUILocation();
             const pos: Vec3 = this.getModuler(MapMgr).getCenterByPos(touchPos);
-            if(this.getModuler(CardMgr).touchCard(touchPos)){
-                this.getModuler(TowerMgr).creatTower(this._towerPos,1);
+
+            //点到炮台 炮台升级的UI显示出来
+            if(towerUI.isShow()){
+                if(towerUI.touchIcon(touchPos)){
+
+                }
+                return;
+            }
+
+            if(cardMgr.isShow()){
+                const data = cardMgr.touchCard(touchPos)
+                if(data){
+                    this.getModuler(TowerMgr).creatTower(this._towerPos,data);
+                }
+                //把种植位置置空
+                this._towerPos = null;
                 return;
             }
-            if(!this.getModuler(CardMgr).show(pos)){
-                this._towerPos = pos;
+
+             //判断是否点到炮台
+             if(towerMgr.bTouchTower(touchPos)){
                 return;
             }
+
+            const posMap: Vec3 = mapMgr.canCreatorTower(touchPos);
+            if(posMap){
+                //保存下次点击要种植炮台的位置
+                this._towerPos = posMap;
+                //显示卡片层
+                cardMgr.show(posMap);
+            }
+
+           
+            
         })
     }
 }

+ 17 - 6
assets/Script/Game/GameFrameWork/TowerMgr.ts

@@ -1,10 +1,11 @@
-import { _decorator, instantiate, log, Prefab, Sprite, Vec3 } from 'cc';
+import { _decorator, instantiate, log, Prefab, Sprite, Vec2, Vec3 } from 'cc';
 import { ModulerBase } from './ModulerBase';
 import { GameMgr } from './GameMgr';
 import { MapMgr } from './MapMgr';
 import { resMgr } from '../../Frames/ResourcesMgr';
 import { TowerData } from '../../DataItem/ItemData';
 import { dataMgr } from '../../Frames/DataManager';
+import { Tower } from '../Tower';
 const { ccclass, property } = _decorator;
 
 @ccclass('TowerMgr')
@@ -15,18 +16,28 @@ export class TowerMgr extends ModulerBase {
         //GameMgr.Instance.getModuler(MapMgr).test();
         //this.getModuler(MapMgr).test();
     }
-    creatTower(pos: Vec3, id: number){
-        const data: TowerData = dataMgr.getData(id, "TowerDt");
-        const frame = resMgr.getSpriteFrame(data.chassis[0]);
+    creatTower(pos: Vec3, data: TowerData){
+        //const data: TowerData = dataMgr.getData(id, "TowerDt");
+        
         const node = instantiate(resMgr.getPrefab("Tower"));
         //const node = instantiate(resMgr.getPrefab("Tower"));
-        node.getComponent(Sprite).spriteFrame = frame;
-        node.setPosition(pos);
+        const tower = node.getComponent(Tower);
+        tower.init(data, pos);
         node.parent = this.node;
     }
     protected clearSelf(): void {
         
     }
+
+    bTouchTower(pos: Vec2){
+        for(const towerNode of this.node.children){
+            const tower: Tower = towerNode.getComponent(Tower);
+            if(tower.bTouch(pos)){
+                return true;
+            }
+        }
+        return false;
+    }
     update(deltaTime: number) {
         
     }

+ 55 - 0
assets/Script/Game/GameFrameWork/TowerUI.ts

@@ -0,0 +1,55 @@
+import { _decorator, Component, Node, Sprite, UITransform, Vec2, Vec3, view } from 'cc';
+import { ModulerBase } from './ModulerBase';
+const { ccclass, property } = _decorator;
+
+@ccclass('TowerUI')
+export class TowerUI extends ModulerBase {
+    private _sell: UITransform = null;
+    private _upGrade: UITransform = null;
+    init(): void {
+        this._sell = this.node.getChildByName("Sell").getComponent(UITransform);
+        this._upGrade = this.node.getChildByName("UpGrade").getComponent(UITransform);
+    }
+    start() {
+
+    }
+
+    update(deltaTime: number) {
+        
+    }
+
+    touchIcon(pos: Vec2):boolean{
+       if(this._sell.getBoundingBoxToWorld().contains(pos)){
+
+       }
+       else if(this._upGrade.getBoundingBoxToWorld().contains(pos)){
+        
+       }
+        this.hide();
+        return false;
+
+    }
+    //当前卡片是否显示
+    isShow(){
+        return this.node.active;
+    }
+
+    show(pos: Vec3){
+        //view.getVisibleSize().width;
+        //view.getVisibleSize().height;
+        // if(this.node.active){
+        //     this.hide();
+        //     return true;
+
+        // }
+        this.node.setPosition(pos);
+        this.node.active = true;
+    }
+
+    hide(){
+        this.node.active = false;
+
+    }
+}
+
+

+ 1 - 0
assets/Script/Game/GameFrameWork/TowerUI.ts.meta

@@ -0,0 +1 @@
+{"ver":"4.0.23","importer":"typescript","imported":true,"uuid":"f5c25449-fc14-420a-a9e8-f7329b64d1ff","files":[],"subMetas":{},"userData":{}}

+ 38 - 0
assets/Script/Game/Tower.ts

@@ -0,0 +1,38 @@
+import { _decorator, Component, Sprite, Vec2, Vec3 } from 'cc';
+import { TowerData } from '../DataItem/ItemData';
+import { resMgr } from '../Frames/ResourcesMgr';
+import { GameMgr } from './GameFrameWork/GameMgr';
+import { MapMgr } from './GameFrameWork/MapMgr';
+import { TowerUI } from './GameFrameWork/TowerUI';
+const { ccclass, property } = _decorator;
+
+@ccclass('Tower')
+export class Tower extends Component {
+    private _tilePos: Vec2 = null;
+    init(data: TowerData, pos: Vec3){
+        const frame = resMgr.getSpriteFrame(data.chassis[0]);
+        this.node.getComponent(Sprite).spriteFrame = frame;
+        this.node.setPosition(pos);
+
+        //炮的图片
+        this.node.getChildByName("Gun").getComponent(Sprite).spriteFrame
+        = resMgr.getSpriteFrame(data.fireAniImg + "11");
+
+        this._tilePos = GameMgr.Instance.getModuler(MapMgr).getTiledByPos(new Vec2(pos.x, pos.y));
+   }
+
+   bTouch(pos: Vec2): boolean{
+        const tiled = GameMgr.Instance.getModuler(MapMgr).getTiledByPos(new Vec2(pos.x, pos.y));
+        if(this._tilePos.equals(tiled)){
+            this.showUI();
+            return true;
+        };
+        return false;
+   }
+
+   showUI(){
+        GameMgr.Instance.getModuler(TowerUI).show(this.node.position)
+   }
+}
+
+

+ 9 - 0
assets/Script/Game/Tower.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "cf295175-94d6-454a-b7b9-fa3d1889122d",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 9 - 0
assets/Script/Game/UI.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.2.0",
+  "importer": "directory",
+  "imported": true,
+  "uuid": "48958d8d-eadd-4d07-a428-7b6324ad6f96",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 38 - 0
assets/Script/Game/UI/GameMenu.ts

@@ -0,0 +1,38 @@
+import { _decorator, Component, director, Node } from 'cc';
+const { ccclass, property } = _decorator;
+
+@ccclass('GameMenu')
+export class GameMenu extends Component {
+    start() {
+
+    }
+
+    update(deltaTime: number) {
+        
+    }
+
+    show(){
+        this.node.active = true;
+        //暂停游戏
+        director.pause();
+    }
+
+    //退出游戏=>"选择关卡"
+    quit(){
+        director.loadScene("SelectScene");
+        this.resume();
+    }
+
+    //“继续游戏” 以及 关闭UI
+    resume(){
+        director.resume();
+        this.node.active = false;
+    }
+
+    //重新开始
+    reStart(){
+        //director.reset();
+    }
+}
+
+

+ 9 - 0
assets/Script/Game/UI/GameMenu.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "645b71ef-44cf-4e65-89a0-cb05ef68e996",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 24 - 0
assets/Script/Game/UI/TopMenu.ts

@@ -0,0 +1,24 @@
+import { _decorator, Component, Node } from 'cc';
+import { GameMenu } from './GameMenu';
+const { ccclass, property } = _decorator;
+
+@ccclass('TopMenu')
+export class TopMenu extends Component {
+    private _gameMenu: GameMenu = null;
+    protected onLoad(): void {
+        this._gameMenu = this.node.parent.getChildByName("GameMenu").getComponent(GameMenu);
+    }
+    start() {
+
+    }
+
+    update(deltaTime: number) {
+        
+    }
+
+    setting(){
+        this._gameMenu.show();
+    }
+}
+
+

+ 9 - 0
assets/Script/Game/UI/TopMenu.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "729f2a72-b3d7-47c4-8a41-a42a97473eac",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 1 - 1
assets/resources/Data/LevelDt.csv

@@ -1,5 +1,5 @@
 名称,id,towerid,totalwave
-类型,number,arr_number,number
+类型,number,number[],number
 关卡,1001,1;2,15
 关卡,1002,1;2;3,15
 关卡,1003,1;2;4,20

+ 146 - 0
assets/resources/Res/Prefab/Bullet.prefab

@@ -0,0 +1,146 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "Bullet",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "persistent": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Bullet",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": null,
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 2
+      },
+      {
+        "__id__": 4
+      }
+    ],
+    "_prefab": {
+      "__id__": 6
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 3
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 26,
+      "height": 52
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "1be1toYn9GBJAbTmsgovMs"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 5
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "c54f5894-a855-472f-8218-35949e451d24@cd080",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "04ZVQ5OyVE47OSONuslZ4Z"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "884FI8BG9Di4Gt00Ud1EXK",
+    "targetOverrides": null
+  }
+]

+ 13 - 0
assets/resources/Res/Prefab/Bullet.prefab.meta

@@ -0,0 +1,13 @@
+{
+  "ver": "1.1.50",
+  "importer": "prefab",
+  "imported": true,
+  "uuid": "23ff983a-22ab-45ee-aba2-7081375351eb",
+  "files": [
+    ".json"
+  ],
+  "subMetas": {},
+  "userData": {
+    "syncNodeName": "Bullet"
+  }
+}

+ 167 - 5
assets/resources/Res/Prefab/Tower.prefab

@@ -17,18 +17,75 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 8
+      },
+      {
+        "__id__": 10
+      },
+      {
+        "__id__": 12
+      }
+    ],
+    "_prefab": {
+      "__id__": 14
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "Gun",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
     "_children": [],
     "_active": true,
     "_components": [
       {
-        "__id__": 2
+        "__id__": 3
       },
       {
-        "__id__": 4
+        "__id__": 5
       }
     ],
     "_prefab": {
-      "__id__": 6
+      "__id__": 7
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -59,6 +116,92 @@
     },
     "_id": ""
   },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 4
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 26,
+      "height": 56
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "e9iMce/PZEFJIs2cvQ1seT"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 6
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "c54f5894-a855-472f-8218-35949e451d24@9e974",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "df6lt2xWZLupYQSJ2NjtJl"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "28rXzlwgxNJpvLTc6SIy1x",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
   {
     "__type__": "cc.UITransform",
     "_name": "",
@@ -69,7 +212,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 3
+      "__id__": 9
     },
     "_contentSize": {
       "__type__": "cc.Size",
@@ -97,7 +240,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 5
+      "__id__": 11
     },
     "_customMaterial": null,
     "_srcBlendFactor": 2,
@@ -132,6 +275,24 @@
     "__type__": "cc.CompPrefabInfo",
     "fileId": "4fIw2zhLNLBYp4yyfUIXW1"
   },
+  {
+    "__type__": "cf295F1lNZFSre5+j0YiRIt",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 13
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "8fMpGYJRJLaZxL7XOxJHTU"
+  },
   {
     "__type__": "cc.PrefabInfo",
     "root": {
@@ -141,6 +302,7 @@
       "__id__": 0
     },
     "fileId": "99eDxpLMtMIIuOQikWraFN",
+    "instance": null,
     "targetOverrides": null
   }
 ]

+ 687 - 0
assets/resources/Res/Prefab/TowerUI.prefab

@@ -0,0 +1,687 @@
+[
+  {
+    "__type__": "cc.Prefab",
+    "_name": "TowerUI",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_native": "",
+    "data": {
+      "__id__": 1
+    },
+    "optimizationPolicy": 0,
+    "persistent": false
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "TowerUI",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": null,
+    "_children": [
+      {
+        "__id__": 2
+      },
+      {
+        "__id__": 8
+      },
+      {
+        "__id__": 14
+      },
+      {
+        "__id__": 20
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 28
+      }
+    ],
+    "_prefab": {
+      "__id__": 30
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "howtoplay",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 3
+      },
+      {
+        "__id__": 5
+      }
+    ],
+    "_prefab": {
+      "__id__": 7
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 0.8,
+      "y": 0.8,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 4
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 128,
+      "height": 128
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "cbt6vU5pRH85p74Ep5e66z"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 2
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 6
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "670f1c9c-5922-41e8-a64e-e17118762876@9b791",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "8f7FXFTKhL6JeiS9iTUu0m"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "45LozQ8S5MlYrSgOcuSitY",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "sell",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 9
+      },
+      {
+        "__id__": 11
+      }
+    ],
+    "_prefab": {
+      "__id__": 13
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": -80,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 0.8,
+      "y": 0.8,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 8
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 10
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 76,
+      "height": 78
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "21M3upfI9HcZ1YUMmyMAWo"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 8
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 12
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "e104c27b-9803-4bed-bb01-f58171e15ac9@34036",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "64EWRvV9FEtKhAMZ1Ci9xu"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "75xk19o7ZPxbRxOiSRU2Kl",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "upgrade",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 15
+      },
+      {
+        "__id__": 17
+      }
+    ],
+    "_prefab": {
+      "__id__": 19
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 80,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 0.8,
+      "y": 0.8,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 14
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 16
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 76,
+      "height": 78
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "f5HOeHMn1Mzb5KYHjHtGPV"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 14
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 18
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "e104c27b-9803-4bed-bb01-f58171e15ac9@72b06",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "7ceVqx/QZMkLwvcyIOGWdM"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "38LIME5gpDOIz5Pl70rUec",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "select",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 21
+      },
+      {
+        "__id__": 23
+      },
+      {
+        "__id__": 25
+      }
+    ],
+    "_prefab": {
+      "__id__": 27
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 20
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 22
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 58,
+      "height": 58
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "f1VODz5+9DXJh1GwKzMPy3"
+  },
+  {
+    "__type__": "cc.Sprite",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 20
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 24
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_spriteFrame": {
+      "__uuid__": "e104c27b-9803-4bed-bb01-f58171e15ac9@bc519",
+      "__expectedType__": "cc.SpriteFrame"
+    },
+    "_type": 0,
+    "_fillType": 0,
+    "_sizeMode": 1,
+    "_fillCenter": {
+      "__type__": "cc.Vec2",
+      "x": 0,
+      "y": 0
+    },
+    "_fillStart": 0,
+    "_fillRange": 0,
+    "_isTrimmedMode": true,
+    "_useGrayscale": false,
+    "_atlas": null,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "91puR1UKZHrY7C7Fgyn0nG"
+  },
+  {
+    "__type__": "cc.Animation",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 20
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 26
+    },
+    "playOnLoad": true,
+    "_clips": [
+      {
+        "__uuid__": "acde0d2e-0b40-4e7f-8ae9-e266315ea029",
+        "__expectedType__": "cc.AnimationClip"
+      }
+    ],
+    "_defaultClip": {
+      "__uuid__": "acde0d2e-0b40-4e7f-8ae9-e266315ea029",
+      "__expectedType__": "cc.AnimationClip"
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "2bGgvi8TlPloA+coLlcXs7"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "628s1r9ENLnJl/p5Lfld3z",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 29
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 100
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "1cizGTZitPwpmSwAWcqdJR"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "5atWp/ZwFFiIiHD1Z0Ohg3",
+    "targetOverrides": null
+  }
+]

+ 13 - 0
assets/resources/Res/Prefab/TowerUI.prefab.meta

@@ -0,0 +1,13 @@
+{
+  "ver": "1.1.50",
+  "importer": "prefab",
+  "imported": true,
+  "uuid": "decf8eef-1bbb-48b1-8922-a27fe67cf5b0",
+  "files": [
+    ".json"
+  ],
+  "subMetas": {},
+  "userData": {
+    "syncNodeName": "TowerUI"
+  }
+}

Some files were not shown because too many files changed in this diff