1.广告优化

2.更换UI
This commit is contained in:
huanghaipeng 2025-10-20 16:06:37 +08:00
parent b49cc4af77
commit 03334b81b1
12 changed files with 8416 additions and 8332 deletions

BIN
Project.lnk Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -416,7 +416,7 @@ export default class MapConroler extends cc.Component {
if (cc.fx.GameConfig.GM_INFO.otherLevel) {
levelName = cc.fx.GameConfig.GM_INFO.otherLevel;
}
NumberToImage.numberToImageNodes(levelName, 45, 0, "level_", this.levelLabel, true)
NumberToImage.numberToImageNodes(levelName, 45, 0, "level_g_", this.levelLabel, true)
console.log("当前关卡", cc.fx.GameConfig.GM_INFO.level + 1);
this.mapWidth = cc.fx.GameConfig.LEVEL_INFO[0].map[0];
@ -1968,11 +1968,12 @@ export default class MapConroler extends cc.Component {
reviewLevel(event, type) {
console.log("该处需要改-时间到了复活");
if (this.reviewState == true) {
return;
}
// if (this.reviewState == true) {
// return;
// }
this.reviewState = true;
// this.reviewState = true;
console.log("复活1");
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
let data = {
type: type,
@ -1983,38 +1984,53 @@ export default class MapConroler extends cc.Component {
ad_placement_name: "2000", //内部广告位名称
current_page: "GameScene" //所在页面
}
if (typeof wx !== 'undefined' && wx !== null) {
if (type == "time") {
if (cc.fx.GameTool.canObtainByShare("reviveTime")) {
cc.fx.GameTool.shareToWX(this.runRewive(data))
} else {
cc.fx.GameTool.onShowVideo(this.runRewive(data), overData)
}
}
else if (type == "boom") {
if (cc.fx.GameTool.canObtainByShare("removeBomb")) {
cc.fx.GameTool.shareToWX(this.runRewive(data))
} else {
cc.fx.GameTool.onShowVideo(this.runRewive(data), overData)
}
}
else if (type == "lock") {
if (cc.fx.GameTool.canObtainByShare("openDoor")) {
cc.fx.GameTool.shareToWX(this.runRewive(data))
} else {
cc.fx.GameTool.onShowVideo(this.runRewive(data), overData)
}
}
else if (type == "revolving") {
if (cc.fx.GameTool.canObtainByShare("removeJam")) {
cc.fx.GameTool.shareToWX(this.runRewive(data))
} else {
cc.fx.GameTool.onShowVideo(this.runRewive(data), overData)
}
var self = this;
var callback = function (isType) {
console.log("复活成功", isType, data);
// self.reviewState = false;
if (isType) {
self.runRewive(data);
} else {
// this.runRewive(data);
// self.runRewive(data);
}
}
console.log("复活")
if (typeof wx !== 'undefined' && wx !== null) {
console.log("复活广告")
cc.fx.GameTool.onShowVideo(callback, overData)
}
// if (type == "time") {
// if (cc.fx.GameTool.canObtainByShare("reviveTime")) {
// cc.fx.GameTool.shareToWX(this.runRewive(data))
// } else {
// cc.fx.GameTool.onShowVideo(this.runRewive(data), overData)
// }
// }
// else if (type == "boom") {
// if (cc.fx.GameTool.canObtainByShare("removeBomb")) {
// cc.fx.GameTool.shareToWX(this.runRewive(data))
// } else {
// cc.fx.GameTool.onShowVideo(this.runRewive(data), overData)
// }
// }
// else if (type == "lock") {
// if (cc.fx.GameTool.canObtainByShare("openDoor")) {
// cc.fx.GameTool.shareToWX(this.runRewive(data))
// } else {
// cc.fx.GameTool.onShowVideo(this.runRewive(data), overData)
// }
// }
// else if (type == "revolving") {
// if (cc.fx.GameTool.canObtainByShare("removeJam")) {
// cc.fx.GameTool.shareToWX(this.runRewive(data))
// } else {
// cc.fx.GameTool.onShowVideo(this.runRewive(data), overData)
// }
// } else {
// // this.runRewive(data);
// }
// }
}
//执行复活函数
@ -2108,23 +2124,23 @@ export default class MapConroler extends cc.Component {
}
//执行复活函数
runRewiveCopy() {
this.isreview = true;
MiniGameSdk.API.showToast("继续游戏");
this.gameOver = false;
this.gameWin = false;
this.pause = false;
this.timeNumber = 21;
this.add_Time += 20;
NumberToImage.getTimeMargin(20, 50, "time_", this.timeLabel)
this.blockNum = this.blocks.length;
if (this.blockNum == 0) this.nextLevel(1);
this.node.parent.parent.getChildByName("Lose").active = false;
setTimeout(() => {
this.reviewState = false;
}, 200);
this.stopTimeCutDown();
}
// runRewiveCopy() {
// this.isreview = true;
// MiniGameSdk.API.showToast("继续游戏");
// this.gameOver = false;
// this.gameWin = false;
// this.pause = false;
// this.timeNumber = 21;
// this.add_Time += 20;
// NumberToImage.getTimeMargin(20, 50, "time_", this.timeLabel)
// this.blockNum = this.blocks.length;
// if (this.blockNum == 0) this.nextLevel(1);
// this.node.parent.parent.getChildByName("Lose").active = false;
// setTimeout(() => {
// this.reviewState = false;
// }, 200);
// this.stopTimeCutDown();
// }
homeBtn() {
@ -3616,7 +3632,7 @@ export default class MapConroler extends cc.Component {
let tiaodik = this.gameOverNode.getChildByName("tiaodik");
let pian = this.gameOverNode.getChildByName("pian");
let guang = this.gameOverNode.getChildByName("guang");
let coins4 = this.gameOverNode.getChildByName("coins4");
let person = this.gameOverNode.getChildByName("person");
let caidai = this.gameOverNode.getChildByName("caidai");
// 初始化所有元素为隐藏状态
@ -3626,7 +3642,7 @@ export default class MapConroler extends cc.Component {
tiaodik.active = false;
pian.active = false;
guang.active = false;
coins4.active = false;
person.active = false;
caidai.active = false;
@ -3714,7 +3730,7 @@ export default class MapConroler extends cc.Component {
playDecorationGroup() {
let pian = this.gameOverNode.getChildByName("pian");
let guang = this.gameOverNode.getChildByName("guang");
let coins4 = this.gameOverNode.getChildByName("coins4");
let person = this.gameOverNode.getChildByName("person");
let caidai = this.gameOverNode.getChildByName("caidai");
let diguan = this.gameOverNode.getChildByName("diguan");
@ -3748,17 +3764,17 @@ export default class MapConroler extends cc.Component {
.delay(0.1)
.to(0, { scale: 0 })
.call(() => {
// guang.active = true;
guang.active = true;
})
.to(0.3, { scale: 1 })
.start();
// coins4 动画(最后播放)
cc.tween(coins4)
// person 动画(最后播放)
cc.tween(person)
.delay(0.15)
.to(0, { scale: 0 })
.call(() => {
// coins4.active = true;
person.active = true;
})
.to(0.2, { scale: 2.2 }, { easing: 'backOut' })
.to(0.12, { scale: 1.8 }, { easing: 'quadIn' })

View File

@ -1433,6 +1433,7 @@ var GameTool = {
};
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
cc.fx.AudioManager._instance.onHide();
//@ts-ignore
wx.shareAppMessage(shareParams);
@ -1444,10 +1445,15 @@ var GameTool = {
// 从后台返回的监听函数
const showListener = () => {
// 恢复背景音乐播放
cc.fx.AudioManager._instance.onShow();
cc.fx.AudioManager._instance.playMusicGame();
if (hideTime > 0) {
const showTime = Date.now(); // 记录返回时间
const duration = showTime - hideTime; // 计算后台停留时间
console.log("从后台返回时间:", showTime, "停留时间:", duration, "毫秒");
// console.log("从后台返回时间:", showTime, "停留时间:", duration, "毫秒");
// 如果后台停留时间大于等于3秒则认为分享成功
if (duration >= 3000) {
@ -1506,7 +1512,16 @@ var GameTool = {
}
cc.fx.GameTool.shushu_Track("ad_request", requestData);
cc.fx.GameConfig.GM_INFO.videoTime = Math.floor(Date.now() / 1000);
// 添加超时处理
const timeoutId = setTimeout(() => {
console.log('广告加载超时');
if (scene) scene.closeLoad();
MiniGameSdk.API.showToast('广告加载超时,请稍后再试');
// 调用回调并传入错误状态
callback(false);
}, 6000); // 6秒超时
MiniGameSdk.AdvertManager.instance.showVideo('adunit-32a23bc2b2f4ee0a', videoData, (res: MiniGameSdk.EAdVideoResult, count: number) => {
if (timeoutId) clearTimeout(timeoutId);
console.log('用户看的视频广告个数是:', count);
// 根据用户观看广告的结果执行不同的逻辑s
console.log('用户观看视频广告结果:', res);

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -21,13 +21,13 @@
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0.5,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1080,
"height": 169,
"rawWidth": 1080,
"rawHeight": 170,
"width": 383,
"height": 129,
"rawWidth": 383,
"rawHeight": 129,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -9,7 +9,7 @@
"genMipmaps": false,
"packable": true,
"width": 256,
"height": 2040,
"height": 1792,
"platformSettings": {},
"subMetas": {}
}