using System; using System.IO; using UnityEngine; public class MaidParts : MonoBehaviour { public bool Initialize(GameObject f_objMaid, Maid f_Maid) { this.m_objMaid = f_objMaid; this.m_Maid = f_Maid; for (int i = 0; i < 9; i++) { this.m_aryPartsColorTable[i] = new Texture2D(256, 1, TextureFormat.RGBA32, false); } return true; } public void SetPartsColor(MaidParts.PARTS_COLOR f_eColorType, MaidParts.PartsColor f_cColor) { this.m_aryPartsColor[(int)f_eColorType] = f_cColor; UTY.UpdateColorTableTexture(f_cColor, ref this.m_aryPartsColorTable[(int)f_eColorType]); this.m_Maid.body0.UpdateInfinityColor(f_eColorType); } public MaidParts.PartsColor GetPartsColor(MaidParts.PARTS_COLOR f_eColorType) { return this.m_aryPartsColor[(int)f_eColorType]; } public Texture2D GetPartsColorTableTex(MaidParts.PARTS_COLOR f_eColorType) { return this.m_aryPartsColorTable[(int)f_eColorType]; } public unsafe bool Serialize(BinaryWriter f_bwWrite) { f_bwWrite.Write("CM3D2_MULTI_COL"); f_bwWrite.Write(1170); f_bwWrite.Write(this.m_aryPartsColor.Length); for (int i = 0; i < this.m_aryPartsColor.Length; i++) { fixed (MaidParts.PartsColor* ptr = &this.m_aryPartsColor[i]) { f_bwWrite.Write(ptr->m_bUse); f_bwWrite.Write(ptr->m_nMainHue); f_bwWrite.Write(ptr->m_nMainChroma); f_bwWrite.Write(ptr->m_nMainBrightness); f_bwWrite.Write(ptr->m_nMainContrast); f_bwWrite.Write(ptr->m_nShadowRate); f_bwWrite.Write(ptr->m_nShadowHue); f_bwWrite.Write(ptr->m_nShadowChroma); f_bwWrite.Write(ptr->m_nShadowBrightness); f_bwWrite.Write(ptr->m_nShadowContrast); } } return true; } public unsafe static MaidParts.PartsColor[] DeserializePre(BinaryReader f_brRead) { MaidParts.PartsColor[] array = new MaidParts.PartsColor[9]; string a = f_brRead.ReadString(); NDebug.Assert(a == "CM3D2_MULTI_COL", "無限色のヘッダーが不正です。"); int num = f_brRead.ReadInt32(); int num2 = f_brRead.ReadInt32(); if (num >= 200 && array.Length != num2) { NDebug.Assert("無限色数が異なります。セーブデータが破損しています。", false); } for (int i = 0; i < num2; i++) { fixed (MaidParts.PartsColor* ptr = &array[i]) { ptr->m_bUse = f_brRead.ReadBoolean(); ptr->m_nMainHue = f_brRead.ReadInt32(); ptr->m_nMainChroma = f_brRead.ReadInt32(); ptr->m_nMainBrightness = f_brRead.ReadInt32(); ptr->m_nMainContrast = f_brRead.ReadInt32(); ptr->m_nShadowRate = f_brRead.ReadInt32(); ptr->m_nShadowHue = f_brRead.ReadInt32(); ptr->m_nShadowChroma = f_brRead.ReadInt32(); ptr->m_nShadowBrightness = f_brRead.ReadInt32(); ptr->m_nShadowContrast = f_brRead.ReadInt32(); } } return array; } private MaidParts.PartsColor[] m_aryPartsColor = new MaidParts.PartsColor[] { new MaidParts.PartsColor { m_nMainHue = 6, m_nMainChroma = 117, m_nMainBrightness = 179, m_nMainContrast = 94 }, new MaidParts.PartsColor { m_nMainHue = 6, m_nMainChroma = 117, m_nMainBrightness = 179, m_nMainContrast = 94 }, new MaidParts.PartsColor { m_nMainHue = 69, m_nMainChroma = 186, m_nMainBrightness = 270, m_nMainContrast = 94 }, new MaidParts.PartsColor { m_nMainHue = 0, m_nMainChroma = 0, m_nMainBrightness = 183, m_nMainContrast = 0 }, new MaidParts.PartsColor { m_nMainHue = 0, m_nMainChroma = 0, m_nMainBrightness = 0, m_nMainContrast = 0 }, new MaidParts.PartsColor { m_nMainHue = 18, m_nMainChroma = 149, m_nMainBrightness = 247, m_nMainContrast = 100 }, new MaidParts.PartsColor { m_nMainHue = 18, m_nMainChroma = 149, m_nMainBrightness = 247, m_nMainContrast = 100 }, new MaidParts.PartsColor { m_nMainHue = 69, m_nMainChroma = 186, m_nMainBrightness = 270, m_nMainContrast = 94 }, new MaidParts.PartsColor { m_nMainHue = 18, m_nMainChroma = 149, m_nMainBrightness = 247, m_nMainContrast = 100 } }; private Texture2D[] m_aryPartsColorTable = new Texture2D[9]; private GameObject m_objMaid; private Maid m_Maid; public enum PARTS_COLOR { NONE = -1, EYE_L, EYE_R, HAIR, EYE_BROW, UNDER_HAIR, SKIN, NIPPLE, HAIR_OUTLINE, SKIN_OUTLINE, MAX } public struct PartsColor { public bool m_bUse; public int m_nMainHue; public int m_nMainChroma; public int m_nMainBrightness; public int m_nMainContrast; public int m_nShadowRate; public int m_nShadowHue; public int m_nShadowChroma; public int m_nShadowBrightness; public int m_nShadowContrast; } }