55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class UbimobileToolkitTest : MonoBehaviour
|
|
{
|
|
// Use this for initialization
|
|
IEnumerator Start ()
|
|
{
|
|
// get an instance of UbimobileToolkit
|
|
UbimobileToolkit tk = UbimobileToolkit.instance;
|
|
|
|
// init network time and country (geoIP) retrieval
|
|
yield return StartCoroutine(tk.network_countryAndTime_init());
|
|
|
|
// fetch ubisoft unique device identifier (an id common to all ubisoft game on this device)
|
|
Debug.Log ("#ubisoftDeviceUniqueId : " + tk.ubisoftDeviceUniqueId());
|
|
|
|
// fetch ubisoft user agent to be used as user agent in http request
|
|
Debug.Log ("#ubisoftUserAgent : " + tk.ubisoftUserAgent());
|
|
|
|
// get network country (null if unable to get it)
|
|
Debug.Log ("#network_country : " + tk.network_country());
|
|
|
|
// get network time (NaN if unable to get it)
|
|
Debug.Log ("#network_time : " + tk.network_time());
|
|
|
|
// get an ubimobile access token to log with ubiservices
|
|
Debug.Log ("--- ubimobileAccessToken_get ---");
|
|
{
|
|
// get token
|
|
System.String token = tk.ubimobileAccessToken_get();
|
|
Debug.Log ("#token : " + token);
|
|
|
|
// create a facade with ubiservice
|
|
//...
|
|
|
|
// if facade was sucessfully created, then save token (in this example i do not save token otherwise you woudl end up with an invalid token stored on the device)
|
|
// if (! tk.ubimobileAccessToken_save(token) )
|
|
// {
|
|
// Debug.Log ("-->unable to save token");
|
|
// if unable to save the token then we should not use it
|
|
// }
|
|
}
|
|
Debug.Log("#### all done");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
void Update ()
|
|
{
|
|
|
|
}
|
|
}
|