1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import { _decorator, Component, Node } from 'cc';
- import { zhao_xi_jie_data, zhao_xi_jie_item_data } from '../../../data/data';
- import { config } from '../../config';
- import { tip_type_single } from './tip_type_single';
- import { tip_type_all } from './tip_type_all';
- import { shouji_item } from './shouji_item';
- import { ClientEvent } from '../../clientEvent';
- import { gameManager } from '../gameManager';
- import { SdkUtil } from '../../sdkUtil';
- import { statisticsManager } from '../../statisticsManager';
- const { ccclass, property } = _decorator;
- @ccclass('ui_manifestations')
- export class ui_manifestations extends Component {
- @property(Node) tip_type_single:Node = null;
- @property(Node) tip_type_all:Node = null;
- @property(Node) btn_single_click_hide_tip:Node = null;
- private tipsMap:Map<string,boolean> = new Map;
- private mData:zhao_xi_jie_data = null;
- public initView(data:zhao_xi_jie_data){
- this.tipsMap.clear()
- this.mData = data;
- if(this.mData.tip_type===config.zhao_xi_jie_tip_type.select_tips){
- this.tip_type_single.active = true;
- this.btn_single_click_hide_tip.active = false;
- this.btn_single_click_hide_tip.off(Node.EventType.TOUCH_END)
- this.btn_single_click_hide_tip.on(Node.EventType.TOUCH_END,()=>{
- this.btn_single_click_hide_tip.active = false;
- this.tip_type_single.getComponent(tip_type_single).hideTipBtn()
- })
- this.tip_type_all.active = false;
- this.tip_type_single.getComponent(tip_type_single).initView(data,this.onItemClick.bind(this),this.onItemTips.bind(this))
- }else{
- this.tip_type_all.active = true;
- this.tip_type_single.active = false;
- this.tip_type_all.getComponent(tip_type_all).initView(data,this.onShowTips.bind(this))
- }
- ClientEvent.on(config.EventRun.SHOW_ZHAO_BU_TONG_FINISH_STATUS,this.on_zhao_bu_tong_finish.bind(this),this)
- ClientEvent.on(config.EventRun.ON_ZHAO_BU_TONG_ALL_FINISH,this.on_zhao_bu_tong_all_finish.bind(this),this)
- }
- on_zhao_bu_tong_finish(widget:zhao_xi_jie_item_data){
- if(this.mData.tip_type===config.zhao_xi_jie_tip_type.select_tips){
- widget.is_find_answer = true
- this.tip_type_single.getComponent(tip_type_single).showFinishIcon(widget.widget_id)
- }else{
- this.tip_type_all.getComponent(tip_type_all).showFinishIcon(widget.widget_id)
- }
- }
- on_zhao_bu_tong_all_finish(data: zhao_xi_jie_data) {
- this.node.active = false
- }
- onItemClick(item:shouji_item){
- this.btn_single_click_hide_tip.active = true;
- this.updateBtnTipStatus(item.getData())
- }
- public onItemTips(data:zhao_xi_jie_item_data){
- if(this.tipsMap.get(data.tips_res)){
- ClientEvent.dispatchEvent(config.EventRun.SHOW_TIPS,data.tips_res)
- }else{
- let ad_id = SdkUtil.getAdId(config.AD_TYPE.LOOK_TIPS)
- SdkUtil.showVideoAd(ad_id,(res)=>{
- if(res.isEnded){
- data.is_look_video_ads = true
- this.updateBtnTipStatus(data)
- this.tipsMap.set(data.tips_res,true)
- ClientEvent.dispatchEvent(config.EventRun.SHOW_TIPS,data.tips_res)
- }
- // 统计-激励视频广告
- let level_id = gameManager.Singleton.getLevelData().id
- let collect_data = statisticsManager.get_collect_ads_data(level_id, res, config.STATISTICS_ACTION_TYPE.CHA_KAN_TI_SHI)
- statisticsManager.request_collect_rewardVideoData(collect_data)
- })
- }
-
- }
-
- private updateBtnTipStatus(data:zhao_xi_jie_item_data) {
- this.tip_type_single.getComponent(tip_type_single).updateBtnTipStatus(data)
- }
- public onShowTips(){
- gameManager.Singleton.showTips()
- }
- }
|