xx 1 year ago
parent
commit
aee8cba0f2

+ 3 - 3
assets/resources/prefab/select_widget_list.prefab

@@ -1163,7 +1163,7 @@
     },
     "clickEvents": [],
     "_interactable": true,
-    "_transition": 3,
+    "_transition": 0,
     "_normalColor": {
       "__type__": "cc.Color",
       "r": 214,
@@ -1320,8 +1320,8 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 1920,
-      "height": 1080
+      "width": 1919.9999999999998,
+      "height": 1919.9999999999998
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 1 - 1
assets/script/run/bag/dai_dao_ju_bag.ts

@@ -73,7 +73,7 @@ export class dai_dao_ju_bag extends Component {
 
         this.btn_addtime.on(Node.EventType.TOUCH_END,()=>{
             if( this.m_add_time_call !=null){
-                this.m_add_time_call();
+                this.m_add_time_call(this.mData.binding_count_time_widget,this.mData.add_time_number);
             }
         })
 

+ 6 - 0
assets/script/run/gameManager.ts

@@ -568,6 +568,12 @@ export class gameManager extends Component {
             })
         })
     }
+
+    public static LookVideoCallBack(call){
+        if(call!=null){
+            call()
+        }
+    }
 }
 
 

+ 18 - 5
assets/script/run/ui/count_down.ts

@@ -1,5 +1,5 @@
 import { _decorator, Component, Label, Node, ProgressBar } from 'cc';
-import { att_count_down } from '../../../data/data';
+import { att_count_down, widget_item_data } from '../../../data/data';
 import { gameManager } from '../gameManager';
 const { ccclass, property } = _decorator;
 
@@ -11,13 +11,19 @@ export class count_down extends Component {
     @property(Node) img_text:Node = null;
     @property(Node) lab_time:Node = null;
     private time_count:number = 0;
+    private add_time:number = 0;
     private m_over_call = null;
-    public init(data:att_count_down,on_over_call){
+    private m_widget_data:widget_item_data = null;
+    public init(data:att_count_down,on_over_call,widget_data:widget_item_data){
 
         this.m_data = data;
 
+        this.m_widget_data = widget_data;
+
         this.m_over_call = on_over_call;
 
+        this.add_time = 0;
+
         gameManager.initUiBaseAtt(this.ProgressBar_Bar,this.m_data.ProgressBar_Bar)
         
         gameManager.initUiBaseAtt(this.ProgressBar_Bg,this.m_data.ProgressBar_Bg)
@@ -44,19 +50,26 @@ export class count_down extends Component {
         return this.m_data
     }
 
+    public addTime(widget_id:number,time:number){
+        if(this.m_widget_data.att.id==widget_id){
+            this.add_time+=time;
+        }
+    }
+
     public startCountDown(){
         this.schedule(()=>{
             this.time_count+=1;
-            if(this.time_count>this.m_data.time_count){
+            let all_time = this.m_data.time_count+this.add_time
+            if(this.time_count>all_time){
                 this.unscheduleAllCallbacks()
                 if(this.m_over_call!=null){
                     this.m_over_call(true)
                 }
                 return
             }
-            this.ProgressBar_Bg.getComponent(ProgressBar).progress = 1-this.time_count/this.m_data.time_count
+            this.ProgressBar_Bg.getComponent(ProgressBar).progress = 1-this.time_count/all_time
             if(this.m_data.is_show_time){
-                this.lab_time.getComponent(Label).string = `${this.m_data.time_count-this.time_count}秒`
+                this.lab_time.getComponent(Label).string = `${all_time-this.time_count}秒`
             }
            
         },1)

+ 9 - 5
assets/script/run/ui_layer.ts

@@ -159,12 +159,20 @@ export class ui_layer extends Component {
         item.parent = this.content_count_down;
         item.position = new Vec3(data.att.x,data.att.y)
         this.mAttCountDown = item.getComponent(count_down)
-        this.mAttCountDown.init(data.att.count_down,this.onCountDownOver.bind(this))
+        this.mAttCountDown.init(data.att.count_down,this.onCountDownOver.bind(this),data)
         this.mAttCountDown.startCountDown()
         ClientEvent.dispatchEvent(config.EventRun.ON_COUNT_DOWN_START,this.mAttCountDown.getData().start_event_id)
         ClientEvent.on(config.EventRun.ON_WIDGET_FINISH_COLLECT_EVENT,this.onCountDownListening.bind(this),this)
     }
 
+    public onAddTime(widgetId:number,time_num:number){
+        gameManager.LookVideoCallBack(()=>{
+            if(this.mAttCountDown!=null){
+                this.mAttCountDown.addTime(widgetId,time_num)
+            }
+        })
+    }
+
     onCountDownListening(event_id:number){
         if(this.mAttCountDown!=null){
             let att_count_down_data = this.mAttCountDown.getData()
@@ -253,7 +261,6 @@ export class ui_layer extends Component {
                     return tools.showToast("带道具没有配置!");
                 }
                 this.dai_dao_ju_bag.active = true;
-                console.log("_guo_ju_qing_dai_dao_ju:",data._guo_ju_qing_dai_dao_ju)
                 this.dai_dao_ju_bag.getComponent(dai_dao_ju_bag).initView(data._guo_ju_qing_dai_dao_ju,this.onClickBossTips.bind(this),this.onAddTime.bind(this))
             break;
         }
@@ -269,9 +276,6 @@ export class ui_layer extends Component {
         this.content_rule_and_tips.getComponent(content_rule_and_tips).showRuleBtn()
     }
 
-    onAddTime(){
-
-    }
 }