Пример #1
0
    void Awake()
    {
        QualitySettings.vSyncCount  = 0;
        Application.targetFrameRate = 30;

        if (GameData.music)
        {
            AudioSource audio = GetComponent <AudioSource>();
            audio.Play();
        }

        if (GameData.useServer && GameData.rain > 0.2f)
        {
            rainParticleSystem.gameObject.SetActive(true);
            rainParticleSystem.Play();

            if (GooglePlayServices.IsAuthenticated())
            {
                GooglePlayServices.UnlockAchievement(GPGSIds.achievement_raining_day_isnt_it);
            }
        }
        else if (!GameData.useServer)
        {
            int r = Random.Range(0, 4);
            if (r == 0)
            {
                rainParticleSystem.gameObject.SetActive(true);
                rainParticleSystem.Play();
            }
        }
    }
Пример #2
0
        private void Start()
        {
            gps = GameObject.FindGameObjectWithTag("GooglePlayServices").GetComponent<GooglePlayServices>();
            playerPrefs = GameObject.FindGameObjectWithTag("PlayerPreferences").GetComponent<PlayerPreferences>();

            if (playerPrefs.FirstTime)  GetComponent<Animator>().SetTrigger("Show");
        }
Пример #3
0
        /// <summary>
        /// Отображение открытой карточки
        /// </summary>
        public void ShowImageCard()
        {
            _image.sprite = _openCard;

            if (Application.internetReachability != NetworkReachability.NotReachable)
            {
                GooglePlayServices.UnlockingAchievement(_achievement);
            }
        }
Пример #4
0
 /// <summary>
 /// Достижение за уровень без ошибок
 /// </summary>
 private void AchievementPerLevel()
 {
     if (_levelManager.CurrentErrors == 0)
     {
         if (Application.internetReachability != NetworkReachability.NotReachable)
         {
             // Открываем достижение по прохождению без ошибок
             GooglePlayServices.UnlockingAchievement(GPGSIds.achievement_5);
         }
     }
 }
Пример #5
0
    void Start()
    {
        stringi = PlayerPrefs.GetFloat("record", 0f).ToString();
        m       = long.Parse(stringi);
        Debug.Log(m);
        PlayerPrefs.GetFloat("record", 0f);
        recordtext.text = "Best score: " + PlayerPrefs.GetFloat("record") + "m";


        GooglePlayServices.PostToLeaderboard(m);
    }
Пример #6
0
        private void Start()
        {
            gps = GameObject.FindGameObjectWithTag("GooglePlayServices").GetComponent<GooglePlayServices>();
            playerPrefs = GameObject.FindGameObjectWithTag("PlayerPreferences").GetComponent<PlayerPreferences>();

            GetComponent<Button>().onClick.AddListener(OnClick);

            GooglePlayConnection.ActionPlayerConnected += ActionPlayerConnected;
            GooglePlayConnection.ActionPlayerDisconnected += ActionPlayerDisconnected;

            disbaledIcon.SetActive(gps.SignedIn);
        }
Пример #7
0
 // Start is called before the first frame update
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         if (instance != this)
         {
             Destroy(gameObject);
         }
     }
 }
Пример #9
0
    void Start() {
        instance = this;
        config = new PlayGamesClientConfiguration.Builder().Build();
        PlayGamesPlatform.Activate();

        if (!Social.localUser.authenticated)
        {
            Social.localUser.Authenticate((bool success) =>
            {
                if (success) { }
                else { }

            });
        }
	}
Пример #10
0
        private void Start()
        {
            // Получаем номер текущего вопроса по категории
            currentQuestion = _sets.SetsHelper.arraySets[_number];

            if (currentQuestion > 0)
            {
                UpdateCategory();

                // Если категория полностью пройдена
                if (currentQuestion > _sets.Task[_number])
                {
                    GooglePlayServices.UnlockingAchievement(_achievement);
                }
            }
        }
Пример #11
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        if ((coll.gameObject.tag == "Wall" || coll.gameObject.tag == "Enemy") && charging)
        {
            if (coll.gameObject.tag == "Enemy")
            {
                coll.gameObject.GetComponent <BaseEnemy>().Die();

                if (GooglePlayServices.IsAuthenticated())
                {
                    GooglePlayServices.UnlockAchievement(GPGSIds.achievement_big_dodger);
                    GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_dodgers, 1);
                }
            }
            this.Die();
        }
    }
Пример #12
0
 //<summary>
 // Add the score to the global leaderboard if it is the local best result.
 //</summary>
 private void ProcessFinalScore()
 {
     if (GooglePlayServices.IsAuthenticated())
     {
         string s = GameData.ReadScore(0);
         if (s != "NONE")
         {
             string[] values     = s.Split('\t');
             uint     savedScore = uint.Parse(values[0]);
             if (savedScore < GameData.last_score)
             {
                 GooglePlayServices.AddScoreToLeaderboard(GPGSIds.leaderboard_global_leaderboard, GameData.last_score);
             }
         }
         else
         {
             GooglePlayServices.AddScoreToLeaderboard(GPGSIds.leaderboard_global_leaderboard, GameData.last_score);
         }
     }
 }
Пример #13
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "Terrain")
        {
            Destroy(this.gameObject);
        }
        else if (coll.gameObject.tag == "Enemy")
        {
            BaseEnemy en = coll.gameObject.GetComponent <BaseEnemy>();
            en.Die();

            if (GooglePlayServices.IsAuthenticated())
            {
                GooglePlayServices.UnlockAchievement(GPGSIds.achievement_big_strategist);
                GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_strategist, 1);
            }

            Destroy(this.gameObject);
        }
    }
Пример #14
0
    //<summary>
    // Unlocks and updates the achievements related to the game based on light, temperature and time.
    //</summary>
    private void ProcessAchievement()
    {
        if (GooglePlayServices.IsAuthenticated())
        {
            GooglePlayServices.UnlockAchievement(GPGSIds.achievement_first_time);

            if (GameData.last_light_condition == "Light")
            {
                GooglePlayServices.IncrementAchievement(GPGSIds.achievement_player_of_the_day, 1);
                GooglePlayServices.IncrementAchievement(GPGSIds.achievement_owner_of_the_day, 1);
                GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_the_day, 1);
            }
            else
            {
                GooglePlayServices.IncrementAchievement(GPGSIds.achievement_player_of_the_night, 1);
                GooglePlayServices.IncrementAchievement(GPGSIds.achievement_owner_of_the_night, 1);
                GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_the_night, 1);
            }

            if (GameData.last_temperature_condition == "Cold")
            {
                GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_ice, 1);
            }
            else if (GameData.last_temperature_condition == "Hot")
            {
                GooglePlayServices.IncrementAchievement(GPGSIds.achievement_master_of_fire, 1);
            }

            if (GameData.last_time_condition == 12)
            {
                GooglePlayServices.UnlockAchievement(GPGSIds.achievement_player_of_midday);
            }
            else if (GameData.last_time_condition == 24 || GameData.last_time_condition == 0)
            {
                GooglePlayServices.UnlockAchievement(GPGSIds.achievement_player_of_midnight);
            }
        }
    }
Пример #15
0
 public void ShowAchievements()
 {
     GooglePlayServices.ShowAchievementsUI();
 }
Пример #16
0
 private void Awake()
 {
     instance = this;
     DontDestroyOnLoad(this.gameObject);
 }
Пример #17
0
 private void Start()
 {
     gps = GameObject.FindGameObjectWithTag("GooglePlayServices").GetComponent<GooglePlayServices>();
     GetComponent<Button>().onClick.AddListener(OnClick);
 }
Пример #18
0
    public GameObject way;//particle

    public void OpenLeaderboard()
    {
        GooglePlayServices.ShowLeaderboardUI();
    }
Пример #19
0
 public void UnlockOne()
 {
     GooglePlayServices.UnlockAchievement(GPGSIds.achievement_first_time);
 }
Пример #20
0
 public static void saveHighScore()
 {
     PlayerPrefs.SetInt("highestScore", highScore);
     GooglePlayServices.OnAddScoreToLeaderBoard(highScore);
 }
Пример #21
0
 public void ShowLeaderboard()
 {
     GooglePlayServices.Show();
 }
Пример #22
0
    // Update is called once per frame
    void Update()
    {
        if (PlayerPrefs.GetString("pseudonim") != "1")
        {
            UserName.text = "" + PlayerPrefs.GetString("pseudonim");
        }
        //zapis#2 ustawianie wartosci
        PlayerPrefs.SetFloat("gold", gold);
        PlayerPrefs.SetFloat("exp", exp);
        PlayerPrefs.SetInt("lvl", lvl);
        PlayerPrefs.SetInt("goldperclick", goldperclick);
        PlayerPrefs.SetFloat("suby", suby);
        PlayerPrefs.SetFloat("wyswietlenia", wyswietlenia);
        PlayerPrefs.SetFloat("like", like);
        //PlayerPrefs.SetFloat("dislike", dislike);

        if (PlayerPrefs.GetInt("jezyk") == 0)
        {
            if (dislike < 1000)
            {
                dislike_text.text = "" + dislike.ToString("n0") + "";
            }
            else if ((dislike > 1000) && (dislike < 1000000))
            {
                dislike_text.text = "" + (dislike / 1000).ToString("n1") + " thous.";
            }
            else if (dislike >= 1000000)
            {
                dislike_text.text = "" + (dislike / 1000000).ToString("n1") + " mln.";
            }
            else if (dislike >= 1000000000)
            {
                dislike_text.text = "" + (dislike / 1000000000).ToString("n1") + " mld.";
            }

            if (like < 1000)
            {
                like_text.text = "" + like.ToString("n0") + "";
            }
            else if ((like > 1000) && (like < 1000000))
            {
                like_text.text = "" + (like / 1000).ToString("n1") + " thous.";
            }
            else if (like >= 1000000)
            {
                like_text.text = "" + (like / 1000000).ToString("n1") + " mln.";
            }
            else if (like >= 1000000000)
            {
                like_text.text = "" + (like / 1000000000).ToString("n1") + " mld.";
            }

            if (suby < 1000)
            {
                suby_text.text = "" + suby.ToString("n0") + " subscribers";
            }
            else if ((suby > 1000) && (suby < 1000000))
            {
                suby_text.text = "" + (suby / 1000).ToString("n0") + " thous. subscribers";
            }
            else if (suby >= 1000000)
            {
                suby_text.text = "" + (suby / 1000000).ToString("n0") + " mln. subscribers";
            }
            else if (suby >= 1000000000)
            {
                suby_text.text = "" + (suby / 1000000000).ToString("n0") + " mld. subscribers";
            }

            if (wyswietlenia < 1000)
            {
                wyswietlenia_text.text = "" + wyswietlenia.ToString("n0") + " views";
            }
            else if ((wyswietlenia > 1000) && (wyswietlenia < 1000000))
            {
                wyswietlenia_text.text = "" + (wyswietlenia / 1000).ToString("n0") + " thous. views";
            }
            else if (wyswietlenia >= 1000000)
            {
                wyswietlenia_text.text = "" + (wyswietlenia / 1000000).ToString("n0") + " mln. views";
            }
            else if (wyswietlenia >= 1000000000)
            {
                wyswietlenia_text.text = "" + (wyswietlenia / 1000000000).ToString("n0") + " mld. views";
            }
        }
        else if (PlayerPrefs.GetInt("jezyk") == 1)
        {
            if (dislike < 1000)
            {
                dislike_text.text = "" + dislike.ToString("n0") + "";
            }
            else if ((dislike > 1000) && (dislike < 1000000))
            {
                dislike_text.text = "" + (dislike / 1000).ToString("n1") + " tys.";
            }
            else if (dislike >= 1000000)
            {
                dislike_text.text = "" + (dislike / 1000000).ToString("n1") + " mln.";
            }
            else if (dislike >= 1000000000)
            {
                dislike_text.text = "" + (dislike / 1000000000).ToString("n1") + " mld.";
            }

            if (like < 1000)
            {
                like_text.text = "" + like.ToString("n0") + "";
            }
            else if ((like > 1000) && (like < 1000000))
            {
                like_text.text = "" + (like / 1000).ToString("n1") + " tys.";
            }
            else if (like >= 1000000)
            {
                like_text.text = "" + (like / 1000000).ToString("n1") + " mln.";
            }
            else if (like >= 1000000000)
            {
                like_text.text = "" + (like / 1000000000).ToString("n1") + " mld.";
            }

            if (suby < 1000)
            {
                suby_text.text = "" + suby.ToString("n0") + " subskrypcji";
            }
            else if ((suby > 1000) && (suby < 1000000))
            {
                suby_text.text = "" + (suby / 1000).ToString("n0") + " tys. subskrypcji";
            }
            else if (suby >= 1000000)
            {
                suby_text.text = "" + (suby / 1000000).ToString("n0") + " mln. subskrypcji";
            }
            else if (suby >= 1000000000)
            {
                suby_text.text = "" + (suby / 1000000000).ToString("n0") + " mld. subskrypcji";
            }

            if (wyswietlenia < 1000)
            {
                wyswietlenia_text.text = "" + wyswietlenia.ToString("n0") + " wyświetleń";
            }
            else if ((wyswietlenia > 1000) && (wyswietlenia < 1000000))
            {
                wyswietlenia_text.text = "" + (wyswietlenia / 1000).ToString("n0") + " tys. wyświetleń";
            }
            else if (wyswietlenia >= 1000000)
            {
                wyswietlenia_text.text = "" + (wyswietlenia / 1000000).ToString("n0") + " mln. wyświetleń";
            }
            else if (wyswietlenia >= 1000000000)
            {
                wyswietlenia_text.text = "" + (wyswietlenia / 1000000000).ToString("n0") + " mld. wyświetleń";
            }
        }



        if (PlayerPrefs.GetInt("likedown") == 1)
        {
            dislike = Mathf.Round(like * PlayerPrefs.GetFloat("reputacja123")) / 100 + 1;
        }
        else
        {
            dislike = Mathf.Round(like * PlayerPrefs.GetFloat("reputacja123")) / 100;
        }

        //texty
        goldDisplay.text = "" + gold.ToString("n0") + "$";
        expInfo.text     = "" + exp.ToString("n0") + "/" + expMax.ToString("n0");
        levelText.text   = "" + lvl.ToString("n0");

        if (gold >= 1000000)
        {
            goldDisplay.fontSize = 25;
        }
        else if (gold >= 10000000)
        {
            goldDisplay.fontSize = 22;
        }
        else if (gold >= 1000000000)
        {
            goldDisplay.fontSize = 20;
        }
        else if (gold >= 10000000000)
        {
            goldDisplay.fontSize = 18;
        }
        else if (gold >= 1000000000000)
        {
            goldDisplay.fontSize = 14;
        }
        else if (gold >= 100000000000000000)
        {
            goldDisplay.fontSize = 10;
        }

        if (expMax >= 10000)
        {
            expInfo.fontSize = 25;
        }
        if (expMax >= 100000)
        {
            expInfo.fontSize = 23;
        }
        if (expMax >= 1000000)
        {
            expInfo.fontSize = 20;
        }
        if (expMax >= 10000000)
        {
            expInfo.fontSize = 18;
        }
        if (expMax >= 100000000)
        {
            expInfo.fontSize = 14;
        }

        if (goldperclick >= 1000000)
        {
            gpc.fontSize = 27;
        }
        else if (goldperclick >= 10000000)
        {
            gpc.fontSize = 25;
        }
        else if (goldperclick >= 100000000)
        {
            gpc.fontSize = 20;
        }

        //level

        if (exp >= expMax)//-----------------------------------
        {
            exp    = 0;
            count  = 0;
            expMax = Mathf.Round(expMax * 1.8f);

            suby = suby + Mathf.Round(expMax * 0.9f);
            PlayerPrefs.SetFloat("suby", suby);

            wyswietlenia = wyswietlenia + Mathf.Round(expMax * 0.4f);
            PlayerPrefs.SetFloat("wyswietlenia", wyswietlenia);

            like = like + Mathf.Round(expMax * 0.15f);
            PlayerPrefs.SetFloat("like", like);

            if (PlayerPrefs.GetInt("jezyk") == 0)
            {
                pluswidzowie.text     = "+ " + Mathf.Round(expMax * 0.9f).ToString("n0") + " subscribers";
                pluswyswietlenia.text = "+ " + Mathf.Round(expMax * 0.4f).ToString("n0") + " views";
                pluslike.text         = "+ " + Mathf.Round(expMax * 0.15f).ToString("n0") + " likes";
            }
            else if (PlayerPrefs.GetInt("jezyk") == 1)
            {
                pluswidzowie.text     = "+ " + Mathf.Round(expMax * 0.9f).ToString("n0") + " widzów";
                pluswyswietlenia.text = "+ " + Mathf.Round(expMax * 0.4f).ToString("n0") + " wyświetleń";
                pluslike.text         = "+ " + Mathf.Round(expMax * 0.15f).ToString("n0") + " łapek";
            }

            lvl++;
            PlayerPrefs.SetFloat("expMax", expMax);//zapis maxexpa
            lvlupsource.Play();

            lvlupanim.GetComponent <Animator>().Play("nowypoziom");

            // anim.SetTrigger("animacjalvlup");
            // anim.Play("animacjalvlup");


            stringi = lvl.ToString();
            m       = long.Parse(stringi);



            GooglePlayServices.PostToLeaderboard(m);



            stringi2 = like.ToString();
            m2       = long.Parse(stringi2);
            GooglePlayServices.PostToLeaderboardLikes(m2);

            stringi3 = suby.ToString();
            m3       = long.Parse(stringi3);
            GooglePlayServices.PostToLeaderboardSubs(m3);
        }

        if (PlayerPrefs.GetInt("mnoznik") == 0)
        {
            if (PlayerPrefs.GetInt("jezyk") == 0)
            {
                gpc.text = "+ " + goldperclick.ToString("n0") + "$ /click";//f0
            }
            else if (PlayerPrefs.GetInt("jezyk") == 1)
            {
                gpc.text = "+ " + goldperclick.ToString("n0") + "$ /klik";//f0
            }
        }
        else if (PlayerPrefs.GetInt("mnoznik") == 1)
        {
            if (PlayerPrefs.GetInt("jezyk") == 0)
            {
                gpc.text = "+ " + (goldperclick * 2).ToString("n0") + "$ /click";//f0
            }
            else if (PlayerPrefs.GetInt("jezyk") == 1)
            {
                gpc.text = "+ " + (goldperclick * 2).ToString("n0") + "$ /klik";//f0
            }
        }
    }