Browse Source

PopupUI_Update

0224995 12 hours ago
parent
commit
88ffa1ec5e

+ 25 - 27
assets/Scene/GameScene.scene

@@ -93,7 +93,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 640,
-      "y": 360.00000000000006,
+      "y": 360.0849256900213,
       "z": 0
     },
     "_lrot": {
@@ -178,7 +178,7 @@
     "_priority": 0,
     "_fov": 45,
     "_fovAxis": 0,
-    "_orthoHeight": 365.52016985138005,
+    "_orthoHeight": 360.08492569002124,
     "_near": 0,
     "_far": 1000,
     "_color": {
@@ -356,7 +356,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 552.2339999999999
+      "height": 552.4038513800424
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -458,7 +458,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": -640,
-      "y": -360,
+      "y": -360.08492569002124,
       "z": 0
     },
     "_lrot": {
@@ -497,7 +497,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -597,7 +597,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": -565,
-      "y": 87.5,
+      "y": 87.58492569002124,
       "z": 0
     },
     "_lrot": {
@@ -1417,7 +1417,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 565,
-      "y": 87.5,
+      "y": 87.58492569002124,
       "z": 0
     },
     "_lrot": {
@@ -2205,7 +2205,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -270,
+      "y": -270.08492569002124,
       "z": 0
     },
     "_lrot": {
@@ -10696,7 +10696,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": -640,
-      "y": -360,
+      "y": -360.08492569002124,
       "z": 0
     },
     "_lrot": {
@@ -11573,7 +11573,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -11625,7 +11625,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -11688,7 +11688,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": -640,
-      "y": -360,
+      "y": -360.08492569002124,
       "z": 0
     },
     "_lrot": {
@@ -11727,7 +11727,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -11809,7 +11809,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": -640,
-      "y": -360,
+      "y": -360.08492569002124,
       "z": 0
     },
     "_lrot": {
@@ -12686,7 +12686,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -12738,7 +12738,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -17668,7 +17668,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": -584.8,
-      "y": 228.6,
+      "y": 228.68492569002123,
       "z": 0
     },
     "_lrot": {
@@ -18831,7 +18831,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -18895,7 +18895,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -18915,9 +18915,7 @@
     "_enabled": true,
     "__prefab": null,
     "_alignFlags": 45,
-    "_target": {
-      "__id__": 2
-    },
+    "_target": null,
     "_left": 0,
     "_right": 0,
     "_top": 0,
@@ -19067,7 +19065,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -19167,7 +19165,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -19267,7 +19265,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -19319,7 +19317,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -19373,7 +19371,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1280,
-      "height": 720
+      "height": 720.1698513800425
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

File diff suppressed because it is too large
+ 1016 - 68
assets/Scene/StartScene.scene


+ 41 - 0
assets/Script/Frames/LocalDt.ts

@@ -0,0 +1,41 @@
+class LocalStorage {
+    static instance: LocalStorage = null;
+    //保存关卡
+    saveLvDt(curLv: number) {
+        localStorage.setItem("curLv", JSON.stringify(curLv));
+    }
+    //获取关卡
+    getLvDt(): number {
+        const jsonStr = localStorage.getItem("curLv")
+        return JSON.parse(jsonStr);
+    }
+    //保存玩家名字
+    savePlayerName(name: string) {
+        localStorage.setItem(`PlayerName`, JSON.stringify(name));
+    }
+    //获取玩家名字
+    getPlayerName(): string {
+        const jsonStr = localStorage.getItem(`PlayerName`)
+        return JSON.parse(jsonStr);
+    }
+    //金币
+    saveGold(num: number) {
+        localStorage.setItem(`Gold`, JSON.stringify(num));
+    }
+    getGold(): number {
+        const jsonStr = localStorage.getItem(`Gold`)
+        return JSON.parse(jsonStr);
+    }
+    //钻石
+    saveDiamond(num: number) {
+        localStorage.setItem(`Diamond`, JSON.stringify(num));
+    }
+    getDiamond(): number {
+        const jsonStr = localStorage.getItem(`Diamond`)
+        return JSON.parse(jsonStr);
+    }
+
+
+}
+export const localDt: LocalStorage = LocalStorage.instance = new LocalStorage();
+

+ 9 - 0
assets/Script/Frames/LocalDt.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "a07c0545-b5a1-40dc-86a8-a5747c117984",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 9 - 9
assets/Script/Game/MyApp.ts

@@ -1,17 +1,16 @@
 import { _decorator, Component } from 'cc';
-import { UIMgr } from '../Frames/UIManager';
 import { resMgr } from '../Frames/ResourcesMgr';
 import { dataMgr } from '../Frames/DataManager';
-import { UIType } from './GameFrameWork/UIBase';
 import { LoadingUI } from './UI/LoadingUI';
 const { ccclass, property } = _decorator;
 
 @ccclass('MyApp')
 export class MyApp extends Component {
-    protected async  onLoad(){
-        await UIMgr.openUI("LoadingUI",UIType.PAGE);
-        const loadingUI = UIMgr.getUI(LoadingUI);
-        
+    protected async start(){
+        // await UIMgr.openUI("LoadingUI",UIType.PAGE);
+        // const loadingUI = UIMgr.getUI(LoadingUI);
+        const loadingUI = this.node.getChildByName("LoadingUI").getComponent(LoadingUI)
+        await dataMgr.loadDataDir("Data");
         await resMgr.loadAllRes("Res", (finish, total)=>{
             if(loadingUI){
                 loadingUI.updateProgress(finish / total);
@@ -24,8 +23,9 @@ export class MyApp extends Component {
                 loadingUI.updateWhichRes(2);
             }
         });
-        await dataMgr.loadDataDir("Data");
-        UIMgr.closeUI("LoadingUI");
-        UIMgr.openUI("Start",UIType.PAGE);
+        
+        this.node.getChildByName("LoadingUI").active = false;
+        // UIMgr.closeUI("LoadingUI");
+        // UIMgr.openUI("Start",UIType.PAGE);
     }
 }

+ 5 - 5
assets/Script/Game/MyApp/GameScene/EnemyTower.ts

@@ -1,4 +1,4 @@
-import { _decorator, find,Label, PhysicsGroup } from 'cc';
+import { _decorator, find, Label, PhysicsGroup } from 'cc';
 import { LifeBar } from './LifeBar';
 import { Role } from '../Role';
 import { Enemy } from './Enemy';
@@ -36,7 +36,7 @@ export class EnemyTower extends Role {
     }
 
     //游戏结束数据结算
-    private _gameOverDtSettlement(){
+    private _gameOverDtSettlement() {
         GameInfo.Instance.setIsGameOver(true);
         GameInfo.Instance.setOverWin(true);
         const myTower = find("Canvas/GameRoot/MyTower").getComponent(MyTower);
@@ -44,12 +44,12 @@ export class EnemyTower extends Role {
         GameMgr.Instance.getModuler(GameOver).show();
     }
 
-    private _lifePercent(curHp: number, totalHp: number){
-        if(totalHp <= 0){
+    private _lifePercent(curHp: number, totalHp: number) {
+        if (totalHp <= 0) {
             return;
         }
         let lifePercent = Math.floor((curHp / totalHp) * 100);
-        lifePercent = Math.max(0, Math.min(lifePercent,100));
+        lifePercent = Math.max(0, Math.min(lifePercent, 100));
         GameInfo.Instance.setLifePecent(lifePercent);
     }
 

+ 6 - 1
assets/Script/Game/MyApp/GameScene/GameOver.ts

@@ -1,8 +1,9 @@
-import { _decorator, director, Label, } from 'cc';
+import { _decorator, Director, director, EventKeyboard, find, Label, NodeEventType, } from 'cc';
 import { ModulerBase } from '../../GameFrameWork/ModulerBase';
 import { resMgr } from '../../../Frames/ResourcesMgr';
 import { GameInfo } from '../../../GameInfo';
 import { messageMgr } from '../../../Frames/MessageMgr';
+import { localDt } from '../../../Frames/LocalDt';
 const { ccclass, property } = _decorator;
 
 @ccclass('GameOver')
@@ -45,6 +46,7 @@ export class GameOver extends ModulerBase {
     protected onStart(): void {
         this.onBtnClick("_btnLeft", this._onBtnBack, this);
         this.onBtnClick("_btnRight", this._onBtnRight, this);
+        director.preloadScene("StartScene")
     }
     config() {
         this.getSprite("_gameOverUITitle").spriteFrame =
@@ -117,6 +119,7 @@ export class GameOver extends ModulerBase {
         map.set("GameOverRewardGold",this.totalGold + GameInfo.Instance.getGold());
         map.set("GameOverRewardDia", this.totalDia + GameInfo.Instance.getDiamond());
         map.set("Xp", this.xp + GameInfo.Instance.getCurGradeExp());
+        
         if(GameInfo.Instance.getOverWin()){
             GameInfo.Instance.setCurLv(GameInfo.Instance.getCurlv() + 1);
             map.set("CurLv", GameInfo.Instance.getCurlv());
@@ -124,6 +127,8 @@ export class GameOver extends ModulerBase {
         GameInfo.Instance.setGameOverReward(map);
         GameInfo.Instance.setGold(this.totalGold + GameInfo.Instance.getGold());
         GameInfo.Instance.setDiamond(this.totalDia + GameInfo.Instance.getDiamond());
+        localDt.saveGold(GameInfo.Instance.getGold());
+        localDt.saveDiamond(GameInfo.Instance.getDiamond());
     }
 }
 

+ 2 - 1
assets/Script/Game/MyApp/SelectTroopsBottom.ts

@@ -1,4 +1,4 @@
-import { _decorator, Button, Component, director, Node, resources, Sprite, SpriteFrame } from 'cc';
+import { _decorator, Button, Component, director, find, Node, resources, Sprite, SpriteFrame } from 'cc';
 import { GameInfo } from '../../GameInfo';
 import { UIMgr } from '../../Frames/UIManager';
 import { GameMgr } from '../GameFrameWork/GameMgr';
@@ -24,6 +24,7 @@ export class SelectTroopsBottom extends Component {
         if (this._names) {
             GameInfo.Instance.setRoleImgNames(this._names);
             GameInfo.Instance.getGameOverReward().clear();
+            
             director.loadScene("GameScene");
         }
     }

+ 19 - 1
assets/Script/Game/UI/BattleSceneLeft.ts

@@ -1,20 +1,27 @@
-import { _decorator, director, } from 'cc';
+import { _decorator, director, EditBox, } from 'cc';
 import { GameInfo } from '../../GameInfo';
 import { resMgr } from '../../Frames/ResourcesMgr';
 import { ModulerBase } from '../GameFrameWork/ModulerBase';
 import { GameMgr } from '../GameFrameWork/GameMgr';
 import { SelectTroops } from './SelectTroops';
 import { BattleSceneTop } from './BattleSceneTop';
+import { localDt } from '../../Frames/LocalDt';
 const { ccclass, property } = _decorator;
 
 @ccclass('BattleSceneLeft')
 export class BattleSceneLeft extends ModulerBase {
+    editBox: EditBox | null = null;
+    
     protected onStart() {
+        this.editBox = this.getComponentInChildren(EditBox);
+        this._setEdit();
+        
         this._curLv(GameInfo.Instance.getCurlv());
         this.onBtnClick("_btnLevel", this._btnLevel);
         if(GameInfo.Instance.getOverWin() && GameInfo.Instance.getGameOverReward().size != 0){
             this._curLv(GameInfo.Instance.getGameOverReward().get("CurLv"));
         }
+        this.editBox.node.on("editing-did-ended", this._onEdit, this)
     }
 
     //当前关卡
@@ -26,6 +33,17 @@ export class BattleSceneLeft extends ModulerBase {
         GameMgr.Instance.getModuler(SelectTroops).show();
         GameMgr.Instance.getModuler(BattleSceneTop).battleMode("选择部队")
     }
+
+    //保存名字
+    private _onEdit(editbox: EditBox){
+        localDt.savePlayerName(editbox.string);
+    }
+
+    private _setEdit(){
+        if(localDt.getPlayerName()){
+            this.editBox.string = localDt.getPlayerName();
+        }
+    }
 }
 
 

+ 2 - 2
assets/Script/Game/UI/BattleSceneTop.ts

@@ -24,12 +24,12 @@ export class BattleSceneTop extends ModulerBase {
     }
 
     //金币数量
-    private _gold(goldAmound: number) {
+    _gold(goldAmound: number) {
         this.getLabel("_gold").string = String(goldAmound);
     }
 
     //钻石数量
-    private _diamond(diamondAmound: number) {
+    _diamond(diamondAmound: number) {
         this.getLabel("_diamond").string = String(diamondAmound);
     }
 

+ 27 - 4
assets/Script/Game/UI/LoadingUI.ts

@@ -1,16 +1,39 @@
-import { _decorator,Label, ProgressBar } from 'cc';
+import { _decorator,Component,director,Label, ProgressBar } from 'cc';
 import { UIBase } from '../GameFrameWork/UIBase';
 const { ccclass, property } = _decorator;
 
 @ccclass('LoadingUI')
-export class LoadingUI extends UIBase {
+// export class LoadingUI extends UIBase {
+//     progressBar: ProgressBar = null;
+//     progressLabel: Label = null;
+//     whichRes: Label = null;
+//     protected onStart(): void {
+//         this.progressBar = this.getComponentInChildren(ProgressBar);
+//         this.progressLabel = this.getComponentInChildren(Label);
+//         this.whichRes = this.getLabel("_which");
+//     }
+//     public updateProgress(progress: number){
+//         if(this.progressBar){
+//             this.progressBar.progress = progress;
+//         }
+//         if(this.progressLabel){
+//             this.progressLabel.string = `${Math.floor(progress * 100)}%`;
+//         }
+//     }
+//     public updateWhichRes(which: number){
+//         if(this.whichRes){
+//             this.whichRes.string = `${which}/2`;
+//         }
+//     }
+// }
+export class LoadingUI extends Component {
     progressBar: ProgressBar = null;
     progressLabel: Label = null;
     whichRes: Label = null;
-    protected onStart(): void {
+    protected start(): void {
         this.progressBar = this.getComponentInChildren(ProgressBar);
         this.progressLabel = this.getComponentInChildren(Label);
-        this.whichRes = this.getLabel("_which");
+        this.whichRes = this.node.getChildByName("_which").getComponent(Label);
     }
     public updateProgress(progress: number){
         if(this.progressBar){

+ 4 - 1
assets/Script/Game/UI/PopupUI.ts

@@ -6,6 +6,8 @@ import { UIMgr } from '../../Frames/UIManager';
 import { GameInfo } from '../../GameInfo';
 import { Tip } from './Tip';
 import { messageMgr } from '../../Frames/MessageMgr';
+import { GameMgr } from '../GameFrameWork/GameMgr';
+import { BattleSceneTop } from './BattleSceneTop';
 const { ccclass, property } = _decorator;
 
 @ccclass('PopupUI')
@@ -96,7 +98,8 @@ export class PopupUI extends UIBase {
             tip.parent = this.node;
             return;
         }
-        messageMgr.dispatch("reduceGold", (totalGold - consume));
+        GameMgr.Instance.getModuler(BattleSceneTop)._gold((totalGold - consume));
+        //messageMgr.dispatch("reduceGold", (totalGold - consume));
         GameInfo.Instance.setGold((totalGold - consume));
         (PopupUIDataConfig.Instance.getFunction())();
         UIMgr.closeUI("PopupUI", true);

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

@@ -1,22 +1,22 @@
 ĂűłĆ,id,lvName,imgName,enemyTowerHp,bgName
 ,number,number,string[],number,string
-lv1,1,1,Role1;Role3;Role5;Role8;Role4;Role10,3000,Scene_1
-lv2,2,2,Role2;Role4;Role6;Role9;Role5;Role11,3000,Scene_2
-lv3,3,3,Role3;Role5;Role7;Role10;Role6;Role12,3000,Scene_3
-lv4,4,4,Role4;Role6;Role8;Role11;Role7;Role13,3500,Scene_4
-lv5,5,5,Role5;Role7;Role9;Role12;Role8;Role14,3500,Scene_5
-lv6,6,6,Role6;Role8;Role10;Role13;Role9;Role1,3700,Scene_6
-lv7,7,7,Role7;Role9;Role11;Role14;Role10,3700,Scene_7
-lv8,8,8,Role8;Role10;Role12;Role1;Role11,4000,Scene_3
-lv9,9,9,Role7;Role9;Role11;Role14;Role10,4000,Scene_4
-lv10,10,10,Role1;Role3;Role5;Role8;Role4;Role10,4500,Scene_2
-lv11,11,11,Role4;Role6;Role8;Role11;Role7;Role13,4500,Scene_3
-lv12,12,12,Role7;Role9;Role11;Role14;Role10,4500,Scene_5
-lv13,13,13,Role8;Role10;Role12;Role1;Role11,4800,Scene_4
-lv14,14,14,Role6;Role8;Role10;Role13;Role9;Role1,4800,Scene_1
-lv15,15,15,Role4;Role6;Role8;Role11;Role7;Role13,4800,Scene_3
-lv16,16,16,Role8;Role10;Role12;Role1;Role11,5000,Scene_5
-lv17,17,17,Role6;Role8;Role10;Role13;Role9;Role1,5000,Scene_2
-lv18,18,18,Role5;Role7;Role9;Role12;Role8;Role14,5000,Scene_5
-lv19,19,19,Role4;Role6;Role8;Role11;Role7;Role13,5500,Scene_7
-lv20,20,20,Role1;Role3;Role5;Role8;Role4;Role10,5500,Scene_1
+lv1,1,1,Role0_1;Role0_3;Role0_5;Role0_8;Role0_4;Role0_10,3000,Scene_1
+lv2,2,2,Role0_2;Role0_4;Role0_6;Role0_9;Role0_5;Role0_11,3000,Scene_2
+lv3,3,3,Role0_3;Role0_5;Role0_7;Role0_10;Role0_6;Role0_12,3000,Scene_3
+lv4,4,4,Role0_4;Role0_6;Role0_8;Role0_11;Role0_7;Role0_13,3500,Scene_4
+lv5,5,5,Role0_5;Role0_7;Role0_9;Role0_12;Role0_8;Role0_14,3500,Scene_5
+lv6,6,6,Role0_6;Role0_8;Role0_10;Role0_13;Role0_9;Role0_1,3700,Scene_6
+lv7,7,7,Role0_7;Role0_9;Role0_11;Role0_14;Role0_10,3700,Scene_7
+lv8,8,8,Role0_8;Role0_10;Role0_12;Role0_1;Role0_11,4000,Scene_3
+lv9,9,9,Role0_7;Role0_9;Role0_11;Role0_14;Role0_10,4000,Scene_4
+lv10,10,10,Role0_1;Role0_3;Role0_5;Role0_8;Role0_4;Role0_10,4500,Scene_2
+lv11,11,11,Role0_4;Role0_6;Role0_8;Role0_11;Role0_7;Role0_13,4500,Scene_3
+lv12,12,12,Role0_7;Role0_9;Role0_11;Role0_14;Role0_10,4500,Scene_5
+lv13,13,13,Role0_8;Role0_10;Role0_12;Role0_1;Role0_11,4800,Scene_4
+lv14,14,14,Role0_6;Role0_8;Role0_10;Role0_13;Role0_9;Role0_1,4800,Scene_1
+lv15,15,15,Role0_4;Role0_6;Role0_8;Role0_11;Role0_7;Role0_13,4800,Scene_3
+lv16,16,16,Role0_8;Role0_10;Role0_12;Role0_1;Role0_11,5000,Scene_5
+lv17,17,17,Role0_6;Role0_8;Role0_10;Role0_13;Role0_9;Role0_1,5000,Scene_2
+lv18,18,18,Role0_5;Role0_7;Role0_9;Role0_12;Role0_8;Role0_14,5000,Scene_5
+lv19,19,19,Role0_4;Role0_6;Role0_8;Role0_11;Role0_7;Role0_13,5500,Scene_7
+lv20,20,20,Role0_1;Role0_3;Role0_5;Role0_8;Role0_4;Role0_10,5500,Scene_1

+ 14 - 14
assets/resources/Data/RoleCardData.csv

@@ -1,16 +1,16 @@
 名称,id,imgName,atk,hp,atkLength,moveSpeed,typeRole,moveCount,moveImg,atkCount,atkImg,idleCount,idleImg,dieCount,dieImg,bulletCount,bulletImg,bulletExplodeCount,bulletExplodeImg,consume
 ,number,string,number,number,number,number,string,number,string,number,string,number,string,number,string,number,string,number,string,number
-Role1,1,Role1,35,400,240,40,water,8,Role1_move_,8,Role1_attack_,8,Role1_idle_,9,Die,4,bullet1_,5,burst3_,9
-Role2,2,Role2,40,520,235,35,fire,8,Role2_move_,8,Role2_attack_,8,Role2_idle_,9,Die,3,bullet2_,8,burst2_,10
-Role3,3,Role3,32,480,247,30,wind,8,Role3_move_,8,Role3_attack_,8,Role3_idle_,9,Die,3,bullet3_,5,burst7_,11
-Role4,4,Role4,25,500,250,38,fire,8,Role4_move_,8,Role4_attack_,8,Role4_idle_,9,Die,1,bullet4_,10,burst6_,9
-Role5,5,Role5,32,600,245,42,water,8,Role5_move_,8,Role5_attack_,8,Role5_idle_,9,Die,1,bullet5_,6,burst9_,10
-Role6,6,Role6,28,489,245,40,dark,8,Role6_move_,8,Role6_attack_,8,Role6_idle_,9,Die,4,bullet6_,5,burst7_,9
-Role7,7,Role7,41,512,257,37,light,8,Role7_move_,8,Role7_attack_,8,Role7_idle_,9,Die,3,bullet7_,11,burst10_,10
-Role8,8,Role8,100,500,240,41,dark,8,Role8_move_,8,Role8_attack_,8,Role8_idle_,9,Die,3,bullet8_,6,burst9_,11
-Role9,9,Role9,120,600,240,20,dark,8,Role9_move_,8,Role9_attack_,8,Role9_idle_,9,Die,11,bullet9_,17,burst1_,11
-Role10,10,Role10,70,700,230,30,dark,8,Role10_move_,8,Role10_attack_,8,Role10_idle_,9,Die,3,bullet8_,6,burst9_,10
-Role11,11,Role11,80,560,220,25,dark,8,Role11_move_,8,Role11_attack_,8,Role11_idle_,9,Die,3,bullet3_,5,burst7_,9
-Role12,12,Role12,90,645,260,20,dark,8,Role12_move_,8,Role12_attack_,8,Role12_idle_,9,Die,3,bullet8_,6,burst9_,11
-Role13,13,Role13,60,850,245,30,dark,8,Role13_move_,8,Role13_attack_,8,Role13_idle_,9,Die,3,bullet10_,6,burst8_,9
-Role14,14,Role14,75,750,240,50,dark,8,Role14_move_,8,Role14_attack_,8,Role14_idle_,9,Die,1,bullet5_,6,burst9_,9
+Role1,1,Role0_1,35,400,240,40,water,8,Role1_move_,8,Role1_attack_,8,Role1_idle_,9,Die,4,bullet1_,5,burst3_,9
+Role2,2,Role0_2,40,520,235,35,fire,8,Role2_move_,8,Role2_attack_,8,Role2_idle_,9,Die,3,bullet2_,8,burst2_,10
+Role3,3,Role0_3,32,480,247,30,wind,8,Role3_move_,8,Role3_attack_,8,Role3_idle_,9,Die,3,bullet3_,5,burst7_,11
+Role4,4,Role0_4,25,500,250,38,fire,8,Role4_move_,8,Role4_attack_,8,Role4_idle_,9,Die,1,bullet4_,10,burst6_,9
+Role5,5,Role0_5,32,600,245,42,water,8,Role5_move_,8,Role5_attack_,8,Role5_idle_,9,Die,1,bullet5_,6,burst9_,10
+Role6,6,Role0_6,28,489,245,40,dark,8,Role6_move_,8,Role6_attack_,8,Role6_idle_,9,Die,4,bullet6_,5,burst7_,9
+Role7,7,Role0_7,41,512,257,37,light,8,Role7_move_,8,Role7_attack_,8,Role7_idle_,9,Die,3,bullet7_,11,burst10_,10
+Role8,8,Role0_8,100,500,240,41,dark,8,Role8_move_,8,Role8_attack_,8,Role8_idle_,9,Die,3,bullet8_,6,burst9_,11
+Role9,9,Role0_9,120,600,240,20,dark,8,Role9_move_,8,Role9_attack_,8,Role9_idle_,9,Die,11,bullet9_,17,burst1_,11
+Role10,10,Role0_10,70,700,230,30,dark,8,Role10_move_,8,Role10_attack_,8,Role10_idle_,9,Die,3,bullet8_,6,burst9_,10
+Role11,11,Role0_11,80,560,220,25,dark,8,Role11_move_,8,Role11_attack_,8,Role11_idle_,9,Die,3,bullet3_,5,burst7_,9
+Role12,12,Role0_12,90,645,260,20,dark,8,Role12_move_,8,Role12_attack_,8,Role12_idle_,9,Die,3,bullet8_,6,burst9_,11
+Role13,13,Role0_13,60,850,245,30,dark,8,Role13_move_,8,Role13_attack_,8,Role13_idle_,9,Die,3,bullet10_,6,burst8_,9
+Role14,14,Role0_14,75,750,240,50,dark,8,Role14_move_,8,Role14_attack_,8,Role14_idle_,9,Die,1,bullet5_,6,burst9_,9

+ 15 - 15
assets/resources/Res/Roles/Roles1-14.plist

@@ -4,7 +4,7 @@
     <dict>
         <key>frames</key>
         <dict>
-            <key>Role1.png</key>
+            <key>Role0_1.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{358,190},{93,96}}</string>
@@ -17,7 +17,7 @@
                 <key>sourceSize</key>
                 <string>{93,96}</string>
             </dict>
-            <key>Role10.png</key>
+            <key>Role0_10.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{159,217},{87,98}}</string>
@@ -30,7 +30,7 @@
                 <key>sourceSize</key>
                 <string>{87,98}</string>
             </dict>
-            <key>Role11.png</key>
+            <key>Role0_11.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{248,228},{83,93}}</string>
@@ -43,7 +43,7 @@
                 <key>sourceSize</key>
                 <string>{83,93}</string>
             </dict>
-            <key>Role12.png</key>
+            <key>Role0_12.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{242,2},{131,118}}</string>
@@ -56,7 +56,7 @@
                 <key>sourceSize</key>
                 <string>{131,118}</string>
             </dict>
-            <key>Role13.png</key>
+            <key>Role0_13.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{104,383},{119,92}}</string>
@@ -69,7 +69,7 @@
                 <key>sourceSize</key>
                 <string>{119,92}</string>
             </dict>
-            <key>Role14.png</key>
+            <key>Role0_14.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{362,2},{119,91}}</string>
@@ -82,7 +82,7 @@
                 <key>sourceSize</key>
                 <string>{119,91}</string>
             </dict>
-            <key>Role2.png</key>
+            <key>Role0_2.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{130,2},{132,110}}</string>
@@ -95,7 +95,7 @@
                 <key>sourceSize</key>
                 <string>{132,110}</string>
             </dict>
-            <key>Role3.png</key>
+            <key>Role0_3.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{2,2},{126,216}}</string>
@@ -108,7 +108,7 @@
                 <key>sourceSize</key>
                 <string>{126,216}</string>
             </dict>
-            <key>Role4.png</key>
+            <key>Role0_4.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{2,220},{161,155}}</string>
@@ -121,7 +121,7 @@
                 <key>sourceSize</key>
                 <string>{161,155}</string>
             </dict>
-            <key>Role5.png</key>
+            <key>Role0_5.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{250,135},{91,106}}</string>
@@ -134,7 +134,7 @@
                 <key>sourceSize</key>
                 <string>{91,106}</string>
             </dict>
-            <key>Role6.png</key>
+            <key>Role0_6.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{2,383},{121,100}}</string>
@@ -147,7 +147,7 @@
                 <key>sourceSize</key>
                 <string>{121,100}</string>
             </dict>
-            <key>Role7.png</key>
+            <key>Role0_7.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{130,136},{118,79}}</string>
@@ -160,7 +160,7 @@
                 <key>sourceSize</key>
                 <string>{118,79}</string>
             </dict>
-            <key>Role8.png</key>
+            <key>Role0_8.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{343,285},{85,91}}</string>
@@ -173,7 +173,7 @@
                 <key>sourceSize</key>
                 <string>{85,91}</string>
             </dict>
-            <key>Role9.png</key>
+            <key>Role0_9.png</key>
             <dict>
                 <key>frame</key>
                 <string>{{362,95},{108,93}}</string>
@@ -196,7 +196,7 @@
             <key>size</key>
             <string>{512,512}</string>
             <key>smartupdate</key>
-            <string>$TexturePacker:SmartUpdate:d6c6d690b44114ce30021ef915ca6a5e$</string>
+            <string>$TexturePacker:SmartUpdate:a9d3b64b20e9e1cbbf8fe5c529c767e0$</string>
             <key>textureFileName</key>
             <string>Roles1-14.png</string>
         </dict>

+ 98 - 98
assets/resources/Res/Roles/Roles1-14.plist.meta

@@ -7,12 +7,58 @@
     ".json"
   ],
   "subMetas": {
-    "1ab52": {
+    "88343": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@1ab52",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@88343",
       "displayName": "",
-      "id": "1ab52",
-      "name": "Role1",
+      "id": "88343",
+      "name": "Role0_6",
+      "userData": {
+        "trimType": "auto",
+        "trimThreshold": 1,
+        "rotated": true,
+        "offsetX": 0,
+        "offsetY": 0,
+        "trimX": 2,
+        "trimY": 383,
+        "width": 121,
+        "height": 100,
+        "rawWidth": 121,
+        "rawHeight": 100,
+        "borderTop": 0,
+        "borderBottom": 0,
+        "borderLeft": 0,
+        "borderRight": 0,
+        "packable": true,
+        "pixelsToUnit": 100,
+        "pivotX": 0.5,
+        "pivotY": 0.5,
+        "meshType": 0,
+        "vertices": {
+          "rawPosition": [],
+          "indexes": [],
+          "uv": [],
+          "nuv": [],
+          "minPos": [],
+          "maxPos": []
+        },
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "71e8f99e-0c04-4d75-a750-55c55b6e8ac0@6c48a",
+        "atlasUuid": "4218f44f-12d2-4af3-879d-a84b502d6d98"
+      },
+      "ver": "1.0.12",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    },
+    "c5b8e": {
+      "importer": "sprite-frame",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@c5b8e",
+      "displayName": "",
+      "id": "c5b8e",
+      "name": "Role0_1",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -53,12 +99,12 @@
       ],
       "subMetas": {}
     },
-    "a0118": {
+    "fcac2": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@a0118",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@fcac2",
       "displayName": "",
-      "id": "a0118",
-      "name": "Role10",
+      "id": "fcac2",
+      "name": "Role0_10",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -99,12 +145,12 @@
       ],
       "subMetas": {}
     },
-    "50f0e": {
+    "8ec08": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@50f0e",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@8ec08",
       "displayName": "",
-      "id": "50f0e",
-      "name": "Role11",
+      "id": "8ec08",
+      "name": "Role0_11",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -145,12 +191,12 @@
       ],
       "subMetas": {}
     },
-    "d86ed": {
+    "b5ece": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@d86ed",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@b5ece",
       "displayName": "",
-      "id": "d86ed",
-      "name": "Role12",
+      "id": "b5ece",
+      "name": "Role0_12",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -191,12 +237,12 @@
       ],
       "subMetas": {}
     },
-    "b3af3": {
+    "ce785": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@b3af3",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@ce785",
       "displayName": "",
-      "id": "b3af3",
-      "name": "Role13",
+      "id": "ce785",
+      "name": "Role0_13",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -237,12 +283,12 @@
       ],
       "subMetas": {}
     },
-    "b1f20": {
+    "c727f": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@b1f20",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@c727f",
       "displayName": "",
-      "id": "b1f20",
-      "name": "Role14",
+      "id": "c727f",
+      "name": "Role0_14",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -283,12 +329,12 @@
       ],
       "subMetas": {}
     },
-    "1d2a3": {
+    "415c5": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@1d2a3",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@415c5",
       "displayName": "",
-      "id": "1d2a3",
-      "name": "Role2",
+      "id": "415c5",
+      "name": "Role0_2",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -329,12 +375,12 @@
       ],
       "subMetas": {}
     },
-    "27ada": {
+    "d9cf8": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@27ada",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@d9cf8",
       "displayName": "",
-      "id": "27ada",
-      "name": "Role3",
+      "id": "d9cf8",
+      "name": "Role0_3",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -375,12 +421,12 @@
       ],
       "subMetas": {}
     },
-    "8f744": {
+    "6acb7": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@8f744",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@6acb7",
       "displayName": "",
-      "id": "8f744",
-      "name": "Role4",
+      "id": "6acb7",
+      "name": "Role0_4",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -421,12 +467,12 @@
       ],
       "subMetas": {}
     },
-    "fe656": {
+    "e59da": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@fe656",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@e59da",
       "displayName": "",
-      "id": "fe656",
-      "name": "Role5",
+      "id": "e59da",
+      "name": "Role0_5",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -467,58 +513,12 @@
       ],
       "subMetas": {}
     },
-    "98dca": {
-      "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@98dca",
-      "displayName": "",
-      "id": "98dca",
-      "name": "Role6",
-      "userData": {
-        "trimType": "auto",
-        "trimThreshold": 1,
-        "rotated": true,
-        "offsetX": 0,
-        "offsetY": 0,
-        "trimX": 2,
-        "trimY": 383,
-        "width": 121,
-        "height": 100,
-        "rawWidth": 121,
-        "rawHeight": 100,
-        "borderTop": 0,
-        "borderBottom": 0,
-        "borderLeft": 0,
-        "borderRight": 0,
-        "packable": true,
-        "pixelsToUnit": 100,
-        "pivotX": 0.5,
-        "pivotY": 0.5,
-        "meshType": 0,
-        "vertices": {
-          "rawPosition": [],
-          "indexes": [],
-          "uv": [],
-          "nuv": [],
-          "minPos": [],
-          "maxPos": []
-        },
-        "isUuid": true,
-        "imageUuidOrDatabaseUri": "71e8f99e-0c04-4d75-a750-55c55b6e8ac0@6c48a",
-        "atlasUuid": "4218f44f-12d2-4af3-879d-a84b502d6d98"
-      },
-      "ver": "1.0.12",
-      "imported": true,
-      "files": [
-        ".json"
-      ],
-      "subMetas": {}
-    },
-    "c56e9": {
+    "c3ccd": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@c56e9",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@c3ccd",
       "displayName": "",
-      "id": "c56e9",
-      "name": "Role7",
+      "id": "c3ccd",
+      "name": "Role0_7",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -559,12 +559,12 @@
       ],
       "subMetas": {}
     },
-    "1749f": {
+    "dc003": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@1749f",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@dc003",
       "displayName": "",
-      "id": "1749f",
-      "name": "Role8",
+      "id": "dc003",
+      "name": "Role0_8",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,
@@ -605,12 +605,12 @@
       ],
       "subMetas": {}
     },
-    "21bbf": {
+    "73aff": {
       "importer": "sprite-frame",
-      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@21bbf",
+      "uuid": "4218f44f-12d2-4af3-879d-a84b502d6d98@73aff",
       "displayName": "",
-      "id": "21bbf",
-      "name": "Role9",
+      "id": "73aff",
+      "name": "Role0_9",
       "userData": {
         "trimType": "auto",
         "trimThreshold": 1,

+ 3 - 0
build-templates/templates-version.json

@@ -0,0 +1,3 @@
+{
+    "wechatgame": "1.0.0"
+}

+ 80 - 0
build-templates/wechatgame/game.ejs

@@ -0,0 +1,80 @@
+function __initApp () {  // init app
+globalThis.__wxRequire = require;  // FIX: require cannot work in separate engine 
+require('./web-adapter');
+const firstScreen = require('./first-screen');
+
+<%- include(cocosTemplate, {}) %>
+
+// Adapt for IOS, swap if opposite
+const info = wx.getSystemInfoSync();
+if (canvas){
+    var _w = canvas.width;
+    var _h = canvas.height;
+    if (info.screenWidth < info.screenHeight) {
+        if (canvas.width > canvas.height) {
+            _w = canvas.height;
+            _h = canvas.width;
+        }
+    } else {
+        if (canvas.width < canvas.height) {
+            _w = canvas.height;
+            _h = canvas.width;
+        }
+    }
+    canvas.width = _w;
+    canvas.height = _h;
+}
+// Adjust initial canvas size
+if (canvas && window.devicePixelRatio >= 2) {canvas.width *= info.devicePixelRatio; canvas.height *= info.devicePixelRatio;}
+
+const importMap = require("<%= importMapFile%>").default;
+System.warmup({
+    importMap,
+    importMapUrl: '<%= importMapFile%>',
+    defaultHandler: (urlNoSchema) => {
+        require('.' + urlNoSchema);
+    },
+    handlers: {
+        'plugin:': (urlNoSchema) => {
+            requirePlugin(urlNoSchema);
+        },
+        'project:': (urlNoSchema) => {
+            require(urlNoSchema);
+        },
+    },
+});
+
+firstScreen.start('<%= alpha %>', '<%= antialias %>', '<%= useWebgl2 %>').then(() => {
+    return System.import('<%= applicationJs %>');
+}).then((module) => {
+    return firstScreen.setProgress(0.2).then(() => Promise.resolve(module));
+}).then(({ Application }) => {
+    return new Application();
+}).then((application) => {
+    return firstScreen.setProgress(0.4).then(() => Promise.resolve(application));
+}).then((application) => {
+    return onApplicationCreated(application);
+}).catch((err) => {
+    console.error(err);
+});
+
+function onApplicationCreated(application) {
+    return System.import('cc').then((module) => {
+        return firstScreen.setProgress(0.6).then(() => Promise.resolve(module));
+    }).then((cc) => {
+        require('./engine-adapter');
+        return application.init(cc);
+    }).then(() => {
+        return firstScreen.end().then(() => application.start());
+    });
+}
+
+}  // init app
+
+// NOTE: on WeChat Android end, we can only get the correct screen size at the second tick of game.
+var sysInfo = wx.getSystemInfoSync();
+if (sysInfo.platform.toLocaleLowerCase() === 'android') {
+    GameGlobal.requestAnimationFrame (__initApp);
+} else {
+    __initApp();
+}

+ 10 - 0
build-templates/wechatgame/game.json

@@ -0,0 +1,10 @@
+{
+  "deviceOrientation": "portrait",
+  "openDataContext": "",
+  "networkTimeout": {
+    "request": 5000,
+    "connectSocket": 5000,
+    "uploadFile": 5000,
+    "downloadFile": 500000
+  }
+}

+ 35 - 0
build-templates/wechatgame/project.config.json

@@ -0,0 +1,35 @@
+{
+    "description": "项目配置文件。",
+    "miniprogramRoot": "./",
+    "setting": {
+        "urlCheck": true,
+        "postcss": true,
+        "minified": true,
+        "newFeature": false,
+        "enhance": true,
+        "useIsolateContext": true
+    },
+    "compileType": "game",
+    "libVersion": "game",
+    "appid": "",
+    "projectname": "",
+    "condition": {
+        "search": {
+            "current": -1,
+            "list": []
+        },
+        "conversation": {
+            "current": -1,
+            "list": []
+        },
+        "game": {
+            "currentL": -1,
+            "list": [],
+            "current": -1
+        },
+        "miniprogram": {
+            "current": -1,
+            "list": []
+        }
+    }
+}

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