// Use this for initialization
    void Start()
    {
        if (PlayerPrefs.HasKey("Language"))
        {
            currentLanguage = PlayerPrefs.GetInt("Language");
        }
        else
        {
            PlayerPrefs.SetInt("Language", 0);
        }
        languages[currentLanguage].SetNewLanguage(languageImage, ref currentLinkToPDF);
        buyText.text = languages[currentLanguage].buyText;
        if (PlayerPrefs.HasKey("Paid"))
        {
            paid = PlayerPrefs.GetInt("Paid");
        }
        else
        {
            PlayerPrefs.SetInt("Paid", 0);
        }

        if (!PlayerPrefs.HasKey("Game1") && !PlayerPrefs.HasKey("Game2"))
        {
            PlayerPrefs.SetString("Game1", "none");
            PlayerPrefs.SetString("Game2", "none");
        }
        if (!PlayerPrefs.HasKey("Mother"))
        {
            PlayerPrefs.SetString("Mother", "none");
        }
        if (!PlayerPrefs.HasKey("Code"))
        {
            PlayerPrefs.SetString("Code", "none");
        }
        if (PurchaseManager.CheckBuyState("code1"))
        {
            PlayerPrefs.SetString("Code", "Paid");
        }
        if (PurchaseManager.CheckBuyState("game"))
        {
            PlayerPrefs.SetString("Game1", "Paid");
            PlayerPrefs.SetString("Game2", "Paid");
            PlayerPrefs.SetString("Mother", "Paid");
        }
        if (PlayerPrefs.HasKey("Quest1") && PlayerPrefs.HasKey("Quest2") && PlayerPrefs.HasKey("Quest3"))
        {
            motherModeButton.sprite = hasQuests;
        }
        PurchaseManager.OnPurchaseNonConsumable += PurchaseManager_OnPurchaseNonConsumable;
    }
Exemple #2
0
    private void LateUpdate()
    {
        if (PurchaseManager.IsInitialized())
        {
            if (PurchaseManager.CheckBuyState("no_ads"))
            {
                AdsManager.IsBought = true;
            }
            else
            {
                AdsManager.IsBought = false;
            }

            if (!MainMenu.IsBarUnlocked && PurchaseManager.CheckBuyState("unlock_bar"))
            {
                MainMenu.IsBarUnlocked = true;
                if (!PlayerPrefs.HasKey("0011Stars"))
                {
                    PlayerPrefs.SetInt("0011Stars", 0);
                    OnPurchaseChapter();
                }
            }
            if (!MainMenu.IsLaboratoryUnlocked && PurchaseManager.CheckBuyState("unlock_laboratory"))
            {
                MainMenu.IsLaboratoryUnlocked = true;
                if (!PlayerPrefs.HasKey("0021Stars"))
                {
                    PlayerPrefs.SetInt("0021Stars", 0);
                    OnPurchaseChapter();
                }
            }
            if (!MainMenu.IsFactoryUnlocked && PurchaseManager.CheckBuyState("unlock_factory"))
            {
                MainMenu.IsFactoryUnlocked = true;
                if (!PlayerPrefs.HasKey("0031Stars"))
                {
                    PlayerPrefs.SetInt("0031Stars", 0);
                    OnPurchaseChapter();
                }
            }
        }
    }
    private void FixedUpdate()
    {
        timeHelp++;
        time++;
        if (game.t1.Count != 0 && game.t2.Count != 0 && game.t3.Count != 0 && game.t4.Count != 0 && game.t5.Count != 0 && flag2 == true)
        {
            xmlNRepetition.SaveNonRepetitionSystem();
            game.gameObject.SetActive(true);
            flag2 = false;
        }
        if (sumComponents >= 14 && flag1 == true)
        {
            timeOnLoadVideo++;
            OnHints();
            if (game.actualVersion > game.versionGameInNumbers)
            {
                PlayOffline();
                gameObject.SetActive(false);
                return;
            }
            if (game.promptInModeMenu == true)
            {
                promptInModeMenu.SetActive(true);
            }
            for (int i = 0; i < game.banList.Length; i++)
            {
                if (SystemInfo.deviceUniqueIdentifier == game.banList[i])
                {
                    game.ban = true;
                    textBan.gameObject.SetActive(true);
                    PlayOffline();
                    gameObject.SetActive(false);
                    return;
                }
            }
            for (int i = 0; i < game.banListOnName.Length; i++)
            {
                if (SystemInfo.deviceUniqueIdentifier == game.banListOnName[i])
                {
                    game.banOnName = true;
                    textBanOnName.gameObject.SetActive(true);
                }
            }
            buttinImageMedalArcade.gameObject.SetActive(true);
            buttinImageMedalClassic.gameObject.SetActive(true);

            if (game.bestPlayerInClassic != "")
            {
                bestPlayerUnderButtonClassic.SetActive(true);
                searchClassic.SetActive(true);
            }
            if (game.bestPlayerInArcade != "")
            {
                bestPlayerUnderButtonArcade.SetActive(true);
                searchArcade.SetActive(true);
            }
            textBestPlayerInArcadeMainMenu.gameObject.SetActive(true);
            textBestPlayerInArcadeMainMenu.text = game.bestPlayerInArcade;
            textNameArcade.text = game.bestPlayerInArcade;
            textBestStreakRoundsInArcade.text    = $"{((Int32.Parse(game.bestStreakInArcade) - 1) / 15) + 1}";
            textBestStreakQuestionsInArcade.text = $"{((Int32.Parse(game.bestStreakInArcade) - 1) % 15) + 1}";
            if (game.bestExtraLife == "True")
            {
                textExtraLife.text = "Да";
            }
            else
            {
                textExtraLife.text = "Нет";
            }
            textBestTimeInArcade.text      = $"{Int32.Parse(game.bestTimeInArcade) / 60} м. {Int32.Parse(game.bestTimeInArcade) % 60} с.";
            textBestMMRPlayerInArcade.text = $"{game.bestMMRPlayerInArcade} ММР";

            textBestPlayerInClassicMainMenu.gameObject.SetActive(true);
            textBestPlayerInClassicMainMenu.text = game.bestPlayerInClassic;
            textNameClassic.text            = game.bestPlayerInClassic;
            textBestTimeInClassic.text      = $"{Int32.Parse(game.bestTimeInClassic) / 60} м. {Int32.Parse(game.bestTimeInClassic) % 60} с.";
            textBestMMRPlayerInClassic.text = $"{game.bestMMRPlayerInClassic} ММР";

            if (game.developerMessage != "")
            {
                textDeveloperMessage.gameObject.SetActive(true);
                textDeveloperMessage.text = game.developerMessage;
            }


            if (videoMainMenu.isPrepared && game.videoInGameMenu == true)
            {
                animator1.enabled = true;
                animator2.runtimeAnimatorController = acpIcon;
                animator3.runtimeAnimatorController = acpTextLoaded;
                animator4.runtimeAnimatorController = acpTextLoaded;
                if (game.playerName != "")
                {
                    SetMedal();
                }
                if (Game.startWhith == "Arcade" || Game.startWhith == "Classic")
                {
                    buttonAcceptTest.MakeTest();
                    loading.SetActive(false);
                }
                else
                {
                    Invoke("LoaddingOff", 1);
                }
                gameObject.SetActive(false);
            }
            else if (game.videoInGameMenu == false || timeOnLoadVideo > 250)
            {
                videoMainMenu.gameObject.SetActive(false);
                animator1.enabled = true;
                animator2.runtimeAnimatorController = acpIcon;
                animator3.runtimeAnimatorController = acpTextLoaded;
                animator4.runtimeAnimatorController = acpTextLoaded;
                if (game.playerName != "")
                {
                    SetMedal();
                }
                if (Game.startWhith == "Arcade" || Game.startWhith == "Classic")
                {
                    buttonAcceptTest.MakeTest();
                    loading.SetActive(false);
                }
                else
                {
                    Invoke("LoaddingOff", 1);
                }
                gameObject.SetActive(false);
            }
        }

        if (timeHelp == 10)
        {
            textLoaded.text = "Подключение к серверу.";
        }
        else if (timeHelp == 20)
        {
            textLoaded.text = "Подключение к серверу..";
        }
        else if (timeHelp == 30)
        {
            textLoaded.text = "Подключение к серверу...";
            timeHelp        = 0;
        }

        if (game.actualVersion != 0)
        {
            components[0] = true;
        }
        if (game.bestStreakInArcade != null)
        {
            components[1] = true;
        }
        if (game.bestExtraLife != null)
        {
            components[2] = true;
        }
        if (game.bestTimeInArcade != null)
        {
            components[3] = true;
        }
        if (game.bestMMRPlayerInArcade != null)
        {
            components[4] = true;
        }
        if (game.bestPlayerInArcade != null)
        {
            components[5] = true;
        }
        if (game.bestPlayerInClassic != null)
        {
            components[6] = true;
        }
        if (game.bestTimeInClassic != null)
        {
            components[7] = true;
        }
        if (game.bestMMRPlayerInClassic != null)
        {
            components[8] = true;
        }
        if (game.banList != null)
        {
            components[9] = true;
        }
        if (game.banListOnName != null)
        {
            components[10] = true;
        }
        if (game.developerMessage != null)
        {
            components[11] = true;
        }
        if (game.classicLeaderBoards != null)
        {
            components[12] = true;
        }
        if (game.arcadeLeaderBoards != null)
        {
            components[13] = true;
        }

        sumComponents = 0;

        for (int i = 0; i < components.Length; i++)
        {
            if (components[i] == true)
            {
                sumComponents++;
            }
        }
        textComponents.text = $"Компонентов {sumComponents}/14";

        if (time % 250 == 0)
        {
            if (sumComponents < 13)
            {
                baseConnect.GetStatsThread();
            }
            GetLeaderBoardClassicThread();
            GetLeaderBoardArcadeThread();
        }
        if (playOffline == false && time > 250)
        {
            buttonPlayOfflineAnimation.gameObject.SetActive(true);
        }
        if (PurchaseManager.CheckBuyState("no__ads") == 2 || game.deviceId == "8ef213cb925629c74b012b4a3398e08f")
        {
            game.xmlData.DeliteKey();
            flag1 = true;
        }
        else if (PurchaseManager.CheckBuyState("no__ads") == 1 && game.deviceId != "8ef213cb925629c74b012b4a3398e08f")
        {
            game.xmlData.SaveKey();
            game.ads = false;
            flag1    = true;
        }
        else
        {
            flag1 = false;
        }
    }