npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@parazeni/cocos-admob-ios

v1.1.3

Published

A comprehensive AdMob integration for iOS apps built with Cocos Creator 3.8 or higher. Features include displaying banner ads, interstitial ads, and rewarded ads, providing a seamless advertising solution for developers.

Downloads

3

Readme

Cocos Creator 3.8 Admob iOS app

介紹

cocos-admob-ios 這個 npm 是提供給 cocos creator 3.8 版本以上的 iOS app,內有3個基礎的功能。

  1. 顯示橫幅廣告
  2. 顯示插頁廣告
  3. 獎勵廣告

配置設定

const config: GameCenterManagerConfig = {
  /** 是否開啟日誌 */
  openLog: true;
  /** banner(橫幅)廣告 */
   bannerAdId: "ca-app-pub-3940256099942544/2934735716",
  /** 插頁式廣告 */
    interstitialAdId: "ca-app-pub-3940256099942544/4411468910",
  /** 獎勵廣告 */
    rewardVideoAdId: "ca-app-pub-3940256099942544/1712485313",
}

// 使用 Admob 廣告前需要 initAd
AdmobAdManger.initAd(config);

使用範例

import { _decorator, Component, Label } from "cc";
import AdmobAdManger, { GameCenterManagerConfig } from "@parazeni/cocos-admob-ios";
const { ccclass, property } = _decorator;

@ccclass("AdmobManger")
export class AdmobManger extends Component {

  @property({ type: Label })
  public RewardLabel: Label = null;
  private _count: number = 0;

  start() {
    const config: GameCenterManagerConfig = { openLog: true };
    AdmobAdManger.initAd(config);
  }

  update(deltaTime: number) {}
  /** 觸發顯示獎勵廣告彈窗 */
  async onShowRewardedVideoAdClick(event: Event, str: string) {
    console.log("觸發顯示獎勵廣告彈窗");
    try {
      const reward = await AdmobAdManger.showRewardedVideoAd();
      console.log("弹出獎勵廣告事件", JSON.stringify(reward));
      if (reward.result === "complete") {
        console.log("獎勵廣告完成");
        // 增加獎勵廣告次數
        this._count++;
        if (this.RewardLabel) {
          this.RewardLabel.string = `獎勵次數:${this._count}`;
        }
      } else {
        console.log("獎勵廣告未完成");
      }
    } catch (error) {
      console.log("獎勵廣告錯誤", error);
    }
  }

  /** 顯示 橫幅廣告 */
  onShowBannerAdClick(event: Event, str: string) {
    console.log("顯示 橫幅廣告");
    AdmobAdManger.showBannerAd();
  }

  /** 關閉 橫幅廣告 */
  onHideBannerAdClick() {    
    console.log("關閉 橫幅廣告");
    AdmobAdManger.hideBannerAd();
  }

  /** 觸發 插頁式廣告 */
  async onShowInterstitialAdClick(event: Event, str: string) {
    console.log("觸發 插頁式廣告");
    try {
      let result = await AdmobAdManger.showInterstitialAd();
      console.log("插頁式廣告 結果:", result);      
    } catch (error) {
      console.log("插頁式廣告 錯誤:", error);
    }
  }
}