Example #1
0
    public void GoToScreen(int screen)
    {
        foreach (GameObject s in m_Screens)
        {
            s.SetActive(false);
        }

        AudioManager.Instance.PlaySoundEvent(SOUNDID.MENU_CLICK);
        m_PreviousScreen = m_CurrentScreen;
        m_CurrentScreen  = screen;

        m_Screens[m_PreviousScreen].SetActive(true);
        m_Screens[m_CurrentScreen].SetActive(true);

        m_bScreenAnimate = m_PreviousScreen != m_CurrentScreen;
        if (m_bScreenAnimate)
        {
            m_fScreenAnimateTimer = 0.0f;

            // Setting screen to correct position
            Vector3 prevPos = m_Screens[m_PreviousScreen].GetComponent <RectTransform>().localPosition;
            prevPos.x = 0.0f;
            m_Screens[m_PreviousScreen].GetComponent <RectTransform>().localPosition = prevPos;

            Vector3 currentPos = m_Screens[m_CurrentScreen].GetComponent <RectTransform>().localPosition;
            currentPos.x = m_PreviousScreen > m_CurrentScreen ? -m_fScreenWidth : m_fScreenWidth;
            m_Screens[m_CurrentScreen].GetComponent <RectTransform>().localPosition = currentPos;

            m_fScreenFrom = currentPos.x;
        }

#if UNITY_IOS
        if (m_CurrentScreen == (int)eScreen.ACHIEVEMENTS)
        {
            GameObject btn = GameObject.FindGameObjectWithTag("Platform Specific Achievement Button");
            if (btn != null)
            {
                btn.SetActive(false);
            }
            //	GPManager.ShowAchievementsUI();
        }
#endif

#if UNITY_ANDROID
        if (m_CurrentScreen == (int)eScreen.CREDITS)
        {
            ++m_CreditVisitNum;

            if (m_CreditVisitNum == 1)
            {
                GooglePlayService.ProgressAcheivement(GPGSIds.achievement_visit_credits_screen, 100.0f);
            }

            if (m_CreditVisitNum <= 5)
            {
                GooglePlayService.ProgressAcheivement(GPGSIds.achievement_visit_credits_screen_more, (float)m_CreditVisitNum / 5.0f * 100.0f);
            }
        }
#endif
    }
Example #2
0
    public void StartOfStageClearCinematic()
    {
        StartCoroutine(MoveCameraToVector_Coroutine(vectorToSeeBoss));

        if (enemySpawnMgr)
        {
            enemySpawnMgr.PauseTiking();
            float timeTik = enemySpawnMgr.GetTimeTik();

            GooglePlayService.AddScoreToLeaderboard(timeTik, stageIdx);
        }

        BGMMgr.Instance.FadeOutBGM();

        // ui , bosshealthbar, queenhealthbar
        foreach (var o in notVisiblesDuringTimelineAnimation)
        {
            o.SetActive(false);
        }

        foreach (var e in FindObjectsOfType <Enemy_Health>())
        {
            e.gameObject.SetActive(false);
        }

        foreach (var f in FindObjectsOfType <Friendly_Health>())
        {
            f.gameObject.SetActive(false);
        }
    }
Example #3
0
    private static bool IsServiceAuthenticated()
    {
#if UNITY_ANDROID
        return(GooglePlayService.IsAuthenticated());
#elif UNITY_IOS
        // @todo: IOS logic here
        return(true);
#endif
    }
Example #4
0
    private static int ServiceNumRetryNum()
    {
#if UNITY_ANDROID
        //return GooglePlayService.IsLoaded()
        return(GooglePlayService.RetryNum());
#elif UNITY_IOS
        // @todo: IOS logic here
        return(1);
#endif
    }
Example #5
0
    void CheckCounters(ACHIEVEMENTSET[] arr, int currCount, ref int nextIndex)
    {
        while (currCount >= arr[nextIndex].count)
        {
            PrintObtainedText(arr[nextIndex]);

#if UNITY_ANDROID
            // This will be multiple times as long as next index did not change
            if (arr[nextIndex].achievementID != "")
            {
                GooglePlayService.ProgressAcheivement(arr[nextIndex].achievementID, 100.0f);
            }
#endif

            if (arr.Length > nextIndex + 1)
            {
                ++nextIndex;
            }
            else
            {
                break;
            }
        }

#if UNITY_ANDROID
        int currentIndex = Math.Max(0, nextIndex - 1);
        // This will be multiple times as long as next index did not change
        //if ( arr[currentIndex].achievementID != "" )
        //{
        //	GooglePlayService.ProgressAcheivement( arr[currentIndex].achievementID, 100.0f );
        //}

        while (arr.Length > currentIndex + 1 && arr[++currentIndex].achievementID == "")
        {
            ;
        }
        if (arr[currentIndex].achievementID != "")
        {
            GooglePlayService.ProgressAcheivement(arr[currentIndex].achievementID, (float)currCount / arr[currentIndex].count);
        }
#endif
        //SaveLoad.Save();
        SaveDataLoader.SaveGame();
    }
Example #6
0
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
            return;
        }
        DontDestroyOnLoad(this.gameObject);
        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
                                              .RequestEmail()
                                              .Build();

        PlayGamesPlatform.InitializeInstance(config);
        PlayGamesPlatform.DebugLogEnabled = true;
        PlayGamesPlatform.Activate();
        SignIn();
    }
Example #7
0
    public void StartShowLeaderboardUI()
    {
#if UNITY_ANDROID
        GameObject playServiceObj = GameObject.Find("Google Play Service");
        if (playServiceObj != null)
        {
            GooglePlayService service = playServiceObj.GetComponent <GooglePlayService>();
            if (service != null)
            {
                service.StartShowLeaderboardUI();
            }
            else
            {
                Debug.Log("GooglePlayService component can't be found");
            }
        }
        else
        {
            Debug.Log("Google Play Service game object can't be found");
        }
#elif UNITY_IOS
        GameObject centerServiceObj = GameObject.Find("Game Center Service");
        if (centerServiceObj != null)
        {
            GameCenterService service = centerServiceObj.GetComponent <GameCenterService>();
            if (service != null)
            {
                service.StartShowLeaderboardUI();
            }
            else
            {
                Debug.Log("GameCenterService component can't be found");
            }
        }
        else
        {
            Debug.Log("Game Center Service game object can't be found");
        }
#endif
    }
Example #8
0
    public void StartShowAchievementUI()
    {
#if UNITY_ANDROID
        GameObject playServiceObj = GameObject.Find("Google Play Service");
        if (playServiceObj != null)
        {
            GooglePlayService service = playServiceObj.GetComponent <GooglePlayService>();
            if (service != null)
            {
                service.StartShowAchievementUI();
            }
            else
            {
                Debug.Log("GooglePlayService component can't be found");
            }
        }
        else
        {
            Debug.Log("Google Play Service game object can't be found");
        }
#elif UNITY_IOS
        // @todo Show Apple achievement
#endif
    }
Example #9
0
 // Start is called before the first frame update
 void Start()
 {
     GooglePlayService.InitializeGooglePlayService();
 }
Example #10
0
 public void OnClick_LeaderboardBtn()
 {
     GooglePlayService.ShowLeadboard();
 }
Example #11
0
    // Use this for initialization
    void Start()
    {
        // Getting stats
        m_PlayerStats = GameObject.FindGameObjectWithTag("Player Statistics").GetComponent <PlayerStatistics>();
        m_Score.GetComponent <Text> ().text = m_CountUp_Score.ToString();
        m_CountUp_Progress = -1;
        m_fPreCountUp      = 0.0f;

        m_CountUp_Gems = new int[4];

        int gemDestroyed = 0;

        for (int i = 0; i < m_PlayerStats.m_aDestroyCount.Length; ++i)
        {
            m_CountUp_Gems[i] = 0;
            gemDestroyed     += m_PlayerStats.m_aDestroyCount[i];
        }

        // Find the score without boosters, to use for gold calc
        int realScore = (int)Mathf.Round(m_PlayerStats.m_nScore / BoosterManager.Instance.GetBoostValue(BOOSTERTYPE.ScoreMult) / BoosterManager.Instance.GetScoreMultOnce());

        m_GoldEarned = (int)Mathf.Round(realScore / 100 * BoosterManager.Instance.GetBoostValue(BOOSTERTYPE.GoldMult) * BoosterManager.Instance.GetGoldMultOnce());
        if (GameData.Instance.m_Boost_GoldMultOnce)
        {
            GameData.Instance.m_Boost_GoldMultOnce = false;
        }
        if (GameData.Instance.m_Boost_MoreHealthOnce)
        {
            GameData.Instance.m_Boost_MoreHealthOnce = false;
        }
        if (GameData.Instance.m_Boost_ScoreMultOnce)
        {
            GameData.Instance.m_Boost_ScoreMultOnce = false;
        }

        m_CoinsThisRound.GetComponent <Text>().text = m_CountUp_Gold.ToString();
        m_LeakedCounter.GetComponent <Text>().text  = m_CountUp_GemGrey.ToString();
        m_ComboCounter.GetComponent <Text> ().text  = m_CountUp_Combo.ToString();

        m_HighScoreText.SetActive(false);
        if (GameData.Instance.m_HighScore < m_PlayerStats.m_nScore)
        {
            GameData.Instance.m_HighScore = m_PlayerStats.m_nScore;
            m_HighScoreText.SetActive(true);
        }

        if (GameData.Instance.m_HighestCombo < m_PlayerStats.m_nMaxCombo)
        {
            GameData.Instance.m_HighestCombo = m_PlayerStats.m_nMaxCombo;
        }

        m_BestScore.GetComponent <Text>().text = "Best " + GameData.Instance.m_HighScore.ToString();

        // Initialising animation timer
        m_nFrameNum = m_PlayerStats.m_aGems[0].GetComponent <GemSpriteContainer>().m_Sprites.Length;
        for (int i = 1; i < m_PlayerStats.m_aGems.Length; ++i)
        {
            int num = m_PlayerStats.m_aGems[i].GetComponent <GemSpriteContainer>().m_Sprites.Length;
            m_nFrameNum = m_nFrameNum > num ? num : m_nFrameNum;
        }
        m_fAnimationIntervalTimer = 0.0f;
        m_fAnimationTimer         = 0.0f;
        m_bAnimating      = false;
        m_nAnimatingFrame = -1;

        if (m_PlayerStats.m_nScore > 0)
        {
            AchievementManager.Instance.AddGamesPlayed();
            AchievementManager.Instance.AddCoinsEarned(m_GoldEarned);
            AchievementManager.Instance.AddScoreEarned(m_PlayerStats.m_nScore);
            AchievementManager.Instance.AddLinkedGems(1, m_PlayerStats.m_aDestroyCount[0]);
            AchievementManager.Instance.AddLinkedGems(2, m_PlayerStats.m_aDestroyCount[1]);
            AchievementManager.Instance.AddLinkedGems(3, m_PlayerStats.m_aDestroyCount[2]);
            AchievementManager.Instance.AddLinkedGems(4, m_PlayerStats.m_aDestroyCount[3]);

            AchievementManager.Instance.AddCombo(m_PlayerStats.m_nMaxCombo);
            AchievementManager.Instance.AddCoinsEarned_PerGame(m_GoldEarned);
            AchievementManager.Instance.AddScoreEarned_PerGame(m_PlayerStats.m_nScore);
        }

        Analytics.CustomEvent("Scorecard", new Dictionary <string, object>
        {
            { "Score", m_PlayerStats.m_nScore },
            { "RedGem", m_PlayerStats.m_aDestroyCount[0] },
            { "BlueGem", m_PlayerStats.m_aDestroyCount[1] },
            { "GreenGem", m_PlayerStats.m_aDestroyCount[2] },
            { "YellowGem", m_PlayerStats.m_aDestroyCount[3] },
            { "GreyGem", m_PlayerStats.m_nLeakCount.ToString() },
            { "Combo", m_PlayerStats.m_nMaxCombo },
            { "GoldEarned", m_GoldEarned }
        });

#if LINKIT_COOP
        if (NetworkManager.IsConnected())
        {
            NetworkManager.Disconnect();
        }
#endif   // LINKIT_COOP

        GameData.Instance.m_Coin += m_PlayerStats.m_nCoinsGain;
        m_CurrentCoins            = GameData.Instance.m_Coin;
        m_nShowingCoins           = GameData.Instance.m_Coin;
        m_nPrevCoins              = GameData.Instance.m_Coin;
        m_fCoinsTimer             = 0.0f;
        GameData.Instance.m_Coin += m_GoldEarned;

        Text coinsText = m_Coins.GetComponent <Text>();
        coinsText.text = m_nShowingCoins.ToString();        // + " (+" + m_PlayerStats.m_nCoinsGain + ")";

#if UNITY_ANDROID
        GooglePlayService.PostHighScore(m_PlayerStats.m_nScore);
#elif UNITY_IOS
        GameCenterService.PostHighScore(m_PlayerStats.m_nScore);
#endif

        AchievementManager.Instance.BoosterGamesPlayed();
        AchievementManager.Instance.BoosterPointsEarned(m_PlayerStats.m_nScore);

        // Save
        //SaveLoad.Save();
        SaveDataLoader.SaveGame();

        if (GameObject.FindGameObjectWithTag("Gem Details") != null)
        {
            m_GemDetails = GameObject.FindGameObjectWithTag("Gem Details").GetComponent <GemDetails>();
        }

        m_bIsCurrentScreenScore = true;
        m_bScreenAnimate        = false;
        m_fScreenAnimateTimer   = 0.0f;
        m_fScreenWidth          = m_ScoreCanvas.GetComponent <RectTransform>().sizeDelta.x;
        GoToScore();
    }
Example #12
0
 // Use this for initialization
 void Awake()
 {
     Instance = this;
 }