private static void ShopCheck() { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM Shop;"); while (CheckingUser <= AllUsers) { try { if (Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT isDoubleCoinsBonusActive FROM Shop WHERE id = {CheckingUser};")) == null) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET isDoubleCoinsBonusActive = {0} WHERE id = '" + CheckingUser + "';"); } } catch (Exception ex) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET isDoubleCoinsBonusActive = {0} WHERE id = '" + CheckingUser + "';"); } CheckingUser++; } if (CheckingUser > AllUsers) { CheckingUser = 1; } }
IEnumerator FalseForTimer() { isDieByTime = true; Handheld.Vibrate(); maytimerrun = false; isdied = true; gameoverfortimeleft.SetActive(false); timeleftpanel.SetActive(true); Instantiate(effect, effectpoint_timeleft.position, Quaternion.identity); yield return(new WaitForSeconds(1.5f)); timeleftpanel.SetActive(false); if (Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT isRevivalBonusActive FROM Shop WHERE id = {CurrentUser};")) == 1) { revival_bonus_panel.SetActive(true); } else { gameoverfortimeleft.SetActive(true); } now_number_task--; now_task_aftertimeexit.text = now_number_task.ToString(); max_tasks_aftertimeexit.text = limit_tasks.ToString(); }
IEnumerator FalseForTimer() { Handheld.Vibrate(); maytimerrun = false; isdied = true; gameoverfortimeleft.SetActive(false); timeleftpanel.SetActive(true); Instantiate(effect, effectpoint_timeleft.position, Quaternion.identity); yield return(new WaitForSeconds(1.5f)); timeleftpanel.SetActive(false); if (isrecord == true) { record_panel_after.SetActive(true); } if (Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT isRevivalBonusActive FROM Shop WHERE id = {CurrentUser};")) == 1) { revival_bonus_panel.SetActive(true); } else { gameoverfortimeleft.SetActive(true); } }
public void DeleteUser3() { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM PlayerStats WHERE id = {3};"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM IsLevelsFinished WHERE stroka = {3};"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM Shop WHERE id = {3};"); if (CountOfAllUsers == 4) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {3} WHERE id = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {3} WHERE stroka = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {3} WHERE id = 4;"); } if (CountOfAllUsers == 5) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {3} WHERE id = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {4} WHERE id = 5;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {3} WHERE stroka = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {4} WHERE stroka = 5;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {3} WHERE id = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {4} WHERE id = 5;"); } CountOfAllUsers--; PlayerPrefs.SetInt("AllUsers", CountOfAllUsers); AllUsersUpdate(); }
public static int Balance() //Дает возможность узнать баланс игрока { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM Shop;"); coins = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Coins FROM Shop WHERE id = {CurrentUser};")); return(coins); //Возвращает требуемый баланс монет }
public void CheckForPlusDoubleBonusTask() //Если куплен бонус Удвоение монет, то идет прибавление завершенных заданий { if (Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT isDoubleCoinsBonusActive FROM Shop WHERE id = {CurrentUser};")) == 1) { int doubleBonusFinishTasks = PlayerPrefs.GetInt("DoubleBonusFinishTasks"); doubleBonusFinishTasks++; PlayerPrefs.SetInt("DoubleBonusFinishTasks", doubleBonusFinishTasks); } }
public void OnAcceptUseRevivalBonusButtonClick() { revival_bonus_panel.SetActive(false); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET isRevivalBonusActive = {0} WHERE id = {CurrentUser};"); score--; maytimerrun = true; isdied = false; ChooseDifferentMode(); }
public void OnAcceptUseRevivalBonusButtonClick() { revival_bonus_panel.SetActive(false); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET isRevivalBonusActive = {0} WHERE id = {CurrentUser};"); now_number_task--; maytimerrun = true; isdied = false; ChooseLevelTaskGenerate(); }
public void CheckForPlusDoubleBonusTask() { if (Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT isDoubleCoinsBonusActive FROM Shop WHERE id = {CurrentUser};")) == 1) { int doubleBonusFinishTasks = PlayerPrefs.GetInt("DoubleBonusFinishTasks"); doubleBonusFinishTasks++; PlayerPrefs.SetInt("DoubleBonusFinishTasks", doubleBonusFinishTasks); } }
public void PlusCountLevelsFinished() { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM PlayerStats;"); int countLevelFinished = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT LevelsFinished FROM PlayerStats WHERE id = {CurrentUser};")); countLevelFinished++; MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET LevelsFinished = {countLevelFinished} WHERE id = {CurrentUser};"); }
public void DeleteUser5() { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM PlayerStats WHERE id = {5};"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM IsLevelsFinished WHERE stroka = {5};"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM Shop WHERE id = {5};"); CountOfAllUsers--; PlayerPrefs.SetInt("AllUsers", CountOfAllUsers); AllUsersUpdate(); }
public void SyncPlayerStats() { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM PlayerStats;"); nickname = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {CurrentUser};"); years_old = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT YearsOld FROM PlayerStats WHERE id = {CurrentUser};")); is_man_or_women = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT IsMenOrWomen FROM PlayerStats WHERE id = {CurrentUser};")); _class = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Class FROM PlayerStats WHERE id = {CurrentUser};")); levels_finished = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT LevelsFinished FROM PlayerStats WHERE id = {CurrentUser};")); all_plays_count = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT AllPlaysCount FROM PlayerStats WHERE id = {CurrentUser};")); score_easy_infinity_mode = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT ScoreEasyInfinityMode FROM PlayerStats WHERE id = {CurrentUser};")); score_middle_infinity_mode = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT ScoreMiddleInfinityMode FROM PlayerStats WHERE id = {CurrentUser};")); score_high_infinity_mode = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT ScoreHighInfinityMode FROM PlayerStats WHERE id = {CurrentUser};")); challenges_finished = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT ChallengesFinished FROM PlayerStats WHERE id = {CurrentUser};")); NamePlayerExit.text = nickname; AllPlaysCountExit.text = all_plays_count.ToString(); YearsOldExit.text = "Возраст: " + years_old.ToString(); ClassExit.text = "Класс: " + _class.ToString(); LevelsFinishedExit.text = levels_finished.ToString(); ScoreEasyInfinityModeExit.text = score_easy_infinity_mode.ToString(); ScoreMiddleInfinityModeExit.text = score_middle_infinity_mode.ToString(); ScoreHighInfinityModeExit.text = score_high_infinity_mode.ToString(); ChallengeFinishedExit.text = challenges_finished.ToString(); if (years_old == 0) { YearsOldExitObject.SetActive(false); } if (_class == 0) { ClassExitObject.SetActive(false); } if (is_man_or_women == 0) { GenderExitObject.SetActive(false); } else if (is_man_or_women == 1) { GenderExit.text = "Пол: Мужской"; } else if (is_man_or_women == 2) { GenderExit.text = "Пол: Женский"; } }
private void Start() { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM PlayerStats"); Application.targetFrameRate = PlayerPrefs.GetInt("FPS"); CurrentUser = PlayerPrefs.GetInt("CurrentUser"); int all_plays_count = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT AllPlaysCount FROM PlayerStats WHERE id = '" + CurrentUser + "';")); all_plays_count++; MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET AllPlaysCount = '" + all_plays_count + "' WHERE id = '" + CurrentUser + "';"); ChooseDifferentMode(); }
IEnumerator FinishingChallenge() { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM IsLevelsFinished;"); Reward.Coins(30); maytimerrun = false; int isChallengeFinished; if (TaskModes.isBulletChallengeMode == true) { isChallengeFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT BulletChallenge FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isChallengeFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET BulletChallenge = {1} WHERE stroka = {CurrentUser};"); PlusCountChallengesFinished(); } } if (TaskModes.isPodvoxChallengeMode == true) { isChallengeFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT PodvoxChallenge FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isChallengeFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET PodvoxChallenge = {1} WHERE stroka = {CurrentUser};"); PlusCountChallengesFinished(); } } if (TaskModes.isMeshalkaChallengeMode == true) { isChallengeFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT MeshalkaChallenge FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isChallengeFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET MeshalkaChallenge = {1} WHERE stroka = {CurrentUser};"); PlusCountChallengesFinished(); } } finish_panel.SetActive(true); yield return(new WaitForSeconds(0.3f)); Instantiate(effect, effect_medal_point.position, Quaternion.identity); }
public void CheckForFinishDoubleBonusTasks() //Проверка на выполнение 10 заданий при купленом бонусе { if (isDoubleBonusActive == 1 && PlayerPrefs.GetInt("DoubleBonusFinishTasks") >= 10) { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM Shop;"); EffectOfThunder.SetActive(false); NotifFinishDoubleBonusPanel.SetActive(true); PlayerPrefs.SetInt("DoubleBonusFinishTasks", 0); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET isDoubleCoinsBonusActive = {0} WHERE id = '" + CurrentUser + "';"); ShowEarnedCoins.text = "+" + CostOfDoubleBonus * 2; Reward.Coins(CostOfDoubleBonus * 2); coins = ShopManager.Balance(); ShowAllCoins.text = coins.ToString(); } }
public void OnResetFromProfilButtonClick() { menuButtons.SoundOfButtonClick(); PlayerPrefs.SetInt("first_start", 0); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM PlayerStats;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM IsLevelsFinished;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM Shop"); PlayerPrefs.SetInt("AllUsers", 0); PlayerPrefs.SetInt("FPS", 60); PlayerPrefs.SetInt("isSoundActive", 1); PlayerPrefs.SetInt("isMusicActive", 1); StartCoroutine(LoadLevel("Menu")); }
public static void SpecialPodvoxTasks() { isTaskString = true; DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM PodvoxTasks"); choose_type_question = UnityEngine.Random.Range(1, 10); choose_right_answer = UnityEngine.Random.Range(1, 4); task = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Task FROM PodvoxTasks WHERE number = {choose_type_question};"); question_text = task; right_answer_string = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT RightAnswer FROM PodvoxTasks WHERE number = {choose_type_question};"); choose_fake_answer1_string = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FakeAnswer1 FROM PodvoxTasks WHERE number = {choose_type_question};"); choose_fake_answer2_string = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FakeAnswer2 FROM PodvoxTasks WHERE number = {choose_type_question};"); }
public static void Level10() { isTaskString = false; DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM DiskriminantTasks"); choose_type_question = UnityEngine.Random.Range(1, 21); choose_right_answer = UnityEngine.Random.Range(1, 4); task = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Task FROM DiskriminantTasks WHERE Number = {choose_type_question};"); question_text = "Найдите дискриминант " + task; right_answer = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT RightAnswer FROM DiskriminantTasks WHERE Number = {choose_type_question};")); choose_fake_answer1 = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FakeAnswer1 FROM DiskriminantTasks WHERE Number = {choose_type_question};")); choose_fake_answer2 = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FakeAnswer2 FROM DiskriminantTasks WHERE Number = {choose_type_question};")); }
public static void Level7() { isTaskString = false; DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM ProchentTasks"); choose_type_question = UnityEngine.Random.Range(1, 11); choose_right_answer = UnityEngine.Random.Range(1, 4); prochent = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Prochent FROM ProchentTasks WHERE Number = {choose_type_question};"); chislo = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Chislo FROM ProchentTasks WHERE Number = {choose_type_question};"); question_text = "Найдите " + prochent + "% от " + chislo; right_answer = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT RightAnswer FROM ProchentTasks WHERE Number = {choose_type_question};")); choose_fake_answer1 = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FakeAnswer1 FROM ProchentTasks WHERE Number = {choose_type_question};")); choose_fake_answer2 = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FakeAnswer2 FROM ProchentTasks WHERE Number = {choose_type_question};")); }
IEnumerator False() { isDieByTime = false; Handheld.Vibrate(); maytimerrun = false; isdied = true; gameover.SetActive(false); aftergameover.SetActive(true); if (LevelsDataBase.isTaskString == true) { right_answer_after_gameover.text = LevelsDataBase.right_answer_string; } else { right_answer_after_gameover.text = LevelsDataBase.right_answer.ToString(); } Instantiate(effect, effectpoint_gameover.position, Quaternion.identity); yield return(new WaitForSeconds(2.5f)); aftergameover.SetActive(false); if (Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT isRevivalBonusActive FROM Shop WHERE id = {CurrentUser};")) == 1) { revival_bonus_panel.SetActive(true); //Если есть бонус возрождения, откроется окошко с предложением использовать его } else { gameover.SetActive(true); } if (now_number_task > 1) { now_number_task--; } now_task_aftergameover.text = now_number_task.ToString(); max_tasks_aftergameover.text = limit_tasks.ToString(); }
public void UpdateShop() { if (PlayerPrefs.GetInt("CheckedUSS") != 1) //Выход из метода и новая попытка через корутин при не выполненной проверки USS { StartCoroutine(UpdateShopEnableSystem()); return; } DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM Shop;"); coins = ShopManager.Balance(); isRevivalBonusActive = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT isRevivalBonusActive FROM Shop WHERE id = {CurrentUser};")); isDoubleBonusActive = Convert.ToInt32(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT isDoubleCoinsBonusActive FROM Shop WHERE id = {CurrentUser};")); CoinsExit.text = coins.ToString(); CostOfRevivalBonusText.text = CostOfRevivalBonus.ToString(); CostOfDoubleBonusText.text = CostOfDoubleBonus.ToString(); CheckForFinishDoubleBonusTasks(); CheckCanUserBuyBonuses(); }
public void RoleUpdate() { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM ZvaniesTable;"); if (levels_finished < 3 || score_easy_infinity_mode < 5) { Zvanie = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Zvanies FROM ZvaniesTable WHERE number = {1};"); Color c1 = new Color(55, 255, 12, 255); zvanie.color = c1; } if (levels_finished >= 3 && score_easy_infinity_mode >= 5) { Zvanie = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Zvanies FROM ZvaniesTable WHERE number = {2};"); RanksIcons[0].SetActive(true); ShadowRanks[0].SetActive(false); Color c2 = new Color(12, 255, 234, 255); zvanie.color = c2; } if (levels_finished >= 5 && score_middle_infinity_mode >= 4 && score_easy_infinity_mode >= 10) { Zvanie = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Zvanies FROM ZvaniesTable WHERE number = {3};"); RanksIcons[1].SetActive(true); ShadowRanks[1].SetActive(false); Color c3 = new Color(125, 102, 241, 255); zvanie.color = c3; } if (levels_finished >= 6 && score_middle_infinity_mode >= 10 && score_easy_infinity_mode >= 10) { Zvanie = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Zvanies FROM ZvaniesTable WHERE number = {4};"); RanksIcons[2].SetActive(true); ShadowRanks[2].SetActive(false); Color c4 = new Color(252, 14, 235, 255); zvanie.color = c4; } if (levels_finished >= 9 && score_high_infinity_mode >= 4 && score_middle_infinity_mode >= 15 && score_easy_infinity_mode >= 10) { Zvanie = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Zvanies FROM ZvaniesTable WHERE number = {5};"); RanksIcons[3].SetActive(true); ShadowRanks[3].SetActive(false); Color c5 = new Color(255, 38, 47, 255); zvanie.color = c5; } if (levels_finished == 12 && score_high_infinity_mode >= 8 && score_middle_infinity_mode >= 15 && score_easy_infinity_mode >= 10) { Zvanie = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT Zvanies FROM ZvaniesTable WHERE number = {6};"); RanksIcons[4].SetActive(true); ShadowRanks[4].SetActive(false); Color c6 = new Color(255, 222, 43, 255); zvanie.color = c6; } zvanie.text = Zvanie; }
public void DeleteUser1() { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM PlayerStats WHERE id = {1};"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM IsLevelsFinished WHERE stroka = {1};"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"DELETE FROM Shop WHERE id = {1};"); if (CountOfAllUsers == 2) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {1} WHERE id = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {1} WHERE stroka = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {1} WHERE id = 2;"); } if (CountOfAllUsers == 3) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {1} WHERE id = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {2} WHERE id = 3;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {1} WHERE stroka = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {2} WHERE stroka = 3;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {1} WHERE id = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {2} WHERE id = 3;"); } if (CountOfAllUsers == 4) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {1} WHERE id = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {2} WHERE id = 3;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {3} WHERE id = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {1} WHERE stroka = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {2} WHERE stroka = 3;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {3} WHERE stroka = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {1} WHERE id = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {2} WHERE id = 3;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {3} WHERE id = 4;"); } if (CountOfAllUsers == 5) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {1} WHERE id = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {2} WHERE id = 3;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {3} WHERE id = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET id = {4} WHERE id = 5;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {1} WHERE stroka = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {2} WHERE stroka = 3;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {3} WHERE stroka = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET stroka = {4} WHERE stroka = 5;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {1} WHERE id = 2;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {2} WHERE id = 3;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {3} WHERE id = 4;"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET id = {4} WHERE id = 5;"); } CountOfAllUsers--; PlayerPrefs.SetInt("AllUsers", CountOfAllUsers); AllUsersUpdate(); if (CountOfAllUsers == 0) { PlayerPrefs.SetInt("first_start", 0); WaitForLoadPanel.SetActive(true); Invoke("LoadLevel", 0.6f); } }
IEnumerator Right() { StartCoroutine(RestartTimer()); rightpanel.SetActive(true); answer_panel1.SetActive(false); answer_panel2.SetActive(false); answer_panel3.SetActive(false); CheckForPlusDoubleBonusTask(); //Если куплен бонус Удвоение монет, то идет прибавление завершенных заданий Instantiate(effect, effectpoint.position, Quaternion.identity); yield return(new WaitForSeconds(1f)); rightpanel.SetActive(false); if (now_number_task < limit_tasks) { now_task.text = now_number_task.ToString(); answer_panel1.SetActive(true); answer_panel2.SetActive(true); answer_panel3.SetActive(true); ChooseLevelTaskGenerate(); } else { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM IsLevelsFinished;"); int isLevelFinished; if (Levels.level_now == 1) { Reward.Coins(10); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT OneLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET OneLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 2) { Reward.Coins(20); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT TwoLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET TwoLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 3) { Reward.Coins(25); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT ThreeLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET ThreeLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 4) { Reward.Coins(30); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FourLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET FourLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 5) { Reward.Coins(35); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FiveLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET FiveLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 6) { Reward.Coins(40); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT SixLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET SixLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 7) { Reward.Coins(50); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT SevenLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET SevenLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 8) { Reward.Coins(60); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT EightLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET EightLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 9) { Reward.Coins(70); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NineLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET NineLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 10) { Reward.Coins(80); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT TenLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET TenLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 11) { Reward.Coins(90); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT ElevenLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET ElevenLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } if (Levels.level_now == 12) { Reward.Coins(100); isLevelFinished = Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT TwelveLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")); if (isLevelFinished == 0) { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE IsLevelsFinished SET TwelveLevel = {1} WHERE stroka = {CurrentUser};"); PlusCountLevelsFinished(); } } ShowReceivedCoins.text = "+" + Reward.GlobalRewardCoins.ToString(); ShowBalance.text = (ShopManager.Balance()).ToString(); maytimerrun = false; finishpanel.SetActive(true); yield return(new WaitForSeconds(0.3f)); Instantiate(effect, effect_medal_point.position, Quaternion.identity); } }
// <----------------------------------------------- FIRST ACCOUNT FOR USER! ---------------------------------------------> public void OnAcceptDataPlayerButtonClick() { menuButtons.SoundOfButtonClick(); nickname = NamePlayerEnter.text; int lengthNickname = nickname.Length; if (string.IsNullOrWhiteSpace(YearsOldEnter.text)) { years_old = 0; } else { years_old = Convert.ToInt32(YearsOldEnter.text); } if (string.IsNullOrWhiteSpace(ClassEnter.text)) { _class = 0; } else { _class = Convert.ToInt32(ClassEnter.text); } if (string.IsNullOrWhiteSpace(NamePlayerEnter.text)) { error_name_player_panel.SetActive(true); ErorFromNickname.text = "Имя не может быть пустое"; } else if (lengthNickname > 13) { error_name_player_panel.SetActive(true); ErorFromNickname.text = "Максимальное количество букв в имени 13"; } else { menuButtons.first_enter_panel.SetActive(false); WaitForLoadPanelSystem(); try { MyDataBaseConnection.ExecuteQueryWithoutAnswer($"INSERT INTO PlayerStats (NamePlayer, AllPlaysCount, YearsOld, IsMenOrWomen, Class, LevelsFinished, ScoreEasyInfinityMode, ScoreMiddleInfinityMode, ScoreHighInfinityMode, ChallengesFinished, id) VALUES ('" + nickname + "', '" + 0 + "', '" + years_old + "', '" + is_man_or_women + "', '" + _class + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 1 + "');"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"INSERT INTO IsLevelsFinished (OneLevel, TwoLevel, ThreeLevel, FourLevel, FiveLevel, SixLevel, SevenLevel, EightLevel, NineLevel, TenLevel, ElevenLevel, TwelveLevel, BulletChallenge, PodvoxChallenge, MeshalkaChallenge, stroka) VALUES ('" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "' ,'" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 1 + "');"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"INSERT INTO Shop (Coins, isRevivalBonusActive, isDoubleCoinsBonusActive, id) VALUES ('" + 0 + "', '" + 0 + "', '" + 0 + "', '" + 1 + "');"); } catch (Exception ex) { Debug.Log(ex); } SyncPlayerStats(); PlayerPrefs.SetInt("first_start", 1); Invoke("LoadLevel", 0.8f); } }
public static int GlobalRewardCoins; //Позволяет другим скриптам узнать сколько монет получил игрок public static void Coins(int coins) //Вознаграждает игрока указанными монетами { ShopManager.coins = ShopManager.Balance() + coins; GlobalRewardCoins = coins; MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET Coins = '" + ShopManager.coins + "' WHERE id = '" + ShopManager.CurrentUser + "';"); }
public static void MinusCoinsFromBalance(int coinsMinus) // вычитает из баланса указанное количество монет { coins = Balance(); coins -= coinsMinus; MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE Shop SET Coins = '" + coins + "' WHERE id = '" + CurrentUser + "';"); }
// <----------------------------------------------- EDIT ACCOUNT FOR USER! ---------------------------------------------> public void OnAcceptEditDataPlayerButtonClick() { menuButtons.SoundOfButtonClick(); CurrentUser = PlayerPrefs.GetInt("CurrentUser"); int lengthNickname = nickname.Length; if (string.IsNullOrWhiteSpace(EditYearsOldEnter.text)) { years_old = 0; } else { years_old = Convert.ToInt32(EditYearsOldEnter.text); } if (string.IsNullOrWhiteSpace(EditClassEnter.text)) { _class = 0; } else { _class = Convert.ToInt32(EditClassEnter.text); } if (string.IsNullOrWhiteSpace(EditNamePlayerEnter.text)) { error_name_player_edit_panel.SetActive(true); ErorFromEditNickname.text = "Имя не может быть пустое"; } else if (lengthNickname > 13) { error_name_player_edit_panel.SetActive(true); ErorFromEditNickname.text = "Максимальное количество букв в имени 13"; } else { menuButtons.profil_panel.SetActive(false); WaitForLoadPanelSystem(); try { nickname = EditNamePlayerEnter.text; MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET NamePlayer = '" + nickname + "' WHERE id = '" + CurrentUser + "';"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET YearsOld = '" + years_old + "' WHERE id = '" + CurrentUser + "';"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET Class = '" + _class + "' WHERE id = '" + CurrentUser + "';"); MyDataBaseConnection.ExecuteQueryWithoutAnswer($"UPDATE PlayerStats SET IsMenOrWomen = '" + is_man_or_women + "' WHERE id = '" + CurrentUser + "';"); } catch (Exception ex) { Debug.Log(ex); } edit_button.SetActive(true); edit_name_panel.SetActive(false); error_name_player_edit_panel.SetActive(false); SyncPlayerStats(); Invoke("LoadLevel", 0.8f); } }
public void SyncLevelsFinished() { DataTable playerboard = MyDataBaseConnection.GetTable("SELECT * FROM IsLevelsFinished;"); if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT OneLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[0].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT TwoLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[1].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT ThreeLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[2].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FourLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[3].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT FiveLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[4].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT SixLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[5].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT SevenLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[6].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT EightLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[7].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NineLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[8].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT TenLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[9].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT ElevenLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[10].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT TwelveLevel FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { LevelsFinishedIcons[11].SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT BulletChallenge FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { BulletChallengeFinishedIcon.SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT PodvoxChallenge FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { PodvoxChallengeFinishedIcon.SetActive(true); } if (Convert.ToInt16(MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT MeshalkaChallenge FROM IsLevelsFinished WHERE stroka = {CurrentUser};")) == 1) { MeshalkaChallengeFinishedIcon.SetActive(true); } }
public void AllUsersUpdate() { CurrentUser = PlayerPrefs.GetInt("CurrentUser"); AllUsers.text = (PlayerPrefs.GetInt("AllUsers")).ToString(); CountOfAllUsers = PlayerPrefs.GetInt("AllUsers"); if (CountOfAllUsers == 0) { UsersButtons[0].SetActive(false); UsersButtons[1].SetActive(false); UsersButtons[2].SetActive(false); UsersButtons[3].SetActive(false); UsersButtons[4].SetActive(false); PlayerPrefs.SetInt("first_start", 0); StartCoroutine(LoadLevel("Menu")); } if (CountOfAllUsers == 1) { NewUserButton.SetActive(true); User1NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {1};"); UsersButtons[0].SetActive(true); UsersButtons[1].SetActive(false); UsersButtons[2].SetActive(false); UsersButtons[3].SetActive(false); UsersButtons[4].SetActive(false); } if (CountOfAllUsers == 2) { NewUserButton.SetActive(true); User1NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {1};"); User2NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {2};"); UsersButtons[0].SetActive(true); UsersButtons[1].SetActive(true); UsersButtons[2].SetActive(false); UsersButtons[3].SetActive(false); UsersButtons[4].SetActive(false); } if (CountOfAllUsers == 3) { NewUserButton.SetActive(true); User1NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {1};"); User2NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {2};"); User3NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {3};"); UsersButtons[0].SetActive(true); UsersButtons[1].SetActive(true); UsersButtons[2].SetActive(true); UsersButtons[3].SetActive(false); UsersButtons[4].SetActive(false); } if (CountOfAllUsers == 4) { NewUserButton.SetActive(true); User1NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {1};"); User2NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {2};"); User3NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {3};"); User4NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {4};"); UsersButtons[0].SetActive(true); UsersButtons[1].SetActive(true); UsersButtons[2].SetActive(true); UsersButtons[3].SetActive(true); UsersButtons[4].SetActive(false); } if (CountOfAllUsers == 5) { NewUserButton.SetActive(false); User1NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {1};"); User2NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {2};"); User3NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {3};"); User4NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {4};"); User5NameExit.text = MyDataBaseConnection.ExecuteQueryWithAnswer($"SELECT NamePlayer FROM PlayerStats WHERE id = {5};"); UsersButtons[0].SetActive(true); UsersButtons[1].SetActive(true); UsersButtons[2].SetActive(true); UsersButtons[3].SetActive(true); UsersButtons[4].SetActive(true); } }