Example #1
0
    public static void Press()
    {
        Coroutines coroutines = GameObject.FindObjectOfType(typeof(Coroutines)) as Coroutines;

        // if we have at least 1 hint or more
        if ((SaveInGame.SavesCountHelp >= 1 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.SimpleLever)) ||
            (SaveInGame.SavesCountHelp >= 2 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.BestPractices || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ElementaryLaws)) ||
            (SaveInGame.SavesCountHelp >= 3 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ScientistsNotes)) ||
            (SaveInGame.SavesCountHelp >= 4 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ExperimentalProcess || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.Mechanics)) ||
            (SaveInGame.SavesCountHelp >= 5 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.AcademicDegree || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LatestDevelopments)))
        {
            if (SaveInGame.numberLvlClick == 4 && GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests && GlobalSaves.saveInGame[0].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] != true)
            {
                SaveInGame.SavesCountHelp++;                                                                                                                                                                                                          //если у нас 4-ый лвл, то мы не уменшаем кол-во подсказок, так как для 4-го лвла нет подсказки
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests && GlobalSaves.saveInGame[0].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp--;
                GlobalSaves.saveInGame[0].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.SimpleLever && GlobalSaves.saveInGame[5].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp--;
                GlobalSaves.saveInGame[5].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.BestPractices && GlobalSaves.saveInGame[1].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 2;
                GlobalSaves.saveInGame[1].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ElementaryLaws && GlobalSaves.saveInGame[6].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 2;
                GlobalSaves.saveInGame[6].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ScientistsNotes && GlobalSaves.saveInGame[2].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 3;
                GlobalSaves.saveInGame[2].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ExperimentalProcess && GlobalSaves.saveInGame[3].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 4;
                GlobalSaves.saveInGame[3].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.Mechanics && GlobalSaves.saveInGame[7].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 4;
                GlobalSaves.saveInGame[7].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.AcademicDegree && GlobalSaves.saveInGame[4].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 5;
                GlobalSaves.saveInGame[4].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LatestDevelopments && GlobalSaves.saveInGame[8].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 5;
                GlobalSaves.saveInGame[8].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            coroutines.PassedHelpAndShowAchievments();
            CountImageHelp.Show();

            SaveData.Save();

            GlobalSceneObjects.helpBoard.SetActive(true);
        }
        else
        {
            if (GlobalVariables.isRussianLanguage == true)
            {
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.SimpleLever)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Послушай. Для этой задачки мне нужна всего лишь 1 рыбка!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.BestPractices || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ElementaryLaws)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Дашь мне 2 рыбки и я тебе помогу!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ScientistsNotes)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Что-то не вижу 3 рыбок!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ExperimentalProcess || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.Mechanics)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Я много же не прошу! Всего лишь 4 рыбки!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.AcademicDegree || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LatestDevelopments)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Чтобы лучше думалось, мне нужно не меньше 5 рыбок!";
                }
            }
            else
            {
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.SimpleLever)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "For this task I only need 1 fish!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.BestPractices || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ElementaryLaws)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Give me 2 fish and I will help you!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ScientistsNotes)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "I don't see three fish!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ExperimentalProcess || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.Mechanics)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "I don’t ask too much! Only 4 fish!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.AcademicDegree || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LatestDevelopments)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "To think better, I need at least 5 fish!";
                }
            }

            GlobalSceneObjects.helpButton.transform.Find("CountHelp").Find("PictureHelp").GetComponent <Animator>().Play("PictureHelp");
        }
    }
Example #2
0
    public static void InitLoad()
    {
        Coroutines coroutines = GameObject.FindObjectOfType(typeof(Coroutines)) as Coroutines;

        for (int i = 0; i < GlobalSaves.saveInGame.Length; i++)
        {
            GlobalSaves.saveInGame[i] = new SaveInGame();
        }
        TextAchievments.ChangeLanguage();

        string loadedData = null;


        if (!PlayerPrefs.HasKey("BestS"))
        {
            PlayerPrefs.SetString("BestS", "");
        }
        else
        {
            loadedData = PlayerPrefs.GetString("BestS");
            int    charsCount = loadedData.Length;
            byte[] bytes      = new byte[charsCount / 2];//
            for (int i = 0; i < charsCount; i += 2)
            {
                bytes[i / 2] = Convert.ToByte(loadedData.Substring(i, 2), 16);
            }
            loadedData = Encoding.UTF8.GetString(bytes, 0, bytes.Length);

            GlobalSaves.sv            = JsonUtility.FromJson <SaveInJson>(loadedData);
            GlobalSaves.saveInGame    = JsonHelper.FromJson <SaveInGame>(GlobalSaves.sv.saveInGame);
            GlobalVariables.isOnSound = GlobalSaves.sv.isOnSound;
            if (GlobalVariables.isOnSound == false)
            {
                GlobalVariables.isOnSound = true;
                Sounds.Invoke();
            }

            SaveInGame.SavesCountHelp = GlobalSaves.sv.SavesCountHelp;

            GlobalVariables.isPossessedHouse = GlobalSaves.sv.isPossessedHouse;
        }

        for (int numberAchievments = 0; numberAchievments < 38; numberAchievments++)
        {
            SaveInGame.isCompleteAchievment[numberAchievments]      = GlobalSaves.sv.completeAchievment[numberAchievments];
            SaveInGame.isPressCompleteAchievment[numberAchievments] = GlobalSaves.sv.isPressCompleteAchievment[numberAchievments];

            if (SaveInGame.isCompleteAchievment[numberAchievments] == true)
            {
                GlobalSceneObjects.achievmentsContent.transform.GetChild(numberAchievments).Find("Fish").Find("CountHelpImage").gameObject.SetActive(false);
                GlobalSceneObjects.achievmentsContent.transform.GetChild(numberAchievments).Find("Fish").Find("CheckMark").gameObject.SetActive(true);
            }
        }


        if (GlobalVariables.isRussianLanguage == true && GlobalVariables.isPossessedHouse == true)
        {
            GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TextMeshProUGUI>().text = "Одержимые";
        }
        if (GlobalVariables.isRussianLanguage == false && GlobalVariables.isPossessedHouse == true)
        {
            GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TextMeshProUGUI>().text = "Possessed";
        }
        if (GlobalVariables.isRussianLanguage == true && GlobalVariables.isPossessedHouse == false)
        {
            GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TextMeshProUGUI>().text = "Логические";
        }

        if (GlobalVariables.isRussianLanguage == false && GlobalVariables.isPossessedHouse == false)
        {
            GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TextMeshProUGUI>().text = "Logic";
        }

        CountImageHelp.Show();

        int currentLevel = 0;

        for (int nameLevels = 0; nameLevels < GlobalSceneObjects.contentBalls.transform.childCount; nameLevels++)
        {
            for (int row = 1; row < GlobalSceneObjects.contentBalls.transform.GetChild(nameLevels).GetChild(0).childCount - 1; row++)
            {
                for (int column = 0; column < GlobalSceneObjects.contentBalls.transform.GetChild(nameLevels).GetChild(0).GetChild(row).childCount - 1; column++)
                {
                    currentLevel++;

                    Reaction.SetReactionLevels(nameLevels, row, column, currentLevel);
                }
            }
            currentLevel = 0;
        }
        for (int numberAchievments = 0; numberAchievments < GlobalSceneObjects.achievmentsContent.transform.childCount; numberAchievments++)
        {
            Reaction.SetReactionAchievments(numberAchievments);
        }

        Reaction.SetReactionButtons();

        if (GlobalSaves.sv.firstLaunch == "false")
        {
            GlobalVariables.isFirstLaunchGame = false;
        }
        if (GlobalVariables.isFirstLaunchGame == true)
        {
            GlobalSaves.sv.SavesCountHelp = SaveInGame.SavesCountHelp;
            CountImageHelp.Show();
            if (Application.systemLanguage == SystemLanguage.Russian)
            {
                GlobalVariables.isRussianLanguage = true;
            }
            else
            {
                Language.SetEnglish(true);
            }
            GlobalSaves.sv.firstLaunch        = "false";
            GlobalVariables.isFirstLaunchGame = false;
            GlobalSaves.sv.Language           = GlobalVariables.isRussianLanguage;
            SaveData.Save();
        }

        else
        {
            if (GlobalSaves.sv.Language == false)
            {
                Language.SetEnglish(true);
            }
        }
        SaveInGame.isPressRateGame = GlobalSaves.sv.isPressRate;
        SaveInGame.numberJokeTask  = GlobalSaves.sv.numberJokeTask;

        coroutines.InvokeStartGameAndLoadAchievments();
    }
Example #3
0
    /// <summary>
    /// The player confirmed that he wants to skip the level.
    /// </summary>
    public static void PressYes()
    {
        Coroutines coroutines = GameObject.FindObjectOfType(typeof(Coroutines)) as Coroutines;

        GlobalVariables.stateForAnimation = (int)GlobalVariables.NameAnimation.TableSkip;

        SaveInGame.SavesCountHelp     = SaveInGame.SavesCountHelp - 3;
        GlobalSaves.sv.SavesCountHelp = SaveInGame.SavesCountHelp;

        if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests)
        {
            GlobalSaves.saveInGame[0].isSkipRateLevelsCheck[SaveInGame.numberLvlClick] = true;
        }

        if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.BestPractices)
        {
            GlobalSaves.saveInGame[1].isSkipRateLevelsCheck[SaveInGame.numberLvlClick] = true;
        }

        if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ScientistsNotes)
        {
            GlobalSaves.saveInGame[2].isSkipRateLevelsCheck[SaveInGame.numberLvlClick] = true;
        }

        if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ExperimentalProcess)
        {
            GlobalSaves.saveInGame[3].isSkipRateLevelsCheck[SaveInGame.numberLvlClick] = true;
        }

        if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.AcademicDegree)
        {
            GlobalSaves.saveInGame[4].isSkipRateLevelsCheck[SaveInGame.numberLvlClick] = true;
        }

        if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.SimpleLever)
        {
            GlobalSaves.saveInGame[5].isSkipRateLevelsCheck[SaveInGame.numberLvlClick] = true;
        }

        if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ElementaryLaws)
        {
            GlobalSaves.saveInGame[6].isSkipRateLevelsCheck[SaveInGame.numberLvlClick] = true;
        }

        if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.Mechanics)
        {
            GlobalSaves.saveInGame[7].isSkipRateLevelsCheck[SaveInGame.numberLvlClick] = true;
        }

        if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LatestDevelopments)
        {
            GlobalSaves.saveInGame[8].isSkipRateLevelsCheck[SaveInGame.numberLvlClick] = true;
        }

        SaveData.Save();
        CountImageHelp.Show();
        GlobalSceneObjects.tableSkip.GetComponent <Animator>().SetTrigger("HideTrigger");

        coroutines.PassedAndShowAchievments1();
        GlobalVariables.isSkipLevel = true;
        Victory.Invoke();
    }