public override void Outfit_Save(MsgObject message) { var characters = GetSelectedCharacters(); if (characters.Count > 0) { string date = GetTimeNow(); foreach (var chara in characters) { string prefix = chara.sex == 0 ? "KKCoordeM" : "KKCoordeF"; string path = Path.Combine(message.path, $"{prefix}_{date}.png"); Log(LogLevel.Message, $"Save outfit [{Path.GetFileName(path)}]"); PlaySaveSound(); DelayAction(() => { var chaFile = chara.charInfo.chaFile; var outfit = chaFile.coordinate[chaFile.status.coordinateType]; CustomCapture.CreatePng(ref outfit.pngData, 252, 352, null, null, Camera.main, null); outfit.coordinateName = "coordinateName"; outfit.SaveFile(path); }); } } else { Log(LogLevel.Message, "Select character before saving outfit"); PlayFailSound(); } }
// Copied from CustomControl.Start public override void Character_Save(MsgObject message) { var characters = GetSelectedCharacters(); if (characters.Count > 0) { string date = GetTimeNow(); //KKKiyase.ForceDisableOneFrame(); PlaySaveSound(); foreach (var item in characters) { var param = item.charInfo.fileParam; var charFile = item.oiCharInfo.charFile; var path = Path.Combine(message.path, $"{param.lastname}_{param.firstname}_{date}.png"); Log(LogLevel.Message, $"Save character [{Path.GetFileName(path)}]"); DelayAction(() => { Traverse.Create(charFile).Property("charaFileName").SetValue(Path.GetFileNameWithoutExtension(path)); CustomCapture.CreatePng(ref charFile.pngData, 252, 352, null, null, Camera.main, null); CustomCapture.CreatePng(ref charFile.facePngData, 240, 320, null, null, Camera.main, null); using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write)) { charFile.SaveCharaFile(fileStream, true); } }); } } else { Log(LogLevel.Message, "Select characters to save"); PlayFailSound(); } }
void SaveCard() { switch (currentType) { case 0: { Studio.Studio.Instance.dicObjectCtrl.Values.ToList().ForEach(x => x.OnSavePreprocessing()); Studio.Studio.Instance.sceneInfo.cameraSaveData = Studio.Studio.Instance.cameraCtrl.Export(); string path = GetCategoryFolder() + DateTime.Now.ToString("yyyy_MMdd_HHmm_ss_fff") + ".png"; Studio.Studio.Instance.sceneInfo.Save(path); var button = CreateSceneButton(GetCurrentList().transform, PngAssist.LoadTexture(path), path); button.transform.SetAsFirstSibling(); break; } case 1: { var list = (from v in GuideObjectManager.Instance.selectObjectKey select Studio.Studio.GetCtrlInfo(v) as OCIChar into v where v != null //where v.oiCharInfo.sex == 1 select v).ToList(); if (list.Count > 0) { confirmpanel.gameObject.SetActive(false); optionspanel.gameObject.SetActive(false); string format = ".png"; string date = DateTime.Now.ToString("yyyy_MMdd_HHmm_ss_fff"); string folder = GetCategoryFolder(); foreach (var item in list) { var param = item.charInfo.fileParam; var charFile = item.oiCharInfo.charFile; var path = string.Format("{0}{1}_{2}_{3}{4}", folder, param.lastname, param.firstname, date, format); Traverse.Create(charFile).Property("charaFileName").SetValue(Path.GetFileName(path)); CustomCapture.CreatePng(ref charFile.pngData, 252, 352, null, null, Camera.main, null); CustomCapture.CreatePng(ref charFile.facePngData, 252, 352, null, null, Camera.main, null); using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write)) { if (charFile.SaveCharaFile(fileStream, true)) { var button = CreateSceneButton(GetCurrentList().transform, PngAssist.LoadTexture(path), path); button.transform.SetAsFirstSibling(); } else { BepInEx.Logger.Log(BepInEx.Logging.LogLevel.Error, "Failed to save card at " + path); } } } } break; } case 2: { break; } } }