/// <summary> /// Initialises a new instance with the given App Token. Must be called on the /// main thread. /// </summary> /// /// <param name="appToken">The App Token.</param> /// <param name="verboseLogging">Whether or not to enable verbose logging. This is typically only /// enabled while debugging.</param> public ChilliConnectSdk(string appToken, bool verboseLogging) { var logging = new Logging(verboseLogging); m_sdkObject = GameObjectFactory.CreateCoreSdkGameObject(); var taskScheduler = m_sdkObject.GetComponent <TaskScheduler>(); var httpSystem = new HttpSystem(taskScheduler); var serverRequestSystem = new ServerRequestSystem(taskScheduler, httpSystem); var dataStore = new DataStore(); dataStore.Set("AppToken", appToken); PlayerAccounts = new PlayerAccounts(logging, taskScheduler, serverRequestSystem, dataStore); CloudData = new CloudData(logging, taskScheduler, serverRequestSystem, dataStore); Leaderboards = new Leaderboards(logging, taskScheduler, serverRequestSystem, dataStore); CloudCode = new CloudCode(logging, taskScheduler, serverRequestSystem, dataStore); PushNotifications = new PushNotifications(logging, taskScheduler, serverRequestSystem, dataStore); InAppPurchase = new InAppPurchase(logging, taskScheduler, serverRequestSystem, dataStore); Metrics = new Metrics(logging, taskScheduler, serverRequestSystem, dataStore); Catalog = new Catalog(logging, taskScheduler, serverRequestSystem, dataStore); Economy = new Economy(logging, taskScheduler, serverRequestSystem, dataStore); Messaging = new Messaging(logging, taskScheduler, serverRequestSystem, dataStore); LiveOps = new LiveOps(logging, taskScheduler, serverRequestSystem, dataStore); Multiplayer = new Multiplayer(logging, taskScheduler, serverRequestSystem, dataStore); AsyncMultiplayer = new AsyncMultiplayer(logging, taskScheduler, serverRequestSystem, dataStore); }
//------------------------------------------------------------------ /// Callback for succeeding to request a Push Notification Device ID. /// Attempts to register Push Notifications with ChilliConnect. /// /// @param in_deviceID - Device Identifier. //------------------------------------------------------------------ private void OnPluginRegistered(string in_deviceID) { m_deviceIdentifier = in_deviceID; Action <RegisterTokenRequest> successCallback = (RegisterTokenRequest request) => { UnityEngine.Debug.Log("PushNotificationDemoSceneController : OnPluginRegistered - Success!"); }; Action <RegisterTokenRequest, RegisterTokenError> errorCallback = (RegisterTokenRequest request, RegisterTokenError error) => { UnityEngine.Debug.Log(string.Format("An error occurred while Registering Push Notifications: {0} - Device Token -", error.ErrorDescription)); }; RegisterTokenRequestDesc desc = new RegisterTokenRequestDesc(k_pushService, m_deviceIdentifier); ChilliConnect.PushNotifications pushNotificationModule = m_chilliConnect.PushNotifications; pushNotificationModule.RegisterToken(desc, successCallback, errorCallback); }