mirror of
				https://github.com/tidys/cc-inspector-chrome
				synced 2025-11-04 16:05:25 +00:00 
			
		
		
		
	控制广告的地方
This commit is contained in:
		@@ -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",
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user