From e331c51dc364dcc35690a1338c8a6d08ce415564 Mon Sep 17 00:00:00 2001 From: xu_yanfeng Date: Fri, 7 Feb 2025 14:10:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96popup=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=9B=B4=E5=A4=9A=E7=9A=84=E6=B8=B8=E6=88=8F=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cc-plugin.config.ts | 2 +- src/scripts/inject-view/ad.vue | 2 +- src/scripts/inject-view/loader.ts | 14 ++- src/views/popup/index.vue | 161 ++++++++++++++++++++++++++---- src/views/popup/res/30.jpg | Bin 0 -> 132007 bytes 5 files changed, 153 insertions(+), 26 deletions(-) create mode 100644 src/views/popup/res/30.jpg diff --git a/cc-plugin.config.ts b/cc-plugin.config.ts index ebe169f..152d2e2 100644 --- a/cc-plugin.config.ts +++ b/cc-plugin.config.ts @@ -9,7 +9,7 @@ function i18n(key: string) { const manifest: CocosPluginManifest = { name: pkgName, - version: "2.1.6", + version: "2.1.7", description: "Debug games made with CocosCreator and display node trees and node properties", author: "xu_yanfeng", main: "./src/main.ts", diff --git a/src/scripts/inject-view/ad.vue b/src/scripts/inject-view/ad.vue index e18f977..95ccfe4 100644 --- a/src/scripts/inject-view/ad.vue +++ b/src/scripts/inject-view/ad.vue @@ -34,7 +34,7 @@ export default defineComponent({ console.log(`not find any ad`); return; } - ads.value = data.data; + ads.value = data.data.filter((item) => item.valid); console.log("get ads ", toRaw(ads.value)); ga(GA_EventName.ShowAd); diff --git a/src/scripts/inject-view/loader.ts b/src/scripts/inject-view/loader.ts index aa7c961..3adbb86 100644 --- a/src/scripts/inject-view/loader.ts +++ b/src/scripts/inject-view/loader.ts @@ -12,7 +12,7 @@ export class AdItem { /** * 插件的试用地址 */ - try: string = ""; + try: string | Array<{ name: string; url: string }> = ""; /** * 广告的store购买链接 */ @@ -29,6 +29,14 @@ export class AdItem { * 背景图 */ img: string = ""; + getTryInfos(): Array<{ name: string; url: string }> { + if (typeof this.try === "string" && this.try) { + return [{ name: this.name, url: this.try }]; + } else if (Array.isArray(this.try)) { + return this.try; + } + return []; + } parse(data: AdItem) { this.name = data.name; this.store = data.store || ""; @@ -95,10 +103,6 @@ export class AdData { console.warn(`add failed, ad.duration is ${item.duration}, ${JSON.stringify(item)}`); return; } - if (!item.valid) { - console.warn(`add failed, ad is invalid, ${JSON.stringify(item)}`); - return; - } this.data.push(item); }); } diff --git a/src/views/popup/index.vue b/src/views/popup/index.vue index 73dac48..ecc1408 100644 --- a/src/views/popup/index.vue +++ b/src/views/popup/index.vue @@ -1,10 +1,39 @@