# com.gameframex.unity.advertisement **Repository Path**: gameframex/com.gameframex.unity.advertisement ## Basic Information - **Project Name**: com.gameframex.unity.advertisement - **Description**: GameFrameX Unity Advertisement component providing a unified abstraction layer for ad integration across multiple platforms - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: https://gameframex.doc.alianblank.com - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-23 - **Last Updated**: 2026-06-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
Game Frame X Logo # GameFrameX Advertisement 广告组件 [![License](https://img.shields.io/github/license/GameFrameX/com.gameframex.unity.advertisement)](https://github.com/GameFrameX/com.gameframex.unity.advertisement/blob/main/LICENSE.md) [![Version](https://img.shields.io/github/v/release/GameFrameX/com.gameframex.unity.advertisement)](https://github.com/GameFrameX/com.gameframex.unity.advertisement/releases) [![Unity Version](https://img.shields.io/badge/Unity-2019.4-black?logo=unity)](https://unity.com/) [![Documentation](https://img.shields.io/badge/Documentation-docs-blue)](https://gameframex.doc.alianblank.com) 独立游戏前后端一体化解决方案 · 独立游戏开发者的圆梦大使
[文档](https://gameframex.doc.alianblank.com) · [快速开始](#快速开始) · QQ群: 467608841 / 233840761
[English](README.md) | **简体中文** | [繁體中文](README.zh-TW.md) | [日本語](README.ja.md) | [한국어](README.ko.md)
## 目录导航 - [项目简介](#项目简介) - [快速开始](#快速开始) - [使用示例](#使用示例) - [文档与资源](#文档与资源) - [社区与支持](#社区与支持) - [开源协议](#开源协议) --- ## 项目简介 GameFrameX Advertisement 是一个 GameFrameX 框架的广告组件,用于在 Unity 项目中快速集成广告功能。 ### 核心特性 - **简单集成** - 最少配置即可添加广告支持 - **组件化设计** - 基于 GameFrameX 模块化架构 - **多广告网络** - 抽象接口支持多种广告 SDK(AdMob、Unity Ads、IronSource 等) - **激励广告** - 内置激励视频广告的奖励回调处理 - **编辑器集成** - 自定义 Inspector 方便配置 ### 系统要求 - Unity 2017.1 或更高版本 --- ## 快速开始 ### 安装 选择以下任一方式: 1. 编辑 Unity 项目的 `Packages/manifest.json`,添加 `scopedRegistries` 部分: ```json { "scopedRegistries": [ { "name": "GameFrameX", "url": "https://gameframex.upm.alianblank.uk", "scopes": [ "com.gameframex" ] } ], "dependencies": { "com.gameframex.unity.advertisement": "1.5.0" } } ``` `scopes` 控制哪些包通过此注册表解析。只有以 `com.gameframex` 开头的包才会从这个注册表获取。 2. 直接在 `manifest.json` 的 `dependencies` 节点下添加以下内容: ```json { "com.gameframex.unity.advertisement": "https://github.com/gameframex/com.gameframex.unity.advertisement.git" } ``` 3. 在 Unity 的 `Package Manager` 中使用 `Git URL` 的方式添加库,地址为:`https://github.com/gameframex/com.gameframex.unity.advertisement.git` 4. 直接下载仓库放置到 Unity 项目的 `Packages` 目录下,会自动加载识别。 ## 使用示例 ### 基本使用 ```csharp using GameFrameX.Advertisement.Runtime; using UnityEngine; using System; public class MyAdCaller : MonoBehaviour { private AdvertisementComponent adComponent; void Start() { // 获取 AdvertisementComponent 组件实例 adComponent = GetComponent(); } // 加载广告 public void LoadAd() { if (adComponent != null) { adComponent.Load( (message) => { Debug.Log("广告加载成功: " + message); }, (error) => { Debug.LogError("广告加载失败: " + error); } ); } } // 显示广告 public void ShowAd() { if (adComponent != null) { adComponent.Show( (message) => { Debug.Log("广告展示成功: " + message); }, (error) => { Debug.LogError("广告展示失败: " + error); }, (reward) => { if (reward) { Debug.Log("广告播放完成,发放奖励"); } else { Debug.Log("广告未完整播放"); } } ); } } } ``` ### 主要类和接口 - **`AdvertisementComponent`**: Unity MonoBehaviour 组件,是与广告系统交互的主要入口。 - **`IAdvertisementManager`**: 广告管理器的核心接口。所有具体的广告网络实现都必须实现此接口。 - **`BaseAdvertisementManager`**: 一个可选的抽象基类,实现了 `IAdvertisementManager` 接口,提供了通用的回调处理逻辑。 --- ## 文档与资源 - **完整文档**: [https://gameframex.doc.alianblank.com](https://gameframex.doc.alianblank.com) - **问题反馈**: [GitHub Issues](https://github.com/GameFrameX/com.gameframex.unity.advertisement/issues) --- ## 社区与支持 - **QQ 讨论群**: [467608841](https://qm.qq.com/cgi-bin/qm/qr?k=sYFd1nv6m2KZIWFLorZ5pBR0AE5ZhbuL&jump_from=webapi&authKey=oCu+uoL3n35fT5SEt7iLgGtROPxh31n/rHUxRlp0w1f+j38W4tKBuWyRH3KEdwHN) - **功能建议**: [GitHub Discussions](https://github.com/GameFrameX/com.gameframex.unity.advertisement/discussions) --- ## 依赖 | 包 | 说明 | |----|------| | (无) | - | ## 更新日志 查看 [Releases](https://github.com/GameFrameX/gameframex/com.gameframex.unity.advertisement/releases) 了解更新日志。 ## 开源协议 详见 [LICENSE.md](LICENSE.md) 文件。