public static GameDialogHelperCharaController GetGameDialogHelperController(this SaveData.Player player) { GameDialogHelperCharaController controller = null; player.SafeProc(h => h.chaCtrl.SafeProcObject(cc => controller = cc.GetGameDialogHelperController())); return(controller); }
public static void SceneUnloaded_Girls(Scene scene) { // Compile the girls. Manager.Game game = Manager.Game.Instance; if (game == null || scene.name != "MyRoom") { return; } player = game.Player; if (KK_Wardrobe.IncludePlayer.Value) { girls.Add(new Girl( () => player.charaBase, () => player.chaCtrl, () => player.charFile )); } foreach (SaveData.Heroine girl in game.HeroineList) { if (!girl.isTeacher) { girls.Add(new Girl( () => girl.charaBase, () => girl.chaCtrl, () => girl.charFile )); } } }
public static void Update_Girls() { if (girls.Count == 0) { return; } if (player?.charaBase == null) { player = null; girls.Clear(); return; } foreach (Girl girl in girls) { girl.Update(); } }
/// <summary> /// Get ChaFiles that are related to this player. Warning: It might not return some copies. /// </summary> public static IEnumerable <ChaFileControl> GetRelatedChaFiles(this SaveData.Player player) { if (player == null) { throw new ArgumentNullException(nameof(player)); } var results = new HashSet <ChaFileControl>(); if (player.charFile != null) { results.Add(player.charFile); } if (player.chaCtrl != null && player.chaCtrl.chaFile != null) { results.Add(player.chaCtrl.chaFile); } return(results); }
public static Guid GetPlayerGuid(this SaveData.Player player, int guidVersion = PluginDataInfo.CurrentSaveGuidVersion) { return(player.GetCharaGuid(guidVersion)); }
internal static void ApplySettings(Apply apply) { // Refresh character list Utilities.LoadCharList(); // Set counter for number of cards applied to int appliedNo = 0; // Get currently viewed ClassList int currSchoolClass = Traverse.Create(Utilities.ClassroomScene.classRoomList).Field("_page").GetValue <IntReactiveProperty>().Value; // If character is Minase Ai, add her to players class Utilities.CharaList.Find(x => ((SaveData.Heroine)x).fixCharaID == -10).schoolClass = 1; foreach (SaveData.CharaData chaData in apply == Apply.Class ? Utilities.CharaList.Where(c => c.schoolClass == currSchoolClass) : Utilities.CharaList) { if (apply == Apply.Card && CurrClassData != null && chaData.schoolClassIndex != CurrClassData.data.schoolClassIndex) { continue; } if (!((SaveData.Heroine)chaData).isTeacher) { if (currSchoolClass == 4) { // Set cards for Fixed Characters SetRandomClothes(CurrClassData.data.charFile); appliedNo++; if (apply == Apply.Card) { break; } } else { SetRandomClothes(chaData.charFile); appliedNo++; } } if (chaData.chaCtrl != null) { chaData.chaCtrl.chaFile.coordinate = chaData.charFile.coordinate; } } // Reset Minase Ai to fixed character list CharaList.Find(x => ((SaveData.Heroine)x).fixCharaID == -10).schoolClass = -1; // Apply colors to player SaveData.Player player = Singleton <Manager.Game> .Instance.Player; if (apply != Apply.Card) { if (apply == Apply.All || currSchoolClass == player.schoolClass) { Colors.SetColors(player.charFile); appliedNo++; if (player.chaCtrl != null) { player.chaCtrl.chaFile.coordinate = player.charFile.coordinate; } } } // Play sound and write message Utils.Sound.Play(SystemSE.ok_l); Logger.Log(BepInEx.Logging.LogLevel.Message, String.Format("Successfully changed clothes for {0} characters!", appliedNo)); }