This documentation will help you integrating KadoSaku Services in your game using KadoSaku SDK.
Please refer to examples for implementation.
This SDK must be installed using Touchten Framework Wizard and have dependencies to
- TT-Core (Shared Settings & Initialization)
- TT-Social (TTSociaExtension)
- TT-Analytics (DataExtension)
- KadoSaku-WebClient
Notes Don't init this module manually, unless you know what you are doing.
All initialization sequence is handled by TT-Core
Don't forget to setup your KadoSaku Settings in Unity Menu
Unity Menu Bar > KadoSaku > Edit Core Settings
- Game App Id: get from portal.touchten.com
- Game App Secret: get from portal.touchten.com
- Game Public Key: get from portal.touchten.com
- Game Name: fill with your game name
- Game Photo Link: fill with URL to download your game icon
- Game Link: fill with download link of your game
- iTunes App Id: get from itunesconnect
- Enable Auto Login: Set this to true if your game is using auto-login features
- Enable KadoSaku Debug Message: Enable this to report KadoSaku system to console
Examples
Result Object Interface
Api List
Changelog
Add namespace
using KadoSaku.Api;Using Callback Method
void TriggerAchievement (string achievementId) {
KS.Achievement.TriggerAchievement(achievementId, onAchievementTriggered);
}
// Create method that satisfy KadoSakuDelegate
void onAchievementTriggered (IActionResult result) {
Debug.Log (result.IsSuccess);
if(result.IsSuccess) {
// TODO: Add your code here ...
}
}Notes on creating method that satisfy KadoSakuDelegate
- Create void method that has one parameter that equal with KadoSakuDelegate Generic Type
- Maybe it is easier to explain in this:
create void CallbackMethodName (T result) where T equals T in KadoSakuDelegate<T> case 1: void OnSubmitScoreCompleted(IActionResult result) {} => because the callback KadoSakuDelegate<IActionResult> signature CallbackMethodName: OnSubmitScoreCompleted T: IActionResult case 2: void OnLeaderboardInfoRequestCompleted (ILeaderboardInfoResult result) {} => because the callback use KadoSakuDelegate<ILeaderboardInfoResult> signature CallbackMethodName: OnLeaderboardInfoCompleted T: ILeaderboardInfoResult
Using Anonymous Callback Method
string achievementId = "000000000000001";
KS.Achievement.TriggerAchievement (achievementId, delegate(IActionResult result) {
Debug.Log(result.IsSuccess);
if (result.IsSuccess) {
// TODO: Add your code here ...
}
});Notes usually the signature is provided by IDE's intellisense
Using anonymous callback method, checking result using Error and Cancelled property from IResult
string leaderboardId = "000000000000001";
KS.Leaderboard.GetLeaderboardInfo (leaderboardId, delegate(ILeadeboardInfoResult result) {
if (result.Error != null || result.Cancelled == false) {
Debug.LogError(result.Error.Message);
return;
}
// TODO: Add your code here ...
Debug.Log(result.Name);
});Handle Error and Cancelled property from IResult
string leaderboardId = "000000000000001";
KS.Leaderboard.GetLeaderboardInfo (leaderboardId, delegate(ILeadeboardInfoResult result) {
if (result.Error != null) {
// TODO: Handle error here
Debug.LogError(result.Error.Message);
return; // Don't forget to return to stop program execution
}
if (result.Cancelled == false) {
// TODO: Handle cancelled here
return;
}
// If there is no Error and not cancelled
// TODO: Add your code here ...
Debug.Log(result.Name);
});IError
Field:
int Code
string MessageIResult
Field:
IError Error
bool? Cancelled
string RawResultIActionResult : IResult
Field:
bool IsSuccessIDownloadMetaDataResult : IResult
Field:
DateTime? Date
int FileLength
string FileType
DateTime? LastCreated
DateTime? LastModifiedIDownloadSaveResult : IResult
Field:
DateTime? Date
int FileLength
string FileType
DateTime? LastCreated
DateTime? LastModifiedILeaderboardScoresResult : IResult
Field:
string Name
string Status
bool EnableMatchmakingILeaderboardScoresResult : IResult
Field:
IList<ILeaderboardScoreModel> ScoresILeaderboardScoreModel
Field:
IPlayerModel Player
int ScoreIPlayerProfileResult : IResult, IPlayerProfileModel
Field:
IList<ILeaderboardScoreModel> ScoresIPlayerProfileModel : IPlayerModel
Field:
IPlayerModel Player
string Email
int CreditsIPlayerModel
Field:
string ObjectId
string Name
string PhotoURLIMailResult : IResult
Field:
IList<IMailModel> MailsIMailModel
Field:
string Id
string Title
string CustomData
string Status
string Description
DateTime SendDate
DateTime Expiration
string TypeILoginResult : IResult
Field:
string MembershipToken
IPlayerProfileModel PlayerProfileITimeResult : IResult
Field:
DateTime? UTCTimeProperties
bool KS.IsLogin { get; }
bool KS.IsKadoSakuViewShown { get; }
bool KS.IsInitComplete { get; }
IPlayerProfileModel KS.PlayerProfile { get; }Events
KS.onViewStateChangedEventAchievements
void KS.Achievement.TriggerAchievement(string achievementId, KadoSakuDelegate<IActionResult> callback)
void KS.Achievement.ShowAchievementListView()
void KS.Achievement.ShowAchievementResultView()Authentication
void KS.Authentication.ShowLoginView(KadoSakuDelegate<IActionResult> callback)
void KS.Authentication.Logout(KadoSakuDelegate<IActionResult> callback)
void KS.Authentication.UnlinkSocialAndLogout(KadoSakuDelegate<IActionResult> callback)CloudSave
void KS.CloudSave.UploadSave(string fileName, string file, KadoSakuDelegate<IActionResult> callback)
void KS.CloudSave.DownloadSave(string fileName, KadoSakuDelegate<IDownloadSaveResult> callback)
void KS.CloudSave.DownloadMetaData(string fileName, KadoSakuDelegate<IDownloadMetaDataResult> callback)
void KS.CloudSave.DeleteSave(string fileName, KadoSakuDelegate<IActionResult> callback)Leaderboard
void KS.Leaderboard.ShowView(string leaderboardId)
void KS.Leaderboard.SubmitScore(string leaderboardId, int score, KadoSakuDelegate<IDownloadSaveResult> callback)
void KS.Leaderboard.GetLeaderboardInfo(string leaderboardId, KadoSakuDelegate<ILeadeboardInfoResult> callback)
void KS.Leaderboard.GetGlobalScores(string leaderboardId, LeaderboardTimeFrame timeFrame, KadoSakuDelegate<ILeaderboardScoresResult> callback)
void KS.Leaderboard.GetSocialScores(string leaderboardId, LeaderboardTimeFrame timeFrame, KadoSakuDelegate<ILeaderboardScoresResult> callback)void KS.Mail.CheckInbox(KadoSakuDelegate<IMailResult> callback)
void KS.Mail.CheckAnnouncements(KadoSakuDelegate<IMailResult> callback)
void KS.Mail.MarkMailAsRead(string mailId, KadoSakuDelegate<IActionResult> callback)Reward
void KS.Reward.ShowView()User
void KS.User.UpdatePlayerProfile(KadoSakuDelegate<IPlayerProfileResult> callback)Utility
void KS.Utility.UpdatePlayerProfile(KadoSakuDelegate<ITimeResult> callback)version 1.4.1
- Fix localization bug: Cannot Update Localization by changing device's language
version 1.3.1
- Fix KadoSaku iOS encryption library is not loaded
version 1.3.0
- Fix Keyboard blocking Webview's input field