Commit 95a16c50 王帅

read me

1 个父辈 752e46c0
# Get Started
# What is ZAnti-AddictionSDK
This guide is intended for publishers who want to integrate the Anti-Addiction system.
For games released in China, one of the rules that must be followed is real-name authentication before playing and a limit on how long minors can play.
# Prerequisites
Using this sdk, you can easily implement this feature.
- To deploy to iOS
# Platform
- iOS
- Xcode 10 or higher
- iOS 10.0 or higher
- [CocoaPods](https://guides.cocoapods.org/using/getting-started.html)
- To deploy to Android
- Not supported at present
- Android
- Not supported
## Download the AntiAddictionSystem Unity plugin
The AntiAddictionSystem Unity plugin is distributed with the Unity [Play Services Resolver library](https://github.com/googlesamples/unity-jar-resolver). This library is intended for use by any Unity plugin that requires access to Android specific libraries (e.g., AARs) or iOS CocoaPods. It provides Unity plugins the ability to declare dependencies, which are then automatically resolved and copied into your Unity project.
The AntiAddictionSystem Unity plugin enables Unity developers to easily serve AntiAddictionSystemSDK on Android and iOS apps without having to write Java or Objective-C code. The plugin provides a C# interface for requesting ads that is used by C# scripts in your Unity project.
# Detailed Steps
Use the links below to download the Unity package for the plugin or to take a look at its code on GitHub.
#### 1. Download the Plugin
[Download the Plugin](http://59.110.70.54/ZAnti-Addiction/ZAnti-Addiction-Unity/blob/master/ZAnti-AddictionSDK.unitypackage)
Or use the `ZAnti-AddictionSDK.unitypackage` file within the project
## Import the AntiAddictionSystem Unity plugin
#### Import plugin
Open your project in the Unity editor.
Select Assets > Import Package > Custom Package and find the AntiAddictionSystem.unitypackage file you downloaded.
<img src='resources/add_custom_package.png'>
Make sure all of the files are selected and click Import.
<img src='resources/import_custom_package.png'>
## Include the AntiAddictionSystem SDK
The AntiAddictionSystem Unity plugin is distributed with the Unity [Play Services Resolver library](https://github.com/googlesamples/unity-jar-resolver). This library is intended for use by any Unity plugin that requires access to Android specific libraries (e.g., AARs) or iOS CocoaPods. It provides Unity plugins the ability to declare dependencies, which are then automatically resolved and copied into your Unity project.
Select Assets > Import Package > Custom Package and find the ZAnti-AddictionSDK.unitypackage file you downloaded.
Follow the steps listed below to ensure your project includes the Atmosplay Ads SDK.
<img src='resources/add_custom_package.png' width=300>
### Deploy to iOS
Import
No additional steps are required to include the AntiAddictionSystem SDK into the Unity project.
<img src='resources/import_custom_package.jpg' width=300>
After building, open xcworkspace project.
#### 3. Build iOS Project
*Note: iOS dependencies are identified using CocoaPods. CocoaPods is run as a post build process step.*
<img src='resources/unity_build.jpg' width=300>
### Deploy to Android
#### 4. Run CocoaPods
<img src='resources/build_ios.jpg' width=300>
Not supported at present
After the build is completed, enter the project directory and execute `pod install`
This step depends [CocoaPods](https://guides.cocoapods.org/using/getting-started.html)
## Config Parametrs
### Config the iOS parameters
#### 5. Necessary Configuration
##### info.plist
Add the following parameters into the `info.plist`.
You can find the `info.plist` in your Xcode project.
- `NSUserTrackingUsageDescription`:get hint for IDFA
- `zgameid`:You can contact PM for this
- `zchannelid`:You can contact PM for this
......@@ -67,24 +61,28 @@ You can find the `info.plist` in your Xcode project.
<key>zchannelid</key>
<string>your channel id</string>
<key>NSUserTrackingUsageDescription</key>
<string>get hint for IDFA</string>
```
### Config the Sign In with Apple
##### Capabilities - Sign In with Apple
In the project editor, add the Sign In with Apple capability to your target.
<img src='resources/signApple_en.png'>
<img src='resources/signApple1.jpg' width=400>
<img src='resources/signApple2.jpg' width=400>
<img src='resources/signApple3.jpg' width=400>
You might get the following error:
- "xxx" requires a provisioning profile with the Sign in with Apple feature.
- can't find Sign In with Apple in capability
It might have something to do with Certificates, Identifiers & Profiles,You can contact the PM to try to resolve the problem.
# How to use
# 3. Integration
##### AntiAddictionSDK
```csharp
using System;
......@@ -106,42 +104,6 @@ public class AASDKDemoScript: MonoBehaviour
antiAddictionSDK.ZAASDKCompleted += HandleZAASDKCompleted;
}
// Obtain the real-name authentication status of the user
// 0: uncertified
// 1:authenticated
public void IsAuthenticated()
{
statusText.text = "IsAuthenticated";
if (antiAddictionSDK != null)
{
statusText.text = antiAddictionSDK.IsAuthenticated()+"";
}
}
// Obtain the authentication result of the current user
// 0 uncertified
// 1 adult
// 2 underage
public void GetUserAgeGroup()
{
statusText.text = "GetUserAgeGroup";
if (antiAddictionSDK != null)
{
statusText.text = antiAddictionSDK.AgeGroupOfCurrentUser()+"";
}
}
// leftTimeOfCurrentUser = -1 : no time limited
// leftTimeOfCurrentUser more than the 0 : left time of current user
public void LeftTimeOfCurrentUser()
{
statusText.text = "LeftTimeOfCurrentUser";
if (antiAddictionSDK != null)
{
statusText.text = antiAddictionSDK.LeftTimeOfCurrentUser()+"";
}
}
// allback handlers
// Allow the game to start
public void HandleZAASDKCompleted(object sender, EventArgs args)
......@@ -151,7 +113,20 @@ public class AASDKDemoScript: MonoBehaviour
}
}
```
# Custom interface
# Optional configuration
#### 1. IDFA
Getting IDFA helps optimize the user experience.
Add the following parameters into the `info.plist`:
- `NSUserTrackingUsageDescription`:get hint for IDFA
```xml
<key>NSUserTrackingUsageDescription</key>
<string>get hint for IDFA</string>
```
#### 2. Change SDk Background Image
The current default screen is as follows:
Portrait
<img src='resources/launch_V.jpg' width=150>
......
......@@ -42,7 +42,7 @@ Import
<img src='resources/unity_build.jpg' width=300>
#### 4. 安装依赖
#### 4. 运行CocoaPods
<img src='resources/build_ios.jpg' width=300>
构建完毕后进入项目目录,执行 `pod install`
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!