public void registerFirstWinStars(string level, int stars) { registerEventWithParameters(FIRST_WIN_STARS, new Dictionary <string, string>() { { "Level", level }, { "User", DataManagerKubera.GetInstance().currentUserId }, { "Stars", stars.ToString() } }); }
public void registerGemsUsedOnLevel(string level, int gems) { registerEventWithParameters(GEMS_USED_ON_LEVEL, new Dictionary <string, string>() { { "Level", level }, { "User", DataManagerKubera.GetInstance().currentUserId }, { "Gems", gems.ToString() } }); }
public void registerLevelAttempts(string level, int attempts) { registerEventWithParameters(ATTEMPT_PER_LEVEL, new Dictionary <string, string>() { { "Level", level }, { "User", DataManagerKubera.GetInstance().currentUserId }, { "Attempts", attempts.ToString() } }); }
public void registerForBeforeBonification(string level, int points, int movements) { registerEventWithParameters(BEFORE_BONIFICATION_POINTS_MOVEMENTS, new Dictionary <string, string>() { { "Level", level }, { "User", DataManagerKubera.GetInstance().currentUserId }, { "Points", points.ToString() }, { "Movements", movements.ToString() } }); }
public void askForLifes() { if ((DataManagerKubera.GetInstance() as DataManagerKubera).currentUser.playerLifes == 0) { OnComplete("askLifes", false); } else { OnComplete("askLifes", false); } }
void OnApplicationPause(bool pauseStatus) { if (pauseStatus) { registerEventWithParameters(LAST_LEVEL_BEFORE_PAUSE_APP, new Dictionary <string, string> () { { "Level", PersistentData.GetInstance().lastLevelReachedName }, { "User", DataManagerKubera.GetInstance().currentUserId } }); } }
public void registerForBossReached(string level, int currentStars) { float percent = (currentStars / (int.Parse(level) * 3)) * 100; registerEventWithParameters(BOSS_REACHED, new Dictionary <string, string>() { { "Level", level }, { "User", DataManagerKubera.GetInstance().currentUserId }, { "StarsEarned", currentStars.ToString() }, { "PercentOfStars", percent.ToString() } }); }
void Start() { if (timeForLifeInMinutes != 30) { Debug.Log("<color=red>Modo test: VIDAS NO EN 30min</color>"); } showTimer = false; dataManager = (DataManagerKubera.GetInstance() as DataManagerKubera); if (dataManager == null) { return; } maximumLifes = dataManager.initialLifes; if (dataManager.currentUserId != dataManager.ANONYMOUS_USER) { maximumLifes += 2; } else if (maximumLifes < currentUser.playerLifes) { currentUser.playerLifes = maximumLifes; } if (PersistentData.GetInstance().fromLevelBuilder) { return; } if (currentUser.playerLifes < maximumLifes) { if (currentUser.lifeTimerDate == null) { setLifeDate(); } if (currentUser.lifeTimerDate == "") { setLifeDate(); } updateLifesSinceLastPlay(); } refreshHUD(); }
public void registerPowerUpsUse(string level, Dictionary <string, int> powerUps, int attempt) { Dictionary <string, string> parameters = new Dictionary <string, string> { { "Level", level }, { "User", DataManagerKubera.GetInstance().currentUserId }, { "Attempts", attempt.ToString() } }; foreach (KeyValuePair <string, int> val in powerUps) { parameters.Add(val.Key, val.Value.ToString()); } registerEventWithParameters(POWERUPS_USED, parameters); }
public void analizeFacebookStatus() { if ((DataManagerKubera.GetInstance() as DataManagerKubera).currentUserId == (DataManagerKubera.GetInstance() as DataManagerKubera).ANONYMOUS_USER) { facebookLargeButton.gameObject.SetActive(true); facebookHighLight.gameObject.SetActive(true); facebookButton.gameObject.SetActive(false); facebookAnim = true; } else { facebookButton.gameObject.SetActive(true); facebookLargeButton.gameObject.SetActive(false); facebookHighLight.gameObject.SetActive(false); } }
public void OnLifesPressed() { KuberaUser currentUser = (DataManagerKubera.GetInstance() as DataManagerKubera).currentUser; if (currentUser.playerLifes == LifesManager.GetInstance().maximumLifes) { openPopUp(fullLifes_PopUp); } else if (currentUser.playerLifes == 0) { openPopUp(noLifes_PopUp); } else { openPopUp(missingLifes_PopUp); } }
public override void activate() { popUp.SetActive(true); PersistentData.GetInstance().startLevel--; char[] lvl; switch (PersistentData.GetInstance().lastLevelPlayedName.Length) { case 1: LevelNumberUnit.text = PersistentData.GetInstance().lastLevelPlayedName; LevelNumberDecimal.gameObject.SetActive(false); LevelNumberHundred.gameObject.SetActive(false); break; case 2: lvl = PersistentData.GetInstance().lastLevelPlayedName.ToCharArray(); LevelNumberUnit.text = lvl[1].ToString(); LevelNumberDecimal.text = lvl[0].ToString(); LevelNumberHundred.gameObject.SetActive(false); break; case 3: lvl = PersistentData.GetInstance().lastLevelPlayedName.ToCharArray(); LevelNumberUnit.text = lvl[2].ToString(); LevelNumberDecimal.text = lvl[1].ToString(); LevelNumberHundred.text = lvl[0].ToString(); break; } if ((DataManagerKubera.GetInstance() as DataManagerKubera).currentUser.playerLifes == 0) { playText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.LOOSEGAME_POPUP_RETRY_NOLIFES); } else { playText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.LOOSEGAME_POPUP_NEXT); } int currentLifes = LifesManager.GetInstance().currentUser.playerLifes + 1; textHeart.text = textHeartShadow.text = currentLifes.ToString(); Invoke("startAnimation", 0.25f); }
public void unlockBoss(string lvlName) { (DataManagerKubera.GetInstance() as DataManagerKubera).unlockLevel(lvlName); //TODO Hacer animacion openPopUp("bossLocked"); bossLockedPopUp.unlockAnimation(); for (int i = 0; i < mapLevels.Count; i++) { if (mapLevels [i].fullLvlName == lvlName) { mapLevels [i].status = MapLevel.EMapLevelsStatus.BOSS_UNLOCKED; mapLevels [i].OnClickNotification -= OnBossReachedPressed; mapLevels [i].OnClickNotification += OnLevelUnlockedPressed; } } }
public void playGame() { if (pressed) { return; } pressed = true; soundButton(); if ((DataManagerKubera.GetInstance() as DataManagerKubera).currentUser.playerLifes > 0) { OnComplete("playGame", false); } else { pressed = false; OnPopUpCompleted(this, "NoLifes", false); //OnComplete ("NoLifes",false); } }
public void retryLevel() { if (pressed) { return; } pressed = true; soundButton(); if ((DataManagerKubera.GetInstance() as DataManagerKubera).currentUser.playerLifes > 0) { setStartingPlaces(); DOTween.Kill("askFriendsButtonAnimation"); OnComplete("retry", false); } else { pressed = false; DOTween.Kill("askFriendsButtonAnimation"); askForLifes(); } }
protected void OnLevelUnlockedPressed(MapLevel pressed) { if (cantPlay) { return; } PersistentData.GetInstance().fromLevelsToGame = true; PersistentData.GetInstance().setLevelNumber(int.Parse(pressed.lvlName)); PersistentData.GetInstance().lastLevelPlayedName = pressed.lvlName; PersistentData.GetInstance().nextLevelIsReached = pressed.nextLevelIsReached; goalManager.initializeFromString(PersistentData.GetInstance().currentLevel.goal); int starsReached = (DataManagerKubera.GetInstance() as DataManagerKubera).getLevelStars(PersistentData.GetInstance().currentLevel.name); setGoalPopUp(goalManager.currentCondition, goalManager.getGoalConditionParameters(), PersistentData.GetInstance().currentLevel.name, starsReached); //HACK temporal para probar el leaderboard KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().getLevelLeaderboard(PersistentData.GetInstance().currentLevel.name); //SceneManager.LoadScene ("Game"); }
public void sendRequest() { List <string> friendsIds = new List <string> (); List <List <string> > friIDs = new List <List <string> >(); friendsIds = getFriendsActivatedIDByFriendsType(currentFriendType); int friendGroups = (int)Mathf.Floor(friendsIds.Count / 30.0f); facebookManager.OnSuccesRequest += succesPopUp; /* * string myId = FacebookPersistentData.GetInstance ().getPlayerId (); * * if(currentFriendType == EFriendsType.GAME) * { * for(int i=0; i<friendsIds.Count; i++) * { * ShopikaSyncManager.GetCastedInstance<ShopikaSyncManager>().registerInvite(friendsIds[i],myId); * } * }*/ if (friendsIds.Count == 0) { return; } switch (currentRequestType) { case ERequestType.ASK_KEYS: KuberaAnalytics.GetInstance().registerFacebookKeyRequest(PersistentData.GetInstance().lastLevelReachedName); if (friendsIds.Count > 30) { for (int i = 0, k = 0; i <= friendGroups; i++) { friIDs.Add(new List <string>()); for (int j = 0; j < 30; j++, k++) { if (friendsIds [k] != null) { friIDs [i].Add(friendsIds [k]); } } } for (int i = 0; i < friIDs.Count; i++) { facebookManager.askKey(friIDs[i]); } } else { facebookManager.askKey(friendsIds); return; } break; case ERequestType.ASK_LIFES: if (!((DataManagerKubera)DataManagerKubera.GetInstance()).alreadyAskForLifes()) { KuberaAnalytics.GetInstance().registerFacebookFirstLifeRequest(PersistentData.GetInstance().lastLevelReachedName); ((DataManagerKubera)DataManagerKubera.GetInstance()).markLifesAsAsked(); } if (friendsIds.Count > 30) { for (int i = 0, k = 0; i <= friendGroups; i++) { friIDs.Add(new List <string>()); for (int j = 0; j < 30; j++, k++) { if (k < friendsIds.Count) { friIDs [i].Add(friendsIds [k]); } } } for (int i = 0; i < friIDs.Count; i++) { facebookManager.askLife(friIDs[i]); } } else { facebookManager.askLife(friendsIds); return; } break; default: break; } }
protected void settingMapLevelStatus(MapLevel level) { DataManagerKubera DataManager = (DataManagerKubera.GetInstance() as DataManagerKubera); if (level.isBoss) { /*//facebook * level.status = MapLevel.EMapLevelsStatus.BOSS_REACHED; * return;*/ if (DataManager.isLevelPassed(level.lvlName)) { level.status = MapLevel.EMapLevelsStatus.BOSS_PASSED; } else { if (DataManager.isLevelReached(level.lvlName)) { if (!DataManager.isLevelLocked(level.lvlName)) { level.status = MapLevel.EMapLevelsStatus.BOSS_UNLOCKED; } else { level.status = MapLevel.EMapLevelsStatus.BOSS_REACHED; } } else { if (AllLevelsUnlocked) { level.status = MapLevel.EMapLevelsStatus.BOSS_REACHED; } else { level.status = MapLevel.EMapLevelsStatus.BOSS_LOCKED; } } } } else { if (DataManager.isLevelPassed(level.lvlName)) { level.status = MapLevel.EMapLevelsStatus.NORMAL_PASSED; } else { if (DataManager.isLevelReached(level.lvlName)) { level.status = MapLevel.EMapLevelsStatus.NORMAL_REACHED; } else { if (AllLevelsUnlocked) { level.status = MapLevel.EMapLevelsStatus.NORMAL_REACHED; } else { level.status = MapLevel.EMapLevelsStatus.NORMAL_LOCKED; } } } } switch (DataManager.getLevelStars(level.lvlName)) { case 1: level.stars = MapLevel.EMapLevelStars.ONE; break; case 2: level.stars = MapLevel.EMapLevelStars.TWO; break; case 3: level.stars = MapLevel.EMapLevelStars.THREE; break; default: level.stars = MapLevel.EMapLevelStars.NONE; break; } }
protected void setParalaxManager() { if (currentLevel == null) { currentLevel = mapLevels [0]; PersistentData.GetInstance().lastLevelReachedName = currentLevel.fullLvlName; } if (first) { paralaxManager.setPosLastOrFirst(true); first = false; } else if (last) { paralaxManager.setPosLastOrFirst(false); last = false; } else if (fromGame) { if (PersistentData.GetInstance().fromLoose) { popUpManager.activatePopUp("retryPopUp"); stopInput(true); (DataManagerKubera.GetInstance() as DataManagerKubera).incrementLevelAttemp(PersistentData.GetInstance().currentLevel.name); if (LifesManager.GetInstance().currentUser.playerLifes == 0) { KuberaAnalytics.GetInstance().registerLevelWhereReached0Lifes(PersistentData.GetInstance().currentLevel.name); } } else { int starsReached = PersistentData.GetInstance().lastPlayedLevelStars; //;(DataManagerKubera.GetInstance () as DataManagerKubera).getLevelStars (PersistentData.GetInstance ().currentLevel.name); int pointsMade = PersistentData.GetInstance().lastPlayedLevelPoints; //(DataManagerKubera.GetInstance () as DataManagerKubera).getLevelPoints (PersistentData.GetInstance ().currentLevel.name); goalManager.initializeFromString(PersistentData.GetInstance().currentLevel.goal); string levelName = PersistentData.GetInstance().currentLevel.name; for (int i = 0; i < levelName.Length; i++) { if (levelName [i] == '0') { levelName = levelName.Remove(i, 1); i--; } else { break; } } goalAfterGame.setGoalPopUpInfo(starsReached, levelName, pointsMade.ToString(), PersistentData.GetInstance().currentWorld); popUpManager.activatePopUp("goalAfterGame"); stopInput(true); } if (toStairs) { paralaxManager.setPosByCurrentLevel(paralaxManager.getPosByLevel(mapLevels[mapLevels.Count - 1])); } else { paralaxManager.setPosByCurrentLevel(paralaxManager.getPosByLevel(lastLevelPlayed)); } } else { //print ("currentLevel " + currentLevel); //paralaxManager.setPosByCurrentLevel (paralaxManager.getPosByLevel( mapLevels [0])); paralaxManager.setPosByCurrentLevel(paralaxManager.getPosByLevel(currentLevel)); } }
public void giveLifesToUser(int amount = 1) { (DataManagerKubera.GetInstance() as DataManagerKubera).giveUserLifes(amount); }
protected void saveDataOnList(string type, string firstName, string playerID, string requestID) { //print (requestID); //print (type); switch (type) { case "askLife": if (idExistOnList(askedLifes, playerID)) { deleteAppRequest(requestID); } else { gotMessage(); addToList(askedLifes, firstName, playerID, requestID); } break; case "SendLife": if (idExistOnList(giftLifes, playerID)) { deleteAppRequest(requestID); } else { gotMessage(); addToList(giftLifes, firstName, playerID, requestID); } break; default: //llaves que me pidieron if (type.Contains("askKey")) { string[] splitType = type.Split(','); string bossReached = ""; if (splitType.Length > 1) { bossReached = splitType [1]; } if (idExistOnList(askedKeys, playerID)) { deleteAppRequest(requestID); } else { gotMessage(); addToList(askedKeys, firstName, playerID, requestID, bossReached); } } //llaves que pedí else if (type.Contains("SendKey")) { string[] splitType = type.Split(','); string bossReached = ""; if (splitType.Length > 1) { bossReached = splitType [1]; } if (giftKeys.Count == maxUsersPerMessage || idExistOnList(giftKeys, playerID) || !(DataManagerKubera.GetInstance() as DataManagerKubera).isLevelLocked(bossReached)) { //print ("delete boosKey"); deleteAppRequest(requestID); } else { gotMessage(); addToList(giftKeys, firstName, playerID, requestID, bossReached); } } //if(type) break; } }