123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- using System;
- using System.IO;
- using MaidStatus;
- using UnityEngine;
- using wf;
- namespace scoutmode
- {
- public class ScoutMaidOverrideData : ICloneable
- {
- public string guid { get; private set; }
- public bool enabled { get; private set; }
- public void CreateStatus(ScoutMaidData.SimpleStatus status)
- {
- this.enabled = true;
- this.guid = Guid.NewGuid().ToString();
- this.status.SetStatus(status);
- }
- public void Apply(Maid maid)
- {
- if (!this.enabled)
- {
- return;
- }
- if (!string.IsNullOrEmpty(this.guid))
- {
- maid.status.SetNewGuidAndCreationTime(this.guid, maid.status.creationTime);
- }
- MaidStatus.Status status = maid.status;
- status.SetPersonal(this.status.personalId);
- status.seikeiken = (status.initSeikeiken = this.status.seikeiken);
- status.baseLovely = this.status.lovely;
- status.baseElegance = this.status.elegance;
- status.baseCharm = this.status.charm;
- status.baseCooking = this.status.cooking;
- status.baseDance = this.status.dance;
- status.baseVocal = this.status.vocal;
- status.baseInyoku = this.status.inyoku;
- status.baseMvalue = this.status.mvalue;
- status.baseHentai = this.status.hentai;
- status.baseHousi = this.status.housi;
- }
- public void Destroy()
- {
- this.enabled = false;
- }
- public byte[] Serialize()
- {
- MemoryStream memoryStream = new MemoryStream();
- BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
- binaryWriter.Write("COM3D2_SCOUT_OVERRIDE_DATA");
- binaryWriter.Write(1000);
- binaryWriter.Write((this.guid != null) ? this.guid : string.Empty);
- binaryWriter.Write(JsonUtility.ToJson(this.status));
- binaryWriter.Write(this.enabled);
- int num = (this.iconImageBinary != null && this.iconImageBinary.Length > 0) ? this.iconImageBinary.Length : 0;
- binaryWriter.Write(num);
- if (num > 0)
- {
- binaryWriter.Write(this.iconImageBinary);
- }
- num = ((this.pressetBinary != null && this.pressetBinary.Length > 0) ? this.pressetBinary.Length : 0);
- binaryWriter.Write(num);
- if (num > 0)
- {
- binaryWriter.Write(this.pressetBinary);
- }
- return memoryStream.ToArray();
- }
- public void DeSerialize(byte[] data)
- {
- MemoryStream input = new MemoryStream(data);
- BinaryReader binaryReader = new BinaryReader(input);
- NDebug.Assert(binaryReader.ReadString() == "COM3D2_SCOUT_OVERRIDE_DATA", "ScoutMaidData::ScoutMaidOverrideData::DeSerialize Header Check error.");
- int num = binaryReader.ReadInt32();
- this.guid = binaryReader.ReadString();
- this.status = JsonUtility.FromJson<ScoutMaidOverrideData.Status>(binaryReader.ReadString());
- this.enabled = binaryReader.ReadBoolean();
- int num2 = binaryReader.ReadInt32();
- this.iconImageBinary = ((num2 > 0) ? binaryReader.ReadBytes(num2) : null);
- num2 = binaryReader.ReadInt32();
- this.pressetBinary = ((num2 > 0) ? binaryReader.ReadBytes(num2) : null);
- }
- public object Clone()
- {
- ScoutMaidOverrideData scoutMaidOverrideData = (ScoutMaidOverrideData)base.MemberwiseClone();
- scoutMaidOverrideData.status = JsonUtility.FromJson<ScoutMaidOverrideData.Status>(JsonUtility.ToJson(this.status));
- scoutMaidOverrideData.iconImageBinary = ((this.iconImageBinary != null && this.iconImageBinary.Length > 0) ? ((byte[])this.iconImageBinary.Clone()) : null);
- scoutMaidOverrideData.pressetBinary = ((this.pressetBinary != null && this.pressetBinary.Length > 0) ? ((byte[])this.pressetBinary.Clone()) : null);
- return scoutMaidOverrideData;
- }
- private const int FixVersion = 1000;
- public ScoutMaidOverrideData.Status status = new ScoutMaidOverrideData.Status();
- public byte[] iconImageBinary;
- public byte[] pressetBinary;
- [Serializable]
- public class Status : ISerializationCallbackReceiver
- {
- public Personal.Data personal
- {
- get
- {
- return Personal.GetData(this.personalId);
- }
- }
- public void SetStatus(ScoutMaidData.SimpleStatus status)
- {
- this.personalId = status.personalId;
- this.seikeiken = status.seikeiken;
- this.lovely = status.lovely;
- this.elegance = status.elegance;
- this.charm = status.charm;
- this.cooking = status.cooking;
- this.dance = status.dance;
- this.vocal = status.vocal;
- this.inyoku = status.inyoku;
- this.mvalue = status.mvalue;
- this.hentai = status.hentai;
- this.housi = status.housi;
- }
- public void ClearStatus()
- {
- this.lovely = 0;
- this.elegance = 0;
- this.charm = 0;
- this.cooking = 0;
- this.dance = 0;
- this.vocal = 0;
- this.inyoku = 0;
- this.mvalue = 0;
- this.hentai = 0;
- this.housi = 0;
- }
- public bool AddRandomStatusValue(int value)
- {
- switch (UnityEngine.Random.Range(0, 10))
- {
- case 0:
- if (this.lovely == 9999)
- {
- return false;
- }
- this.lovely = wf.Math.Round4(this.lovely + value);
- break;
- case 1:
- if (this.elegance == 9999)
- {
- return false;
- }
- this.elegance = wf.Math.Round4(this.elegance + value);
- break;
- case 2:
- if (this.charm == 9999)
- {
- return false;
- }
- this.charm = wf.Math.Round4(this.charm + value);
- break;
- case 3:
- if (this.cooking == 9999)
- {
- return false;
- }
- this.cooking = wf.Math.Round4(this.cooking + value);
- break;
- case 4:
- if (this.dance == 9999)
- {
- return false;
- }
- this.dance = wf.Math.Round4(this.dance + value);
- break;
- case 5:
- if (this.vocal == 9999)
- {
- return false;
- }
- this.vocal = wf.Math.Round4(this.vocal + value);
- break;
- case 6:
- if (this.inyoku == 9999)
- {
- return false;
- }
- this.inyoku = wf.Math.Round4(this.inyoku + value);
- break;
- case 7:
- if (this.mvalue == 9999)
- {
- return false;
- }
- this.mvalue = wf.Math.Round4(this.mvalue + value);
- break;
- case 8:
- if (this.hentai == 9999)
- {
- return false;
- }
- this.hentai = wf.Math.Round4(this.hentai + value);
- break;
- case 9:
- if (this.housi == 9999)
- {
- return false;
- }
- this.housi = wf.Math.Round4(this.housi + value);
- break;
- }
- return true;
- }
- public void OnBeforeSerialize()
- {
- this.version = 1000;
- }
- public void OnAfterDeserialize()
- {
- }
- public int version = 1000;
- public int personalId;
- public Seikeiken seikeiken;
- public int lovely;
- public int elegance;
- public int charm;
- public int cooking;
- public int dance;
- public int vocal;
- public int inyoku;
- public int mvalue;
- public int hentai;
- public int housi;
- }
- }
- }
|