com.amanotes.acm
v2.1.17
Published
ACM SDK is a free library from Amanotes provides an efficient way to access Amanotes's content store.
Downloads
49
Readme
Amanotes ACM SDK
Before you begin
ACM SDK is a free library from Amanotes provides an efficient way to access Amanotes's content store.
How does it work?
ACM SDK help you to download any content (mp3 files, level design etc.) of your game from Amanotes Content Store, manage content of your game, provide analytics to help you understand your game better. ACM SDK also provide an easy way for your to update your game's content without update a new game version.
Setup ACM SDK for your game
Add npm registry at the top of ./Packages/manifest.json
, then add com.amanotes.acm
package at the end of dependencies
block. You can get lastest version here
{
"scopedRegistries": [{
"name": "Amanotes",
"url": "https://registry.npmjs.org/",
"scopes": [
"com.amanotes"
]
}],
"dependencies": {
// Others config goes here
...
"com.amanotes.acm" : "<lastest_version>"
}
}
For Android
Update your AndroidManifest.xml (You can find it in /Assets/Plugins/Android/AndroidManifest.xml. If it's not exist, go to \Editor\Data\PlaybackEngines\AndroidPlayer\Apk, Copy the AndroidManifest.xml file to your Assets\Plugins\Android)
/**
* Add android:usesCleartextTraffic="true" inside your <application> tag
* Add uses-library at the end of <application> tag, before </application>
* Add uses-permission at the end of <manifest> tag, before </manifest>
*/
<manifest>
<application
...
android:usesCleartextTraffic="true"
...
>
...
<uses-library android:name="org.apache.http.legacy" android:required="false" />
</application>
...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>
Add ACM SDK to your app
Import ACM package
using Amanotes.ACM;
Init ACM SDK, typically in your very first init scene of you game
/**
* Init ACM SDK
* Provide callback functions to listen result from ACM SDK initialize process
*
* @param key key provided by Amanotes team
* @param OnInitFail callback function when ACM SDK initialize failed
* @param OnInitSuccess callback function when ACM SDK initialize success
*/
ACMSDK.Instance.Initialize(key, OnInitFail , OnInitSuccess);
/**
* Callback when ACM SDK init failed
*/
public void OnInitFail()
{
}
/**
* Callback when ACM SDK init success
* @return config the config info of your game
*/
public void OnInitSuccess(InitConfig config)
{
}
Download Mp3 content from Amanotes Content Store
/**
* Download Mp3 content
*
* @param songID ID of the content which you want to download
* @param OnCompleteMp3Fail callback function when mp3 content download failed
* @param OnCompleteMp3Success callback function when mp3 content download success
*/
ACMSDK.Instance.GetFileMp3(songID, OnCompleteMp3Fail, OnCompleteMp3Success);
/**
* Callback when mp3 content download success
* @return extraInfoDownload the information of downloaded mp3 content
* @return path the local path of your downloaded mp3 content
*/
private void OnCompleteMp3Success(ExtraInfoDownload extraInfoDownload, string path)
{
Debug.Log("OnCompleteMp3Success " + path);
}
/**
* Callback when mp3 content download failed
* @return data the error message
*/
private void OnCompleteMp3Fail(string data)
{
Debug.Log("OnCompleteMp3Fail " + data);
}
Download Midi content from Amanotes Content Store
/**
* Download Midi content
*
* @param songID ID of the content which you want to download
* @param OnCompleteMidiFail callback function when Midi content download failed
* @param OnCompleteMidiSuccess callback function when Midi content download success
*/
ACMSDK.Instance.GetFileMidi(songID, OnCompleteMidiFail, OnCompleteMidiSuccess);
/**
* Callback when Midi content download success
* @return extraInfoDownload the information of downloaded mp3 content
* @return path the local path of your downloaded mp3 content
*/
private void OnCompleteMidiSuccess(ExtraInfoDownload extraInfoDownload, string path)
{
}
/**
* Callback when Midi content download failed
* @return data the error message
*/
private void OnCompleteMidiFail(string data)
{
}
Log Events
Song Request
Triggered when user choose a song to play
/**
* Triggered when user choose a song to play
*
* @param songID ID of the Song you are playing
*/
ACMSDK.Instance.SendEventSongRequest(songID);
Song Start
Triggered when the game finish initializes the Action phase of level/song. Including Action phase in tutorial, tap on Play from Main Screen, Retry. Not including: Revive to continue.
/**
* Call this function when game is loading finish a game level and start playing
*
* @param songID ID of the Song you are playing
* @param level the level of this song
* @param unlock unlock condition for the song, with the following values:
* - Default: unlocked automatically.
* - Progression: Unlocked by completing previous level and satisfying the other requirement (percentages/challenges...)
* - Ads: Unlocked by watching a number of reward video ads.
* - SC: bought with soft currency
* - HC: bought with hard currency
* - Gift: songs unlocked by participating in ingame event.
*/
ACMSDK.Instance.SendEventSongStart(songID, level, unlock);
Song End
Triggered when user clear/complete a level (including tutorial). In games with endless mode and the song are looped, fire the event when the song complete in the first time.
/**
* Call this function when game is loading finish a game level and start playing
*
* @param songID ID of the Song you are playing
* @param level the level of this song
* @param unlock unlock condition for the song, with the following values:
* - Default: unlocked automatically.
* - Progression: Unlocked by completing previous level and satisfying the other requirement (percentages/challenges...)
* - Ads: Unlocked by watching a number of reward video ads.
* - SC: bought with soft currency
* - HC: bought with hard currency
* - Gift: songs unlocked by participating in ingame event.
*/
ACMSDK.Instance.SendEventSongEnd(songID, level, unlock);
Song Result
Triggered when the player reaches Result Screen.
/**
* Triggered when the player reaches Result Screen.
*
* @param songID ID of the Song you are playing
* @param level the level of this song
* @param unlock unlock condition for the song, with the following values:
* - Default: unlocked automatically.
* - Progression: Unlocked by completing previous level and satisfying the other requirement (percentages/challenges...)
* - Ads: Unlocked by watching a number of reward video ads.
* - SC: bought with soft currency
* - HC: bought with hard currency
* - Gift: songs unlocked by participating in ingame event.
* @param playtime Playing time in seconds since the start of the level, not including time spent watching ads
*/
ACMSDK.Instance.SendEventSongResult(songID, level, unlock, playtime);
Song Fail
Triggered every time a player fail in a level (even if he would revive with reward video after), including failing after revival
/**
* Triggered every time a player fail in a level (even if he would revive with reward video after), including failing after revival.
*
* @param songID ID of the Song you are playing
* @param level the level of this song
* @param unlock unlock condition for the song, with the following values:
* - Default: unlocked automatically.
* - Progression: Unlocked by completing previous level and satisfying the other requirement (percentages/challenges...)
* - Ads: Unlocked by watching a number of reward video ads.
* - SC: bought with soft currency
* - HC: bought with hard currency
* - Gift: songs unlocked by participating in ingame event.
*/
ACMSDK.Instance.SendEventSongFail(songID, level, unlock);
Versioning
We use SemVer for versioning.
License
This project is licensed under the MIT License - see the LICENSE.md file for details