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 @@