You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							123 lines
						
					
					
						
							4.5 KiB
						
					
					
				
			
		
		
	
	
							123 lines
						
					
					
						
							4.5 KiB
						
					
					
				| import { ryw_Event } from "../FrameWork/Event/EventEnum";
 | |
| import EventMgr from "../FrameWork/Event/EventMgr";
 | |
| import GameMgr from "../FrameWork/Mgr/GameMgr";
 | |
| import AppPlatform from "../FrameWork/Util/AppPlatform";
 | |
| import Common from "../FrameWork/Util/Common";
 | |
| import Common5 from "../Platform/th/Common5";
 | |
| import TTAPI from "../Platform/tt/TTAPI";
 | |
| import PhysicalPowerManger from "../ttFrame/manager/PhysicalPowerManger";
 | |
| 
 | |
| 
 | |
| 
 | |
| /*
 | |
|  * @Author: YeeChan
 | |
|  * @Date: 2021-12-22 18:54:23
 | |
|  * @Description: 无限体力弹窗
 | |
|  */
 | |
| const { ccclass, property } = cc._decorator;
 | |
| 
 | |
| @ccclass
 | |
| export default class WxtlUI extends cc.Component {
 | |
| 
 | |
|     protected showNode: cc.Node = null;
 | |
|     protected btnOk: cc.Node = null;
 | |
|     protected btnOneTime: cc.Node = null;
 | |
|     protected btnBack: cc.Node = null;
 | |
|     private label: cc.Label = null;
 | |
|     private isNext = false;
 | |
|     protected start(): void {
 | |
|         this.showNode = this.node.getChildByName("show");
 | |
|         this.btnOk = this.showNode.getChildByName("btnOk");
 | |
|         this.btnOneTime = this.showNode.getChildByName("btnOneTime");
 | |
|         this.btnBack = this.node.getChildByName("btnBack");
 | |
| 
 | |
|         this.label = this.btnOk.getChildByName("times_lab").getComponent(cc.Label);
 | |
| 
 | |
|         this.btnOk.on("click", () => {
 | |
|             let tab = {
 | |
|                 onClose: (finish)=>{
 | |
|                     if (finish) {
 | |
|                         if (AppPlatform.is_TT_GAME_custom()) {
 | |
|                             window["tt"].reportAnalytics('watchAd', {
 | |
|                                 type: '看视频无限体力',
 | |
|                             });
 | |
|                         }
 | |
|                         let num = PhysicalPowerManger.getPhyVideoAllNum();
 | |
|                         num = num + 1;
 | |
|                         if (num >= Common5.videoWxtlPowerNum) {
 | |
|                             Common5.isNoPower = false;
 | |
|                             num = 0;
 | |
|                             PhysicalPowerManger.setPhyVideoAllNum(num);
 | |
|                             PhysicalPowerManger.addNewPhysicalAll();//增加一个24小时无限体力
 | |
|                             GameMgr.getInstance_custom().saveGameData_custom();
 | |
|                             EventMgr.emitEvent_custom(ryw_Event.start_hideWxtlBtn);
 | |
|                             this.scheduleOnce(() => {
 | |
|                                 this.btnCloseFunc();
 | |
|                                 EventMgr.emitEvent_custom(ryw_Event.game_restart);
 | |
|                             }, 0.3)
 | |
|                         } else {
 | |
|                             PhysicalPowerManger.setPhyVideoAllNum(num);
 | |
|                             this.updateVideoNum();
 | |
|                             GameMgr.getInstance_custom().saveGameData_custom();
 | |
|                         }
 | |
|                     }
 | |
|                 },onFailed:()=>{
 | |
|     
 | |
|                 }
 | |
|             }
 | |
|             AppPlatform.playVideo_custom(tab)
 | |
|         }, this);
 | |
| 
 | |
| 
 | |
|         this.btnOneTime.on("click", () => {
 | |
|             let tab = {
 | |
|                 onClose: (finish)=>{
 | |
|                     if (finish) {
 | |
|                         if(AppPlatform.is_TT_GAME_custom()){
 | |
|                             window["tt"].reportAnalytics('watchAd', {
 | |
|                                 type: '看视频普通体力',
 | |
|                             });
 | |
|                         }
 | |
|                         PhysicalPowerManger.setPhysicalNum(Common5.videoGetPowerNum+PhysicalPowerManger.getPhysicalNum());
 | |
|                         GameMgr.getInstance_custom().saveGameData_custom();
 | |
|                         this.btnCloseFunc();
 | |
|                         EventMgr.emitEvent_custom(ryw_Event.game_restart);
 | |
|                         // EventMgr.emitEvent_custom(ryw_Event.game_restart);
 | |
|                     }
 | |
|                     else{
 | |
|                         this.btnCloseFunc();
 | |
|                     }
 | |
|                 },onFailed:()=>{
 | |
|     
 | |
|                 }
 | |
|             }
 | |
|             AppPlatform.playVideo_custom(tab)
 | |
|         }, this);
 | |
| 
 | |
|         this.btnBack.on("click", () => {
 | |
|             this.btnCloseFunc();
 | |
|         }, this);
 | |
| 
 | |
|         this.updateVideoNum();
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * 更新无限体力看视频的次数
 | |
|      */
 | |
|     public updateVideoNum() {
 | |
|         console.log("ly++++++++++++++++++ 无限体力看视频的次数", PhysicalPowerManger.getPhyVideoAllNum());
 | |
| 
 | |
|         this.label.string = PhysicalPowerManger.getPhyVideoAllNum() + "/" + Common5.videoWxtlPowerNum;
 | |
|     }
 | |
| 
 | |
|     btnCloseFunc() {
 | |
|         // console.log("ly+++++++++++++++++  关闭");
 | |
|         // if (Common5.isNoPower) {
 | |
|         //     Common.getPrefabFromBundle("ZoomGame", "Prefabs/UI/AddPower", null, (NewPlayerGuider: cc.Node) => {
 | |
| 
 | |
|         //     })
 | |
|         // }
 | |
|         this.node.removeFromParent();
 | |
|     }
 | |
| 
 | |
| }
 | |
| 
 |