public void GetFriendsCallback() { foreach (var f in fbFriends.value.data) { GameSparkRequests getIdRequest = new GameSparkRequests(); getIdRequest.Request("GetGSFromFB", "FBID", f.id, AddFBFriendCallback); } }
private void AfterLoginSuccess() { isOnline.value = true; if (isNewUser) { AccountDetails.instance.Save(Gold: 2500); } GameSparkRequests request = new GameSparkRequests(); request.Request("CheckVersion", "version", "version", Callback); }
public void Save(int Gold = 0, int Gem = 0, string PING = null, int MMR = 0, float mostAreaCovered = 0f, int totalKills = 0, int totalDeaths = 0, int totalWins = 0, int totalLoss = 0, string slot1 = "0", string slot2 = "0", string slot3 = "0", string slot4 = "0", int rocket = 0, int minishots = 0, int heal = 0, int speed = 0, int freeze = 0, int shield = 0, int lives = 0, int health = 0, int movespeed = 0, string friendID = null) { if (!firstLoad) { return; } Dictionary <string, object> pair = new Dictionary <string, object>(); playerData.Gold += Gold; playerData.Gem += Gem; playerData.PING = string.IsNullOrEmpty(PING) ? playerData.PING : PING; playerData.MMR += MMR; playerData.MMR = playerData.MMR < 0 ? 0 : playerData.MMR; playerData.mostAreaCovered = playerData.mostAreaCovered < mostAreaCovered ? mostAreaCovered : playerData.mostAreaCovered; playerData.highestTrophies = playerData.highestTrophies > playerData.MMR ? playerData.highestTrophies : playerData.MMR; playerData.totalKills += totalKills; playerData.totalDeaths += totalDeaths; playerData.totalWins += totalWins; playerData.totalLoss += totalLoss; playerData.slot1 = slot1 != "0" ? slot1 : playerData.slot1; playerData.slot2 = slot2 != "0" ? slot2 : playerData.slot2; playerData.slot3 = slot3 != "0" ? slot3 : playerData.slot3; playerData.slot4 = slot4 != "0" ? slot4 : playerData.slot4; playerData.rocket += rocket; playerData.minishots += minishots; playerData.heal += heal; playerData.speed += speed; playerData.freeze += freeze; playerData.shield += shield; playerData.lives += lives; playerData.health += health; playerData.movespeed += movespeed; if (!string.IsNullOrEmpty(friendID)) { if (!playerData.FriendsList.Contains(friendID) && (accountDetails.userId != friendID)) { playerData.FriendsList.Add(friendID); } else { friendID = null; } } tempId = friendID; string data = JsonUtility.ToJson(playerData); accountDetails.scriptData.data = data; pair.Add("data", data); GameSparkRequests saveRequest = new GameSparkRequests(); saveRequest.Request("Save", pair, SaveSuccess); }
void LoginCallback(ILoginResult result) { if (string.IsNullOrEmpty(result.Error)) { if (!result.RawResult.Contains("cancelled")) { GameSparkRequests request = new GameSparkRequests(); request.Request("LinkFBID", "FBID", AccessToken.CurrentAccessToken.UserId, Print); fbLoginSuccess.Fire(); PlayerPrefs.SetInt(key, 1); } } }
public void Set(string id, Transform scrollParent, ParameterlessDelegate callback) { detailsSet = callback; this.id = id; parentt = scrollParent; GameSparkRequests getPlayerDetail = new GameSparkRequests(); getPlayerDetail.Request("GetPlayerDataWithID", "ID", id, Callback); transform.SetParent(scrollParent); transform.localRotation = Quaternion.identity; transform.localScale = Vector3.one; transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, 0); CheckOnline(); }
public void ShowGameOverGUI() { if (Pages[2].isActiveAndEnabled) { return; } if (!PlayerPrefs.HasKey("TutorialComplete")) { PlayerPrefs.SetInt("TutorialComplete", 1); ShowTutorialLog("Congratulations !! You've successfully completed the tutorial !!"); inGameGUI.GetComponent <UIElement>().Hide(false); StartCoroutine(WaitAndReloadScene()); GameSparkRequests req = new GameSparkRequests(); req.Request("AddGold", "amt", "50", UpdateAccountDetails); return; } inGameGUI.GetComponent <UIElement>().Hide(false); gameOverGUI.gameObject.SetActive(true); gameOverGUI.GetComponent <UIElement>().Show(false); }
public void CheckOnline() { GameSparkRequests getPlayerDetail = new GameSparkRequests(); getPlayerDetail.Request("GetPlayerDataWithID", "ID", id, Callback); }
public void AddGoogleFriend(string GoogleID) { GameSparkRequests getGSId = new GameSparkRequests(); getGSId.Request("GetGSFromGoogle", "GoogleID", GoogleID.ToLower(), GetGSIDCallback); }