12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652 |
- 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 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(1440);
- 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(1440);
- 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 str = UTY.gameProjectPath + "\\";
- string text2 = str + "Preset";
- if (!Directory.Exists(text2))
- {
- Directory.CreateDirectory(text2);
- }
- File.WriteAllBytes(text2 + "\\" + text, memoryStream.ToArray());
- memoryStream.Dispose();
- preset.texThum = texture2D;
- preset.strFileName = text;
- preset.ePreType = f_type;
- return preset;
- }
- public 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(1440);
- 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 str = UTY.gameProjectPath + "\\";
- string text2 = str + "Preset";
- if (!Directory.Exists(text2))
- {
- Directory.CreateDirectory(text2);
- }
- File.WriteAllBytes(text2 + "\\" + text, bytes);
- }
- public static CharacterMgr.Preset LoadePresetLowCapacityData(string data_text)
- {
- if (string.IsNullOrEmpty(data_text) || data_text.IndexOf("^CM3D2P^") != 0)
- {
- return null;
- }
- data_text = data_text.Replace("^CM3D2P^", string.Empty);
- byte[] array = Convert.FromBase64String(data_text);
- array = Utility.ZlibUncompress(array);
- CharacterMgr.Preset preset = new CharacterMgr.Preset();
- preset.strFileName = string.Empty;
- using (MemoryStream memoryStream = new MemoryStream(array))
- {
- BinaryReader binaryReader = new BinaryReader(memoryStream);
- string a = binaryReader.ReadString();
- NDebug.Assert(a == "CM3D2_PRESET_S", "低用量プリセットファイルのヘッダーが不正です。");
- int num = binaryReader.ReadInt32();
- preset.ePreType = (CharacterMgr.PresetType)binaryReader.ReadChar();
- preset.listMprop = Maid.DeserializePropLowCapacity(binaryReader);
- preset.aryPartsColor = Maid.DeserializeMultiColorPre(binaryReader);
- binaryReader.Close();
- }
- return preset;
- }
- public CharacterMgr.Preset PresetLoad(string f_strFileName)
- {
- FileStream fileStream = new FileStream(f_strFileName, FileMode.Open);
- if (fileStream == null)
- {
- return null;
- }
- byte[] buffer = new byte[fileStream.Length];
- fileStream.Read(buffer, 0, (int)fileStream.Length);
- fileStream.Close();
- fileStream.Dispose();
- BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer));
- CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName));
- binaryReader.Close();
- return result;
- }
- public CharacterMgr.Preset PresetLoadFromResources(string f_strFileName)
- {
- TextAsset textAsset = Resources.Load("Preset/" + f_strFileName) as TextAsset;
- NDebug.Assert(textAsset != null, "内部Resourcesからファイル[" + f_strFileName + "]を読み込めませんでした");
- BinaryReader binaryReader = new BinaryReader(new MemoryStream(textAsset.bytes));
- CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName));
- binaryReader.Close();
- Resources.UnloadAsset(textAsset);
- return result;
- }
- public CharacterMgr.Preset PresetLoad(BinaryReader brRead, string f_strFileName)
- {
- CharacterMgr.Preset preset = new CharacterMgr.Preset();
- preset.strFileName = f_strFileName;
- string a = brRead.ReadString();
- NDebug.Assert(a == "CM3D2_PRESET", "プリセットファイルのヘッダーが不正です。");
- int num = brRead.ReadInt32();
- preset.nVersion = num;
- int ePreType = brRead.ReadInt32();
- preset.ePreType = (CharacterMgr.PresetType)ePreType;
- int num2 = brRead.ReadInt32();
- if (num2 != 0)
- {
- byte[] data = brRead.ReadBytes(num2);
- preset.texThum = new Texture2D(1, 1);
- preset.texThum.LoadImage(data);
- preset.texThum.wrapMode = TextureWrapMode.Clamp;
- }
- else
- {
- preset.texThum = null;
- }
- preset.listMprop = Maid.DeserializePropPre(brRead);
- if (num >= 2)
- {
- preset.aryPartsColor = Maid.DeserializeMultiColorPre(brRead);
- }
- if (num >= 200)
- {
- Maid.DeserializeBodyPre(brRead);
- }
- return preset;
- }
- public void PresetDelete(CharacterMgr.Preset f_pre)
- {
- try
- {
- string str = UTY.gameProjectPath + "\\";
- string str2 = str + "Preset";
- string text = str2 + "\\" + 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 str = UTY.gameProjectPath + "\\";
- string path = str + "Preset";
- if (!Directory.Exists(path))
- {
- Directory.CreateDirectory(path);
- }
- foreach (string f_strFileName in Directory.GetFiles(path, "*.preset"))
- {
- CharacterMgr.Preset item = this.PresetLoad(f_strFileName);
- list.Add(item);
- }
- return list;
- }
- private bool IsEnableMenu(string f_strFileName)
- {
- if (CharacterMgr.EditModeLookHaveItem)
- {
- return GameMain.Instance.CharacterMgr.status.IsHavePartsItem(f_strFileName) && GameUty.IsExistFile(f_strFileName, null);
- }
- return GameUty.IsExistFile(f_strFileName, null);
- }
- public void PresetSet(Maid f_maid, CharacterMgr.Preset f_prest)
- {
- MaidProp[] array;
- if (f_prest.ePreType == CharacterMgr.PresetType.Body)
- {
- array = (from mp in f_prest.listMprop
- where (1 <= mp.idx && mp.idx <= 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(1440);
- this.m_PlayerStatus.Serialize(bwWrite);
- bwWrite.Write(this.m_listStockMan.Count);
- for (int i = 0; i < this.m_listStockMan.Count; i++)
- {
- Maid maid = this.m_listStockMan[i];
- maid.SerializeProp(bwWrite);
- maid.SerializeMisc(bwWrite);
- }
- bwWrite.Write(this.m_listStockMaid.Count);
- for (int j = 0; j < this.m_listStockMaid.Count; j++)
- {
- Maid maid2 = this.m_listStockMaid[j];
- maid2.SerializeProp(bwWrite);
- maid2.SerializeMultiColor(bwWrite);
- maid2.status.Serialize(bwWrite);
- maid2.SerializeMisc(bwWrite);
- maid2.SerializeBody(bwWrite);
- }
- return true;
- }
- public bool Deserialize(BinaryReader brRead)
- {
- for (int i = 0; i < this.GetMaidCount(); i++)
- {
- Maid maid = this.GetMaid(i);
- if (maid != null)
- {
- this.DeactivateMaid(maid);
- }
- }
- while (this.GetStockMaidCount() != 0)
- {
- this.BanishmentMaid(0);
- }
- int manCount = this.GetManCount();
- for (int j = 0; j < manCount; j++)
- {
- Maid man = this.GetMan(j);
- if (man != null)
- {
- this.DeactivateMan(man);
- }
- }
- string a = brRead.ReadString();
- NDebug.Assert(a == "CM3D2_CHR_MGR", "セーブデータファイルのヘッダーが不正です。CHR_MGR");
- int num = brRead.ReadInt32();
- this.m_PlayerStatus.Deserialize(brRead);
- int num2 = brRead.ReadInt32();
- int num3 = 0;
- for (int k = 0; k < num2; k++)
- {
- Maid maid2 = this.m_listStockMan[k];
- maid2.DeserializeProp(brRead);
- maid2.DeserializeMisc(brRead);
- if (maid2.ActiveSlotNo != -1)
- {
- this.SetActiveMan(maid2, maid2.ActiveSlotNo);
- num3 = System.Math.Max(num3, maid2.ActiveSlotNo);
- }
- }
- int num4 = this.GetManCount() - 2;
- for (int l = num3 + 1; l < num4; l++)
- {
- this.SetActiveMan(this.GetStockMan(l), l);
- }
- int num5 = brRead.ReadInt32();
- for (int m = 0; m < num5; m++)
- {
- Maid maid3 = this.AddStockMaid();
- maid3.DeserializeProp(brRead);
- maid3.DeserializeMultiColor(brRead);
- maid3.status.Deserialize(brRead);
- maid3.DeserializeMisc(brRead);
- if (num >= 200)
- {
- maid3.DeserializeBody(brRead);
- }
- if (maid3.ActiveSlotNo != -1)
- {
- this.SetActiveMaid(maid3, maid3.ActiveSlotNo);
- }
- }
- Maid.DeletedTmpThumCards();
- GameMain.Instance.MsgWnd.ClearBackLogData();
- if (this.status.isDaytime)
- {
- ScheduleAPI.OccurNightWork();
- }
- return true;
- }
- public const int MaidStockMax = 999;
- public const int ActiveMaidSlotCount = 18;
- public const int NpcMaidCreateCount = 3;
- public const int ActiveManSloatCount = 6;
- private static bool m_bEditMode;
- private GameObject m_goCharacter;
- private GameObject m_goActive;
- private GameObject m_goAllOffset;
- private GameObject m_goStock;
- private GameObject m_goStockMaid;
- private GameObject m_goStockNpcMaid;
- private GameObject m_goStockMan;
- private GameObject m_goStockNpcMan;
- private Dictionary<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;
- }
- }
|