/// <summary> /// Returns a ChaFileCoordinate instance from the selected coordinate in CharaMaker. /// </summary> public static ChaFileCoordinate GetSelectedCoordinate() { ChaCustom.CustomCoordinateFile clothesFile = Singleton <ChaCustom.CustomCoordinateFile> .Instance; ChaCustom.CustomFileListCtrl listCtrl = Traverse.Create(clothesFile).Field("listCtrl").GetValue <ChaCustom.CustomFileListCtrl>(); ChaCustom.CustomFileInfoComponent selected = listCtrl.GetSelectTopItem(); if (selected != null) { string fullPath = selected.info.FullPath; ChaFileCoordinate tmp = new ChaFileCoordinate(); tmp.LoadFile(fullPath); return(tmp); } else { return(null); } }
/// <summary> /// Used to increment the selected character / coordinate in the maker. /// </summary> public static void IncrementSelectIndex() { if (KK_Archetypes.IncrementFlag) { // Increment character select index if (KK_Archetypes._loadCharaToggle.isOn && (Body.AnyToggles() || Face.AnyToggles() || Hair.AnyToggles())) { ChaCustom.CustomFileListCtrl listControl = Singleton <ChaCustom.CustomFileListCtrl> .Instance; List <ChaCustom.CustomFileInfo> fileInfos = Traverse.Create(listControl).Field("lstFileInfo").GetValue <List <ChaCustom.CustomFileInfo> >(); if (fileInfos != null) { int nextindex = fileInfos.IndexOf(fileInfos.Find(x => x.index == listControl.GetSelectIndex()[0])) + 1; listControl.ToggleAllOff(); if (nextindex < listControl.GetInclusiveCount()) { listControl.SelectItem(fileInfos[nextindex].index); } } } // Increment coordinate select index if (KK_Archetypes._loadCosToggle.isOn && Clothes._toggleClothes.Value) { ChaCustom.CustomCoordinateFile clothesFile = Singleton <ChaCustom.CustomCoordinateFile> .Instance; ChaCustom.CustomFileListCtrl listControl = Traverse.Create(clothesFile).Field("listCtrl").GetValue <ChaCustom.CustomFileListCtrl>(); List <ChaCustom.CustomFileInfo> fileInfos = Traverse.Create(listControl).Field("lstFileInfo").GetValue <List <ChaCustom.CustomFileInfo> >(); if (fileInfos != null) { int nextindex = fileInfos.IndexOf(fileInfos.Find(x => x.index == listControl.GetSelectIndex()[0])) + 1; listControl.ToggleAllOff(); if (nextindex < listControl.GetInclusiveCount()) { listControl.SelectItem(fileInfos[nextindex].index); } } } } }
public static void StartPostFix(ChaCustom.CustomCoordinateFile __instance) => ChangeRowCount((ChaCustom.CustomFileWindow)__instance.GetField("fileWindow"));