123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- import { _decorator, Button, Component, Label, Node, sys } from 'cc';
- import { Difficulty, SuperFind } from '../../script/Manager/LocalDataMgr';
- import EventMgr from '../../script/Manager/EventMgr';
- import { mainscene } from '../../script/mainscene';
- import PlatformService from '../../script/Platform/PlatformService';
- const { ccclass, property } = _decorator;
- @ccclass('AddCountPanel')
- export class AddCountPanel extends Component {
- @property(Node)
- btnClose:Node = null
- @property(Label)
- labCount:Label = null
- @property(Button)
- btnAdd5:Button = null
- @property(Button)
- btnAdd30:Button = null
- watchAdvCount:number = 0
- start() {
- this.btnClose.on(Node.EventType.TOUCH_END,this.close,this)
- this.btnAdd5.node.on(Node.EventType.TOUCH_END,this.AddCount5,this)
- this.btnAdd30.node.on(Node.EventType.TOUCH_END,this.AddCount30,this)
- }
- close()
- {
- this.node.active = false
- }
- AddCount5()
- {
- if (sys.Platform.BYTEDANCE_MINI_GAME == sys.platform) {
- mainscene.instance.ge.track(
- "ad_show", //追踪事件的名称
- {
- version: "123",
- ad_position: "小熊数量+5",
- level_id: SuperFind.superFindData.currentBgKey
- } //需要上传的事件属性
- );
- }
- PlatformService.getInstance().platformApi.loadAndShowVideoAd(() => {
- // PlatformService.getInstance().platformApi.reportAnalytics("tips", {
- // level: this.data.title
- // })
- if (sys.Platform.BYTEDANCE_MINI_GAME == sys.platform) {
- mainscene.instance.ge.track(
- "ad_showend", //追踪事件的名称
- {
- version: "123",
- ad_position: "小熊数量+5",
- level_id: SuperFind.superFindData.currentBgKey
- } //需要上传的事件属性
- );
- let count = 5
- Difficulty.difficutyData.difficutyCount += count
- Difficulty.createOrDeleteOtherScale();
- Difficulty.saveDifficutyData();
- SuperFind.setTitle()
- EventMgr.ins.dispatchEvent("refreshLevelInfo")
- this.node.active = false
- EventMgr.ins.dispatchEvent("regenerate")
- this.btnAdd5.node.active = false
- }
- })
- }
- AddCount30()
- {
- // AudioManager.instance.playBundleAudio("button")
- if (sys.Platform.BYTEDANCE_MINI_GAME == sys.platform) {
- mainscene.instance.ge.track(
- "ad_show", //追踪事件的名称
- {
- version: "123",
- ad_position: "小熊数量加至30",
- level_id: SuperFind.superFindData.currentBgKey
- } //需要上传的事件属性
- );
- }
- PlatformService.getInstance().platformApi.loadAndShowVideoAd(() => {
- // PlatformService.getInstance().platformApi.reportAnalytics("tips", {
- // level: this.data.title
- // })
- if (sys.Platform.BYTEDANCE_MINI_GAME == sys.platform) {
- mainscene.instance.ge.track(
- "ad_showend", //追踪事件的名称
- {
- version: "123",
- ad_position: "小熊数量加至30",
- level_id: SuperFind.superFindData.currentBgKey
- } //需要上传的事件属性
- );
- this.watchAdvCount++
- if (this.watchAdvCount >= 2) {
- let count = 30
- Difficulty.difficutyData.difficutyCount += count
- if (Difficulty.difficutyData.difficutyCount > 30) {
- Difficulty.difficutyData.difficutyCount = 30
- }
- Difficulty.createOrDeleteOtherScale();
- Difficulty.saveDifficutyData();
- SuperFind.setTitle()
- EventMgr.ins.dispatchEvent("refreshLevelInfo")
- this.node.active = false
- EventMgr.ins.dispatchEvent("regenerate")
- this.btnAdd30.node.active = false
- }
- this.labCount.string = `${this.watchAdvCount}/${2}`
- }
- })
- }
- }
|