示例#1
0
 // Token: 0x0600034D RID: 845 RVA: 0x0001B72C File Offset: 0x0001992C
 public void Show()
 {
     GUILayout.BeginVertical(new GUILayoutOption[0]);
     try
     {
         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
         GUILayout.Label("パーツカラー", this.uiParams.lStyleB, new GUILayoutOption[]
         {
             this.titleWidth,
             this.titleHeight
         });
         GUILayout.EndHorizontal();
         Maid currentMaid = BaseView.holder.CurrentMaid;
         if (!(currentMaid == null))
         {
             if (currentMaid.IsBusy)
             {
                 GUILayout.Space(100f);
                 GUILayout.Label("変更中...", this.uiParams.lStyleB, new GUILayoutOption[0]);
                 GUILayout.Space(this.uiParams.colorRect.height - 105f);
             }
             else
             {
                 this.scrollViewPosition = GUILayout.BeginScrollView(this.scrollViewPosition, new GUILayoutOption[]
                 {
                     GUILayout.Width(this.uiParams.colorRect.width),
                     GUILayout.Height(this.viewHeight)
                 });
                 try
                 {
                     if (!this.editPartColors.Any <ACCPartsColorView.EditParts>())
                     {
                         for (MaidParts.PARTS_COLOR parts_COLOR = MaidParts.PARTS_COLOR.EYE_L; parts_COLOR < MaidParts.PARTS_COLOR.MATSUGE_UP; parts_COLOR++)
                         {
                             MaidParts.PartsColor partsColor = currentMaid.Parts.GetPartsColor(parts_COLOR);
                             this.editPartColors.Add(new ACCPartsColorView.EditParts(ref partsColor, this.presetMgr));
                         }
                     }
                     for (MaidParts.PARTS_COLOR parts_COLOR2 = MaidParts.PARTS_COLOR.EYE_L; parts_COLOR2 < MaidParts.PARTS_COLOR.MATSUGE_UP; parts_COLOR2++)
                     {
                         MaidParts.PartsColor partsColor2 = currentMaid.Parts.GetPartsColor(parts_COLOR2);
                         int index = (int)parts_COLOR2;
                         ACCPartsColorView.EditParts editParts = this.editPartColors[index];
                         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                         try
                         {
                             if (GUILayout.Button(parts_COLOR2.ToString(), this.uiParams.lStyleB, new GUILayoutOption[0]))
                             {
                                 editParts.expand = !editParts.expand;
                             }
                             string text = partsColor2.m_bUse ? "未使用" : "使用中";
                             GUILayout.Label(text, this.uiParams.lStyleRS, new GUILayoutOption[0]);
                         }
                         finally
                         {
                             GUILayout.EndHorizontal();
                         }
                         if (editParts.expand)
                         {
                             if (partsColor2.m_nShadowRate != editParts.shadowRate.val)
                             {
                                 editParts.shadowRate.Set(partsColor2.m_nShadowRate);
                             }
                             if (this.sliderHelper.DrawValueSlider("影率", editParts.shadowRate))
                             {
                                 partsColor2.m_nShadowRate = editParts.shadowRate.val;
                                 currentMaid.Parts.SetPartsColor(parts_COLOR2, partsColor2);
                                 editParts.SetParts(partsColor2);
                             }
                             if (editParts.HasMainChanged(ref partsColor2))
                             {
                                 editParts.SetMain(partsColor2);
                             }
                             if (editParts.HasShadowChanged(ref partsColor2))
                             {
                                 editParts.SetShadow(partsColor2);
                             }
                             if (partsColor2.m_nMainContrast != editParts.c.val)
                             {
                                 editParts.c.Set(partsColor2.m_nMainContrast);
                             }
                             if (this.sliderHelper.DrawValueSlider("主C", editParts.c))
                             {
                                 partsColor2.m_nMainContrast = editParts.c.val;
                                 currentMaid.Parts.SetPartsColor(parts_COLOR2, partsColor2);
                                 editParts.SetParts(partsColor2);
                             }
                             if (partsColor2.m_nShadowContrast != editParts.shadowC.val)
                             {
                                 editParts.shadowC.Set(partsColor2.m_nShadowContrast);
                             }
                             if (this.sliderHelper.DrawValueSlider("影C", editParts.shadowC))
                             {
                                 partsColor2.m_nShadowContrast = editParts.shadowC.val;
                                 currentMaid.Parts.SetPartsColor(parts_COLOR2, partsColor2);
                                 editParts.SetParts(partsColor2);
                             }
                             if (this.sliderHelper.DrawColorSlider("主色", ref editParts.main, SliderHelper.DEFAULT_PRESET, ref editParts.mainExpand, editParts.mainPicker))
                             {
                                 editParts.ReflectMain();
                                 currentMaid.Parts.SetPartsColor(parts_COLOR2, editParts.parts);
                             }
                             if (this.sliderHelper.DrawColorSlider("影色", ref editParts.shadow, SliderHelper.DEFAULT_PRESET, ref editParts.shadowExpand, editParts.shadowPicker))
                             {
                                 editParts.ReflectShadow();
                                 currentMaid.Parts.SetPartsColor(parts_COLOR2, editParts.parts);
                             }
                         }
                     }
                 }
                 finally
                 {
                     GUI.EndScrollView();
                 }
             }
         }
     }
     finally
     {
         GUILayout.EndVertical();
     }
 }
示例#2
0
        // Token: 0x06000066 RID: 102 RVA: 0x00007270 File Offset: 0x00005470
        public void Save(string fileName, string presetName, Dictionary <string, bool> dDelNodes)
        {
            Maid       currentMaid = this._holder.CurrentMaid;
            PresetData presetData  = new PresetData
            {
                name = presetName
            };

            foreach (SlotInfo slotInfo in ACConstants.SlotNames.Values)
            {
                if (slotInfo.enable)
                {
                    TBodySkin slot = currentMaid.body0.GetSlot((int)slotInfo.Id);
                    SlotState mask;
                    if (slot.obj == null)
                    {
                        mask = SlotState.NotLoaded;
                    }
                    else if (!slot.boVisible)
                    {
                        mask = SlotState.Masked;
                    }
                    else
                    {
                        mask = SlotState.Displayed;
                    }
                    Material[] materials = this._holder.GetMaterials(slot);
                    if (materials.Length != 0)
                    {
                        CCSlot ccslot = new CCSlot(slotInfo.Id)
                        {
                            mask = mask
                        };
                        foreach (Material material in materials)
                        {
                            ShaderType shaderType = ShaderType.Resolve(material.shader.name);
                            if (shaderType != ShaderType.UNKNOWN)
                            {
                                CCMaterial ccmaterial = new CCMaterial(material, shaderType);
                                ccslot.Add(ccmaterial);
                                foreach (ShaderPropTex shaderPropTex in shaderType.texProps)
                                {
                                    Texture2D texture2D = material.GetTexture(shaderPropTex.propId) as Texture2D;
                                    if (!(texture2D == null) && !string.IsNullOrEmpty(texture2D.name))
                                    {
                                        TextureInfo textureInfo = new TextureInfo();
                                        ccmaterial.Add(textureInfo);
                                        textureInfo.propName = shaderPropTex.keyName;
                                        textureInfo.texFile  = texture2D.name;
                                        TextureModifier.FilterParam filter = this._texModifier.GetFilter(currentMaid, slotInfo.Id.ToString(), material.name, texture2D.name);
                                        if (filter != null && !filter.HasNotChanged())
                                        {
                                            textureInfo.filter = new TexFilter(filter);
                                        }
                                        Vector2 textureOffset = material.GetTextureOffset(shaderPropTex.propId);
                                        if (Math.Abs(textureOffset.x) > 0.001f)
                                        {
                                            textureInfo.offsetX = new float?(textureOffset.x);
                                        }
                                        if (Math.Abs(textureOffset.y) > 0.001f)
                                        {
                                            textureInfo.offsetY = new float?(textureOffset.y);
                                        }
                                        Vector2 textureScale = material.GetTextureScale(shaderPropTex.propId);
                                        if (Math.Abs(textureScale.x) > 0.001f)
                                        {
                                            textureInfo.scaleX = new float?(textureScale.x);
                                        }
                                        if (Math.Abs(textureScale.y) > 0.001f)
                                        {
                                            textureInfo.scaleY = new float?(textureScale.y);
                                        }
                                    }
                                }
                            }
                        }
                        presetData.slots.Add(ccslot);
                    }
                }
            }
            for (int k = TypeUtil.BODY_START; k <= TypeUtil.BODY_END; k++)
            {
                MPN      mpn  = (MPN)Enum.ToObject(typeof(MPN), k);
                MaidProp prop = currentMaid.GetProp(mpn);
                if (prop != null)
                {
                    if (prop.type == 1 || prop.type == 2)
                    {
                        presetData.mpnvals.Add(new CCMPNValue(mpn, prop.value, prop.min, prop.max));
                    }
                    else if (prop.type == 3 && prop.nFileNameRID != 0)
                    {
                        presetData.mpns.Add(new CCMPN(mpn, prop.strFileName));
                    }
                }
            }
            for (int l = TypeUtil.WEAR_START; l <= TypeUtil.WEAR_END; l++)
            {
                MPN      mpn2  = (MPN)Enum.ToObject(typeof(MPN), l);
                MaidProp prop2 = currentMaid.GetProp(mpn2);
                if (prop2 != null && prop2.nFileNameRID != 0)
                {
                    presetData.mpns.Add(new CCMPN(mpn2, prop2.strFileName));
                }
            }
            for (MaidParts.PARTS_COLOR parts_COLOR = TypeUtil.PARTS_COLOR_START; parts_COLOR <= TypeUtil.PARTS_COLOR_END; parts_COLOR++)
            {
                MaidParts.PartsColor partsColor = currentMaid.Parts.GetPartsColor(parts_COLOR);
                presetData.partsColors[parts_COLOR.ToString()] = new CCPartsColor(partsColor);
            }
            presetData.delNodes = new Dictionary <string, bool>(dDelNodes);
            LogUtil.Debug(new object[]
            {
                "create preset...",
                fileName
            });
            this.SavePreset(fileName, presetData);
        }