Esempio n. 1
0
    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");
            }
        }
    }
Esempio n. 2
0
    protected void OnLoginComplete(string message = "")
    {
        if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn)
        {
            //print ("is loggedIn--------------------------");
            if (canRequestMoreFriends())
            {
                //print ("canRequestMoreFriends--------------------------");
                fbGraph.GetPlayerInfo();
                fbGraph.GetFriends();
                fbGraph.GetInvitableFriends();

                FacebookPersistentData.GetInstance().infoRequested = true;
            }
            else
            {
                fbGraph.setActive();

                fillRequestPanel(FacebookPersistentData.GetInstance().gameFriends, FBFriendsRequestPanel.EFriendsType.GAME);
                fillRequestPanel(FacebookPersistentData.GetInstance().allFriends, FBFriendsRequestPanel.EFriendsType.ALL);
            }

            //print ("getFriendsAppRequests--------------------------");
            fbGraph.getFriendsAppRequests();
            if (conectFacebook != null)
            {
                DestroyImmediate(conectFacebook);
            }
        }
    }
Esempio n. 3
0
 public void actualizeMessageNumber(int messageCount = 0)
 {
     if (messageCount == 0)
     {
         messageCountImage.gameObject.SetActive(false);
         if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn)
         {
             noMessagesMessage.SetActive(true);
         }
         else
         {
             noMessagesMessage.SetActive(false);
         }
     }
     else
     {
         currentMessages = messageCount;
         messageCountImage.gameObject.SetActive(true);
         noMessagesMessage.SetActive(false);
         if (messageCount > 9)
         {
             this.messageCount.text = "+9";
         }
         else
         {
             this.messageCount.text = messageCount.ToString();
         }
     }
 }
Esempio n. 4
0
 void OnDestroy()
 {
     if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>() != null)
     {
         KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().OnDataRetrieved -= reloadDataProgress;
     }
 }
Esempio n. 5
0
    void Start()
    {
        if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn)
        {
            OnLoginComplete();
        }
        else if (!facebookConectMessageCreated)
        {
            //crear FacebookConectMessage
            //print ("creando mensaje para conectar");
            conectFacebook = Instantiate(FacebookConectMessage);
            conectFacebook.transform.SetParent(panelMessages, false);
            facebookConectMessageCreated = true;
        }
        KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.OnLoginSuccessfull += OnLoginComplete;

        fbGraph.OnPlayerInfo           += showPlayerInfo;
        fbGraph.OnGetGameFriends       += addGameFriends;
        fbGraph.OnGetInvitableFriends  += addInivitableFriends;
        fbGraph.OnGetFriendTextures    += addUsersImage;
        fbGraph.onFinishGettingFriends += mergeFriends;

        fbGraph.OnGetAppRequest += chanelData;

        fbGraph.onFinishGettingInfo += fillMessageData;
    }
Esempio n. 6
0
    public void Awake()
    {
        syncManager = KuberaSyncManger.GetCastedInstance <KuberaSyncManger>();
        changeText(syncManager.facebookProvider.isLoggedIn);

        syncManager.facebookProvider.OnLoginSuccessfull  += OnLoginChange;
        syncManager.facebookProvider.OnLogoutSuccessfull += OnLoginChange;
    }
Esempio n. 7
0
 public void activateFacebook()
 {
     //print (KuberaSyncManger.GetCastedInstance<KuberaSyncManger> ().facebookProvider.isLoggedIn);
     if (!KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn)
     {
         activatePopUp("facebookLoadingConnect");
     }
 }
Esempio n. 8
0
 protected void fbLogin()
 {
     if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn)
     {
         inviteFriendsText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.AFTERGAME_POPUP_FACEBOOK);
     }
     else
     {
         inviteFriendsText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.AFTERGAME_POPUP_CONNECT_FACEBOOK);
     }
 }
    void Start()
    {
        exitBTN.gameObject.SetActive(false);

        title.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.CONNECTING_FACEBOOK_TITLE);
        Info.text  = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.CONNECTING_FACEBOOK_INFO);

        KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().OnDataRetrieved        += popUpCompleted;
        KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().OnDataRetrievedFailure += failure;
        KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().OnLoginFailure         += failure;
    }
Esempio n. 10
0
 public void fbAction()
 {
     soundButton();
     if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn)
     {
         inviteFriendsText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.AFTERGAME_POPUP_FACEBOOK);
         FacebookManager.GetInstance().requestNewFriends();
     }
     else
     {
         inviteFriendsText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.AFTERGAME_POPUP_CONNECT_FACEBOOK);
         KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookLogin();
     }
 }
Esempio n. 11
0
    void OnDestroy()
    {
        if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ())
        {
            KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.OnLoginSuccessfull -= OnLoginComplete;
        }

        fbGraph.OnPlayerInfo          -= showPlayerInfo;
        fbGraph.OnGetGameFriends      -= addGameFriends;
        fbGraph.OnGetInvitableFriends -= addInivitableFriends;
        fbGraph.OnGetFriendTextures   -= addUsersImage;

        fbGraph.OnGetAppRequest -= chanelData;

        fbGraph.onFinishGettingInfo -= fillMessageData;
    }
Esempio n. 12
0
    public void conectFacebook()
    {
        syncManager.facebookLogin();

        if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().isGettingData)
        {
            completed();
        }
        else
        {
            completed();

            /*syncManager.facebookProvider.OnLoginSuccessfull += completed;
             * syncManager.facebookProvider.OnLoginFail += completed;*/
        }
    }
Esempio n. 13
0
    protected void getFriendsOnMap(int world)
    {
        if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn)
        {
            FriendsOnWorld friendsOnWorld = friendsOnWorldManager.existFriendsOnWorld(world.ToString());

            if (friendsOnWorld == null)
            {
                //TODO info del server
                string[] facebokId = new string[test.Count];
                for (int i = 0; i < test.Count; i++)
                {
                    facebokId [i] = "10154899709081808";                    //UnityEngine.Random.Range (123, 1230123).ToString ();
                }
                friendsOnWorld = friendsOnWorldManager.getNewFriendsOnWorld(world.ToString(), test.ToArray(), facebokId);
            }
        }
    }
Esempio n. 14
0
    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");
    }
Esempio n. 15
0
    void Start()
    {
        if (!DirectlyToPlayOnTheFirstTime)
        {
            Debug.Log("<color=red>Modo test: Se desactivo el poder ir directamente a jugar en el primer uso del juego.</color>");
        }

        settingButtons.OnActivateMusic += activateMusic;

        playText.text = MultiLanguageTextManager.instance.getTextByID(MultiLanguageTextManager.START_GAME);

        if (AudioManager.GetInstance())
        {
            AudioManager.GetInstance().Stop("gamePlay", false);
            if (!AudioManager.GetInstance().IsPlaying("menuMusic"))
            {
                AudioManager.GetInstance().Play("menuMusic");
            }
        }

        //Invoke ("startScene",0.3f);

        if (ShopikaSyncManager.GetCastedInstance <ShopikaSyncManager>().isGettingData)
        {
            activatePopUp("shopikaConnect");
        }
        if (KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().isGettingData)
        {
            activatePopUp("facebookLoadingConnect");
        }

        popUpManager.OnPopUpCompleted += closePopUp;

        currentFacebookStatus = KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().facebookProvider.isLoggedIn;

        ScreenManager.GetInstance().hideLoading(3);
    }
Esempio n. 16
0
    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);
        }
    }
Esempio n. 17
0
    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);
                }
            }
        }
    }
Esempio n. 18
0
    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;
        }
    }
Esempio n. 19
0
 public void conectFacebook()
 {
     //FindObjectOfType<MapManager> ().activateFacebook();
     KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookLogin();
 }
Esempio n. 20
0
    public LevelLeaderboard getLeaderboard(string id, Transform parent)
    {
        LevelLeaderboard leaderboard = null;

        if (isCurrentLeaderboard(id))
        {
            return(currentLeaderboard);
        }
        else if (currentLeaderboard != null)
        {
            currentLeaderboard.showSlots(false);
        }

        leaderboard = existLeaderboard(id);
        if (leaderboard != null)
        {
            currentLeaderboard = leaderboard;
            return(leaderboard);
        }

        if (leaderboards.Count == maxLeaderbords)
        {
            print("todelete");
            disposeLedearboard(leaderboards [maxLeaderbords - 1]);
        }


        GameObject go = new GameObject(id);

        leaderboard = go.AddComponent <LevelLeaderboard> ();
        go.transform.SetParent(this.transform);

        leaderboard.id     = id;
        leaderboard.slot   = slot;
        leaderboard.parent = parent;

        test[] test = null;
        if (!KuberaSyncManger.GetCastedInstance <KuberaSyncManger>().facebookProvider.isLoggedIn)
        {
            test = new test[Random.Range(3, 6)];
        }

        if (test != null)
        {
            for (int i = 0; i < test.Length; i++)
            {
                test [i]            = new test();
                test [i].idFacebook = Random.Range(0, 100).ToString();
                test [i].score      = Random.Range(100, 20000);
                test [i].rank       = i + 1;
            }

            for (int i = 0; i < test.Length; i++)
            {
                Sprite sprite = facebook.getSpritePictureById(test [i].idFacebook);
                string name   = facebook.getFriendNameById(test [i].idFacebook);
                int    score  = test[i].score;
                int    rank   = test[i].rank;

                if (sprite == null)
                {
                    sprite = dummyIconImages [Random.Range(0, dummyIconImages.Length)];
                }
                leaderboard.setSlotInfo(sprite, name, score, rank);
            }
        }

        leaderboards.Insert(0, leaderboard);
        currentLeaderboard = leaderboard;
        return(leaderboard);
    }
Esempio n. 21
0
 void Start()
 {
     syncManager = KuberaSyncManger.GetCastedInstance <KuberaSyncManger>();
 }
 void OnDestroy()
 {
     KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().OnDataRetrieved        -= popUpCompleted;
     KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().OnDataRetrievedFailure -= failure;
     KuberaSyncManger.GetCastedInstance <KuberaSyncManger> ().OnLoginFailure         -= failure;
 }