Exemplo n.º 1
0
        // Token: 0x060001AB RID: 427 RVA: 0x000102D8 File Offset: 0x0000E4D8
        public void ToStreamEx_TexTable(Stream s, PmxTextureTable tx, PmxElementFormat f)
        {
            PmxStreamHelper.WriteString(s, this.Name, f);
            PmxStreamHelper.WriteString(s, this.NameE, f);
            V4_BytesConvert.ToStream(s, V4_BytesConvert.ColorToVector4(this.Diffuse));
            V3_BytesConvert.ToStream(s, V3_BytesConvert.ColorToVector3(this.Specular));
            PmxStreamHelper.WriteElement_Float(s, this.Power);
            V3_BytesConvert.ToStream(s, V3_BytesConvert.ColorToVector3(this.Ambient));
            s.WriteByte((byte)this.Flags);
            V4_BytesConvert.ToStream(s, V4_BytesConvert.ColorToVector4(this.EdgeColor));
            PmxStreamHelper.WriteElement_Float(s, this.EdgeSize);
            PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(this.Tex), f.TexSize, true);
            PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(this.Sphere), f.TexSize, true);
            s.WriteByte((byte)this.SphereMode);
            int  toonIndex = SystemToon.GetToonIndex(this.Toon);
            bool flag      = toonIndex < 0;

            if (flag)
            {
                s.WriteByte(0);
                PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(this.Toon), f.TexSize, true);
            }
            else
            {
                s.WriteByte(1);
                s.WriteByte((byte)toonIndex);
            }
            PmxStreamHelper.WriteString(s, this.Memo, f);
            PmxStreamHelper.WriteElement_Int32(s, this.FaceCount, 4, true);
        }
        public void ToStreamEx_TexTable(Stream s, PmxTextureTable tx, PmxElementFormat f = null)
        {
            PmxStreamHelper.WriteString(s, Name, f);
            PmxStreamHelper.WriteString(s, NameE, f);
            V4_BytesConvert.ToStream(s, Diffuse);
            V3_BytesConvert.ToStream(s, Specular);
            PmxStreamHelper.WriteElement_Float(s, Power);
            V3_BytesConvert.ToStream(s, Ambient);
            s.WriteByte((byte)Flags);
            V4_BytesConvert.ToStream(s, EdgeColor);
            PmxStreamHelper.WriteElement_Float(s, EdgeSize);
            PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(Tex), f.TexSize);
            PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(Sphere), f.TexSize);
            s.WriteByte((byte)SphereMode);
            int toonIndex = SystemToon.GetToonIndex(Toon);

            if (toonIndex < 0)
            {
                s.WriteByte(0);
                PmxStreamHelper.WriteElement_Int32(s, tx.GetIndex(Toon), f.TexSize);
            }
            else
            {
                s.WriteByte(1);
                s.WriteByte((byte)toonIndex);
            }
            PmxStreamHelper.WriteString(s, Memo, f);
            PmxStreamHelper.WriteElement_Int32(s, FaceCount);
            if (f.WithID)
            {
                PmxStreamHelper.WriteElement_UInt(s, base.UID);
                PmxStreamHelper.WriteElement_UInt(s, base.CID);
            }
        }
Exemplo n.º 3
0
        // Token: 0x060001AA RID: 426 RVA: 0x000101A0 File Offset: 0x0000E3A0
        public void FromStreamEx_TexTable(Stream s, PmxTextureTable tx, PmxElementFormat f)
        {
            this.Name       = PmxStreamHelper.ReadString(s, f);
            this.NameE      = PmxStreamHelper.ReadString(s, f);
            this.Diffuse    = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
            this.Specular   = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
            this.Power      = PmxStreamHelper.ReadElement_Float(s);
            this.Ambient    = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
            this.Flags      = (PmxMaterial.MaterialFlags)s.ReadByte();
            this.EdgeColor  = V4_BytesConvert.Vector4ToColor(V4_BytesConvert.FromStream(s));
            this.EdgeSize   = PmxStreamHelper.ReadElement_Float(s);
            this.Tex        = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize, true));
            this.Sphere     = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize, true));
            this.SphereMode = (PmxMaterial.SphereModeType)s.ReadByte();
            bool flag = s.ReadByte() == 0;

            if (flag)
            {
                this.Toon = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize, true));
            }
            else
            {
                int n = s.ReadByte();
                this.Toon = SystemToon.GetToonName(n);
            }
            this.Memo = PmxStreamHelper.ReadString(s, f);
            this.UpdateAttributeFromMemo();
            this.FaceCount = PmxStreamHelper.ReadElement_Int32(s, 4, true);
        }
 public void FromStreamEx_TexTable(Stream s, PmxTextureTable tx, PmxElementFormat f = null)
 {
     Name       = PmxStreamHelper.ReadString(s, f);
     NameE      = PmxStreamHelper.ReadString(s, f);
     Diffuse    = V4_BytesConvert.FromStream(s);
     Specular   = V3_BytesConvert.FromStream(s);
     Power      = PmxStreamHelper.ReadElement_Float(s);
     Ambient    = V3_BytesConvert.FromStream(s);
     Flags      = (MaterialFlags)s.ReadByte();
     EdgeColor  = V4_BytesConvert.FromStream(s);
     EdgeSize   = PmxStreamHelper.ReadElement_Float(s);
     Tex        = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize));
     Sphere     = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize));
     SphereMode = (SphereModeType)s.ReadByte();
     if (s.ReadByte() == 0)
     {
         Toon = tx.GetName(PmxStreamHelper.ReadElement_Int32(s, f.TexSize));
     }
     else
     {
         int n = s.ReadByte();
         Toon = SystemToon.GetToonName(n);
     }
     Memo = PmxStreamHelper.ReadString(s, f);
     UpdateAttributeFromMemo();
     FaceCount = PmxStreamHelper.ReadElement_Int32(s);
     if (f.WithID)
     {
         base.UID = PmxStreamHelper.ReadElement_UInt(s);
         base.CID = PmxStreamHelper.ReadElement_UInt(s);
     }
 }
Exemplo n.º 5
0
 // Token: 0x060002AF RID: 687 RVA: 0x00014D00 File Offset: 0x00012F00
 public static string[] GetToonNames()
 {
     string[] array = new string[10];
     for (int i = 0; i < array.Length; i++)
     {
         array[i] = SystemToon.GetToonName(i);
     }
     return(array);
 }
Exemplo n.º 6
0
        // Token: 0x060002B1 RID: 689 RVA: 0x00014D7C File Offset: 0x00012F7C
        public static bool IsSystemToon(string name)
        {
            bool flag = SystemToon.m_nametable == null;

            if (flag)
            {
                SystemToon.CreateNameTable();
            }
            return(!string.IsNullOrEmpty(name) && SystemToon.m_nametable.ContainsKey(name));
        }
Exemplo n.º 7
0
        // Token: 0x060002B0 RID: 688 RVA: 0x00014D38 File Offset: 0x00012F38
        private static void CreateNameTable()
        {
            int num = 10;

            SystemToon.m_nametable = new Dictionary <string, int>(num + 1);
            for (int i = -1; i < num; i++)
            {
                SystemToon.m_nametable.Add(SystemToon.GetToonName(i), i);
            }
        }
Exemplo n.º 8
0
        // Token: 0x060002B2 RID: 690 RVA: 0x00014DB8 File Offset: 0x00012FB8
        public static int GetToonIndex(string name)
        {
            bool flag = SystemToon.m_nametable == null;

            if (flag)
            {
                SystemToon.CreateNameTable();
            }
            bool flag2 = !string.IsNullOrEmpty(name) && SystemToon.m_nametable.ContainsKey(name);
            int  result;

            if (flag2)
            {
                result = SystemToon.m_nametable[name];
            }
            else
            {
                result = -2;
            }
            return(result);
        }
        public void CreateTable(List <PmxMaterial> ml)
        {
            NameToIndex.Clear();
            IndexToName.Clear();
            int num = 0;

            for (int i = 0; i < ml.Count; i++)
            {
                PmxMaterial pmxMaterial = ml[i];
                if (!string.IsNullOrEmpty(pmxMaterial.Tex) && !NameToIndex.ContainsKey(pmxMaterial.Tex))
                {
                    NameToIndex.Add(pmxMaterial.Tex, num);
                    IndexToName.Add(num, pmxMaterial.Tex);
                    num++;
                }
                if (!string.IsNullOrEmpty(pmxMaterial.Sphere) && !NameToIndex.ContainsKey(pmxMaterial.Sphere))
                {
                    NameToIndex.Add(pmxMaterial.Sphere, num);
                    IndexToName.Add(num, pmxMaterial.Sphere);
                    num++;
                }
                if (!string.IsNullOrEmpty(pmxMaterial.Toon) && !NameToIndex.ContainsKey(pmxMaterial.Toon) && !SystemToon.IsSystemToon(pmxMaterial.Toon))
                {
                    NameToIndex.Add(pmxMaterial.Toon, num);
                    IndexToName.Add(num, pmxMaterial.Toon);
                    num++;
                }
            }
        }
Exemplo n.º 10
0
        // Token: 0x060002B3 RID: 691 RVA: 0x00014E10 File Offset: 0x00013010
        public SystemToon.ToonInfo GetToonInfo(List <PmxMaterial> list)
        {
            int  count = list.Count;
            bool flag  = count < 0;

            SystemToon.ToonInfo result;
            if (flag)
            {
                result = null;
            }
            else
            {
                SystemToon.ToonInfo toonInfo        = new SystemToon.ToonInfo(count);
                bool[]                   array      = new bool[10];
                List <string>            list2      = new List <string>(count);
                Dictionary <string, int> dictionary = new Dictionary <string, int>(count);
                for (int i = 0; i < count; i++)
                {
                    PmxMaterial pmxMaterial = list[i];
                    bool        flag2       = string.IsNullOrEmpty(pmxMaterial.Toon);
                    if (flag2)
                    {
                        toonInfo.MaterialToon[i] = -1;
                    }
                    else
                    {
                        int toonIndex = SystemToon.GetToonIndex(pmxMaterial.Toon);
                        toonInfo.MaterialToon[i] = toonIndex;
                        bool flag3 = -1 <= toonIndex && toonIndex < 10;
                        if (flag3)
                        {
                            bool flag4 = toonIndex >= 0;
                            if (flag4)
                            {
                                array[toonIndex] = true;
                            }
                        }
                        else
                        {
                            bool flag5 = !dictionary.ContainsKey(pmxMaterial.Toon);
                            if (flag5)
                            {
                                list2.Add(pmxMaterial.Toon);
                                dictionary.Add(pmxMaterial.Toon, 0);
                            }
                        }
                    }
                }
                bool flag6 = list2.Count > 0;
                if (flag6)
                {
                    Dictionary <string, int> dictionary2 = new Dictionary <string, int>(list2.Count);
                    int num = 0;
                    for (int j = 0; j < list2.Count; j++)
                    {
                        for (int k = num; k < array.Length; k++)
                        {
                            bool flag7 = !array[k];
                            if (flag7)
                            {
                                toonInfo.ToonNames[k] = list2[j];
                                dictionary2.Add(list2[j], k);
                                array[k] = true;
                                num      = k + 1;
                                break;
                            }
                        }
                    }
                    for (int l = 0; l < count; l++)
                    {
                        bool flag8 = toonInfo.MaterialToon[l] < -1;
                        if (flag8)
                        {
                            PmxMaterial pmxMaterial2 = list[l];
                            bool        flag9        = dictionary2.ContainsKey(pmxMaterial2.Toon);
                            if (flag9)
                            {
                                toonInfo.MaterialToon[l] = dictionary2[pmxMaterial2.Toon];
                            }
                            else
                            {
                                toonInfo.MaterialToon[l] = -1;
                                toonInfo.IsRejection     = true;
                            }
                        }
                    }
                }
                result = toonInfo;
            }
            return(result);
        }
Exemplo n.º 11
0
 // Token: 0x060003D6 RID: 982 RVA: 0x0001A186 File Offset: 0x00018386
 public ToonInfo(int count)
 {
     this.ToonNames    = SystemToon.GetToonNames();
     this.MaterialToon = new int[count];
     this.IsRejection  = false;
 }
        // Token: 0x06000259 RID: 601 RVA: 0x00013014 File Offset: 0x00011214
        public void CreateTable(List <PmxMaterial> ml)
        {
            this.NameToIndex.Clear();
            this.IndexToName.Clear();
            int num = 0;

            for (int i = 0; i < ml.Count; i++)
            {
                PmxMaterial pmxMaterial = ml[i];
                bool        flag        = !string.IsNullOrEmpty(pmxMaterial.Tex) && !this.NameToIndex.ContainsKey(pmxMaterial.Tex);
                if (flag)
                {
                    this.NameToIndex.Add(pmxMaterial.Tex, num);
                    this.IndexToName.Add(num, pmxMaterial.Tex);
                    num++;
                }
                bool flag2 = !string.IsNullOrEmpty(pmxMaterial.Sphere) && !this.NameToIndex.ContainsKey(pmxMaterial.Sphere);
                if (flag2)
                {
                    this.NameToIndex.Add(pmxMaterial.Sphere, num);
                    this.IndexToName.Add(num, pmxMaterial.Sphere);
                    num++;
                }
                bool flag3 = !string.IsNullOrEmpty(pmxMaterial.Toon) && !this.NameToIndex.ContainsKey(pmxMaterial.Toon) && !SystemToon.IsSystemToon(pmxMaterial.Toon);
                if (flag3)
                {
                    this.NameToIndex.Add(pmxMaterial.Toon, num);
                    this.IndexToName.Add(num, pmxMaterial.Toon);
                    num++;
                }
            }
        }