public static void PresetSave(Maid f_maid, CharacterMgr.PresetType f_type, CharacterMgr.Preset __result) { if (configEntryUtill["PresetSave", false]) { MyLog.LogMessage("CharacterMgr.PresetSavePost0: " + MyUtill.GetMaidFullName(f_maid) + " , " + __result.strFileName + " , " + __result.ePreType); } }
// add more MPN's to preset set method public static void ExtSet(ref MaidProp[] array, Maid f_maid, CharacterMgr.Preset f_prest) { List <MaidProp> customlist; List <MaidProp> baselist = array.ToList(); if (f_prest.ePreType == CharacterMgr.PresetType.Body) { customlist = (from mp in f_prest.listMprop where MPN_string_int["folder_eye2"] <= mp.idx && mp.idx <= MPN_string_int["skintoon"] select mp).ToList(); } else if (f_prest.ePreType == CharacterMgr.PresetType.Wear) { customlist = (from mp in f_prest.listMprop where MPN_string_int["acchandl"] <= mp.idx && mp.idx <= MPN_string_int["horns"] select mp).ToList(); } else if (f_prest.ePreType == CharacterMgr.PresetType.All) { customlist = (from mp in f_prest.listMprop where MPN_string_int["folder_eye2"] <= mp.idx && mp.idx <= MPN_string_int["horns"] select mp).ToList(); } else { customlist = null; } if (customlist != null) { baselist.AddRange(customlist); array = baselist.ToArray(); } }
/// <summary> /// 프리셋에서 불러온 메뉴들을 반납 /// </summary> /// <param name="f_prest"></param> /// <returns></returns> public static MaidProp[] getMaidProp(CharacterMgr.Preset f_prest) { // f_prest.strFileName // MaidProp[] array; if (f_prest.ePreType == CharacterMgr.PresetType.Body) { array = (from mp in f_prest.listMprop where (1 <= mp.idx && mp.idx <= 80) || (115 <= mp.idx && mp.idx <= 122) select mp).ToArray <MaidProp>(); } else if (f_prest.ePreType == CharacterMgr.PresetType.Wear) { array = (from mp in f_prest.listMprop where 81 <= mp.idx && mp.idx <= 110 select mp).ToArray <MaidProp>(); } else { array = (from mp in f_prest.listMprop where (1 <= mp.idx && mp.idx <= 110) || (115 <= mp.idx && mp.idx <= 122) select mp).ToArray <MaidProp>(); } return(array); }
void CharacterMgrPresetSet(CharacterMgr cMgr, Maid maid, CharacterMgr.Preset preset) { if (maid == null) { return; } SliderTemplates.Update(maid, PluginName); }
public static void PresetSetHook(CharacterMgr mgr, Maid maid, CharacterMgr.Preset preset) { if (!ExtPresetSupport.Enabled) { return; } if (preset.strFileName == null || !Path.GetExtension(preset.strFileName).Equals(".png", StringComparison.InvariantCulture)) { return; } var presetFile = Path.Combine(PresetPath, preset.strFileName); if (!File.Exists(presetFile)) { return; } using (var fs = File.OpenRead(presetFile)) { var buf = new byte[EXT_DATA_BEGIN_MAGIC.Length]; fs.Seek(-buf.Length, SeekOrigin.End); fs.Read(buf, 0, buf.Length); if (!BytesEqual(buf, EXT_DATA_END_MAGIC)) { Debug.Log($"[PNGPreset] No end magic found for {presetFile}"); return; } var pos = fs.Position - EXT_DATA_BEGIN_MAGIC.Length; while (true) { if (pos < 0) // Just make sure so we don't f up in case the user tampered with the file { return; } fs.Position = pos; fs.Read(buf, 0, buf.Length); if (BytesEqual(buf, EXT_DATA_BEGIN_MAGIC)) { break; } pos--; } ExtPresetSupport.LoadExPresetData(fs, maid); } }
private static bool Delete(ref CharacterMgr.Preset __0) { string path = Main.this4.PresetDirectory + "\\" + __0.strFileName + ".expreset.xml"; if (File.Exists(path)) { File.Delete(path); } return(false); }
// add more MPN's to preset set method public static void ExtSet(Maid f_maid, CharacterMgr.Preset f_prest) { global::MaidProp[] array; if (f_prest.ePreType == global::CharacterMgr.PresetType.Body) { array = (from mp in f_prest.listMprop where 88 <= mp.idx && mp.idx <= 96 select mp).ToArray <global::MaidProp>(); } else if (f_prest.ePreType == global::CharacterMgr.PresetType.Wear) { array = (from mp in f_prest.listMprop where 97 <= mp.idx && mp.idx <= 105 select mp).ToArray <global::MaidProp>(); } else if (f_prest.ePreType == global::CharacterMgr.PresetType.All) { array = (from mp in f_prest.listMprop where 88 <= mp.idx && mp.idx <= 105 select mp).ToArray <global::MaidProp>(); } else { array = null; } if (array != null) { for (int i = 0; i < array.Length; i++) { MaidProp maidProp = array[i]; if (maidProp.idx != 23) { f_maid.SetProp((MPN)maidProp.idx, maidProp.value, false); if (string.IsNullOrEmpty(maidProp.strFileName)) { string strFileName = maidProp.strFileName; if (CM3.dicDelItem.TryGetValue((MPN)maidProp.idx, out strFileName)) { maidProp.strFileName = strFileName; } } f_maid.SetProp((MPN)maidProp.idx, maidProp.strFileName, 0, false, false); if (CharacterMgr.EditModeLookHaveItem && !GameMain.Instance.CharacterMgr.GetPlayerParam().status.IsHaveItem(maidProp.strFileName)) { f_maid.DelProp((MPN)maidProp.idx, false); } } } } }
/// <summary> /// 프리셋 선택해서 메이드에게 입힐때 작동 /// </summary> /// <param name="__instance"></param> /// <param name="f_maid"></param> /// <param name="f_prest"></param> //[HarmonyPatch(typeof(CharacterMgr), "PresetSet")] //[HarmonyPrefix] public static void PresetSet(CharacterMgr __instance, Maid f_maid, CharacterMgr.Preset f_prest) { MyLog.LogMessage("PresetSetPretfix1.f_prest.strFileName:" + f_prest.strFileName ); //MaidProp[] array = PresetUtill.getMaidProp(f_prest); //foreach (MaidProp maidProp in array) //{ // MyLog.LogMessageS("PresetSetPretfix1: " + maidProp.idx + " , " + maidProp.strFileName); //} }
public static bool PresetSaveHook(CharacterMgr mgr, out CharacterMgr.Preset preset, Maid maid, CharacterMgr.PresetType presetType) { if (!Input.GetKey(KeyCode.LeftControl) && !Input.GetKey(KeyCode.LeftControl)) { preset = null; return(false); } preset = new CharacterMgr.Preset { ePreType = presetType, texThum = ThumShot.ShotThumPreset(maid) }; var bigThumTex = ThumUtil.MakeMaidThumbnail(maid); if (!Directory.Exists(PresetPath)) { Directory.CreateDirectory(PresetPath); } using (var bw = new BinaryWriter(File.Create(Path.Combine(PresetPath, $"pre_{maid.status.lastName}{maid.status.firstName}_{DateTime.Now:yyyyMMddHHmmss}.png")))) { // Load our layers and combine them // Janky AF, but it works, so /shrug Texture2D composedImagePreset; var backgroundLayer = LoadPNG(Path.Combine(LayerPath, "background.png")); composedImagePreset = CombineTextures(backgroundLayer, bigThumTex); var foregroundLayer = LoadPNG(Path.Combine(LayerPath, "foreground.png")); composedImagePreset = CombineTextures(composedImagePreset, foregroundLayer); bw.Write(composedImagePreset.EncodeToPNG()); bw.Write(mgr.PresetSaveNotWriteFile(maid, presetType)); var exData = ExtPresetSupport.SaveExPresetData(maid); if (exData != null) { bw.Write(EXT_DATA_BEGIN_MAGIC); bw.Write(exData); bw.Write(EXT_DATA_END_MAGIC); } } GameMain.Instance.SysDlg.Show( "Saved image as a preset card\n(If you want to save a normal preset, don't hold [CTRL] while saving)", SystemDialog.TYPE.OK); return(true); }
public static bool PresetLoadHook(CharacterMgr mgr, out CharacterMgr.Preset result, BinaryReader br, string fileName) { result = null; if (fileName == null || !Path.GetExtension(fileName).Equals(".png", StringComparison.InvariantCultureIgnoreCase)) { return(false); } var stream = br.BaseStream; var buf = new byte[IEND_MAGIC.Length]; var pos = 0; for (;; stream.Position = ++pos) { var len = stream.Read(buf, 0, buf.Length); if (len != IEND_MAGIC.Length) { return(true); } if (BytesEqual(buf, IEND_MAGIC)) { break; } } // Skip CRC stream.Position += 4; var prevPos = stream.Position; if (br.ReadString() != "CM3D2_PRESET") { return(true); } stream.Position = prevPos; result = mgr.PresetLoad(br, null); result.strFileName = fileName; return(true); }
public static void PresetSet(Maid f_maid, CharacterMgr.Preset f_prest) { if (configEntryUtill["PresetSet", false]) { return; } MyLog.LogMessage("CharacterMgr.PresetSet.f_prest.strFileName:" + f_prest.strFileName + " , " + f_prest.ePreType); MaidProp[] array = MyUtill.getMaidProp(f_prest); foreach (MaidProp maidProp in array) { if (maidProp.strFileName.Length > 0)// 값 없는거 출력 방지 { MyLog.LogMessage("PresetSetPostfix2: " + maidProp.idx.ToString().PadLeft(3) + " , " + maidProp.strFileName); } } }
// Token: 0x06000067 RID: 103 RVA: 0x000082D4 File Offset: 0x000064D4 public CharacterMgr.Preset PresetSave(Maid f_maid, CharacterMgr.PresetType f_type) { CharacterMgr.Preset preset = new CharacterMgr.Preset(); Texture2D texture2D = this.ThumShot(GameMain.Instance.MainCamera.camera, f_maid); MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write("CM3D2_PRESET"); binaryWriter.Write(1160); binaryWriter.Write((int)f_type); if (texture2D != null) { byte[] array = texture2D.EncodeToPNG(); binaryWriter.Write(array.Length); binaryWriter.Write(array); } else { binaryWriter.Write(0); } f_maid.SerializeProp(binaryWriter); f_maid.SerializeMultiColor(binaryWriter); f_maid.SerializeBody(binaryWriter); string text = string.Concat(new string[] { "pre_", f_maid.status.lastName, f_maid.status.firstName, "_", DateTime.Now.ToString("yyyyMMddHHmmss") }); text = UTY.FileNameEscape(text); text += ".preset"; string text2 = Path.GetFullPath(".\\") + "Preset"; if (!Directory.Exists(text2)) { Directory.CreateDirectory(text2); } File.WriteAllBytes(text2 + "\\" + text, memoryStream.ToArray()); memoryStream.Dispose(); preset.texThum = texture2D; preset.strFileName = text; preset.ePreType = f_type; return(preset); }
private static void SetMaidPreset(Maid m_maid, string file) { if (m_maid == null) { //MyLog.LogWarning("SetMaidPreset maid null"); return; } if (m_maid.IsBusy) { if (configEntryUtill["SetMaidPreset", false]) { MyLog.LogDebug("RandPreset Maid Is Busy"); } return; } if (configEntryUtill["SetMaidPreset", false]) { MyLog.LogDebug("SetMaidPreset select :" + file); } CharacterMgr.Preset preset = GameMain.Instance.CharacterMgr.PresetLoad(file); //Main.CustomPresetDirectory = Path.GetDirectoryName(file); //UnityEngine.Debug.Log("RandPreset preset path "+ GameMain.Instance.CharacterMgr.PresetDirectory); //preset.strFileName = file; if (preset == null) { if (configEntryUtill["SetMaidPreset", false]) { MyLog.LogDebug("SetMaidPreset preset null "); } return; } GameMain.Instance.CharacterMgr.PresetSet(m_maid, preset); if (Product.isPublic) { SceneEdit.AllProcPropSeqStart(m_maid); } }
public static void PresetSet(Maid f_maid, CharacterMgr.Preset f_prest) { MyLog.Log("PresetSet.Prefix" , MyUtill.GetMaidFullName(f_maid) , f_prest.strFileName ); switch (presetType) { case PresetType.Wear: f_prest.ePreType = CharacterMgr.PresetType.Wear; break; case PresetType.Body: f_prest.ePreType = CharacterMgr.PresetType.Body; break; case PresetType.All: f_prest.ePreType = CharacterMgr.PresetType.All; break; default: break; } }
public static void PresetSet(Maid f_maid, CharacterMgr.Preset f_prest) { ExPreset.Load(f_maid, f_prest); }
public static void PresetSetPreCall(CharacterMgr that, Maid f_maid, CharacterMgr.Preset f_prest) // 후킹시 원본 클래스도 같이 받도록 돼있음 // public void PresetSet(Maid f_maid, Preset f_prest)// 원본 { Lilly.Log(name + ".PresetSetPreCall:" + f_prest.strFileName); }
public static void PresetSavePostCallRet(CharacterMgr that, Maid f_maid, CharacterMgr.PresetType f_type, CharacterMgr.Preset preset) // 후킹시 원본 클래스도 같이 받도록 돼있음 // public Preset PresetSave(Maid f_maid, PresetType f_type) { Lilly.Log(name + ".PresetSavePostCallRet:" + preset.strFileName); }