1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using I2.Loc;
- using MaidStatus;
- using PlayerStatus;
- using SceneNPCEdit;
- using Schedule;
- using UnityEngine;
- using wf;
- public class CharacterMgr : MonoBehaviour
- {
- public static Dictionary<string, CharacterMgr.NpcData> npcDatas { get; private set; }
- public static bool EditModeLookHaveItem
- {
- get
- {
- return CharacterMgr.m_bEditMode;
- }
- set
- {
- CharacterMgr.m_bEditMode = value;
- }
- }
- public string PresetDirectory
- {
- get
- {
- return Path.Combine(GameMain.Instance.SerializeStorageManager.StoreDirectoryPath, "Preset");
- }
- }
- public GameObject CharacterAll
- {
- get
- {
- return this.m_goCharacter;
- }
- }
- public PlayerStatus.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<Maid> 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, CharacterMgr.NpcData>();
- 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 PlayerStatus.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>();
- 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;
- if (!f_bMan && f_maid.status != null)
- {
- if (f_maid.status.heroineType != HeroineType.Sub)
- {
- f_maid.status.voiceGroup = VoiceGroup.Heroine;
- }
- if (f_maid.status.subCharaStatus != null)
- {
- string contractText = f_maid.status.subCharaStatus.contractText;
- f_maid.status.voiceGroup = ((!(contractText == "ユニーク")) ? VoiceGroup.Extra : VoiceGroup.Sub);
- }
- }
- f_maid.DutPropAll();
- f_maid.AllProcPropSeqStart();
- }
- public Maid Activate(int f_nActiveSlot, int f_nStockSlot, bool f_bMan, bool f_bNpc)
- {
- List<Maid> 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;
- GameObject gameObject = array[slotNoA];
- array[slotNoA] = array[slotNoB];
- array[slotNoB] = gameObject;
- string text = (!(array2[slotNoA] != null)) ? null : array2[slotNoA].gameObject.name;
- if (array2[slotNoA] && array2[slotNoB] != null)
- {
- array2[slotNoA].gameObject.name = array2[slotNoB].gameObject.name;
- }
- if (array2[slotNoB] != null && text != null)
- {
- array2[slotNoB].gameObject.name = text;
- }
- Maid maid = array2[slotNoA];
- array2[slotNoA] = array2[slotNoB];
- array2[slotNoB] = maid;
- int activeSlotNo = (!(array2[slotNoA] != null)) ? -1 : array2[slotNoA].ActiveSlotNo;
- if (array2[slotNoA])
- {
- array2[slotNoA].ActiveSlotNo = ((!(array2[slotNoB] != null)) ? -1 : array2[slotNoB].ActiveSlotNo);
- }
- if (array2[slotNoB])
- {
- 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<Maid> 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<Maid> 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.baseOffset = (maid.baseEulerAngles = Vector3.zero);
- maid.rotateLinkMaid = string.Empty;
- 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.baseOffset = (maid2.baseEulerAngles = Vector3.zero);
- maid2.rotateLinkMaid = string.Empty;
- 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.baseOffset = (maid3.baseEulerAngles = Vector3.zero);
- maid3.rotateLinkMaid = string.Empty;
- 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.baseOffset = (maid4.baseEulerAngles = Vector3.zero);
- maid4.rotateLinkMaid = string.Empty;
- 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);
- if (ScriptManager.isGP001Mode)
- {
- f_maid.motionOffset = zero;
- f_maid.UpdateTransformData();
- }
- else
- {
- f_maid.SetPos(zero);
- }
- return zero2;
- }
- public void SetMaidOffsetOther(List<KeyValuePair<Maid, CharacterMgr.CharaPer>> 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;
- }
- }
- if (!ScriptManager.isGP001Mode)
- {
- this.CharaAllOfsetPos(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 vector;
- this.GetOffsetMan(f_maidTarget, f_nCSTSplitNum, f_bPenisDetailMode, out vecChinkoOffset, out vector, f_cIn, f_cPenisPer);
- f_manMy.body0.vecChinkoOffset = vecChinkoOffset;
- if (ScriptManager.isGP001Mode)
- {
- f_manMy.motionOffset = vector;
- f_manMy.UpdateTransformData();
- }
- else
- {
- f_manMy.SetPos(vector);
- }
- }
- public Texture2D ThumShot(Maid f_maid)
- {
- return GameMain.Instance.ThumCamera.GetComponent<ThumShot>().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(1470);
- 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(1470);
- 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 presetDirectory = this.PresetDirectory;
- if (!Directory.Exists(presetDirectory))
- {
- Directory.CreateDirectory(presetDirectory);
- }
- File.WriteAllBytes(presetDirectory + "\\" + text, memoryStream.ToArray());
- memoryStream.Dispose();
- preset.texThum = texture2D;
- preset.strFileName = text;
- preset.ePreType = f_type;
- return preset;
- }
- public byte[] PresetSaveNotWriteFile(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(1470);
- 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);
- return memoryStream.ToArray();
- }
- 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 presetDirectory = this.PresetDirectory;
- if (!Directory.Exists(presetDirectory))
- {
- Directory.CreateDirectory(presetDirectory);
- }
- File.WriteAllBytes(presetDirectory + "\\" + 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 presetDirectory = this.PresetDirectory;
- string text = presetDirectory + "\\" + 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<CharacterMgr.Preset> PresetListLoad()
- {
- List<CharacterMgr.Preset> list = new List<CharacterMgr.Preset>();
- string presetDirectory = this.PresetDirectory;
- if (!Directory.Exists(presetDirectory))
- {
- Directory.CreateDirectory(presetDirectory);
- }
- foreach (string f_strFileName in Directory.GetFiles(presetDirectory, "*.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 <= 66) || (101 <= mp.idx && mp.idx <= 105)
- select mp).ToArray<MaidProp>();
- }
- else if (f_prest.ePreType == CharacterMgr.PresetType.Wear)
- {
- array = (from mp in f_prest.listMprop
- where 67 <= mp.idx && mp.idx <= 96
- select mp).ToArray<MaidProp>();
- }
- else
- {
- array = (from mp in f_prest.listMprop
- where (1 <= mp.idx && mp.idx <= 96) || (101 <= mp.idx && mp.idx <= 105)
- select mp).ToArray<MaidProp>();
- }
- 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]);
- }
- }
- if (Product.isPublic)
- {
- f_maid.SetProp(MPN.bra, "bra030_i_.menu", 0, false, false);
- f_maid.SetProp(MPN.panz, "Pants030_i_.menu", 0, false, false);
- }
- f_maid.AllProcPropSeqStart();
- }
- public bool Serialize(BinaryWriter bwWrite)
- {
- bwWrite.Write("CM3D2_CHR_MGR");
- bwWrite.Write(1470);
- 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 bool SerializeAddition(BinaryWriter writer)
- {
- if (this.subMaidBackupStatusList == null)
- {
- this.subMaidBackupStatusList = new List<SubMaid.BackupStatus>();
- }
- byte[] array = new byte[0];
- MemoryStream memoryStream = new MemoryStream();
- BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
- int count = this.subMaidBackupStatusList.Count;
- binaryWriter.Write(count);
- for (int i = 0; i < this.subMaidBackupStatusList.Count; i++)
- {
- binaryWriter.Write(JsonUtility.ToJson(this.subMaidBackupStatusList[i]));
- if (this.subMaidBackupStatusList[i].iconBinary == null)
- {
- this.subMaidBackupStatusList[i].iconBinary = new byte[0];
- }
- if (this.subMaidBackupStatusList[i].presetBinary == null)
- {
- this.subMaidBackupStatusList[i].presetBinary = new byte[0];
- }
- binaryWriter.Write(this.subMaidBackupStatusList[i].iconBinary.Length);
- binaryWriter.Write(this.subMaidBackupStatusList[i].iconBinary);
- binaryWriter.Write(this.subMaidBackupStatusList[i].presetBinary.Length);
- binaryWriter.Write(this.subMaidBackupStatusList[i].presetBinary);
- }
- array = Utility.ZlibCompresss(memoryStream.ToArray());
- writer.Write(array.Length);
- writer.Write(array);
- return true;
- }
- public bool DeserializeAddition(BinaryReader reader)
- {
- int count = reader.ReadInt32();
- byte[] buffer = Utility.ZlibUncompress(reader.ReadBytes(count));
- BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer));
- if (this.subMaidBackupStatusList == null)
- {
- this.subMaidBackupStatusList = new List<SubMaid.BackupStatus>();
- }
- this.subMaidBackupStatusList.Clear();
- int num = binaryReader.ReadInt32();
- for (int i = 0; i < num; i++)
- {
- SubMaid.BackupStatus backupStatus = JsonUtility.FromJson<SubMaid.BackupStatus>(binaryReader.ReadString());
- int count2 = binaryReader.ReadInt32();
- backupStatus.iconBinary = binaryReader.ReadBytes(count2);
- count2 = binaryReader.ReadInt32();
- backupStatus.presetBinary = binaryReader.ReadBytes(count2);
- this.subMaidBackupStatusList.Add(backupStatus);
- }
- return true;
- }
- public const int MaidStockMax = 999;
- public const int ActiveMaidSlotCount = 18;
- public const int NpcMaidCreateCount = 3;
- public const int ActiveManSloatCount = 6;
- private static bool m_bEditMode;
- public List<SubMaid.BackupStatus> subMaidBackupStatusList = new List<SubMaid.BackupStatus>();
- 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<string, GameObject> m_dicCaches = new Dictionary<string, GameObject>();
- private GameObject m_goChaches;
- private PlayerStatus.Status m_PlayerStatus;
- private List<Maid> m_listStockMaid = new List<Maid>();
- private List<Maid> m_listStockNpcMaid = new List<Maid>();
- private List<Maid> m_listStockMan = new List<Maid>();
- private List<Maid> m_listStockNpcMan = new List<Maid>();
- 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);
- string cellAsString = csv.GetCellAsString(num++, lineY);
- this.voiceGroup = VoiceGroup.Mob;
- if (!string.IsNullOrEmpty(cellAsString))
- {
- try
- {
- this.voiceGroup = (VoiceGroup)Enum.Parse(typeof(VoiceGroup), cellAsString);
- }
- catch (Exception ex)
- {
- Debug.LogError(ex.StackTrace);
- Debug.LogError(ex.Message);
- }
- }
- 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 string firstNameTerm
- {
- get
- {
- return "SubMaid/" + this.uniqueName + "/名前";
- }
- }
- public string lastNameTerm
- {
- get
- {
- return "SubMaid/" + this.uniqueName + "/苗字";
- }
- }
- 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 (Product.supportMultiLanguage)
- {
- string translation = LocalizationManager.GetTranslation(this.lastNameTerm, true, 0, true, false, null, Product.EnumConvert.ToI2LocalizeLanguageName(Product.defaultLanguage));
- if (!string.IsNullOrEmpty(translation))
- {
- maid.status.lastName = translation;
- }
- translation = LocalizationManager.GetTranslation(this.firstNameTerm, true, 0, true, false, null, Product.EnumConvert.ToI2LocalizeLanguageName(Product.defaultLanguage));
- if (!string.IsNullOrEmpty(translation))
- {
- maid.status.firstName = translation;
- }
- }
- }
- CharacterMgr.Preset preset = SaveData.GetPreset(this);
- if (preset != null)
- {
- characterMgr.PresetSet(maid, preset);
- }
- else 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));
- }
- }
- }
- }
- maid.status.voiceGroup = this.voiceGroup;
- }
- 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 VoiceGroup voiceGroup;
- public readonly string presetFileName;
- public readonly string menuFileName;
- public readonly 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<MaidProp> listMprop = new List<MaidProp>();
- public MaidParts.PartsColor[] aryPartsColor;
- }
- }
|