future 1 yıl önce
ebeveyn
işleme
9eb4dd3bc2

+ 1 - 0
assets/data/data.ts

@@ -253,6 +253,7 @@ export class boss_info_data{
     public bar:ui_att_item = null;
     public head:ui_att_item = null;
     public hp:number = 0;
+    public hp_delay_time:number = 0;
 }
 export class pointer_ding_wei_data{
     public bg:ui_att_item = null;

Dosya farkı çok büyük olduğundan ihmal edildi
+ 122 - 488
assets/edit_game.scene


+ 4 - 4
assets/resources/prefab/ui/ui_top.prefab

@@ -11856,7 +11856,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 90,
+      "width": 300,
       "height": 30
     },
     "_anchorPoint": {
@@ -12035,8 +12035,8 @@
       "__id__": 559
     },
     "_mode": 0,
-    "_totalLength": 300,
-    "_progress": 0.3,
+    "_totalLength": 600,
+    "_progress": 0.5,
     "_reverse": false,
     "_id": ""
   },
@@ -12247,7 +12247,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1920,
-      "height": 1080
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 17 - 0
assets/script/edit/uiWidget/widget_boss_info.ts

@@ -10,6 +10,7 @@ export class widget_boss_info extends Component {
     @property(Node) bar:Node = null;
     @property(Node) head:Node = null;
     @property(Node) edit_hp:Node = null;
+    @property(Node) edit_hp_delay_time:Node = null;
     private m_data:boss_info_data = null;
     public initView(data:boss_info_data){
         this.m_data = data;
@@ -19,9 +20,25 @@ export class widget_boss_info extends Component {
         this.head.getComponent(receive_widget_item).updateView(this.m_data.head)
         this.edit_hp.off(EditBox.EventType.EDITING_DID_ENDED)
         this.edit_hp.on(EditBox.EventType.EDITING_DID_ENDED,()=>{
+            if(this.edit_hp.getComponent(EditBox).string.length==0) {
+                this.edit_hp.getComponent(EditBox).string = '0'
+            }
             this.m_data.hp = parseInt(this.edit_hp.getComponent(EditBox).string)
         })
         this.edit_hp.getComponent(EditBox).string = this.m_data.hp.toString()
+
+        this.edit_hp_delay_time.off(EditBox.EventType.EDITING_DID_ENDED)
+        this.edit_hp_delay_time.on(EditBox.EventType.EDITING_DID_ENDED, ()=>{
+            if(this.edit_hp_delay_time.getComponent(EditBox).string.length==0) {
+                this.edit_hp_delay_time.getComponent(EditBox).string = '0'
+            }
+            this.m_data.hp_delay_time = parseFloat(this.edit_hp_delay_time.getComponent(EditBox).string)
+        })
+        if(this.m_data.hp_delay_time==undefined) {
+            this.m_data.hp_delay_time = 0
+        }
+        this.edit_hp_delay_time.getComponent(EditBox).string = this.m_data.hp_delay_time.toString()
+
     }
 }
 

+ 26 - 14
assets/script/run/ui/ui_boss_info.ts

@@ -1,4 +1,4 @@
-import { _decorator, Color, Component, Label, Node, ProgressBar, Tween, tween } from 'cc';
+import { _decorator, Color, Component, Label, Node, ProgressBar, Size, Tween, tween, UITransform } from 'cc';
 import { ui_base } from './ui_base';
 import { boss_info_data } from '../../../data/data';
 import { tools } from '../../tools';
@@ -25,6 +25,7 @@ export class ui_boss_info extends ui_base {
         gameManager.initUiBaseAtt(this.bg_bar,this.mBossData.bg_bar)
         gameManager.initUiBaseAtt(this.bar,this.mBossData.bar)
         gameManager.initUiBaseAtt(this.head,this.mBossData.head)
+        this.bg_bar.getComponent(ProgressBar).totalLength = this.bg_bar.getComponent(UITransform).width
         this.bossHp = this.mBossData.hp;
         this.bg_bar.getComponent(ProgressBar).progress = 1;
         ClientEvent.on(config.EventRun.ON_BOSS_HURT,this.hurt.bind(this),this)
@@ -32,6 +33,7 @@ export class ui_boss_info extends ui_base {
 
     protected onDisable(): void {
         ClientEvent.off(config.EventRun.ON_BOSS_HURT,this.hurt.bind(this),this)
+        this.unscheduleAllCallbacks()
     }
 
     hurt(hurt_num:number){
@@ -40,20 +42,30 @@ export class ui_boss_info extends ui_base {
             this.onFialEvent()
             return;
         }
-        this.bossHp -= hurt_num;
-        Tween.stopAllByTarget(this.hp_ani)
-        this.hp_ani.getComponent(Label).string = `${hurt_num>0?"-":"+"}${Math.abs(hurt_num)}`
-        this.hp_ani.active = true;
-        this.hp_ani.getComponent(Label).color = hurt_num>0?Color.RED:Color.GREEN;
-        tween(this.hp_ani).delay(2).call(()=>{
-            this.hp_ani.active = false;
-        }).start()
-        this.bg_bar.getComponent(ProgressBar).progress = this.bossHp/this.mBossData.hp;
-        if(this.bossHp<=0){
-            tools.showToast("成功打死boss")
-            this.onFinishEvent()
-            ClientEvent.off(config.EventRun.ON_BOSS_HURT,this.hurt.bind(this),this)
+        let hp_delay_time = 0
+        if(this.mBossData.hp_delay_time!=undefined) {
+            hp_delay_time = this.mBossData.hp_delay_time
         }
+        this.scheduleOnce(()=>{
+            this.bossHp -= hurt_num;
+            Tween.stopAllByTarget(this.hp_ani)
+            this.hp_ani.getComponent(Label).string = `${hurt_num>0?"-":"+"}${Math.abs(hurt_num)}`
+            this.hp_ani.active = true;
+            this.hp_ani.getComponent(Label).color = hurt_num>0?Color.RED:Color.GREEN;
+            tween(this.hp_ani).delay(2).call(()=>{
+                this.hp_ani.active = false;
+            }).start()
+            if(this.bossHp>=this.mBossData.hp) {
+                this.bossHp = this.mBossData.hp
+            }
+            let progress = this.bossHp/this.mBossData.hp
+            this.bg_bar.getComponent(ProgressBar).progress = progress;
+            if(this.bossHp<=0){
+                tools.showToast("成功打死boss")
+                this.onFinishEvent()
+                ClientEvent.off(config.EventRun.ON_BOSS_HURT,this.hurt.bind(this),this)
+            }
+        },hp_delay_time)
     }
 
 }

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor