|
@@ -1,14 +1,26 @@
|
|
|
-import { _decorator, Component, Node } from 'cc';
|
|
|
+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()
|
|
@@ -16,20 +28,90 @@ export class AddCountPanel extends Component {
|
|
|
this.node.active = false
|
|
|
}
|
|
|
|
|
|
- AddCount(event,customEventData)
|
|
|
+ AddCount5()
|
|
|
{
|
|
|
- let count = Number(customEventData)
|
|
|
- Difficulty.difficutyData.difficutyCount += count
|
|
|
- if(Difficulty.difficutyData.difficutyCount > 30)
|
|
|
- {
|
|
|
- Difficulty.difficutyData.difficutyCount = 30
|
|
|
+ if (sys.Platform.BYTEDANCE_MINI_GAME == sys.platform) {
|
|
|
+ mainscene.instance.ge.track(
|
|
|
+ "ad_show", //追踪事件的名称
|
|
|
+ {
|
|
|
+ version: "123",
|
|
|
+ ad_position: "小熊数量+5",
|
|
|
+ level_id: SuperFind.superFindData.currentBgKey
|
|
|
+ } //需要上传的事件属性
|
|
|
+ );
|
|
|
}
|
|
|
- Difficulty.createOrDeleteOtherScale();
|
|
|
- Difficulty.saveDifficutyData();
|
|
|
- SuperFind.setTitle()
|
|
|
- EventMgr.ins.dispatchEvent("refreshLevelInfo")
|
|
|
- this.node.active = false
|
|
|
- EventMgr.ins.dispatchEvent("regenerate")
|
|
|
+
|
|
|
+ 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}`
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|