|
@@ -52,7 +52,10 @@ export class GameOverMediator extends GUIMediator {
|
|
|
|
|
|
private isWin: boolean;
|
|
|
private award: number;
|
|
|
- private diamond:number;
|
|
|
+ private diamond: number;
|
|
|
+
|
|
|
+ private buttonCkilcBool: boolean = false;
|
|
|
+ private buttonClickIsOk: boolean = false;
|
|
|
onLoad() {
|
|
|
// PlatformManager.showBanner()
|
|
|
}
|
|
@@ -64,54 +67,58 @@ export class GameOverMediator extends GUIMediator {
|
|
|
this.DefeatedGroup.active = !this.isWin;
|
|
|
//胜利
|
|
|
if (this.isWin == true) {
|
|
|
- this.WinGroup.active = true;
|
|
|
+ this.scheduleOnce(()=>{
|
|
|
+ this.WinGroup.active = true;
|
|
|
+ }, 2)
|
|
|
this.DefeatedGroup.active = false;
|
|
|
let levelConfig: any = GameConfigManager.GetLevelConfig(GameModel.single.currentLevel - 1);
|
|
|
//关卡基础奖励
|
|
|
this.award = levelConfig.awards + levelConfig.killAward * GameModel.single.killCount;
|
|
|
//金币奖励
|
|
|
- this.WinAwardLabel.string ="X"+StringUtils.numberUtilsEn(this.award,0);
|
|
|
+ this.WinAwardLabel.string = "X" + StringUtils.numberUtilsEn(this.award, 0);
|
|
|
//钻石奖励
|
|
|
- if(levelConfig.diamondRewards>0){
|
|
|
- this.diamond=levelConfig.diamondRewards;
|
|
|
- this.DiamondAwardLabel.string="X"+StringUtils.numberUtilsEn(levelConfig.diamondRewards,0);
|
|
|
- }else{
|
|
|
- this.diamond=0;
|
|
|
- this.DiamondAwardLabel.string="";
|
|
|
+ if (levelConfig.diamondRewards > 0) {
|
|
|
+ this.diamond = levelConfig.diamondRewards;
|
|
|
+ this.DiamondAwardLabel.string = "X" + StringUtils.numberUtilsEn(levelConfig.diamondRewards, 0);
|
|
|
+ } else {
|
|
|
+ this.diamond = 0;
|
|
|
+ this.DiamondAwardLabel.string = "";
|
|
|
}
|
|
|
let weChat = PlatformManager.impl as WeChatPlatform;
|
|
|
- if(weChat instanceof WeChatPlatform){
|
|
|
+ if (weChat instanceof WeChatPlatform) {
|
|
|
// weChat.successBranchAnalytics(String(GameModel.single.currentLevel));
|
|
|
weChat.branchAnalytics(branchIdType.SuccessGame, String(GameModel.single.currentLevel))
|
|
|
}
|
|
|
} else {//失败
|
|
|
//失败不算奖励
|
|
|
this.WinGroup.active = false;
|
|
|
- this.DefeatedGroup.active = true;
|
|
|
+ this.scheduleOnce(()=>{
|
|
|
+ this.DefeatedGroup.active = true;
|
|
|
+ }, 2)
|
|
|
let weChat = PlatformManager.impl as WeChatPlatform;
|
|
|
- if(weChat instanceof WeChatPlatform){
|
|
|
+ if (weChat instanceof WeChatPlatform) {
|
|
|
// weChat.failBranchAnalytics(String(GameModel.single.currentLevel));
|
|
|
weChat.branchAnalytics(branchIdType.FailGame, String(GameModel.single.currentLevel))
|
|
|
}
|
|
|
}
|
|
|
- this.backButtonHandle();
|
|
|
+ // this.backButtonHandle();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 返回按钮误触
|
|
|
*/
|
|
|
backButtonHandle(): void {
|
|
|
- if (LiangLiangSDK.CanWuChu() == true) {
|
|
|
- this.WinBackButton.position = new Vec3(0, -(view.getVisibleSize().height / 2 - 50), 0);
|
|
|
- this.DefeatedBackButton.position = new Vec3(0, -(view.getVisibleSize().height / 2 - 50), 0);
|
|
|
- this.scheduleOnce(() => {
|
|
|
- PlatformManager.showBanner();
|
|
|
- this.WinBackButton.position = new Vec3(0, -375, 0);
|
|
|
- this.DefeatedBackButton.position = new Vec3(0, -358, 0);
|
|
|
- }, 3)
|
|
|
- } else {
|
|
|
- PlatformManager.showBanner();
|
|
|
- }
|
|
|
+ // if (LiangLiangSDK.CanWuChu() == true) {
|
|
|
+ // this.WinBackButton.position = new Vec3(0, -(view.getVisibleSize().height / 2 - 50), 0);
|
|
|
+ // this.DefeatedBackButton.position = new Vec3(0, -(view.getVisibleSize().height / 2 - 50), 0);
|
|
|
+ // this.scheduleOnce(() => {
|
|
|
+ // PlatformManager.showBanner();
|
|
|
+ // this.WinBackButton.position = new Vec3(0, -375, 0);
|
|
|
+ // this.DefeatedBackButton.position = new Vec3(0, -358, 0);
|
|
|
+ // }, 3)
|
|
|
+ // } else {
|
|
|
+ // PlatformManager.showBanner();
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -152,9 +159,45 @@ export class GameOverMediator extends GUIMediator {
|
|
|
* 去全屏幕界面
|
|
|
*/
|
|
|
GoToFullOutput(): void {
|
|
|
- this.AddAward();
|
|
|
- GUIManager.single.Show(UIConst.FULL_OUTPUT_UI);
|
|
|
- this.HideSelf();
|
|
|
+ if(LiangLiangSDK.CanWuChu() == true){
|
|
|
+ if(this.buttonCkilcBool == false){
|
|
|
+ this.buttonCkilcBool = true;
|
|
|
+ this.scheduleOnce(()=>{
|
|
|
+ PlatformManager.showBanner();
|
|
|
+ this.scheduleOnce(()=>{
|
|
|
+ PlatformManager.hideBanner();
|
|
|
+ this.buttonClickIsOk = true;
|
|
|
+ }, 1)
|
|
|
+ }, 1)
|
|
|
+ }else{
|
|
|
+ if(this.buttonClickIsOk == true){
|
|
|
+ this.buttonClickIsOk = false;
|
|
|
+ this.goOn();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.AddAward();
|
|
|
+ this.HideSelf();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ goOn():void{
|
|
|
+ let random:number = Math.random();
|
|
|
+ if(random < 0.5){
|
|
|
+ PlatformManager.showRewardedVideo(()=>{
|
|
|
+ this.AddAward();
|
|
|
+ GUIManager.single.Show(UIConst.FULL_OUTPUT_UI);
|
|
|
+ this.HideSelf();
|
|
|
+ }, ()=>{
|
|
|
+ this.AddAward();
|
|
|
+ GUIManager.single.Show(UIConst.FULL_OUTPUT_UI);
|
|
|
+ this.HideSelf();
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.AddAward();
|
|
|
+ GUIManager.single.Show(UIConst.FULL_OUTPUT_UI);
|
|
|
+ this.HideSelf();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -188,7 +231,7 @@ export class GameOverMediator extends GUIMediator {
|
|
|
private AddAward(value: number = 1): void {
|
|
|
if (this.isWin) {
|
|
|
GameModel.single.gold += this.award * value;
|
|
|
- GameModel.single.diamond+=this.diamond*value;
|
|
|
+ GameModel.single.diamond += this.diamond * value;
|
|
|
}
|
|
|
}
|
|
|
|