控制广告的地方

This commit is contained in:
xu_yanfeng 2025-02-13 15:40:16 +08:00
parent 622537d3c4
commit 771593f948
3 changed files with 12 additions and 8 deletions

View File

@ -9,7 +9,7 @@ function i18n(key: string) {
const manifest: CocosPluginManifest = {
name: pkgName,
version: "2.1.8",
version: "2.1.9",
description: "Debug games made with CocosCreator and display node trees and node properties",
store: "https://store.cocos.com/app/detail/2002",
author: "xu_yanfeng",

View File

@ -34,7 +34,7 @@ export default defineComponent({
console.log(`not find any ad`);
return;
}
ads.value = data.data.filter((item) => item.valid);
ads.value = data.data.filter((item) => item.where === "list");
console.log("get ads ", toRaw(ads.value));
sendGaEvent(GA_EventName.ShowAd);

View File

@ -27,9 +27,13 @@ export class AdItem {
*/
duration: number = 0;
/**
* 广
* 广
*/
valid: boolean = true;
where: "popup" | "list" = "list";
/**
* 广
*/
visible: boolean = true;
/**
*
*/
@ -53,7 +57,8 @@ export class AdItem {
this.tip = data.tip || "";
this.type = data.type || "";
this.duration = data.duration || 0;
this.valid = !!data.valid;
this.where = data.where || "popup";
this.visible = data.visible === false ? false : true;
const img = data.img || "";
this.img = githubMirrorMgr.getFileUrl(img);
return this;
@ -110,10 +115,9 @@ export class AdData {
return;
}
const item = new AdItem().parse(el);
if (!item.duration) {
// console.warn(`add failed, ad.duration is ${item.duration}, ${JSON.stringify(item)}`);
if (item.visible) {
this.data.push(item);
}
this.data.push(item);
});
}
}