// Fetch Currency from ChilliConnect public void FetchCurrency(ChilliConnectSdk chilliConnect) { this.chilliConnect = chilliConnect; Debug.Log("Fetching currency"); chilliConnect.Economy.GetCurrencyBalance(new GetCurrencyBalanceRequestDesc() , (request, response) => { // Handle Currency Response from ChilliConnect Debug.Log("Currency fetched: "); foreach (var item in response.Balances) { switch (item.Key) { case "COINS": playerCoins = item.Balance; break; case "USERLEVEL": playerLevel = item.Balance; break; } } UpdatePlayerStatistics(); } , (request, error) => Debug.LogError(error.ErrorDescription)); }
// Start the ChilliConnect SDK, creating a player if one is not stored on the client. private void ChilliConnectInit() { // InitialiseChilliConnect SDK with our Game Token //chilliConnect = new ChilliConnectSdk("6PvaW0XKPZF3wUTOavDPwcLQUho9DQdS", true); chilliConnect = new ChilliConnectSdk("hxNSsyHz0KYmgNweytP4AiJGiuJIfl8t", true); // Create a Player and store the ChilliConnectId if we don't already have one if (!PlayerPrefs.HasKey("ChilliConnectId") || !PlayerPrefs.HasKey("ChilliConnectSecret")) { var createPlayerRequest = new CreatePlayerRequestDesc(); // Create Player Account chilliConnect.PlayerAccounts.CreatePlayer(createPlayerRequest, (CreatePlayerRequest request, CreatePlayerResponse response) => { Debug.Log("Create Player successfull : " + response.ChilliConnectId); PlayerPrefs.SetString("ChilliConnectId", response.ChilliConnectId); PlayerPrefs.SetString("ChilliConnectSecret", response.ChilliConnectSecret); chilliConnectId = response.ChilliConnectId; chilliConnectSecret = response.ChilliConnectSecret; }, (CreatePlayerRequest request, CreatePlayerError error) => { Debug.Log("An error occurred Creating Player : " + error.ErrorDescription); } ); } else { chilliConnectId = PlayerPrefs.GetString("ChilliConnectId"); chilliConnectSecret = PlayerPrefs.GetString("ChilliConnectSecret"); } }
/// Initialise all the main systems /// private void Awake() { m_chilliConnect = new ChilliConnectSdk(GAME_TOKEN, true); m_accountSystem.Initialise(m_chilliConnect); m_leaderboardSystem.Initialise(m_chilliConnect); m_profilePicSystem.Initialise(); }
void Awake() { //Get a reference to ShowPanels attached to UI object showPanels = GetComponent <ShowPanels> (); //Get a reference to PlayMusic attached to UI object playMusic = GetComponent <PlayMusic> (); playMusic = GetComponent <PlayMusic> (); //setup ChilliConnect SDK with game token and verbose logging chilliConnect = new ChilliConnectSdk(GAME_TOKEN, true); ChilliConnectId = PlayerPrefs.GetString("ChilliConnectId"); ChilliConnectSecret = PlayerPrefs.GetString("ChilliConnectSecret"); UnityEngine.Debug.Log("Loaded from PlayerPrefs ChilliconnectId: " + ChilliConnectId + " ChilliConnectSecret: " + ChilliConnectSecret); //if player not created if (ChilliConnectId.Length == 0) { CreateAndLoginPlayer(); } else { LoginPlayer(); } }
/// <summary> /// Standard starting point for Unity scripts. /// </summary> IEnumerator Start() { IDataAccessLayer dataLayer = null; #if CHILLICONNECT_ENABLED var sdk = new ChilliConnectSdk(chilliConnectAppToken, false); string userId = default,
/// Initialises the IAP system by pulling the available IAP items from ChilliConnect. /// Like most of the IAP calls this is asynchronous and completion can be polled using IsInitialised() /// /// @param chilliConnect /// SDK instance /// public void Initialise(ChilliConnectSdk chilliConnect) { Debug.Log("Initialising IAP system"); m_chilliConnect = chilliConnect; var desc = new GetRealMoneyPurchaseDefinitionsRequestDesc(); // Make a request for all "Real money purchase" items that have been registered on the ChilliConnect dashboard. m_chilliConnect.Catalog.GetRealMoneyPurchaseDefinitions(desc, OnAvailableItemsFetched, (request, error) => Debug.LogError(error.ErrorDescription)); }
/// If a player account has already been created and saved in PlayerPrefs /// log that player in. Otherwise, will create a new account. /// /// @param chilliConnect /// Instance of the chilliConnect SDK /// public void Initialise(ChilliConnectSdk chilliConnect) { m_chilliConnect = chilliConnect; if (PlayerPrefs.HasKey("CCId") && PlayerPrefs.HasKey("CCSecret")) { Login(PlayerPrefs.GetString("CCId"), PlayerPrefs.GetString("CCSecret")); } else { CreateNewAccount(); } }
/// Must be called before any other FB API calls. /// /// @param chilliConnect /// SDK instance /// public void Initialise(ChilliConnectSdk chilliConnect) { m_chilliConnect = chilliConnect; if (FB.IsInitialized == false) { FB.Init(OnFBInitComplete); } else { OnFBInitComplete(); } }
//------------------------------------------------------------------ /// Initilisation that creates an instance of ChilliConnect and subscribes /// to Push Notification listener events. //------------------------------------------------------------------ private void Awake() { m_chilliConnect = new ChilliConnectSdk(k_chilliConnectToken, false); #if UNITY_ANDROID && !UNITY_EDITOR GooglePushNotificationHandler.SetRecieverGameObject("GooglePushNotificationListener"); GameObject.FindObjectOfType <GooglePushNotificationListener>().RegistrationSucceededEvent = OnPluginRegistered; GameObject.FindObjectOfType <GooglePushNotificationListener>().RegistrationFailedEvent = OnPluginFailed; #elif UNITY_IOS GameObject.FindObjectOfType <iOSPushNotificationListener>().RegistrationSucceededEvent = OnPluginRegistered; GameObject.FindObjectOfType <iOSPushNotificationListener>().RegistrationFailedEvent = OnPluginFailed; #endif }
/// If a player account has already been created and saved in PlayerPrefs /// log that player in. Otherwise, will create a new account. /// /// @param chilliConnect /// Instance of the chilliConnect SDK /// public void Initialise(ChilliConnectSdk chilliConnect) { m_chilliConnect = chilliConnect; var player = LoadPlayer(); if (player != null) { Login(player.ChilliConnectId, player.ChilliConnectSecret); } else { CreateNewAccount(); } }
/// If a player account has already been created and saved in PlayerPrefs /// log that player in. Otherwise, will create a new account. /// /// @param chilliConnect /// Instance of the chilliConnect SDK /// public void Initialise(ChilliConnectSdk chilliConnect) { m_chilliConnect = chilliConnect; if (PlayerPrefs.HasKey("CCId") && PlayerPrefs.HasKey("CCSecret")) { UnityEngine.Debug.Log("Current ChilliConnectID: " + PlayerPrefs.GetString("CCId")); Login(PlayerPrefs.GetString("CCId"), PlayerPrefs.GetString("CCSecret")); } else { CreateNewAccount(); } }
/// Initialised ChilliConnect, create and log in a player. /// private void Awake() { // Initialise ChilliConnect. Game token can be found on the game dashboard of ChilliConnect m_chilliConnect = new ChilliConnectSdk(GAME_TOKEN, true); // Create a new ChilliConnect player with the given display name if we don't have any credentials saved for the local player if (PlayerPrefs.HasKey("CCId") == true && PlayerPrefs.HasKey("CCSecret") == true) { Debug.Log("Player already exists. Logging in"); m_chilliConnect.PlayerAccounts.LogInUsingChilliConnect(PlayerPrefs.GetString("CCId"), PlayerPrefs.GetString("CCSecret"), (loginRequest) => OnLoggedIn(), (loginRequest, error) => Debug.LogError(error.ErrorDescription)); } else { Debug.Log("Creating Player"); var requestDesc = new CreatePlayerRequestDesc(); requestDesc.DisplayName = "TestyMcTestface"; m_chilliConnect.PlayerAccounts.CreatePlayer(requestDesc, OnPlayerCreated, (AddEventRequest, error) => Debug.LogError(error.ErrorDescription)); } }
private void Awake() { m_chilliConnect = new ChilliConnectSdk(GAME_TOKEN, false); m_matchSystem.Initialise(m_chilliConnect); m_matchSystem.OnMatchUpdated += OnMatchUpdated; m_matchSystem.OnMatchMakingStarted += OnMatchMakingStarted; m_matchSystem.OnMatchMakingFailed += OnMatchMakingFailed; m_matchSystem.OnMatchMakingSuceeded += OnMatchMakingSuceeded; m_matchSystem.OnNewMatchCreated += OnNewMatchCreated; m_matchSystem.OnMatchSavedOnServer += OnMatchSavedOnServer; m_accountSystem.Initialise(m_chilliConnect); m_accountSystem.OnPlayerLoggedIn += OnPlayerLoggedIn; gameController.ShowChilliInfoPanel(MESSAGE_LOGGING_IN); gameController.OnSideSelected += OnSideSelected; gameController.OnTurnEnded += OnTurnEnded; gameController.OnNewGameSelected += OnNewGameSelected; }
private void Awake() { m_chilliConnect = new ChilliConnectSdk(GAME_TOKEN, false); CurrentMatch = new Match(); m_accountSystem.Initialise(m_chilliConnect); m_accountSystem.OnPlayerLoggedIn += OnPlayerLoggedIn; photonController.Initialise(m_chilliConnect); roomController.Initialise(); roomController.OnGameStart += OnGameStart; roomController.OnRoomJoin += OnRoomJoin; roomController.OnNextTurn += OnNextTurn; roomController.OnGameEnded += OnGameEnded; roomController.OnPlayerQuit += OnPlayerQuit; gameController.ShowChilliInfoPanel(MESSAGE_LOGGING_IN); gameController.OnTurnEnded += OnTurnEnded; }
private void Awake() { m_chilliConnect = new ChilliConnectSdk(GAME_TOKEN, true); m_accountSystem.Initialise(m_chilliConnect); m_economySystem.Initialise(m_chilliConnect); }
public void Initialise(ChilliConnectSdk chilliConnect) { m_chilliConnect = chilliConnect; Recipes = new List <Recipe> (); Characters = new List <Character> (); }
public void Initialise(ChilliConnectSdk chilliConnect) { m_chilliConnect = chilliConnect; CurrentMatch = new Match(); }
public void Initialise(ChilliConnectSdk chilliConnect) { m_chilliConnect = chilliConnect; CurrentGame = new GameState(); }
/// public void Initialise(ChilliConnectSdk chilliConnect) { m_chilliConnect = chilliConnect; }
/// Fetch the inventory contents from ChilliConnect at the start of the game. /// /// @param chilliConnect /// SDK instance /// public void Initialise(ChilliConnectSdk chilliConnect) { Debug.Log("Fetching inventory"); chilliConnect.Economy.GetCurrencyBalance(new GetCurrencyBalanceRequestDesc(), OnCurrencyBalanceFetched, (request, error) => Debug.LogError(error.ErrorDescription)); }