protected override void OnReload(GameMode currentGameMode, bool maintainState) { BodyGUID = null; PenisGUID = null; BallsGUID = null; DisplayPenis = ChaControl.sex == 0; DisplayBalls = ChaControl.sex == 0 ? true : DefaultFemaleDisplayBalls.Value; var data = GetExtendedData(); if (data != null) { if (data.version == 1) { if (data.data.TryGetValue("DisplayBalls", out var loadedDisplayBalls)) { DisplayBalls = (bool)loadedDisplayBalls; } if (data.data.TryGetValue("UncensorGUID", out var loadedUncensorGUID) && loadedUncensorGUID != null) { string UncensorGUID = loadedUncensorGUID.ToString(); if (!UncensorGUID.IsNullOrWhiteSpace() && MigrationDictionary.TryGetValue(UncensorGUID, out MigrationData migrationData)) { BodyGUID = migrationData.BodyGUID; PenisGUID = migrationData.PenisGUID; BallsGUID = migrationData.BallsGUID; if (PenisGUID != null) { DisplayPenis = true; } } } } else { if (data.data.TryGetValue("BodyGUID", out var loadedUncensorGUID) && loadedUncensorGUID != null) { BodyGUID = loadedUncensorGUID.ToString(); } if (data.data.TryGetValue("PenisGUID", out var loadedPenisGUID) && loadedPenisGUID != null) { PenisGUID = loadedPenisGUID.ToString(); } if (data.data.TryGetValue("BallsGUID", out var loadedBallsGUID) && loadedBallsGUID != null) { BallsGUID = loadedBallsGUID.ToString(); } if (data.data.TryGetValue("DisplayPenis", out var loadedDisplayPenis)) { DisplayPenis = (bool)loadedDisplayPenis; } if (data.data.TryGetValue("DisplayBalls", out var loadedDisplayBalls)) { DisplayBalls = (bool)loadedDisplayBalls; } } } if (BodyGUID.IsNullOrWhiteSpace()) { BodyGUID = null; } if (PenisGUID.IsNullOrWhiteSpace()) { PenisGUID = null; } if (BallsGUID.IsNullOrWhiteSpace()) { BallsGUID = null; } if (MakerAPI.InsideAndLoaded) { if (MakerAPI.GetCharacterLoadFlags().Body) { if (MakerAPI.GetMakerBase().chaCtrl == ChaControl) { //Update the UI to match the loaded character if (BodyGUID == null || BodyList.IndexOf(BodyGUID) == -1) { //The loaded uncensor isn't on the list, possibly due to being forbidden BodyDropdown.SetValue(0, false); BodyGUID = null; } else { BodyDropdown.SetValue(BodyList.IndexOf(BodyGUID), false); } if (PenisGUID == null || PenisList.IndexOf(PenisGUID) == -1) { #if KK PenisDropdown.SetValue(DisplayPenis ? 0 : 1, false); #elif EC PenisDropdown.SetValue(0, false); #endif PenisGUID = null; } else { PenisDropdown.SetValue(PenisList.IndexOf(PenisGUID), false); } if (BallsGUID == null || BallsList.IndexOf(BallsGUID) == -1) { BallsDropdown.SetValue(DisplayBalls ? 0 : 1, false); BallsGUID = null; } else { BallsDropdown.SetValue(BallsList.IndexOf(BallsGUID), false); } } } else { //Set the uncensor stuff to whatever is set in the maker BodyGUID = BodyDropdown.Value == 0 ? null : BodyList[BodyDropdown.Value]; #if KK PenisGUID = PenisDropdown.Value == 0 || PenisDropdown.Value == 1 ? null : PenisList[PenisDropdown.Value]; DisplayPenis = PenisDropdown.Value == 1 ? false : true; #elif EC PenisGUID = PenisDropdown.Value == 0 ? null : PenisList[PenisDropdown.Value]; #endif BallsGUID = BallsDropdown.Value == 0 || BallsDropdown.Value == 1 ? null : BallsList[BallsDropdown.Value]; DisplayBalls = BallsDropdown.Value == 1 ? false : true; } } #if KK //Correct characters if genderbender is not permitted, except in Studio where it may be required for scene compatibility if (GenderBender.Value == false && !StudioAPI.InsideStudio) { DisplayPenis = ChaControl.sex == 0; DisplayBalls = ChaControl.sex == 0; } #endif //Update the uncensor on every load or reload UpdateUncensor(); }
protected override void OnReload(GameMode currentGameMode) { BodyGUID = null; PenisGUID = null; BallsGUID = null; DisplayPenis = ChaControl.sex == 0; DisplayBalls = ChaControl.sex == 0; var data = GetExtendedData(); if (data != null) { if (data.version == 1) { if (data.data.TryGetValue("DisplayBalls", out var loadedDisplayBalls)) { DisplayBalls = (bool)loadedDisplayBalls; } if (data.data.TryGetValue("UncensorGUID", out var loadedUncensorGUID) && loadedUncensorGUID != null) { string UncensorGUID = loadedUncensorGUID.ToString(); if (!UncensorGUID.IsNullOrWhiteSpace() && MigrationDictionary.TryGetValue(UncensorGUID, out MigrationData migrationData)) { BodyGUID = migrationData.BodyGUID; PenisGUID = migrationData.PenisGUID; BallsGUID = migrationData.BallsGUID; if (PenisGUID != null) { DisplayPenis = true; } } } } else { if (data.data.TryGetValue("BodyGUID", out var loadedUncensorGUID) && loadedUncensorGUID != null) { BodyGUID = loadedUncensorGUID.ToString(); } if (data.data.TryGetValue("PenisGUID", out var loadedPenisGUID) && loadedPenisGUID != null) { PenisGUID = loadedPenisGUID.ToString(); } if (data.data.TryGetValue("BallsGUID", out var loadedBallsGUID) && loadedBallsGUID != null) { BallsGUID = loadedBallsGUID.ToString(); } if (data.data.TryGetValue("DisplayPenis", out var loadedDisplayPenis)) { DisplayPenis = (bool)loadedDisplayPenis; } if (data.data.TryGetValue("DisplayBalls", out var loadedDisplayBalls)) { DisplayBalls = (bool)loadedDisplayBalls; } } } if (BodyGUID.IsNullOrWhiteSpace()) { BodyGUID = null; } if (PenisGUID.IsNullOrWhiteSpace()) { PenisGUID = null; } if (BallsGUID.IsNullOrWhiteSpace()) { BallsGUID = null; } if (MakerAPI.InsideAndLoaded) { DoDropdownEvents = false; if (MakerAPI.GetCharacterLoadFlags().Body) { if (MakerAPI.GetMakerBase().chaCtrl == ChaControl) { //Update the UI to match the loaded character if (BodyGUID == null || BodyList.IndexOf(BodyGUID) == -1) { //The loaded uncensor isn't on the list, possibly due to being forbidden BodyDropdown.Value = 0; BodyGUID = null; } else { BodyDropdown.Value = BodyList.IndexOf(BodyGUID); } if (PenisGUID == null || PenisList.IndexOf(PenisGUID) == -1) { PenisDropdown.Value = DisplayPenis ? 0 : 1; PenisGUID = null; } else { PenisDropdown.Value = PenisList.IndexOf(PenisGUID); } if (BallsGUID == null || BallsList.IndexOf(BallsGUID) == -1) { BallsDropdown.Value = DisplayBalls ? 0 : 1; BallsGUID = null; } else { BallsDropdown.Value = BallsList.IndexOf(BallsGUID); } } } else { //Set the uncensor stuff to whatever is set in the maker BodyGUID = BodyDropdown.Value == 0 ? null : BodyList[BodyDropdown.Value]; PenisGUID = PenisDropdown.Value == 0 || PenisDropdown.Value == 1 ? null : PenisList[PenisDropdown.Value]; BallsGUID = BallsDropdown.Value == 0 || BallsDropdown.Value == 1 ? null : BallsList[BallsDropdown.Value]; DisplayPenis = PenisDropdown.Value == 1 ? false : true; DisplayBalls = BallsDropdown.Value == 1 ? false : true; } DoDropdownEvents = true; } //Update the uncensor on every load or reload UpdateUncensor(); }