using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using PlayerStatus; using Schedule; using UnityEngine; using wf; public class CharacterMgr : MonoBehaviour { public static Dictionary npcDatas { get; private set; } public static bool EditModeLookHaveItem { get { return CharacterMgr.m_bEditMode; } set { CharacterMgr.m_bEditMode = value; } } public GameObject CharacterAll { get { return this.m_goCharacter; } } public Status status { get { return this.m_PlayerStatus; } } public Maid GetMaid(int nMaidNo) { return (this.m_gcActiveMaid.Length > nMaidNo) ? this.m_gcActiveMaid[nMaidNo] : null; } public Maid GetMaid(string guid) { for (int i = 0; i < this.m_gcActiveMaid.Length; i++) { if (this.m_gcActiveMaid[i] != null && this.m_gcActiveMaid[i].status.guid == guid) { return this.m_gcActiveMaid[i]; } } return null; } public int GetMaidCount() { return this.m_gcActiveMaid.Length; } public Maid GetMan(int nManNo) { return (this.m_gcActiveMan.Length > nManNo) ? this.m_gcActiveMan[nManNo] : null; } public int GetManCount() { return this.m_gcActiveMan.Length; } public List GetStockMaidList() { return this.m_listStockMaid; } public Maid GetStockMaid(int nStockNo) { return this.m_listStockMaid[nStockNo]; } public Maid GetStockMaid(string guid) { for (int i = 0; i < this.m_listStockMaid.Count; i++) { if (this.m_listStockMaid[i].status.guid == guid) { return this.m_listStockMaid[i]; } } return null; } public Maid GetStockNpcMaid(int nStockNo) { return this.m_listStockNpcMaid[nStockNo]; } public Maid GetStockNpcMaid(string guid) { for (int i = 0; i < this.m_listStockNpcMaid.Count; i++) { if (this.m_listStockNpcMaid[i].status.guid == guid) { return this.m_listStockNpcMaid[i]; } } return null; } public Maid GetStockMan(int nStockNo) { return this.m_listStockMan[nStockNo]; } public Maid GetStockMan(string guid) { for (int i = 0; i < this.m_listStockMan.Count; i++) { if (this.m_listStockMan[i].status.guid == guid) { return this.m_listStockMan[i]; } } return null; } public Maid GetStockNpcMan(int nStockNo) { return this.m_listStockNpcMan[nStockNo]; } public Maid GetStockNpcMan(string guid) { for (int i = 0; i < this.m_listStockNpcMan.Count; i++) { if (this.m_listStockNpcMan[i].status.guid == guid) { return this.m_listStockNpcMan[i]; } } return null; } public int GetStockMaidCount() { return this.m_listStockMaid.Count; } public int GetStockManCount() { return this.m_listStockMan.Count; } public static void CreateNpcData() { if (CharacterMgr.npcDatas != null) { return; } CharacterMgr.npcDatas = new Dictionary(); string text = "character_preset_basedata.nei"; using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text)) { using (CsvParser csvParser = new CsvParser()) { bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, text + "\nopen failed."); for (int i = 1; i < csvParser.max_cell_y; i++) { CharacterMgr.NpcData npcData = new CharacterMgr.NpcData(csvParser, i); CharacterMgr.npcDatas.Add(npcData.uniqueName, npcData); } } } } private void Awake() { CharacterMgr.CreateNpcData(); } private void Start() { } public void OnDestroy() { foreach (Maid obj in this.m_listStockNpcMan) { UnityEngine.Object.DestroyImmediate(obj); } this.m_listStockNpcMan.Clear(); foreach (Maid obj2 in this.m_listStockMan) { UnityEngine.Object.DestroyImmediate(obj2); } this.m_listStockMan.Clear(); foreach (Maid obj3 in this.m_listStockNpcMaid) { UnityEngine.Object.DestroyImmediate(obj3); } this.m_listStockNpcMaid.Clear(); foreach (Maid obj4 in this.m_listStockMaid) { UnityEngine.Object.DestroyImmediate(obj4); } this.m_listStockMaid.Clear(); } public void Init(GameMain f_gcGameMain) { BoneMorph.Init(); this.m_PlayerStatus = new Status(); this.m_goCharacter = new GameObject("Character"); this.m_goCharacter.transform.parent = f_gcGameMain.transform; this.m_goActive = new GameObject("Active"); this.m_goActive.transform.parent = this.m_goCharacter.transform; this.m_goAllOffset = new GameObject("AllOffset"); this.m_goAllOffset.transform.parent = this.m_goActive.transform; this.m_goStock = new GameObject("Stock"); this.m_goStock.transform.parent = this.m_goCharacter.transform; this.m_goStockMaid = new GameObject("Maid"); this.m_goStockMaid.transform.SetParent(this.m_goStock.transform, false); this.m_goStockNpcMaid = new GameObject("NpcMaid"); this.m_goStockNpcMaid.transform.SetParent(this.m_goStock.transform, false); this.m_goStockMan = new GameObject("Man"); this.m_goStockMan.transform.SetParent(this.m_goStock.transform, false); this.m_goStockNpcMan = new GameObject("NpcMan"); this.m_goStockNpcMan.transform.SetParent(this.m_goStock.transform, false); this.m_goChaches = new GameObject("_Caches"); this.m_goChaches.transform.SetParent(this.m_goCharacter.transform, false); } public bool TryGetCacheObject(string f_key, out GameObject f_outObj) { return this.m_dicCaches.TryGetValue(f_key, out f_outObj); } public void AddCacheObject(string f_key, GameObject f_obj) { f_obj.transform.SetParent(this.m_goChaches.transform, false); this.m_dicCaches[f_key] = f_obj; } public Maid AddStockMaid() { return this.AddStock(false, false); } public Maid AddStockNpcMaid() { return this.AddStock(false, true); } public Maid AddStockNpcMan() { return this.AddStock(true, true); } public Maid AddStockMan() { return this.AddStock(true, false); } private Maid AddStock(bool f_bMan, bool f_bNpc) { GameObject gameObject = new GameObject(); gameObject.name = ((!f_bMan) ? ((!f_bNpc) ? "StockMaid" : "StockNpcMaid") : ((!f_bNpc) ? "StockMan" : "StockNpcMan")); gameObject.transform.SetParent((!f_bMan) ? ((!f_bNpc) ? this.m_goStockMaid.transform : this.m_goStockNpcMaid.transform) : ((!f_bNpc) ? this.m_goStockMan.transform : this.m_goStockNpcMan.transform), false); Maid maid = gameObject.AddComponent(); maid.boNPC = f_bNpc; ((!f_bMan) ? ((!f_bNpc) ? this.m_listStockMaid : this.m_listStockNpcMaid) : ((!f_bNpc) ? this.m_listStockMan : this.m_listStockNpcMan)).Add(maid); maid.Initialize((!f_bMan) ? "Maid" : "Man", f_bMan); maid.Visible = false; return maid; } public void SetActiveMaid(Maid f_maid, int f_nActiveSlotNo) { this.SetActive(f_maid, f_nActiveSlotNo, false); } public void SetActiveMan(Maid f_maid, int f_nActiveSlotNo) { this.SetActive(f_maid, f_nActiveSlotNo, true); } private void SetActive(Maid f_maid, int f_nActiveSlotNo, bool f_bMan) { GameObject[] array = (!f_bMan) ? this.m_objActiveMaid : this.m_objActiveMan; Maid[] array2 = (!f_bMan) ? this.m_gcActiveMaid : this.m_gcActiveMan; if (array2[f_nActiveSlotNo] == f_maid) { return; } if (array[f_nActiveSlotNo] != null) { this.Deactivate(f_nActiveSlotNo, f_bMan); } f_maid.ActiveSlotNo = f_nActiveSlotNo; GameObject gameObject = f_maid.gameObject; gameObject.transform.SetParent(this.m_goAllOffset.transform, false); for (int i = 0; i < array.Length; i++) { if (array[i] == gameObject) { array[i] = null; array2[i] = null; } } gameObject.name = ((!f_bMan) ? "Maid[" : "Man[") + f_nActiveSlotNo.ToString() + "]"; if (!f_bMan) { GameObject gameObject2 = gameObject; string name = gameObject2.name; gameObject2.name = string.Concat(new string[] { name, " ", f_maid.status.firstName, " ", f_maid.status.lastName }); } array[f_nActiveSlotNo] = gameObject; array2[f_nActiveSlotNo] = f_maid; f_maid.DutPropAll(); f_maid.AllProcPropSeqStart(); } public Maid Activate(int f_nActiveSlot, int f_nStockSlot, bool f_bMan, bool f_bNpc) { List list = (!f_bMan) ? ((!f_bNpc) ? this.m_listStockMaid : this.m_listStockNpcMaid) : ((!f_bNpc) ? this.m_listStockMan : this.m_listStockNpcMan); Maid maid = list[f_nStockSlot]; if (f_bMan) { this.SetActiveMan(maid, f_nActiveSlot); } else { this.SetActiveMaid(maid, f_nActiveSlot); } return maid; } public Maid ActivateNpc(int f_nActiveSlot) { for (int i = 0; i < 3; i++) { Maid stockNpcMaid = this.GetStockNpcMaid(i); if (stockNpcMaid.ActiveSlotNo == -1) { return this.Activate(f_nActiveSlot, i, false, true); } } NDebug.Assert("Subメイドとして同時に扱える上限を超えています(" + 3.ToString() + "体までです", false); return null; } public void SwapActiveSlot(int slotNoA, int slotNoB, bool isMan) { GameObject[] array = (!isMan) ? this.m_objActiveMaid : this.m_objActiveMan; Maid[] array2 = (!isMan) ? this.m_gcActiveMaid : this.m_gcActiveMan; if (array2[slotNoA] == null || array2[slotNoB] == null) { Debug.LogError(string.Concat(new object[] { "ActiveSlot番号", slotNoA, "と", slotNoB, "を交換しようとしましたが、nullが入っています" })); return; } GameObject gameObject = array[slotNoA]; array[slotNoA] = array[slotNoB]; array[slotNoB] = gameObject; string name = array2[slotNoA].gameObject.name; array2[slotNoA].gameObject.name = array2[slotNoB].gameObject.name; array2[slotNoB].gameObject.name = name; Maid maid = array2[slotNoA]; array2[slotNoA] = array2[slotNoB]; array2[slotNoB] = maid; int activeSlotNo = array2[slotNoA].ActiveSlotNo; array2[slotNoA].ActiveSlotNo = array2[slotNoB].ActiveSlotNo; array2[slotNoB].ActiveSlotNo = activeSlotNo; } public void DeactivateCharaAll() { this.DeactivateMaidAll(); this.DeactivateManAll(); this.ResetCharaPosAll(); } public void DeactivateMaid(int f_nActiveSlotNo) { this.Deactivate(f_nActiveSlotNo, false); } public void DeactivateMaid(Maid f_maidActive) { this.Deactivate(f_maidActive.ActiveSlotNo, false); } public void DeactivateMaidAll() { this.CharaVisible(0, false, false); Maid maid = this.GetMaid(0); for (int i = 1; i < this.m_gcActiveMaid.Length; i++) { this.Deactivate(i, false); } } public void DeactivateMan(int f_nActiveSlotNo) { this.Deactivate(f_nActiveSlotNo, true); } public void DeactivateMan(Maid f_manActive) { this.Deactivate(f_manActive.ActiveSlotNo, true); } public void DeactivateManAll() { for (int i = 0; i < this.GetManCount(); i++) { this.CharaVisible(i, false, true); } } public void Deactivate(int f_nActiveSlotNo, bool f_bMan) { if (f_nActiveSlotNo == -1) { return; } GameObject[] array = (!f_bMan) ? this.m_objActiveMaid : this.m_objActiveMan; Maid[] array2 = (!f_bMan) ? this.m_gcActiveMaid : this.m_gcActiveMan; GameObject gameObject = array[f_nActiveSlotNo]; Maid maid = array2[f_nActiveSlotNo]; if (gameObject == null || maid == null) { return; } Debug.Log("Deactivate " + maid.status.firstName); GameObject gameObject2 = (!f_bMan) ? ((!maid.boNPC) ? this.m_goStockMaid : this.m_goStockNpcMaid) : ((!maid.boNPC) ? this.m_goStockMan : this.m_goStockNpcMan); if (gameObject == null) { return; } if (!f_bMan && maid.body0 != null) { maid.body0.MuneYureL(1f); maid.body0.MuneYureR(1f); } maid.Visible = false; maid.ActiveSlotNo = -1; maid.Uninit(); maid.LipSyncEnabled(true); gameObject.transform.SetParent(gameObject2.transform, false); gameObject.name = ((!f_bMan) ? ((!maid.boNPC) ? "StockMaid" : "StockNpcMaid") : ((!maid.boNPC) ? "StockMan" : "StockNpcMan")); if (!f_bMan) { GameObject gameObject3 = gameObject; string name = gameObject3.name; gameObject3.name = string.Concat(new string[] { name, " ", maid.status.firstName, " ", maid.status.lastName }); } array[f_nActiveSlotNo] = null; array2[f_nActiveSlotNo] = null; } public void BanishmentMaid(int f_nStockNo) { this.Banishment(f_nStockNo, false); } public void BanishmentMaid(Maid f_maid) { this.BanishmentMaid(f_maid, false); } public void BanishmentMan(int f_nStockNo) { this.Banishment(f_nStockNo, true); } public void BanishmentMan(Maid f_maid) { this.BanishmentMaid(f_maid, true); } private void Banishment(int f_nStockNo, bool f_bMan) { List list = (!f_bMan) ? this.m_listStockMaid : this.m_listStockMan; if (f_nStockNo < 0 || list.Count <= f_nStockNo) { NDebug.Assert("Banishment メイドストック数より大きいIndexが設定されました。" + f_nStockNo, false); } Maid maid = list[f_nStockNo]; if (maid == null) { NDebug.Assert("Banishment メイドストックはあるのにメイドが居ません。" + f_nStockNo, false); } this.BanishmentMaid(maid, f_bMan); } public void BanishmentMaid(Maid f_maid, bool f_bMan) { List list = (!f_bMan) ? this.m_listStockMaid : this.m_listStockMan; if (f_maid.ActiveSlotNo != -1) { this.Deactivate(f_maid.ActiveSlotNo, f_bMan); } list.Remove(f_maid); if (f_maid != null) { UnityEngine.Object.DestroyImmediate(f_maid.gameObject); } } public Maid CharaVisible(int f_nActiveSlot, bool f_bVisible, bool f_bMan) { Maid[] array = (!f_bMan) ? this.m_gcActiveMaid : this.m_gcActiveMan; Maid maid = array[f_nActiveSlot]; if (maid == null) { return null; } maid.Visible = f_bVisible; return maid; } public void ManAlphaUpdate() { for (int i = 0; i < this.m_listStockMan.Count; i++) { this.m_listStockMan[i].ManColorUpdate(); } } public void LoadDefault() { if (!this.IsBusy()) { for (int i = 0; i < 3; i++) { Maid maid = this.AddStockNpcMaid(); maid.Visible = false; } for (int j = 0; j < 6; j++) { Maid maid2 = this.AddStockMan(); this.SetActiveMan(maid2, j); maid2.Visible = false; } } } public void VisibleAll(bool f_bVisible) { for (int i = 0; i < this.GetMaidCount(); i++) { Maid maid = this.GetMaid(i); if (maid != null) { maid.Visible = f_bVisible; } } for (int j = 0; j < this.GetManCount(); j++) { Maid man = this.GetMan(j); if (man != null) { man.Visible = f_bVisible; } } } public bool IsBusy() { bool flag = false; for (int i = 0; i < this.m_gcActiveMaid.Length; i++) { Maid maid = this.GetMaid(i); if (maid != null) { flag |= maid.IsBusy; } } for (int j = 0; j < this.m_gcActiveMan.Length; j++) { Maid man = this.GetMan(j); if (man != null) { flag |= man.IsBusy; } } return flag; } public void ResetCharaPosAll() { this.SetCharaAllPos(Vector3.zero); this.SetCharaAllRot(Vector3.zero); this.CharaAllOfsetPos(Vector3.zero); this.CharaAllOfsetRot(Vector3.zero); for (int i = 0; i < this.m_listStockMaid.Count; i++) { Maid maid = this.m_listStockMaid[i]; maid.SetPos(Vector3.zero); maid.SetRot(Vector3.zero); maid.SetPosOffset(Vector3.zero); if (maid.body0 != null) { maid.body0.SetBoneHitHeightY(0f); } } for (int j = 0; j < this.m_listStockNpcMaid.Count; j++) { Maid maid2 = this.m_listStockNpcMaid[j]; maid2.SetPos(Vector3.zero); maid2.SetRot(Vector3.zero); maid2.SetPosOffset(Vector3.zero); if (maid2.body0 != null) { maid2.body0.SetBoneHitHeightY(0f); } } for (int k = 0; k < this.m_listStockMan.Count; k++) { Maid maid3 = this.m_listStockMan[k]; maid3.SetPos(Vector3.zero); maid3.SetRot(Vector3.zero); maid3.SetPosOffset(Vector3.zero); if (maid3.body0 != null) { maid3.body0.SetBoneHitHeightY(0f); } } for (int l = 0; l < this.m_listStockNpcMan.Count; l++) { Maid maid4 = this.m_listStockNpcMan[l]; maid4.SetPos(Vector3.zero); maid4.SetRot(Vector3.zero); maid4.SetPosOffset(Vector3.zero); if (maid4.body0 != null) { maid4.body0.SetBoneHitHeightY(0f); } } } public void SetCharaAllPos(Vector3 f_vecLocalPos) { this.m_goActive.transform.localPosition = f_vecLocalPos; } public Vector3 GetCharaAllPos() { return this.m_goActive.transform.localPosition; } public void SetCharaAllRot(Vector3 f_vecLocalRot) { this.m_goActive.transform.localRotation = Quaternion.Euler(f_vecLocalRot); } public Vector3 GetCharaAllRot() { return this.m_goActive.transform.localRotation.eulerAngles; } public void CharaAllOfsetPos(Vector3 f_vecLocalPos) { this.m_goAllOffset.transform.localPosition = f_vecLocalPos; } public Vector3 GetCharaAllOfsetPos() { return this.m_goAllOffset.transform.localPosition; } public void CharaAllOfsetRot(Vector3 f_vecLocalRot) { this.m_goAllOffset.transform.localRotation = Quaternion.Euler(f_vecLocalRot); } public Vector3 GetCharaAllOfsetRot() { return this.m_goAllOffset.transform.localRotation.eulerAngles; } public void GetOffsetMaid(Maid f_maidMy, int f_nCSTSplitNum, out Vector3 f_vecOutCharOffset, out Vector3 f_vecOutAllOfs, CharacterMgr.CharaPer f_cIn) { f_cIn.vecOffsDouParGreater *= 100000f; f_cIn.vecOffsDouParLess *= 100000f; f_cIn.vecOffsShinChoGreater *= 100000f; f_cIn.vecOffsShinChoLess *= 100000f; f_cIn.vecOffsMuneLGreater *= 100000f; f_cIn.vecOffsMuneLLess *= 100000f; f_cIn.vecHaremDouPerGreater *= 100000f; f_cIn.vecHaremDouPerLess *= 100000f; f_cIn.vecHaremShinChoGreater *= 100000f; f_cIn.vecHaremShinChoLess *= 100000f; f_cIn.vecHaremMuneLGreater *= 100000f; f_cIn.vecHaremMuneLLess *= 100000f; NDebug.Assert(f_nCSTSplitNum != 0, "分割数は0以外でなければいけません。"); MaidProp prop = f_maidMy.GetProp(MPN.DouPer); int num; if (prop.boTempDut) { num = prop.temp_value - 50; } else { num = prop.value - 50; } prop = f_maidMy.GetProp(MPN.sintyou); int num2; if (prop.boTempDut) { num2 = prop.temp_value - 50; } else { num2 = prop.value - 50; } Vector3 a; Vector3 a2; if (0 <= num) { a = (float)num * f_cIn.vecOffsDouParGreater / (float)f_nCSTSplitNum; a2 = (float)num * f_cIn.vecHaremDouPerGreater / (float)f_nCSTSplitNum; } else { int num3 = f_nCSTSplitNum * -1; a = (float)num * f_cIn.vecOffsDouParLess / (float)num3; a2 = (float)num * f_cIn.vecHaremDouPerLess / (float)num3; } Vector3 b; Vector3 b2; if (0 <= num2) { b = (float)num2 * f_cIn.vecOffsShinChoGreater / (float)f_nCSTSplitNum; b2 = (float)num2 * f_cIn.vecHaremShinChoGreater / (float)f_nCSTSplitNum; } else { int num4 = f_nCSTSplitNum * -1; b = (float)num2 * f_cIn.vecOffsShinChoLess / (float)num4; b2 = (float)num2 * f_cIn.vecHaremShinChoLess / (float)num4; } prop = f_maidMy.GetProp(MPN.MuneL); int num5; if (prop.boTempDut) { num5 = prop.temp_value - 50; } else { num5 = prop.value - 50; } Vector3 b3; Vector3 b4; if (0 <= num5) { b3 = (float)num5 * f_cIn.vecOffsMuneLGreater / (float)f_nCSTSplitNum; b4 = (float)num5 * f_cIn.vecHaremMuneLGreater / (float)f_nCSTSplitNum; } else { int num6 = f_nCSTSplitNum * -1; b3 = (float)num5 * f_cIn.vecOffsMuneLLess / (float)num6; b4 = (float)num5 * f_cIn.vecHaremMuneLLess / (float)num6; } f_vecOutCharOffset = a + b + b3; f_vecOutCharOffset /= 100000f; f_vecOutAllOfs = a2 + b2 + b4; f_vecOutAllOfs /= 100000f; } public void GetOffsetMan(Maid f_maidTarget, int f_nCSTSplitNum, bool f_bPenisDetailMode, out Vector3 f_vecOutPenis, out Vector3 f_vecOutCharOffset, CharacterMgr.CharaPer f_cIn, CharacterMgr.PenisPer f_cPenisPer) { f_cIn.vecOffsDouParGreater *= 100000f; f_cIn.vecOffsDouParLess *= 100000f; f_cIn.vecOffsShinChoGreater *= 100000f; f_cIn.vecOffsShinChoLess *= 100000f; f_cIn.vecOffsMuneLGreater *= 100000f; f_cIn.vecOffsMuneLLess *= 100000f; f_cIn.vecHaremDouPerGreater *= 100000f; f_cIn.vecHaremDouPerLess *= 100000f; f_cIn.vecHaremShinChoGreater *= 100000f; f_cIn.vecHaremShinChoLess *= 100000f; f_cIn.vecHaremMuneLGreater *= 100000f; f_cIn.vecHaremMuneLLess *= 100000f; f_cPenisPer.vecPenisCommonBase *= 100000f; f_cPenisPer.vecPenisAmend *= 100000f; f_cPenisPer.vecPenisDouPerGreater *= 100000f; f_cPenisPer.vecPenisDouPerLess *= 100000f; f_cPenisPer.vecPenisShinchoGreater *= 100000f; f_cPenisPer.vecPenisShinchoLess *= 100000f; MaidProp prop = f_maidTarget.GetProp(MPN.DouPer); int num; if (prop.boTempDut) { num = prop.temp_value - 50; } else { num = prop.value - 50; } prop = f_maidTarget.GetProp(MPN.sintyou); int num2; if (prop.boTempDut) { num2 = prop.temp_value - 50; } else { num2 = prop.value - 50; } Vector3 a; if (0 <= num) { a = (float)num * f_cIn.vecOffsDouParGreater / (float)f_nCSTSplitNum; } else { int num3 = f_nCSTSplitNum * -1; a = (float)num * f_cIn.vecOffsDouParLess / (float)num3; } Vector3 b; if (0 <= num2) { b = (float)num2 * f_cIn.vecOffsShinChoGreater / (float)f_nCSTSplitNum; } else { int num4 = f_nCSTSplitNum * -1; b = (float)num2 * f_cIn.vecOffsShinChoLess / (float)num4; } prop = f_maidTarget.GetProp(MPN.MuneL); int num5; if (prop.boTempDut) { num5 = prop.temp_value - 50; } else { num5 = prop.value - 50; } Vector3 b2; if (0 <= num5) { b2 = (float)num5 * f_cIn.vecOffsMuneLGreater / (float)f_nCSTSplitNum; } else { int num6 = f_nCSTSplitNum * -1; b2 = (float)num5 * f_cIn.vecOffsMuneLLess / (float)num6; } Vector3 vector = a + b + b2; Vector3 a2 = Vector3.zero; Vector3 b3 = Vector3.zero; if (f_bPenisDetailMode) { if (0 <= num) { a2 = (float)num * (f_cPenisPer.vecPenisDouPerGreater - f_cPenisPer.vecPenisCommonBase) / (float)f_nCSTSplitNum; } else { int num3 = f_nCSTSplitNum * -1; a2 = (float)num * (f_cPenisPer.vecPenisDouPerLess - f_cPenisPer.vecPenisCommonBase) / (float)num3; } if (0 <= num2) { b3 = (float)num2 * (f_cPenisPer.vecPenisShinchoGreater - f_cPenisPer.vecPenisCommonBase) / (float)f_nCSTSplitNum; } else { int num4 = f_nCSTSplitNum * -1; b3 = (float)num2 * (f_cPenisPer.vecPenisShinchoLess - f_cPenisPer.vecPenisCommonBase) / (float)num4; } } f_vecOutPenis = a2 + b3 + f_cPenisPer.vecPenisCommonBase + f_cPenisPer.vecPenisAmend; f_vecOutPenis /= 100000f; f_vecOutCharOffset = vector; f_vecOutCharOffset /= 100000f; } public Vector3 SetMaidOffsetPos(Maid f_maid, int f_nCSTSplitNum, CharacterMgr.CharaPer f_cIn) { Vector3 zero = Vector3.zero; Vector3 zero2 = Vector3.zero; this.GetOffsetMaid(f_maid, f_nCSTSplitNum, out zero, out zero2, f_cIn); f_maid.SetPos(zero); return zero2; } public void SetMaidOffsetOther(List> f_listMaid, int f_nCSTSplitNum) { Vector3 vector = Vector3.zero; Vector3 vector2 = Vector3.zero; for (int i = 0; i < f_listMaid.Count; i++) { vector = this.SetMaidOffsetPos(f_listMaid[i].Key, f_nCSTSplitNum, f_listMaid[i].Value); if (vector2.y < vector.y) { vector2 = vector; } } this.m_goAllOffset.transform.localPosition = new Vector3(0f, vector2.y, 0f); } public void SetManOffsetPos(Maid f_manMy, Maid f_maidTarget, int f_nCSTSplitNum, bool f_bPenisDetailMode, CharacterMgr.CharaPer f_cIn, CharacterMgr.PenisPer f_cPenisPer) { Vector3 vecChinkoOffset; Vector3 pos; this.GetOffsetMan(f_maidTarget, f_nCSTSplitNum, f_bPenisDetailMode, out vecChinkoOffset, out pos, f_cIn, f_cPenisPer); f_manMy.body0.vecChinkoOffset = vecChinkoOffset; f_manMy.SetPos(pos); } public Texture2D ThumShot(Maid f_maid) { return GameMain.Instance.ThumCamera.GetComponent().ShotThumPreset(f_maid); } public static string CreatePresetLowCapacityData(Maid maid, CharacterMgr.PresetType presset_type) { MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); string result = string.Empty; binaryWriter.Write("CM3D2_PRESET_S"); binaryWriter.Write(1140); binaryWriter.Write((char)presset_type); maid.SerializePropLowCapacity(binaryWriter); maid.SerializeMultiColor(binaryWriter); result = "^CM3D2P^" + Convert.ToBase64String(Utility.ZlibCompresss(memoryStream.ToArray())); binaryWriter.Close(); memoryStream.Dispose(); return result; } public CharacterMgr.Preset PresetSave(Maid f_maid, CharacterMgr.PresetType f_type) { CharacterMgr.Preset preset = new CharacterMgr.Preset(); Texture2D texture2D = this.ThumShot(f_maid); MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write("CM3D2_PRESET"); binaryWriter.Write(1140); 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 fullPath = Path.GetFullPath(".\\"); string text2 = fullPath + "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; } public void PresetSaveAsQRCode(Maid f_maid, CharacterMgr.PresetType f_type) { Texture2D texture2D = Utility.CreateQRCodeTexture(CharacterMgr.CreatePresetLowCapacityData(f_maid, f_type), 512, 512); Sprite sprite = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2)); sprite.name = "qr"; byte[] bytes = texture2D.EncodeToPNG(); string text = string.Concat(new string[] { "pre_", f_maid.status.lastName, f_maid.status.firstName, "_", DateTime.Now.ToString("yyyyMMddHHmmss") }); text = UTY.FileNameEscape(text); text += ".png"; string fullPath = Path.GetFullPath(".\\"); string text2 = fullPath + "Preset"; if (!Directory.Exists(text2)) { Directory.CreateDirectory(text2); } File.WriteAllBytes(text2 + "\\" + text, bytes); } public static CharacterMgr.Preset LoadePresetLowCapacityData(string data_text) { if (string.IsNullOrEmpty(data_text) || data_text.IndexOf("^CM3D2P^") != 0) { return null; } data_text = data_text.Replace("^CM3D2P^", string.Empty); byte[] array = Convert.FromBase64String(data_text); array = Utility.ZlibUncompress(array); CharacterMgr.Preset preset = new CharacterMgr.Preset(); preset.strFileName = string.Empty; using (MemoryStream memoryStream = new MemoryStream(array)) { BinaryReader binaryReader = new BinaryReader(memoryStream); string a = binaryReader.ReadString(); NDebug.Assert(a == "CM3D2_PRESET_S", "低用量プリセットファイルのヘッダーが不正です。"); int num = binaryReader.ReadInt32(); preset.ePreType = (CharacterMgr.PresetType)binaryReader.ReadChar(); preset.listMprop = Maid.DeserializePropLowCapacity(binaryReader); preset.aryPartsColor = Maid.DeserializeMultiColorPre(binaryReader); binaryReader.Close(); } return preset; } public CharacterMgr.Preset PresetLoad(string f_strFileName) { FileStream fileStream = new FileStream(f_strFileName, FileMode.Open); if (fileStream == null) { return null; } byte[] buffer = new byte[fileStream.Length]; fileStream.Read(buffer, 0, (int)fileStream.Length); fileStream.Close(); fileStream.Dispose(); BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer)); CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName)); binaryReader.Close(); return result; } public CharacterMgr.Preset PresetLoadFromResources(string f_strFileName) { TextAsset textAsset = Resources.Load("Preset/" + f_strFileName) as TextAsset; NDebug.Assert(textAsset != null, "内部Resourcesからファイル[" + f_strFileName + "]を読み込めませんでした"); BinaryReader binaryReader = new BinaryReader(new MemoryStream(textAsset.bytes)); CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName)); binaryReader.Close(); Resources.UnloadAsset(textAsset); return result; } public CharacterMgr.Preset PresetLoad(BinaryReader brRead, string f_strFileName) { CharacterMgr.Preset preset = new CharacterMgr.Preset(); preset.strFileName = f_strFileName; string a = brRead.ReadString(); NDebug.Assert(a == "CM3D2_PRESET", "プリセットファイルのヘッダーが不正です。"); int num = brRead.ReadInt32(); preset.nVersion = num; int ePreType = brRead.ReadInt32(); preset.ePreType = (CharacterMgr.PresetType)ePreType; int num2 = brRead.ReadInt32(); if (num2 != 0) { byte[] data = brRead.ReadBytes(num2); preset.texThum = new Texture2D(1, 1); preset.texThum.LoadImage(data); preset.texThum.wrapMode = TextureWrapMode.Clamp; } else { preset.texThum = null; } preset.listMprop = Maid.DeserializePropPre(brRead); if (num >= 2) { preset.aryPartsColor = Maid.DeserializeMultiColorPre(brRead); } if (num >= 200) { Maid.DeserializeBodyPre(brRead); } return preset; } public void PresetDelete(CharacterMgr.Preset f_pre) { try { string fullPath = Path.GetFullPath(".\\"); string str = fullPath + "Preset"; string text = str + "\\" + f_pre.strFileName; if (File.Exists(text)) { File.Delete(text); } else { Debug.LogWarning("PresetDelete削除失敗 ファイルがありません。" + text); } } catch (Exception ex) { Debug.LogWarning("PresetDelete削除失敗 " + ex.Message); } } public List PresetListLoad() { List list = new List(); string fullPath = Path.GetFullPath(".\\"); string path = fullPath + "Preset"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } foreach (string f_strFileName in Directory.GetFiles(path, "*.preset")) { CharacterMgr.Preset item = this.PresetLoad(f_strFileName); list.Add(item); } return list; } private bool IsEnableMenu(string f_strFileName) { if (CharacterMgr.EditModeLookHaveItem) { return GameMain.Instance.CharacterMgr.status.IsHavePartsItem(f_strFileName) && GameUty.IsExistFile(f_strFileName, null); } return GameUty.IsExistFile(f_strFileName, null); } public void PresetSet(Maid f_maid, CharacterMgr.Preset f_prest) { MaidProp[] array; if (f_prest.ePreType == CharacterMgr.PresetType.Body) { array = (from mp in f_prest.listMprop where (1 <= mp.idx && mp.idx <= 52) || (87 <= mp.idx && mp.idx <= 90) select mp).ToArray(); } else if (f_prest.ePreType == CharacterMgr.PresetType.Wear) { array = (from mp in f_prest.listMprop where 53 <= mp.idx && mp.idx <= 82 select mp).ToArray(); } else { array = (from mp in f_prest.listMprop where (1 <= mp.idx && mp.idx <= 82) || (87 <= mp.idx && mp.idx <= 90) select mp).ToArray(); } NDebug.Assert(array != null, "プリセットを実行する配列が空です。"); foreach (MaidProp maidProp in array) { if (maidProp.type != 3) { f_maid.SetProp((MPN)maidProp.idx, maidProp.value, false); } else { if (string.IsNullOrEmpty(maidProp.strFileName)) { string strFileName = maidProp.strFileName; if (CM3.dicDelItem.TryGetValue((MPN)maidProp.idx, out strFileName)) { maidProp.strFileName = strFileName; } } if (this.IsEnableMenu(maidProp.strFileName)) { f_maid.SetProp(maidProp); } else { f_maid.DelProp((MPN)maidProp.idx, false); } if (maidProp.listSubProp != null && maidProp.listSubProp.Count != 0) { f_maid.DelProp((MPN)maidProp.idx, false); for (int j = 0; j < maidProp.listSubProp.Count; j++) { SubProp subProp = maidProp.listSubProp[j]; if (subProp != null) { if (this.IsEnableMenu(subProp.strFileName)) { f_maid.SetSubProp((MPN)maidProp.idx, j, subProp.strFileName, subProp.nFileNameRID); f_maid.GetSubProp((MPN)maidProp.idx, j).fTexMulAlpha = subProp.fTexMulAlpha; } else { f_maid.DelSubProp((MPN)maidProp.idx, j); } } } } } } if ((f_prest.ePreType == CharacterMgr.PresetType.Body || f_prest.ePreType == CharacterMgr.PresetType.All) && f_prest.aryPartsColor != null) { for (int k = 0; k < f_prest.aryPartsColor.Length; k++) { f_maid.Parts.SetPartsColor((MaidParts.PARTS_COLOR)k, f_prest.aryPartsColor[k]); } } f_maid.AllProcPropSeqStart(); } public bool Serialize(BinaryWriter bwWrite) { bwWrite.Write("CM3D2_CHR_MGR"); bwWrite.Write(1140); this.m_PlayerStatus.Serialize(bwWrite); bwWrite.Write(this.m_listStockMan.Count); for (int i = 0; i < this.m_listStockMan.Count; i++) { Maid maid = this.m_listStockMan[i]; maid.SerializeProp(bwWrite); maid.SerializeMisc(bwWrite); } bwWrite.Write(this.m_listStockMaid.Count); for (int j = 0; j < this.m_listStockMaid.Count; j++) { Maid maid2 = this.m_listStockMaid[j]; maid2.SerializeProp(bwWrite); maid2.SerializeMultiColor(bwWrite); maid2.status.Serialize(bwWrite); maid2.SerializeMisc(bwWrite); maid2.SerializeBody(bwWrite); } return true; } public bool Deserialize(BinaryReader brRead) { for (int i = 0; i < this.GetMaidCount(); i++) { Maid maid = this.GetMaid(i); if (maid != null) { this.DeactivateMaid(maid); } } while (this.GetStockMaidCount() != 0) { this.BanishmentMaid(0); } int manCount = this.GetManCount(); for (int j = 0; j < manCount; j++) { Maid man = this.GetMan(j); if (man != null) { this.DeactivateMan(man); } } string a = brRead.ReadString(); NDebug.Assert(a == "CM3D2_CHR_MGR", "セーブデータファイルのヘッダーが不正です。CHR_MGR"); int num = brRead.ReadInt32(); this.m_PlayerStatus.Deserialize(brRead); int num2 = brRead.ReadInt32(); int num3 = 0; for (int k = 0; k < num2; k++) { Maid maid2 = this.m_listStockMan[k]; maid2.DeserializeProp(brRead); maid2.DeserializeMisc(brRead); if (maid2.ActiveSlotNo != -1) { this.SetActiveMan(maid2, maid2.ActiveSlotNo); num3 = System.Math.Max(num3, maid2.ActiveSlotNo); } } int num4 = this.GetManCount() - 2; for (int l = num3 + 1; l < num4; l++) { this.SetActiveMan(this.GetStockMan(l), l); } int num5 = brRead.ReadInt32(); for (int m = 0; m < num5; m++) { Maid maid3 = this.AddStockMaid(); maid3.DeserializeProp(brRead); maid3.DeserializeMultiColor(brRead); maid3.status.Deserialize(brRead); maid3.DeserializeMisc(brRead); if (num >= 200) { maid3.DeserializeBody(brRead); } if (maid3.ActiveSlotNo != -1) { this.SetActiveMaid(maid3, maid3.ActiveSlotNo); } } Maid.DeletedTmpThumCards(); GameMain.Instance.MsgWnd.ClearBackLogData(); if (this.status.isDaytime) { ScheduleAPI.OccurNightWork(); } return true; } public const int MaidStockMax = 200; public const int ActiveMaidSlotCount = 18; public const int NpcMaidCreateCount = 3; public const int ActiveManSloatCount = 6; private static bool m_bEditMode; private GameObject m_goCharacter; private GameObject m_goActive; private GameObject m_goAllOffset; private GameObject m_goStock; private GameObject m_goStockMaid; private GameObject m_goStockNpcMaid; private GameObject m_goStockMan; private GameObject m_goStockNpcMan; private Dictionary m_dicCaches = new Dictionary(); private GameObject m_goChaches; private Status m_PlayerStatus; private List m_listStockMaid = new List(); private List m_listStockNpcMaid = new List(); private List m_listStockMan = new List(); private List m_listStockNpcMan = new List(); private Maid[] m_gcActiveMaid = new Maid[18]; private GameObject[] m_objActiveMaid = new GameObject[18]; private Maid[] m_gcActiveMan = new Maid[6]; private GameObject[] m_objActiveMan = new GameObject[6]; public class NpcData { public NpcData(CsvParser csv, int lineY) { int num = 0; this.uniqueName = csv.GetCellAsString(num++, lineY); this.lastName = csv.GetCellAsString(num++, lineY); this.firstName = csv.GetCellAsString(num++, lineY); this.presetFileName = Path.GetFileNameWithoutExtension(csv.GetCellAsString(num++, lineY)); if (!string.IsNullOrEmpty(this.presetFileName)) { this.isResourcesLoad = !GameUty.FileSystem.IsExistentFile(this.presetFileName + ".preset"); } this.menuFileName = Path.GetFileNameWithoutExtension(csv.GetCellAsString(num++, lineY)); if (!string.IsNullOrEmpty(this.menuFileName)) { this.menuFileName += ".menu"; } NDebug.Assert(string.IsNullOrEmpty(this.presetFileName) || string.IsNullOrEmpty(this.menuFileName), "プリセットとメニューファイル両方が指定されています"); } public void Apply(Maid maid, bool onlyPartsLoad = false) { if (maid == null || GameMain.Instance.CharacterMgr == null) { return; } CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; maid.ResetAll(); if (!maid.boMAN) { NDebug.Assert(string.IsNullOrEmpty(this.menuFileName), "メイドに対して男用のNPCデータを適用しようとしています"); if (!onlyPartsLoad) { maid.status.firstName = this.firstName; maid.status.lastName = this.lastName; } if (this.isResourcesLoad) { characterMgr.PresetSet(maid, characterMgr.PresetLoadFromResources(this.presetFileName)); } else { using (AFileBase afileBase = GameUty.FileOpen(this.presetFileName + ".preset", null)) { if (afileBase != null && afileBase.IsValid()) { byte[] buffer = afileBase.ReadAll(); using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8)) { characterMgr.PresetSet(maid, characterMgr.PresetLoad(binaryReader, this.presetFileName)); } } } } } else { NDebug.Assert(string.IsNullOrEmpty(this.presetFileName), "男に対してメイド用のNPCデータを適用しようとしています"); maid.SetUpModel(this.menuFileName); } } public readonly string uniqueName; public readonly string firstName; public readonly string lastName; public readonly string presetFileName; public readonly string menuFileName; private bool isResourcesLoad; } public class CharaPer { public Vector3 vecOffsDouParGreater; public Vector3 vecOffsDouParLess; public Vector3 vecOffsShinChoGreater; public Vector3 vecOffsShinChoLess; public Vector3 vecOffsMuneLGreater; public Vector3 vecOffsMuneLLess; public Vector3 vecHaremDouPerGreater; public Vector3 vecHaremDouPerLess; public Vector3 vecHaremShinChoGreater; public Vector3 vecHaremShinChoLess; public Vector3 vecHaremMuneLGreater; public Vector3 vecHaremMuneLLess; } public class PenisPer { public Vector3 vecPenisCommonBase; public Vector3 vecPenisAmend; public Vector3 vecPenisDouPerGreater; public Vector3 vecPenisDouPerLess; public Vector3 vecPenisShinchoGreater; public Vector3 vecPenisShinchoLess; } public enum PresetType { Wear, Body, All } public class Preset { public int nVersion; public Texture2D texThum; public string strFileName; public CharacterMgr.PresetType ePreType; public List listMprop = new List(); public MaidParts.PartsColor[] aryPartsColor; } }