private void Dif_Checked(object sender, RoutedEventArgs e) { if (DifDesc is null) { return; } if (sender is CheckBox box) { // dif select if (box.Name.Equals(nameof(Dif_easy))) { selectedDiff = Config.Difficulty.Easy; DifDesc.Text = " \u2022 Reduced hard to reach spots.\n" + " \u2022 No RNG for: Uplinks, Amida fans, billboards.\n" + " \u2022 No rare spawns (unique hard-to-reach)."; } else if (box.Name.Equals(nameof(Dif_Normal))) { selectedDiff = Config.Difficulty.Normal; DifDesc.Text = " \u2022 Balanced as originally intended,\n be ready for quite a challenge."; } else if (box.Name.Equals(nameof(Dif_NM))) { selectedDiff = Config.Difficulty.Nightmare; DifDesc.Text = " \u2022 Super hard enemy placements.\n" + " \u2022 You agree to suffer.\n" + " \u2022 Hard-to-reach spots rarity boost.\n" + " \u2022 You agree to become soil."; } DisableDifBoxes(box); } }
// ----------------------------------------------------------------------------------- /// <summary> /// Saves game results into the save file /// </summary> private void SaveResults(out bool isBestTime, out bool isHighScore) { Data.CharacterStats stats = Data.SaveFile.instance.GetCharacterStats(sourceFile.guid); Data.RoundData roundData = stats.rounds[round]; Data.Records records = roundData.records[Config.instance.difficulty]; // only set as cleared if not on easy AND round is one less than the last one if (!roundData.cleared) { bool isHardOnlyRound = round == Config.Rounds - 1; Config.Difficulty diff = Config.instance.difficulty; roundData.cleared = diff == Config.Difficulty.Hard || (diff == Config.Difficulty.Normal && !isHardOnlyRound); } float elapsed = Timer.instance.elapsedTime; isBestTime = records.bestTime == -1 || elapsed < records.bestTime; if (isBestTime) { records.bestTime = elapsed; } long scoreL = (long)score; isHighScore = scoreL > records.highScore; if (isHighScore) { records.highScore = scoreL; } Data.SaveFile.instance.Save(); }
public Settings() { InitializeComponent(); // load cfg to controls checkbox_RngOnRestart.IsChecked = Config.GetInstance().Gen_RngOnRestart; checkbox_RngCybervoid.IsChecked = Config.GetInstance().Gen_RngCV; checkbox_RngTargets.IsChecked = Config.GetInstance().Gen_RngTargets; checkbox_SlideForceTrigger.IsChecked = Config.GetInstance().Settings_RemoveForceSlideTrigger; checkbox_SettingForcedRestart.IsChecked = Config.GetInstance().Settings_ForcedRestart; checkbox_EnableOverlay.IsChecked = Config.GetInstance().Settings_EnableOverlay; // diff difBoxes = new List <CheckBox>() { Dif_easy, Dif_Normal, Dif_NM }; selectedDiff = Config.GetInstance().Setting_Difficulty; switch (selectedDiff) { case Config.Difficulty.Easy: Dif_easy.IsChecked = true; break; case Config.Difficulty.Normal: Dif_Normal.IsChecked = true; break; case Config.Difficulty.Nightmare: Dif_NM.IsChecked = true; break; } // debug? enable all difficulties for testing/debugging only if (Debugger.IsAttached) { difBoxes.ForEach(x => x.IsHitTestVisible = true); } }