This project is Unity game deveoper SDK for CloudBread game server engine In Unity, you don't need to execute raw code for CloudBread API. CloudBread-Unity-SDK can easily integrate CloudBread API as your code.
Official guide repository in CloudBread wiki.
English : https://github.com/CloudBreadProject/CloudBread/wiki/How-to-use-Unity-SDK
Korean : https://github.com/CloudBreadProject/CloudBread/wiki/How-to-use-Unity-SDK-kor
- 2.1.0 oAuth 2.0 Login Service Framework will added (now only Facebook)
CloudBread-Unity-SDK-master – Asset 폴더 안의 파일 추가하기 ![Unity CloudBread SDK]
Asset/CloudBread
/CloudBread.meta
/Editor Default Resources
/Editor Default Resources.meta
Asset 안의 2 개의 폴더와 2 개의 meta 파일을 추가하면 됩니다.
If you can see that menu as this photos, that's all!
- CloudBread – CB-PostMan Click
- PostMan Collection(2016-03-26버전) Download
- Import PostMan File (
.json.postman_collection
) Unity CloudBread Postman Editor)
You can search here and Generate Client File button click
CloudBread – Resources – CB.Settings Click
Here, you can set server address and AES256 Encrypt/Decrypt Keys
If you use TestCall class like this, you can use easily.
using UnityEngine;
using System.Collections;
namespace CloudBread
{
public class Test : TestCall<CBCOMUdtMember.Post, CBCOMUdtMember.Receive>
{
void Start()
{
CBCOMUdtMember.Request(_postData, Callback, ErrorCallback_);
}
}
}
And, you can test like this in Unity Inspector.
Post Data generate
var post_data = new CBCOMUdtMember.Post ();
post_data.MemberID = "aaa";
post_data.EmailAddress = "[email protected]";
Callback function generate
// success!, CallBack function
void CBCOMUDtMember_Callback(CBCOMUdtMember.Receive receive_data){
// Todo
print("Result Data : " + receive_data.result);
}
// Failed, CallBack function
void CBCOMUDtMember_Callback_err(string error){
// Todo
print(error);
}
Request to CloudBread Instance
// Error 콜백 함수는 생략 가능
CloudBread.CBCOMUdtMember.Request (post_data, CBCOMUDtMember_Callback, CBCOMUDtMember_Callback_err);
If you want to use Landa function, you cna use like this.
CloudBread.CBCOMUdtMember.Request(
new CBCOMUdtMember.Post{
MemberID="aaa",
EmailAddress = "aaa"
},
((CBCOMUdtMember.Receive receive_data) => {
print("Result Data : " + receive_data.result);
})
);
- check services you want to uses (Facebook / Google and so on...)
- fill with Redirect Url
- you can download Facebook-Unity-SDK here
you can call service like this.
// make Facebook Login Services
FaceBookServices oAuthFacebook = OAuthManager.GetServices (OAuthManager.OAuthServices.facebook) as FaceBookServices;
oAuthFacebook.RequestToken (accessToken, (BaseOAuth2Services.AzureZumoToken.Receive obj) => {
Debug.Log(obj.user.userId);
});
// Request Facebook's user data
oAuthFacebook.RequestUser (accessToken, (FaceBookServices.FacebookUserData obj) => {
Debug.Log(obj.name);
});