123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- 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;
- }
- }
|