Selaa lähdekoodia

下一关资源未加载BUG

greg 4 vuotta sitten
vanhempi
commit
0e002db1ee

+ 13 - 9
assets/resources/ui/FullScreenui.prefab

@@ -2745,7 +2745,9 @@
       "__id__": 7
     },
     "_enabled": true,
-    "scrollView": null,
+    "scrollView": {
+      "__id__": 85
+    },
     "content": {
       "__id__": 8
     },
@@ -7578,8 +7580,8 @@
     "brake": 0.5,
     "elastic": true,
     "inertia": true,
-    "horizontal": true,
-    "vertical": false,
+    "horizontal": false,
+    "vertical": true,
     "cancelInnerEvents": true,
     "scrollEvents": [],
     "_content": {
@@ -7597,7 +7599,9 @@
       "__id__": 108
     },
     "_enabled": true,
-    "scrollView": null,
+    "scrollView": {
+      "__id__": 240
+    },
     "content": {
       "__id__": 109
     },
@@ -7822,7 +7826,7 @@
     },
     "_sharedMaterial": null,
     "_useOriginalSize": true,
-    "_string": "返回主页",
+    "_string": "继续游戏",
     "_horizontalAlign": 1,
     "_verticalAlign": 1,
     "_actualFontSize": 30,
@@ -7958,13 +7962,13 @@
       "__uuid__": "8e19f7f5-6397-4787-9cf7-9c1cd153edaa@f9941"
     },
     "_hoverSprite": {
-      "__uuid__": "90ccd307-d74d-4edb-b9aa-b3906c07d399@f9941"
+      "__uuid__": "8e19f7f5-6397-4787-9cf7-9c1cd153edaa@f9941"
     },
     "_pressedSprite": {
-      "__uuid__": "90ccd307-d74d-4edb-b9aa-b3906c07d399@f9941"
+      "__uuid__": "8e19f7f5-6397-4787-9cf7-9c1cd153edaa@f9941"
     },
     "_disabledSprite": {
-      "__uuid__": "90ccd307-d74d-4edb-b9aa-b3906c07d399@f9941"
+      "__uuid__": "8e19f7f5-6397-4787-9cf7-9c1cd153edaa@f9941"
     },
     "_duration": 0.1,
     "_zoomScale": 1.2,
@@ -7980,7 +7984,7 @@
     },
     "component": "",
     "_componentId": "047e7uC4zVJdpjqMm8v6bej",
-    "handler": "BackToMain",
+    "handler": "ContinueGame",
     "customEventData": ""
   },
   {

+ 3 - 3
assets/resources/ui/GameOverUI.prefab

@@ -315,7 +315,7 @@
         "__id__": 45
       }
     ],
-    "_active": true,
+    "_active": false,
     "_components": [
       {
         "__id__": 56
@@ -1750,7 +1750,7 @@
     },
     "component": "",
     "_componentId": "15ec3t8BJRJTpilb3tkiwVQ",
-    "handler": "PlayNextLevel",
+    "handler": "GoToFullOutput",
     "customEventData": ""
   },
   {
@@ -3014,7 +3014,7 @@
     },
     "_sharedMaterial": null,
     "_useOriginalSize": true,
-    "_string": ">>> 返回 <<<",
+    "_string": ">>> 继续游戏<<<",
     "_horizontalAlign": 1,
     "_verticalAlign": 1,
     "_actualFontSize": 34,

+ 2 - 49
assets/scripts/games/scenes/FightingScene.ts

@@ -61,65 +61,18 @@ export class FightingScene extends Component {
     })
     RightStartPos:Node=null;
     
-    /**
-     * 资源引用
-     */
-    private assetsRef:Prefab[];
+
 
     onLoad(){
         console.log("进入Fighting场景");
     }
 
-    private LoadAssets():void{
-        let urls:string[]=[];
-        //武器
-        let weaponConfig:any=GameConfigManager.GetWeaponConfig(GameModel.single.currentWeaponId);
-        urls.push(weaponConfig.prefab);
-
-        //栅栏
-        let fenceConfig:any=GameConfigManager.GetFenceConfig(GameModel.single.currentFenceId);
-        urls.push(fenceConfig.prefab);
-        
-        //本关用到的怪物资源
-        let levelConfig:any=GameConfigManager.GetLevelConfig(GameModel.single.currentLevel);
-        let monsterConfig:any;
-        levelConfig.monsters.forEach(element => {
-            monsterConfig=GameConfigManager.GetMonsterConfig(element.monsterId);
-            if(urls.indexOf(monsterConfig.prefab)<0){
-                urls.push(monsterConfig.prefab);
-            }
-        });
-
-        //枪口火焰
-        urls.push("d3d/gunFire/GunFire");
-
-        //怪物血条
-        urls.push("ui/components/MonsterHPUI");
-
-        //加载
-        loader.loadResArray(urls,Prefab,this.LoadAssetsProgress.bind(this),this.LoadAssetsComplete.bind(this));
-    }
-
-    private LoadAssetsProgress(index:number,total:number,item):void{
-        LoadingView.single.UpdateProgress(index/total);
-    }
-
-    private LoadAssetsComplete(error:Error,assets):void{
-        if(error){
-            console.error(error);
-        }
-        this.assetsRef=assets;
-        GUIManager.single.Show(UIConst.FIGHTING_UI);
-    }
-
-
     start () {
         // GameController.single.Init(this.leftHand,this.rightHand);
         
         // // Your initialization goes here.
         // GUIManager.single.Show(UIConst.FIGHTING_UI);
-        
-        this.LoadAssets();
+        GUIManager.single.Show(UIConst.FIGHTING_UI);
     }
 
     update (deltaTime: number) {

+ 2 - 2
assets/scripts/games/ui/UIConst.ts

@@ -23,7 +23,7 @@ export class UIConst extends Component {
      * 商城界面
      */
     public static SHOP_UI:number=3;
-
+    
     /**
      * 商城界面
      */
@@ -35,6 +35,6 @@ export class UIConst extends Component {
         GUIManager.single.RegisterGUI(this.FIGHTING_UI,"ui/FightingUI");
         GUIManager.single.RegisterGUI(this.GAME_OVER_UI,"ui/GameOverUI");
         GUIManager.single.RegisterGUI(this.SHOP_UI,"ui/ShopUI");
-        GUIManager.single.RegisterGUI(this.FULL_OUTPUT_UI,"ui/FullScreenUI");
+        GUIManager.single.RegisterGUI(this.FULL_OUTPUT_UI,"ui/FullScreenui");
     }
 }

+ 64 - 1
assets/scripts/games/ui/fightings/FightingMediator.ts

@@ -1,4 +1,4 @@
-import { _decorator, Component, Node, ButtonComponent, EventTouch, director, SkeletalAnimationComponent, Prefab, instantiate, LayoutComponent, LabelComponent, ProgressBarComponent } from 'cc';
+import { _decorator, Component, Node, ButtonComponent, EventTouch, director, SkeletalAnimationComponent, Prefab, instantiate, LayoutComponent, LabelComponent, ProgressBarComponent, loader } from 'cc';
 import { GUIMediator } from '../../../engines/gui/GUIMediator';
 import { GUIManager } from '../../../engines/gui/GUIManager';
 import { UIConst } from '../UIConst';
@@ -10,6 +10,7 @@ import { SceneManager } from '../../../engines/scenes/SceneManager';
 import { DataModel } from '../../../engines/models/DataModel';
 import { DataModelEventType } from '../../../engines/models/DataModelEventType';
 import { GamePropertys } from '../../models/GamePropertys';
+import { LoadingView } from '../../../engines/loadingView/LoadingView';
 const { ccclass, property } = _decorator;
 
 @ccclass('FightingMediator')
@@ -126,19 +127,78 @@ export class FightingMediator extends GUIMediator {
      * 弹夹子弹池
      */
     bulletPool:Node[]=[];
+
+    /**
+     * 资源引用
+     */
+    private assetsRef:Prefab[];
     
+    /**
+     * 显示状态
+     */
+    private onShowed:boolean=false;
     start () {
         // Your initialization goes here.
     }
 
     OnShow():void{
+        this.onShowed=false;
+        this.LoadAssets();
+    }
+
+    private __OnShow():void{
         GameController.single.monsterHPUILayer=this.monsterHPUILayer;
         GameController.single.Init(this);
         this.AddEvents();
         this.RefreshView();
+        this.onShowed=true;
     }
 
+    private LoadAssets():void{
+        let urls:string[]=[];
+        //武器
+        let weaponConfig:any=GameConfigManager.GetWeaponConfig(GameModel.single.currentWeaponId);
+        urls.push(weaponConfig.prefab);
+
+        //栅栏
+        let fenceConfig:any=GameConfigManager.GetFenceConfig(GameModel.single.currentFenceId);
+        urls.push(fenceConfig.prefab);
+        
+        //本关用到的怪物资源
+        let levelConfig:any=GameConfigManager.GetLevelConfig(GameModel.single.currentLevel);
+        let monsterConfig:any;
+        levelConfig.monsters.forEach(element => {
+            monsterConfig=GameConfigManager.GetMonsterConfig(element.monsterId);
+            if(urls.indexOf(monsterConfig.prefab)<0){
+                urls.push(monsterConfig.prefab);
+            }
+        });
+
+        //枪口火焰
+        urls.push("d3d/gunFire/GunFire");
+
+        //怪物血条
+        urls.push("ui/components/MonsterHPUI");
+
+        //加载
+        loader.loadResArray(urls,Prefab,this.LoadAssetsProgress.bind(this),this.LoadAssetsComplete.bind(this));
+    }
+
+    private LoadAssetsProgress(index:number,total:number,item):void{
+        LoadingView.single.UpdateProgress(index/total);
+    }
+
+    private LoadAssetsComplete(error:Error,assets):void{
+        if(error){
+            console.error(error);
+        }
+        this.assetsRef=assets;
+        this.__OnShow();
+    }
+
+
     OnHide():void{
+        this.onShowed=false;
         this.RemoveEvents();
     }
 
@@ -266,6 +326,9 @@ export class FightingMediator extends GUIMediator {
     
     private fenceHp:number=0;
     update (deltaTime: number) {
+        if(this.onShowed==false){
+            return;
+        }
         super.update(deltaTime);
         if(GameController.single.fence.hp!=this.fenceHp){
             this.RefreshFenceHp();

+ 6 - 0
assets/scripts/games/ui/fullOutputs/FullOutputMediator.ts

@@ -2,6 +2,7 @@ import { _decorator, Component, Node } from 'cc';
 import { GUIManager } from '../../../engines/gui/GUIManager';
 import { GUIMediator } from '../../../engines/gui/GUIMediator';
 import { SceneManager } from '../../../engines/scenes/SceneManager';
+import { UIConst } from '../UIConst';
 const { ccclass, property } = _decorator;
 
 @ccclass('FullOutputMediator')
@@ -28,6 +29,11 @@ export class FullOutputMediator extends GUIMediator {
         this.HideSelf();
     }
     
+    ContinueGame():void{
+        GUIManager.single.Show(UIConst.FIGHTING_UI);
+        this.HideSelf();
+    }
+    
     // update (deltaTime: number) {
     //     // Your update function goes here.
     // }

+ 3 - 1
assets/scripts/games/ui/gameovers/GameOverMediator.ts

@@ -79,7 +79,9 @@ export class GameOverMediator extends GUIMediator {
      * 去全屏幕界面
      */
     GoToFullOutput():void{
-        
+        this.AddAward();
+        GUIManager.single.Show(UIConst.FULL_OUTPUT_UI);
+        this.HideSelf();
     }
 
     /**