public void goToPlay() { if (AudioManager.GetInstance()) { AudioManager.GetInstance().Play("fxButton"); } if (DataManagerKubera.GetCastedInstance <DataManagerKubera> ().currentUser.levels.Count != 0) { if (!PersistentData.GetInstance().fromLevelsToHome&& !KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().facebookProvider.isLoggedIn&& KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().facebookProvider.isLoggedIn != currentFacebookStatus) { PersistentData.GetInstance().fromLevelsToHome = false; } ScreenManager.GetInstance().GoToSceneAsync("Levels"); } else { PersistentData.GetInstance().fromLevelsToGame = true; PersistentData.GetInstance().currentLevel = PersistentData.GetInstance().getFirstLevel(); if (!DirectlyToPlayOnTheFirstTime) { ScreenManager.GetInstance().GoToSceneAsync("Levels"); } else { ScreenManager.GetInstance().GoToSceneAsync("Game"); } } }
protected void setNoPlayingDaysNotifications() { //86400 sconds per day if (DataManagerKubera.GetCastedInstance <DataManagerKubera> () != null) { //3 days int currentLevel = DataManagerKubera.GetCastedInstance <DataManagerKubera> ().currentUser.levels.Count + 1; (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName( villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES, MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_3_DAYS).Replace("{{level}}", currentLevel.ToString()), "Kubera", 259200); } //7 days (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName( villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES, MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_7_DAYS), "Kubera", 604800); //14 days (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName( villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES, MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_14_DAYS), "Kubera", 1209600); //30 days (LocalNotificationManager.GetInstance() as LocalNotificationManager).modifyAndScheduleNotificationByName( villavanilla.Notifications.ERegisteredNotification.NO_PLAYING_GAMES, MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.NOTIFICATION_30_DAYS), "Kubera", 2592000); scheduled = true; }
protected void initializeWorldsQuickMenuInfo() { KuberaUser user = DataManagerKubera.GetCastedInstance <DataManagerKubera> ().currentUser; int maxWorldReached = user.maxWorldReached(); int starsObtained = 0; List <LevelData> worldLevels; if (maxWorldReached == 0) { maxWorldReached++; } if (AllLevelsUnlocked) { maxWorldReached = worldsCount; } if (newWorldUnlocked) { maxWorldReached++; } for (int i = 0; i < worldsCount; i++) { if (maxWorldReached > i) { worldLevels = user.getLevelsByWorld(i + 1); for (int j = 0; j < worldLevels.Count; j++) { starsObtained += worldLevels[j].stars; } worldsPopUp.initializeMiniWorld(i, true, starsObtained, PersistentData.GetInstance().levelsData.getLevelsCountByWorld(i + 1) * 3); starsObtained = 0; } else { worldsPopUp.initializeMiniWorld(i, false, 0, 0); } } }
public void enablePowerUps() { if (DataManagerKubera.GetCastedInstance <DataManagerKubera> () != null) { powerUps [0].gameObject.SetActive((DataManagerKubera.GetCastedInstance <DataManagerKubera>().currentUser.levels.Count >= 21 || enableAllPowerUps || PersistentData.GetInstance().currentLevel.name == "0021") ? true : false); //word hint powerUps [1].gameObject.SetActive((DataManagerKubera.GetCastedInstance <DataManagerKubera>().currentUser.levels.Count >= 13 || enableAllPowerUps || PersistentData.GetInstance().currentLevel.name == "0013") ? true : false); //bomb powerUps [2].gameObject.SetActive((DataManagerKubera.GetCastedInstance <DataManagerKubera>().currentUser.levels.Count >= 35 || enableAllPowerUps || PersistentData.GetInstance().currentLevel.name == "0035") ? true : false); //square powerUps [3].gameObject.SetActive((DataManagerKubera.GetCastedInstance <DataManagerKubera>().currentUser.levels.Count >= 50 || enableAllPowerUps || PersistentData.GetInstance().currentLevel.name == "0050") ? true : false); //rotate powerUps [4].gameObject.SetActive((DataManagerKubera.GetCastedInstance <DataManagerKubera>().currentUser.levels.Count >= 65 || enableAllPowerUps || PersistentData.GetInstance().currentLevel.name == "0065") ? true : false); //wildcard powerUps [5].gameObject.SetActive((DataManagerKubera.GetCastedInstance <DataManagerKubera>().currentUser.levels.Count >= 80 || enableAllPowerUps || PersistentData.GetInstance().currentLevel.name == "0080") ? true : false); //destroy } else { powerUps [0].gameObject.SetActive(true); //word hint powerUps [1].gameObject.SetActive(true); //bomb powerUps [2].gameObject.SetActive(true); //square powerUps [3].gameObject.SetActive(true); //rotate powerUps [4].gameObject.SetActive(true); //wildcard powerUps [5].gameObject.SetActive(true); } }
void Start() { if (AllLevelsUnlocked) { Debug.Log("<color=red>Modo test: NIVELES DESBLOQUEADOS</color>"); } PersistentData persistentInstance = PersistentData.GetInstance(); DataManagerKubera dataManager = DataManagerKubera.GetCastedInstance <DataManagerKubera>(); //Mundo a cargar if (persistentInstance.fromLevelsToHome) { currentWorld = persistentInstance.currentWorld; } else if (persistentInstance.currentWorld == -1 || !persistentInstance.fromGameToLevels) { //Al maximo avance if (dataManager.currentUser.levels.Count != 0) { currentWorld = dataManager.currentUser.maxWorldReached(); int passedLevelsCount = dataManager.currentUser.countPassedLevelsByWorld(currentWorld); int levelsInWorld = persistentInstance.levelsData.getLevelsCountByWorld(currentWorld); if (passedLevelsCount == levelsInWorld) { if (currentWorld + 1 <= worldsCount) { currentWorld++; } } if (currentWorld == 0) { currentWorld++; } } } else { //Solo detecta el que se paso currentWorld = persistentInstance.currentWorld; int passedLevelsCount = dataManager.currentUser.countPassedLevelsByWorld(currentWorld); int levelsInWorld = persistentInstance.levelsData.getLevelsByWorld(currentWorld).Length; if (passedLevelsCount == levelsInWorld) { if (currentWorld + 1 <= worldsCount) { if (DataManagerKubera.GetCastedInstance <DataManagerKubera>().currentUser.maxWorldReached() == currentWorld) { //nuevo mundo desbloqueado newWorldUnlocked = true; } isLastLevel = true; } } } //Flujo entre game y levels if (persistentInstance.fromGameToLevels) { fromGame = true; fromLoose = persistentInstance.fromLoose; persistentInstance.fromGameToLevels = false; nameOfLastLevelPlayed = persistentInstance.lastLevelPlayedName; if (persistentInstance.fromLoose) { toNextLevel = false; } else { toNextLevel = !persistentInstance.nextLevelIsReached; } } persistentInstance.fromLevelsToHome = false; popUpManager.OnPopUpCompleted = OnPopupCompleted; paralaxManager.OnFinish += showNextLevelGoalPopUp; invitationToReview.OnFinish += afterInvitation; settingButtons.OnActivateMusic += activateMusic; //Menu de acceso rapido initializeWorldsQuickMenuInfo(); //Cambiando al mundo adecuado changeWorld(); KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().OnDataRetrieved += reloadDataProgress; if (ShopikaManager.GetCastedInstance <ShopikaManager> ().currentUserId == ShopikaManager.GetCastedInstance <ShopikaManager> ().ANONYMOUS_USER) { hudWithOutShareButton.SetActive(true); hudWithShareButton.SetActive(false); } else { hudWithOutShareButton.SetActive(false); hudWithShareButton.SetActive(true); } }
protected void setLevelsData() { bool isConectedToFacebook = KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn; bool friendInfoInWorld = false; if (isConectedToFacebook) { friendInfoInWorld = friendsOnWorldManager.existAnyFriendInWorld(currentWorld.ToString()); } for (int i = 0; i < mapLevels.Count; i++) { if (isConectedToFacebook && friendInfoInWorld) { FriendInfo friendInfo = isThereAnyFriendOnLevel(currentWorld, mapLevels [i].lvlName); if (friendInfo != null) { mapLevels [i].updateFacebookFriendPicture(friendInfo); } else { mapLevels [i].noFriend(); } } else { mapLevels [i].noFriend(); } if (mapLevels[i].status == MapLevel.EMapLevelsStatus.NORMAL_REACHED || mapLevels[i].status == MapLevel.EMapLevelsStatus.NORMAL_PASSED || mapLevels[i].status == MapLevel.EMapLevelsStatus.BOSS_UNLOCKED || mapLevels[i].status == MapLevel.EMapLevelsStatus.BOSS_REACHED || mapLevels[i].status == MapLevel.EMapLevelsStatus.BOSS_PASSED) { currentLevel = mapLevels [i]; PersistentData.GetInstance().lastLevelReachedName = currentLevel.fullLvlName; if (fromGame && PersistentData.GetInstance().currentLevel.name == mapLevels[i].fullLvlName) { lastLevelPlayed = mapLevels [i]; if (i + 1 != mapLevels.Count) { nextLevel = mapLevels [i + 1]; } } if (mapLevels[i].status == MapLevel.EMapLevelsStatus.BOSS_PASSED && i + 1 == mapLevels.Count) { if (currentWorld + 1 <= worldsCount) { toStairs = true; } toNextLevel = false; } } } if (DataManagerKubera.GetCastedInstance <DataManagerKubera>().currentUser.maxWorldReached() <= currentWorld) { if (toNextLevel) { lastLevelPlayed.myProgress(isConectedToFacebook); } else { if (toStairs && !PersistentData.GetInstance().stairsUnblocked) { isInLastLevelWorld = true; PersistentData.GetInstance().stairsUnblocked = true; currentLevel.myProgress(isConectedToFacebook); } else if (!toStairs) { PersistentData.GetInstance().stairsUnblocked = false; currentLevel.myProgress(isConectedToFacebook); } } } }
private void OnPopupCompleted(string action = "") { if (popUpManager.openPopUps.Count == 0) { stopInput(false); } switch (action) { case "closeObjective": if (toNextLevel) { paralaxManager.setPosToNextLevel(nextLevel); lastLevelPlayed.moveProgress(nextLevel); toNextLevel = false; if (!string.IsNullOrEmpty(nameOfLastLevelPlayed)) { int level = int.Parse(nameOfLastLevelPlayed); if (invitationToReview.isHappeningAReview(level)) { invitationToReview.showInvitationProcessByLevelNumber(level); } } } else { int level = int.Parse(nameOfLastLevelPlayed); if (invitationToReview.isHappeningAReview(level)) { invitationToReview.showInvitationProcessByLevelNumber(level); } stairsToWait(); } //showWorld(); break; case "retry": case "playGame": stopInput(true); ScreenManager.GetInstance().GoToSceneAsync("Game"); break; case "continue": if (toStairs) { //showWorld(); stairsToWait(); if (DataManagerKubera.GetCastedInstance <DataManagerKubera>().currentUser.maxWorldReached() > currentWorld) { toNextLevel = true; showNextLevelGoalPopUp(); } else { paralaxManager.setPosLastOrFirst(false); } } else if (toNextLevel) { paralaxManager.setPosToNextLevel(nextLevel); lastLevelPlayed.moveProgress(nextLevel); } else { toNextLevel = true; showNextLevelGoalPopUp(); } break; case "closeRetry": //showWorld(); break; case "toWorldTraveler": openPopUp("worldsPopUp"); break; case "toFacebookMessages": openPopUp("facebookNews"); break; case "askLifes": if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn) { openPopUp("fbFriendsRequestPanel"); fbFriendsRequestPanel.openFriendsRequestPanel(FBFriendsRequestPanel.ERequestType.ASK_LIFES); } else { popUpManager.activatePopUp("fbConnectPopUp"); } break; case "NoLifes": openPopUp("NoLifes"); break; case "noLifesClose": if (popUpManager.isPopUpOpen("goalPopUp") || popUpManager.isPopUpOpen("retryPopUp")) { stopInput(true); } else { stopInput(false); } break; case "askKeys": stopInput(true); if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn) { openPopUp("fbFriendsRequestPanel"); fbFriendsRequestPanel.openFriendsRequestPanel(FBFriendsRequestPanel.ERequestType.ASK_KEYS); } else { popUpManager.activatePopUp("fbConnectPopUp"); } break; case "needLifes": foreach (PopUpBase val in popUpManager.popups) { if (val.gameObject.activeSelf) { val.deactivate(); } } popUpManager.openPopUps.Clear(); stopInput(true); if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn) { openPopUp("fbFriendsRequestPanel"); fbFriendsRequestPanel.openFriendsRequestPanel(FBFriendsRequestPanel.ERequestType.ASK_LIFES); } else { popUpManager.activatePopUp("fbConnectPopUp"); } break; case "afterBossAnimation": OnLevelUnlockedPressed(nextLevel); break; case "notClose": stopInput(true); break; case "notMoney": activateOpeningShopika(); break; default: break; } }