示例#1
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);
    }
示例#2
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
            }
        }
    }