123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716 |
- 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)
- {
- CM3.Init();
- 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(1480);
- 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(1480);
- 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(1480);
- 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);
- }
- [Obsolete("GameUty.RidMenuDic廃止により使用不可", true)]
- 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 <= 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>();
- }
- 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(1480);
- 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;
- }
- }
|