|
@@ -74,6 +74,18 @@ export default class NewClass extends cc.Component {
|
|
|
@property(cc.Node)
|
|
|
levels_view: cc.Node = null
|
|
|
|
|
|
+ @property(cc.Node)
|
|
|
+ hint_ad_player_icon: cc.Node = null
|
|
|
+
|
|
|
+ @property(cc.Node)
|
|
|
+ undo_ad_player_icon: cc.Node = null
|
|
|
+
|
|
|
+ @property(cc.Node)
|
|
|
+ shuffles_ad_player_icon: cc.Node = null
|
|
|
+
|
|
|
+ @property(cc.Node)
|
|
|
+ moveup_ad_player_icon: cc.Node = null
|
|
|
+
|
|
|
|
|
|
//minzindex
|
|
|
minZindex: number = 10000
|
|
@@ -81,16 +93,37 @@ export default class NewClass extends cc.Component {
|
|
|
progress_levelBase_org = 0.0002
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
protected onLoad(): void {
|
|
|
this.initAd();
|
|
|
+
|
|
|
+ // 初始化广告播放图标
|
|
|
+ if (global_model.game.shuffle_counter === 0) {
|
|
|
+ this.shuffles_ad_player_icon.active = true
|
|
|
+ } else {
|
|
|
+ this.shuffles_ad_player_icon.active = false
|
|
|
+ }
|
|
|
+ if (global_model.game.undo_counter === 0) {
|
|
|
+ this.undo_ad_player_icon.active = true
|
|
|
+ } else {
|
|
|
+ this.undo_ad_player_icon.active = false
|
|
|
+ }
|
|
|
+ if (global_model.game.hint_tip_counter === 0) {
|
|
|
+ this.hint_ad_player_icon.active = true
|
|
|
+ } else {
|
|
|
+ this.hint_ad_player_icon.active = false
|
|
|
+ }
|
|
|
+ if (global_model.game.move_up_counter === 0) {
|
|
|
+ this.moveup_ad_player_icon.active = true
|
|
|
+ } else {
|
|
|
+ this.moveup_ad_player_icon.active = false
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if (cc.sys.platform == cc.sys.IPAD) {
|
|
|
cc.find("Canvas").getComponent(cc.Canvas).fitHeight = true
|
|
|
cc.find("Canvas").getComponent(cc.Canvas).fitWidth = true
|
|
|
}
|
|
|
cc.systemEvent.on(game_constants.select_level_clicked, this.select_level_clicked, this)
|
|
|
-
|
|
|
}
|
|
|
initAd() {
|
|
|
console.log('lichao: initAd Success')
|
|
@@ -151,13 +184,25 @@ export default class NewClass extends cc.Component {
|
|
|
|
|
|
let customerOption = cc.sys.localStorage.getItem("customerOption");
|
|
|
if (customerOption === "shuffle") {
|
|
|
- global_model.game.shuffle_counter++
|
|
|
+ global_model.game.shuffle_counter += 3
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
+ this.shuffles_ad_player_icon.active = false
|
|
|
} else if (customerOption === "revoke") {
|
|
|
- global_model.game.undo_counter++
|
|
|
+ global_model.game.undo_counter += 3
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
+ this.undo_ad_player_icon.active = false
|
|
|
} else if (customerOption === "auto") {
|
|
|
- global_model.game.hint_tip_counter++
|
|
|
+ global_model.game.hint_tip_counter += 3
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
+ this.hint_ad_player_icon.active = false
|
|
|
} else if (customerOption === "clearTopThree") {
|
|
|
- global_model.game.move_up_counter++
|
|
|
+ global_model.game.move_up_counter += 3
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
+ this.moveup_ad_player_icon.active = false
|
|
|
}
|
|
|
|
|
|
this.updateItemView()
|
|
@@ -168,20 +213,26 @@ export default class NewClass extends cc.Component {
|
|
|
}
|
|
|
onRewardedVideoAdClosed(placementId, callbackInfo) {
|
|
|
ATSDK.printLog("AnyThinkRewardedVideoDemo::onRewardedVideoAdClosed(" + placementId + ", " + callbackInfo + ")");
|
|
|
-
|
|
|
- // let customerOption = cc.sys.localStorage.getItem("customerOption");
|
|
|
- // if (customerOption === "shuffle") {
|
|
|
- // global_model.game.shuffle_counter++
|
|
|
- // } else if (customerOption === "revoke") {
|
|
|
- // global_model.game.undo_counter++
|
|
|
- // } else if (customerOption === "auto") {
|
|
|
- // global_model.game.hint_tip_counter++
|
|
|
- // } else if (customerOption === "clearTopThree") {
|
|
|
- // global_model.game.move_up_counter++
|
|
|
- // }
|
|
|
-
|
|
|
- // this.updateItemView()
|
|
|
-
|
|
|
+ if (global_model.game.shuffle_counter === 0) {
|
|
|
+ this.shuffles_ad_player_icon.active = true
|
|
|
+ } else {
|
|
|
+ this.shuffles_ad_player_icon.active = false
|
|
|
+ }
|
|
|
+ if (global_model.game.undo_counter === 0) {
|
|
|
+ this.undo_ad_player_icon.active = true
|
|
|
+ } else {
|
|
|
+ this.undo_ad_player_icon.active = false
|
|
|
+ }
|
|
|
+ if (global_model.game.hint_tip_counter === 0) {
|
|
|
+ this.hint_ad_player_icon.active = true
|
|
|
+ } else {
|
|
|
+ this.hint_ad_player_icon.active = false
|
|
|
+ }
|
|
|
+ if (global_model.game.move_up_counter === 0) {
|
|
|
+ this.moveup_ad_player_icon.active = true
|
|
|
+ } else {
|
|
|
+ this.moveup_ad_player_icon.active = false
|
|
|
+ }
|
|
|
}
|
|
|
onRewardedVideoAdPlayClicked(placementId, callbackInfo) {
|
|
|
ATSDK.printLog("AnyThinkRewardedVideoDemo::onRewardedVideoAdPlayClicked(" + placementId + ", " + callbackInfo + ")");
|
|
@@ -569,11 +620,19 @@ export default class NewClass extends cc.Component {
|
|
|
}
|
|
|
click_shuffle() {
|
|
|
//this.playSFX(this.btn_click)
|
|
|
- if (global_model.game.shuffle_counter > 0) {
|
|
|
+ if (global_model.game.shuffle_counter > 1) {
|
|
|
+ global_model.game.shuffle_counter--
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
+ this.shuffle()
|
|
|
+ this.shuffles_ad_player_icon.active = false
|
|
|
+ } else if (global_model.game.shuffle_counter === 1) {
|
|
|
global_model.game.shuffle_counter--
|
|
|
global_model.save()
|
|
|
this.updateItemView()
|
|
|
this.shuffle()
|
|
|
+ // 广告播放图标
|
|
|
+ this.shuffles_ad_player_icon.active = true
|
|
|
} else {
|
|
|
|
|
|
// 防抖代码
|
|
@@ -607,10 +666,17 @@ export default class NewClass extends cc.Component {
|
|
|
console.log('lichao: 播放广告3')
|
|
|
} else {
|
|
|
console.log('lichao: 播放广告4');
|
|
|
- global_model.game.shuffle_counter++
|
|
|
+ this.shuffles_ad_player_icon.active = false
|
|
|
+ global_model.game.shuffle_counter += 3
|
|
|
+ global_model.save()
|
|
|
this.updateItemView()
|
|
|
}
|
|
|
}, 300)
|
|
|
+ } else {
|
|
|
+ this.shuffles_ad_player_icon.active = false
|
|
|
+ global_model.game.shuffle_counter += 3
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
}
|
|
|
|
|
|
if (this.lock) return
|
|
@@ -663,11 +729,19 @@ export default class NewClass extends cc.Component {
|
|
|
|
|
|
return
|
|
|
}
|
|
|
- if (global_model.game.undo_counter > 0) {
|
|
|
+ if (global_model.game.undo_counter > 1) {
|
|
|
global_model.game.undo_counter--
|
|
|
global_model.save()
|
|
|
this.updateItemView()
|
|
|
this.undo_operator()
|
|
|
+ this.undo_ad_player_icon.active = false
|
|
|
+ } else if (global_model.game.undo_counter === 1) {
|
|
|
+ global_model.game.undo_counter--
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
+ this.undo_operator()
|
|
|
+ // 广告播放图标
|
|
|
+ this.undo_ad_player_icon.active = true
|
|
|
} else {
|
|
|
|
|
|
// 防抖代码
|
|
@@ -701,10 +775,18 @@ export default class NewClass extends cc.Component {
|
|
|
console.log('lichao: 播放广告3')
|
|
|
} else {
|
|
|
console.log('lichao: 播放广告4');
|
|
|
- global_model.game.undo_counter++
|
|
|
+ global_model.game.undo_counter += 3
|
|
|
+ global_model.save()
|
|
|
this.updateItemView()
|
|
|
+ this.undo_ad_player_icon.active = false
|
|
|
+
|
|
|
}
|
|
|
}, 300)
|
|
|
+ } else {
|
|
|
+ global_model.game.undo_counter += 3
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
+ this.undo_ad_player_icon.active = false
|
|
|
}
|
|
|
|
|
|
if (this.lock) return
|
|
@@ -732,11 +814,20 @@ export default class NewClass extends cc.Component {
|
|
|
}
|
|
|
click_hint() {
|
|
|
//this.playSFX(this.btn_click)
|
|
|
- if (global_model.game.hint_tip_counter > 0) {
|
|
|
+ if (global_model.game.hint_tip_counter > 1) {
|
|
|
global_model.game.hint_tip_counter--
|
|
|
global_model.save()
|
|
|
this.updateItemView()
|
|
|
this.searchRemoveable()
|
|
|
+ // this.hintNodeInstance.dispatchEvent(new cc.Event.EventCustom("adIconEnableHint", true));
|
|
|
+ this.hint_ad_player_icon.active = false
|
|
|
+ } else if (global_model.game.hint_tip_counter === 1) {
|
|
|
+ global_model.game.hint_tip_counter--
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
+ this.searchRemoveable()
|
|
|
+ // 广告播放图标
|
|
|
+ this.hint_ad_player_icon.active = true
|
|
|
} else {
|
|
|
|
|
|
// 防抖代码
|
|
@@ -772,10 +863,19 @@ export default class NewClass extends cc.Component {
|
|
|
console.log('lichao: 播放广告3')
|
|
|
} else {
|
|
|
console.log('lichao: 播放广告4');
|
|
|
- global_model.game.hint_tip_counter++
|
|
|
+ this.hint_ad_player_icon.active = false
|
|
|
+
|
|
|
+ global_model.game.hint_tip_counter += 3
|
|
|
+ global_model.save()
|
|
|
this.updateItemView()
|
|
|
}
|
|
|
}, 300)
|
|
|
+ } else {
|
|
|
+ global_model.game.hint_tip_counter += 3
|
|
|
+ this.hint_ad_player_icon.active = false
|
|
|
+
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
}
|
|
|
|
|
|
if (this.lock) return
|
|
@@ -792,13 +892,23 @@ export default class NewClass extends cc.Component {
|
|
|
|
|
|
return
|
|
|
}
|
|
|
- if (global_model.game.move_up_counter > 0) {
|
|
|
+ if (global_model.game.move_up_counter > 1) {
|
|
|
+ global_model.game.move_up_counter--
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
+
|
|
|
+ //放三个 块上去最左边的三个块放上去
|
|
|
+ this.moveup3_elements()
|
|
|
+ this.moveup_ad_player_icon.active = false
|
|
|
+ } else if (global_model.game.move_up_counter === 1) {
|
|
|
global_model.game.move_up_counter--
|
|
|
global_model.save()
|
|
|
this.updateItemView()
|
|
|
|
|
|
//放三个 块上去最左边的三个块放上去
|
|
|
this.moveup3_elements()
|
|
|
+ // 广告播放图标
|
|
|
+ this.moveup_ad_player_icon.active = true
|
|
|
} else {
|
|
|
|
|
|
// 防抖代码
|
|
@@ -832,10 +942,19 @@ export default class NewClass extends cc.Component {
|
|
|
console.log('lichao: 播放广告3')
|
|
|
} else {
|
|
|
console.log('lichao: 播放广告4');
|
|
|
- global_model.game.move_up_counter++
|
|
|
+ this.moveup_ad_player_icon.active = false
|
|
|
+
|
|
|
+ global_model.game.move_up_counter += 3
|
|
|
+ global_model.save()
|
|
|
this.updateItemView()
|
|
|
}
|
|
|
}, 300)
|
|
|
+ } else {
|
|
|
+ this.moveup_ad_player_icon.active = false
|
|
|
+
|
|
|
+ global_model.game.move_up_counter += 3
|
|
|
+ global_model.save()
|
|
|
+ this.updateItemView()
|
|
|
}
|
|
|
|
|
|
if (this.lock) return
|