Пример #1
0
    protected override void SetupControls(string name, System.Func <object> getterFunc, System.Action <object> setterAction, IEnumerable <object> attributes = null)
    {
        // Set name
        nameText.text = name;

        // Set initial value
        SetColor((EditColor)getterFunc.Invoke());

        colorButton.onClick.AddListener(() => PixelsApp.Instance.ShowColorPicker("Select " + name, ((EditColor)getterFunc.Invoke()).asColor32, (res, newColor) =>
        {
            if (res)
            {
                var editColor = EditColor.MakeRGB(newColor);
                SetColor(editColor);
                setterAction?.Invoke(editColor);
            }
        }));

        overrideColorToggle.onValueChanged.AddListener((newToggleValue) =>
        {
            var curColor = (EditColor)getterFunc.Invoke();
            if (newToggleValue)
            {
                curColor.type = EditColor.ColorType.Face;
            }
            else
            {
                curColor.type = EditColor.ColorType.RGB;
            }
            SetColor(curColor);
            setterAction?.Invoke(curColor);
        });
    }
Пример #2
0
        // Token: 0x06000324 RID: 804 RVA: 0x00019588 File Offset: 0x00017788
        internal bool DrawColorSlider(ShaderPropColor colProp, ref EditColor edit, ColorPicker picker = null)
        {
            bool flag = true;

            float[] vals = colProp.composition ? SliderHelper.DEFAULT_PRESET2 : SliderHelper.DEFAULT_PRESET;
            return(this.DrawColorSlider(colProp.name, ref edit, colProp.colorType, vals, ref flag, picker));
        }
Пример #3
0
    void SetColor(EditColor newColor)
    {
        Color32 col32 = Color.grey;

        switch (newColor.type)
        {
        case EditColor.ColorType.RGB:
        {
            col32 = newColor.asColor32;
            // Make sure we always use full alpha
            col32.a          = 255;
            colorImage.color = col32;
            valueText.text   = "#" + col32.r.ToString("X2") + col32.g.ToString("X2") + col32.b.ToString("X2");
            disableOverlayImage.gameObject.SetActive(false);
            overrideColorToggle.isOn = false;
        }
        break;

        case EditColor.ColorType.Face:
        {
            colorImage.color = Color.grey;
            valueText.text   = "N/A";
            disableOverlayImage.gameObject.SetActive(true);
            overrideColorToggle.isOn = true;
        }
        break;

        default:
            throw new System.NotImplementedException();
        }
    }
        private void InitType()
        {
            // Color生成
            var colProps = type.colProps;

            this.editColors = new EditColor[colProps.Length];
            for (int i = 0; i < colProps.Length; i++)
            {
                var colProp = colProps[i];
                var ec      = new EditColor(null, colProp.colorType);
                if (material != null)
                {
                    ec.Set(material.GetColor(colProps[i].propId));
                }
                else
                {
                    ec.Set(colProps[i].defaultVal);
                }
                editColors[i] = ec;
            }

            // float生成
            var props = type.fProps;

            this.editVals = new EditValue[props.Length];
            for (int i = 0; i < props.Length; i++)
            {
                float val = props[i].defaultVal;
                if (material != null)
                {
                    val = material.GetFloat(props[i].propId);
                }
                editVals[i] = new EditValue(val, props[i].range);
            }
        }
        internal bool DrawColorSlider(ShaderPropColor colProp, ref EditColor edit, ColorPicker picker = null)
        {
            var expand  = true;
            var presets = (colProp.composition) ? DEFAULT_PRESET2 : DEFAULT_PRESET;

            return(DrawColorSlider(colProp.name, ref edit, colProp.colorType, presets, ref expand, picker));
        }
Пример #6
0
 // Token: 0x060000D7 RID: 215 RVA: 0x0000A8CC File Offset: 0x00008ACC
 private void InitType()
 {
     ShaderPropColor[] colProps = this.type.colProps;
     this.editColors = new EditColor[colProps.Length];
     this.pickers    = new ColorPicker[colProps.Length];
     for (int i = 0; i < colProps.Length; i++)
     {
         ShaderPropColor shaderPropColor = colProps[i];
         Color           val             = (this.material != null) ? this.material.GetColor(shaderPropColor.propId) : shaderPropColor.defaultVal;
         EditColor       editColor       = new EditColor(val, shaderPropColor.colorType, shaderPropColor.composition);
         this.editColors[i] = editColor;
         ColorPicker colorPicker = new ColorPicker(ACCMaterial.presetMgr)
         {
             ColorTex = new Texture2D(16, 16, TextureFormat.RGB24, false)
         };
         colorPicker.SetTexColor(ref val);
         this.pickers[i] = colorPicker;
     }
     ShaderPropFloat[] fProps = this.type.fProps;
     this.editVals = new EditValue[fProps.Length];
     for (int j = 0; j < fProps.Length; j++)
     {
         float val2 = fProps[j].defaultVal;
         if (this.material != null)
         {
             val2 = this.material.GetFloat(fProps[j].propId);
         }
         this.editVals[j] = new EditValue(val2, fProps[j].range);
     }
 }
Пример #7
0
        public RGBKeyframe ToRGBKeyframe(EditDataSet editSet, DataSet.AnimationBits bits)
        {
            RGBKeyframe ret = new RGBKeyframe();
            // Add the color to the palette if not already there, otherwise grab the color index
            var colorIndex = EditColor.toColorIndex(ref bits.palette, color);

            ret.setTimeAndColorIndex((ushort)(time * 1000), (ushort)colorIndex);
            return(ret);
        }
Пример #8
0
    public EditAnimation AddNewDefaultAnimation()
    {
        var newAnim = new Animations.EditAnimationSimple();

        newAnim.duration = 3.0f;
        newAnim.color    = EditColor.MakeRGB(new Color32(0xFF, 0x30, 0x00, 0xFF));
        newAnim.faces    = 0b11111111111111111111;
        newAnim.name     = "New Lighting Pattern";
        animations.Add(newAnim);
        return(newAnim);
    }
Пример #9
0
        // Token: 0x0600032B RID: 811 RVA: 0x00019D70 File Offset: 0x00017F70
        public bool DrawValueSlider(string label, ref EditColor edit, int idx, ref float sliderVal)
        {
            bool flag  = false;
            bool flag2 = false;

            GUILayout.BeginHorizontal(new GUILayoutOption[]
            {
                this.optItemHeight
            });
            try
            {
                this.DrawLabel(ref label);
                if (!edit.isSyncs[idx])
                {
                    this.SetTextColor(this.uiParams.textStyleSC, ref this.textColorRed);
                    flag2 = true;
                }
                EditRange <float> range = edit.GetRange(idx);
                string            text  = GUILayout.TextField(edit.editVals[idx], this.uiParams.textStyleSC, new GUILayoutOption[]
                {
                    this.optInputWidth
                });
                if (edit.editVals[idx] != text)
                {
                    edit.Set(idx, text, range);
                }
                flag |= this.DrawSlider(ref sliderVal, range.editMin, range.editMax);
                GUILayout.Space(this.buttonMargin);
            }
            catch (Exception ex)
            {
                LogUtil.DebugF("{0}, idx={1}, color={2}, vals.length={3}, syncs.length={4}, e={5}", new object[]
                {
                    label,
                    idx,
                    edit.val,
                    edit.editVals.Length,
                    edit.isSyncs.Length,
                    ex
                });
                throw;
            }
            finally
            {
                GUILayout.EndHorizontal();
                if (flag2)
                {
                    this.SetTextColor(this.uiParams.textStyleSC, ref this.textColor);
                }
            }
            return(flag);
        }
Пример #10
0
 private void Awake()
 {
     br              = GameObject.Find("Canvas/Rotation").GetComponent <BlockRotation>();
     ecolor          = GameObject.Find("Canvas/Color").GetComponent <EditColor>();
     myView          = GetComponent <PhotonView>();
     oText           = GameObject.Find("Canvas/Counter/Objects/Text").GetComponent <Text>();
     es              = GameObject.Find("Canvas/Size").GetComponent <EditSize>();
     hitEffect       = GameObject.Find("HitEffect");
     lastTime        = Time.time;
     count           = cooldown;
     start           = Time.time;
     illusionCube[0] = GameObject.Instantiate(Resources.Load("illusionCube"), defaultPos, Quaternion.identity) as GameObject;
     illusionCube[1] = GameObject.Instantiate(Resources.Load("illusionTriangle"), defaultPos, Quaternion.identity) as GameObject;
     illusionCube[2] = GameObject.Instantiate(Resources.Load("illusionSlope"), defaultPos, Quaternion.identity) as GameObject;
     illusionCube[3] = GameObject.Instantiate(Resources.Load("illusionFlat"), defaultPos, Quaternion.identity) as GameObject;
 }
Пример #11
0
    public uint toColorIndex(ref List <Color> palette)
    {
        switch (type)
        {
        case ColorType.RGB:
            return(EditColor.toColorIndex(ref palette, rgbColor));

        case ColorType.Face:
            return(DataSet.AnimationBits.PALETTE_COLOR_FROM_FACE);

        case ColorType.Random:
            return(DataSet.AnimationBits.PALETTE_COLOR_FROM_RANDOM);

        default:
            throw new System.NotImplementedException();
        }
    }
        // Token: 0x060000E3 RID: 227 RVA: 0x0000B2C4 File Offset: 0x000094C4
        public static void Write(BinaryWriter writer, ACCMaterialEx mate)
        {
            writer.Write(FileConst.HEAD_MATE);
            writer.Write(1000);
            writer.Write(mate.name1);
            writer.Write(mate.name2);
            string name = mate.type.name;

            writer.Write(name);
            string mateName = ShaderType.GetMateName(name);

            writer.Write(mateName);
            foreach (ShaderPropTex shaderPropTex in mate.type.texProps)
            {
                if (shaderPropTex.key == PropKey._RenderTex)
                {
                    writer.Write("null");
                }
                else
                {
                    writer.Write("tex2d");
                    ACCTextureEx acctextureEx = mate.texDic[shaderPropTex.key];
                    writer.Write(acctextureEx.editname);
                    writer.Write(acctextureEx.txtpath);
                    ACCMaterialEx.OUT_UTIL.Write(writer, acctextureEx.texOffset);
                    ACCMaterialEx.OUT_UTIL.Write(writer, acctextureEx.texScale);
                }
            }
            for (int j = 0; j < mate.editColors.Length; j++)
            {
                ShaderPropColor shaderPropColor = mate.type.colProps[j];
                EditColor       editColor       = mate.editColors[j];
                writer.Write(shaderPropColor.type.ToString());
                writer.Write(shaderPropColor.keyName);
                ACCMaterialEx.OUT_UTIL.Write(writer, editColor.val);
            }
            for (int k = 0; k < mate.editVals.Length; k++)
            {
                ShaderPropFloat shaderPropFloat = mate.type.fProps[k];
                EditValue       editValue       = mate.editVals[k];
                writer.Write(shaderPropFloat.type.ToString());
                writer.Write(shaderPropFloat.keyName);
                writer.Write(editValue.val);
            }
        }
Пример #13
0
        // Changement de la palette
        void ClickColor(object sender, System.EventArgs e)
        {
            Label colorClick = sender as Label;

            numCol = colorClick.Tag != null ? (int)colorClick.Tag : 0;
            if (!bpEditMode.Checked)
            {
                EditColor ed = new EditColor(numCol, bitmapCpc.Palette[numCol], bitmapCpc.GetPaletteColor(numCol).GetColorArgb, cpcPlus.Checked);
                ed.ShowDialog(this);
                if (ed.isValide)
                {
                    bitmapCpc.SetPalette(numCol, ed.ValColor);
                    if (autoRecalc.Checked)
                    {
                        bpRecalc_Click(sender, e);
                    }
                    else
                    {
                        Render();
                    }
                }
            }
        }
        public bool DrawValueSlider(string label, ref EditColor edit, int idx, ref float sliderVal)
        {
            var changed     = false;
            var fontChanged = false;

            GUILayout.BeginHorizontal(optItemHeight);
            try {
                DrawLabel(ref label);

                if (!edit.isSyncs[idx])
                {
                    SetTextColor(uiParams.textStyleSC, ref textColorRed);
                    fontChanged = true;
                }

                var range = edit.GetRange(idx);
                var val2  = GUILayout.TextField(edit.editVals[idx], uiParams.textStyleSC, optInputWidth);
                if (edit.editVals[idx] != val2)   // 直接書き換えられたケース
                {
                    edit.Set(idx, val2, range);
                }

                changed |= DrawSlider(ref sliderVal, range.editMin, range.editMax);
                GUILayout.Space(buttonMargin);
            } catch (Exception e) {
                LogUtil.DebugF("{0}, idx={1}, color={2}, vals.length={3}, syncs.length={4}, e={5}",
                               label, idx, edit.val, edit.editVals.Length, edit.isSyncs.Length, e);
                throw;
            } finally {
                GUILayout.EndHorizontal();
                if (fontChanged)
                {
                    SetTextColor(uiParams.textStyleSC, ref textColor);
                }
            }
            return(changed);
        }
Пример #15
0
        private void InitType()
        {
            // Color生成
            var colProps = type.colProps;

            editColors = new EditColor[colProps.Length];
            pickers    = new ColorPicker[colProps.Length];
            for (var i = 0; i < colProps.Length; i++)
            {
                var colProp = colProps[i];
                var color   = material != null?material.GetColor(colProp.propId) : colProp.defaultVal;

                var ec = new EditColor(color, colProp.colorType, colProp.composition);
                editColors[i] = ec;
                var picker = new ColorPicker(presetMgr)
                {
                    ColorTex = new Texture2D(ICON_SIZE, ICON_SIZE, TextureFormat.RGB24, false)
                };
                picker.SetTexColor(ref color);
                pickers[i] = picker;
            }

            // float生成
            var props = type.fProps;

            editVals = new EditValue[props.Length];
            for (var i = 0; i < props.Length; i++)
            {
                var val = props[i].defaultVal;
                if (material != null)
                {
                    val = material.GetFloat(props[i].propId);
                }
                editVals[i] = new EditValue(val, props[i].range);
            }
        }
Пример #16
0
        // Changement de la palette
        void ClickColor(object sender, System.EventArgs e)
        {
            Label colorClick = sender as Label;

            numCol = colorClick.Tag != null ? (int)colorClick.Tag : 0;
            if (!modeEdition.Checked)
            {
                EditColor ed = new EditColor(numCol, bitmapCpc.Palette[numCol], bitmapCpc.GetPaletteColor(numCol).GetColorArgb, bitmapCpc.cpcPlus);
                ed.ShowDialog(this);
                if (ed.isValide)
                {
                    bitmapCpc.SetPalette(numCol, ed.ValColor);
                    UpdatePalette();
                    Convert(false);
                }
            }
            else
            {
                if (editImage != null)
                {
                    editImage.SetPenColor(bitmapCpc.GetPaletteColor(numCol));
                }
            }
        }
Пример #17
0
    public static AppDataSet CreateTestDataSet()
    {
        AppDataSet ret = new AppDataSet();

        // We only save the dice that we have indicated to be in the pool
        // (i.e. ignore dice that are 'new' and we didn't connect to)
        var die0 = new EditDie()
        {
            name           = "Die 000",
            deviceId       = 0x123456789ABCDEF0,
            faceCount      = 20,
            designAndColor = DesignAndColor.V3_Orange
        };

        ret.dice.Add(die0);
        var die1 = new EditDie()
        {
            name           = "Die 001",
            deviceId       = 0xABCDEF0123456789,
            faceCount      = 20,
            designAndColor = DesignAndColor.V5_Black
        };

        ret.dice.Add(die1);
        var die2 = new EditDie()
        {
            name           = "Die 002",
            deviceId       = 0xCDEF0123456789AB,
            faceCount      = 20,
            designAndColor = DesignAndColor.V5_Grey
        };

        ret.dice.Add(die2);
        var die3 = new EditDie()
        {
            name           = "Die 003",
            deviceId       = 0xEF0123456789ABCD,
            faceCount      = 20,
            designAndColor = DesignAndColor.V5_Gold
        };

        ret.dice.Add(die3);

        EditAnimationSimple simpleAnim = new EditAnimationSimple();

        simpleAnim.duration = 1.0f;
        simpleAnim.color    = EditColor.MakeRGB(Color.blue);
        simpleAnim.faces    = 0b11111111111111111111;
        simpleAnim.name     = "Simple Anim 1";
        ret.animations.Add(simpleAnim);


        EditBehavior behavior = new EditBehavior();

        behavior.rules.Add(new EditRule()
        {
            condition = new EditConditionRolling(),
            actions   = new List <EditAction> ()
            {
                new EditActionPlayAnimation()
                {
                    animation = simpleAnim, faceIndex = 0, loopCount = 1
                }
            }
        });
        behavior.rules.Add(new EditRule()
        {
            condition = new EditConditionFaceCompare()
            {
                faceIndex = 19,
                flags     = ConditionFaceCompare_Flags.Equal
            },
            actions = new List <EditAction> ()
            {
                new EditActionPlayAnimation()
                {
                    animation = simpleAnim, faceIndex = 19, loopCount = 1
                }
            }
        });
        behavior.rules.Add(new EditRule()
        {
            condition = new EditConditionFaceCompare()
            {
                faceIndex = 0,
                flags     = ConditionFaceCompare_Flags.Less | ConditionFaceCompare_Flags.Equal | ConditionFaceCompare_Flags.Greater
            },
            actions = new List <EditAction> ()
            {
                new EditActionPlayAnimation()
                {
                    animation = simpleAnim, faceIndex = 2, loopCount = 1
                }
            }
        });
        ret.behaviors.Add(behavior);

        ret.presets.Add(new EditPreset()
        {
            name           = "Preset 0",
            dieAssignments = new List <EditDieAssignment>()
            {
                new EditDieAssignment()
                {
                    die      = die0,
                    behavior = behavior
                },
                new EditDieAssignment()
                {
                    die      = die1,
                    behavior = behavior
                }
            }
        });

        return(ret);
    }
Пример #18
0
        public void Update(ShaderType sdrType)
        {
            if (type == sdrType)
            {
                return;
            }
            // TODO 変更前のマテリアルから設定値をロード


            // 同一長の場合でも更新(Alphaの有無が異なるケースがある)
            var colProps       = sdrType.colProps;
            var createdColors  = new EditColor[colProps.Length];
            var createdPickers = new ColorPicker[colProps.Length];
            var size           = UIParams.Instance.itemHeight;

            for (var i = 0; i < colProps.Length; i++)
            {
                var colProp = colProps[i];
                if (i < editColors.Length)
                {
                    // カラータイプが異なる場合は、インスタンスを作り直して色をコピー
                    if (editColors[i].type == colProp.colorType)
                    {
                        createdColors[i] = editColors[i];
                    }
                    else
                    {
                        createdColors[i] = new EditColor(editColors[i].val, colProp.colorType, colProp.composition);
                    }
                    createdPickers[i] = pickers[i];
                }
                else
                {
                    Color color;
                    if (material != null)
                    {
                        color = material.GetColor(colProp.propId);
                    }
                    else
                    {
                        color = (Original != null)? Original.GetColor(i): colProp.defaultVal;
                    }
                    createdColors[i]  = new EditColor(color, colProp.colorType, colProp.composition);
                    createdPickers[i] = new ColorPicker(presetMgr)
                    {
                        ColorTex = new Texture2D(size, size, TextureFormat.RGB24, false)
                    };
                    createdPickers[i].SetTexColor(ref createdColors[i].val);
                }
            }
            editColors = createdColors;
            pickers    = createdPickers;

            var props       = sdrType.fProps;
            var createdVals = new EditValue[props.Length];

            for (var i = 0; i < props.Length; i++)
            {
                var val = (material != null)? material.GetFloat(props[i].propId) : props[i].defaultVal;
                createdVals[i] = new EditValue(val, props[i].range);
            }
            editVals = createdVals;

            // テクスチャ情報の初期化
            foreach (var texProp in sdrType.texProps)
            {
                // セットしてないテクスチャは空テクスチャをセット
                if (material != null && !material.HasProperty(texProp.keyName))
                {
                    material.SetTexture(texProp.propId, new Texture());
                }
            }

            type = sdrType;
        }
        public void Update(ShaderType sdrType)
        {
            if (this.type == sdrType)
            {
                return;
            }
            // TODO 変更前のマテリアルから設定値をロード


            // 同一長の場合でも更新(Alphaの有無が異なるケースがある)
            var colProps      = sdrType.colProps;
            var createdColors = new EditColor[colProps.Length];

            for (int i = 0; i < colProps.Length; i++)
            {
                var colProp = colProps[i];
                if (i < this.editColors.Length && editColors[i].val.HasValue)
                {
                    // カラータイプが異なる場合は、インスタンスを作り直して色をコピー
                    if (editColors[i].type == colProp.colorType)
                    {
                        createdColors[i] = editColors[i];
                    }
                    else
                    {
                        createdColors[i] = new EditColor(editColors[i].val, colProp.colorType);
                    }
                }
                else
                {
                    var ec = new EditColor(null, colProp.colorType);
                    if (material != null)
                    {
                        ec.Set(material.GetColor(colProps[i].propId));
                    }
                    else
                    {
                        ec.Set((original != null)? original.GetColor(i): colProps[i].defaultVal);
                    }
                    createdColors[i] = ec;
                }
            }
            editColors = createdColors;


            var props       = sdrType.fProps;
            var createdVals = new EditValue[props.Length];

            for (int i = 0; i < props.Length; i++)
            {
                float val;
                if (material != null)
                {
                    val = material.GetFloat(props[i].propId);
                }
                else
                {
                    val = props[i].defaultVal;//(original != null)? original.GetColor(i): Color.white;
                }
                createdVals[i] = new EditValue(val, props[i].range);
            }
            this.editVals = createdVals;

            // テクスチャ情報の初期化
            foreach (var texProp in sdrType.texProps)
            {
                // セットしてないテクスチャは空テクスチャをセット
                if (!material.HasProperty(texProp.keyName))
                {
                    material.SetTexture(texProp.propId, new Texture());
                }
            }

            type = sdrType;
        }
Пример #20
0
        // Token: 0x060000DA RID: 218 RVA: 0x0000AAE8 File Offset: 0x00008CE8
        public void Update(ShaderType sdrType)
        {
            if (this.type == sdrType)
            {
                return;
            }
            ShaderPropColor[] colProps = sdrType.colProps;
            EditColor[]       array    = new EditColor[colProps.Length];
            ColorPicker[]     array2   = new ColorPicker[colProps.Length];
            int itemHeight             = UIParams.Instance.itemHeight;

            for (int i = 0; i < colProps.Length; i++)
            {
                ShaderPropColor shaderPropColor = colProps[i];
                if (i < this.editColors.Length)
                {
                    if (this.editColors[i].type == shaderPropColor.colorType)
                    {
                        array[i] = this.editColors[i];
                    }
                    else
                    {
                        array[i] = new EditColor(this.editColors[i].val, shaderPropColor.colorType, shaderPropColor.composition);
                    }
                    array2[i] = this.pickers[i];
                }
                else
                {
                    Color val;
                    if (this.material != null)
                    {
                        val = this.material.GetColor(shaderPropColor.propId);
                    }
                    else
                    {
                        val = ((this.Original != null) ? this.Original.GetColor(i) : shaderPropColor.defaultVal);
                    }
                    array[i]  = new EditColor(val, shaderPropColor.colorType, shaderPropColor.composition);
                    array2[i] = new ColorPicker(ACCMaterial.presetMgr)
                    {
                        ColorTex = new Texture2D(itemHeight, itemHeight, TextureFormat.RGB24, false)
                    };
                    array2[i].SetTexColor(ref array[i].val);
                }
            }
            this.editColors = array;
            this.pickers    = array2;
            ShaderPropFloat[] fProps = sdrType.fProps;
            EditValue[]       array3 = new EditValue[fProps.Length];
            for (int j = 0; j < fProps.Length; j++)
            {
                float val2 = (this.material != null) ? this.material.GetFloat(fProps[j].propId) : fProps[j].defaultVal;
                array3[j] = new EditValue(val2, fProps[j].range);
            }
            this.editVals = array3;
            foreach (ShaderPropTex shaderPropTex in sdrType.texProps)
            {
                if (this.material != null && !this.material.HasProperty(shaderPropTex.keyName))
                {
                    this.material.SetTexture(shaderPropTex.propId, new Texture());
                }
            }
            this.type = sdrType;
        }
Пример #21
0
        // Token: 0x06000326 RID: 806 RVA: 0x000195DC File Offset: 0x000177DC
        internal bool DrawColorSlider(string label, ref EditColor edit, ColorType colType, IEnumerable <float> vals, ref bool expand, ColorPicker picker = null)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            Color color = edit.val;
            bool  flag  = false;

            try
            {
                if (picker != null)
                {
                    picker.Color = color;
                    if (GUILayout.Button(picker.ColorTex, this.uiParams.lStyleS, new GUILayoutOption[]
                    {
                        this.optItemHeight,
                        picker.IconWidth,
                        GUILayout.ExpandWidth(false)
                    }))
                    {
                        picker.expand = !picker.expand;
                    }
                }
                if (GUILayout.Button(label, this.uiParams.lStyle, new GUILayoutOption[]
                {
                    this.optItemHeight
                }))
                {
                    expand = !expand;
                }
                if (picker != null && ColorPicker.IsColorCode(picker.ColorCode))
                {
                    if (GUILayout.Button(SliderHelper.CopyIcon, this.uiParams.lStyle, new GUILayoutOption[]
                    {
                        this.optCPWidth,
                        this.optItemHeight
                    }))
                    {
                        SliderHelper.clipHandler.SetClipboard(picker.ColorCode);
                    }
                    string text = SliderHelper.clipHandler.GetClipboard();
                    GUI.enabled &= ColorPicker.IsColorCode(text);
                    try
                    {
                        if (GUILayout.Button(SliderHelper.PasteIcon, this.uiParams.lStyle, new GUILayoutOption[]
                        {
                            this.optCPWidth,
                            this.optItemHeight
                        }))
                        {
                            try
                            {
                                if (picker.SetColorCode(text))
                                {
                                    color = picker.Color;
                                    flag  = true;
                                }
                            }
                            catch (Exception ex)
                            {
                                LogUtil.Error(new object[]
                                {
                                    "failed to import color-code",
                                    ex
                                });
                            }
                        }
                    }
                    finally
                    {
                        GUI.enabled = true;
                    }
                    string text2 = GUILayout.TextField(picker.ColorCode, 7, this.uiParams.textStyleSC, new GUILayoutOption[]
                    {
                        this.optCodeWidth
                    });
                    if (text2 != picker.ColorCode && picker.SetColorCode(text2))
                    {
                        color = picker.Color;
                        flag  = true;
                    }
                }
                if (!expand)
                {
                    return(false);
                }
                foreach (float num in vals)
                {
                    float      b          = num;
                    GUIContent guicontent = new GUIContent(b.ToString(CultureInfo.InvariantCulture));
                    if (GUILayout.Button(guicontent, this.bStyleSS, new GUILayoutOption[]
                    {
                        this.getWidthOpt(guicontent)
                    }))
                    {
                        color.r = (color.g = (color.b = b));
                        flag    = true;
                    }
                }
                if (GUILayout.Button("-", this.bStyleSS, new GUILayoutOption[]
                {
                    this.bWidthOpt
                }))
                {
                    if (color.r < SliderHelper.DELTA)
                    {
                        color.r = 0f;
                    }
                    else
                    {
                        color.r -= SliderHelper.DELTA;
                    }
                    if (color.g < SliderHelper.DELTA)
                    {
                        color.g = 0f;
                    }
                    else
                    {
                        color.g -= SliderHelper.DELTA;
                    }
                    if (color.b < SliderHelper.DELTA)
                    {
                        color.b = 0f;
                    }
                    else
                    {
                        color.b -= SliderHelper.DELTA;
                    }
                    flag = true;
                }
                if (GUILayout.Button("+", this.bStyleSS, new GUILayoutOption[]
                {
                    this.bWidthOpt
                }))
                {
                    if (color.r + SliderHelper.DELTA > edit.GetRange(0).editMax)
                    {
                        color.r = edit.GetRange(0).editMax;
                    }
                    else
                    {
                        color.r += SliderHelper.DELTA;
                    }
                    if (color.g + SliderHelper.DELTA > edit.GetRange(1).editMax)
                    {
                        color.g = edit.GetRange(1).editMax;
                    }
                    else
                    {
                        color.g += SliderHelper.DELTA;
                    }
                    if (color.b + SliderHelper.DELTA > edit.GetRange(2).editMax)
                    {
                        color.b = edit.GetRange(2).editMax;
                    }
                    else
                    {
                        color.b += SliderHelper.DELTA;
                    }
                    flag = true;
                }
            }
            finally
            {
                GUILayout.EndHorizontal();
            }
            int idx = 0;

            if (colType == ColorType.rgb || colType == ColorType.rgba)
            {
                flag |= this.DrawValueSlider("R", ref edit, idx++, ref color.r);
                flag |= this.DrawValueSlider("G", ref edit, idx++, ref color.g);
                flag |= this.DrawValueSlider("B", ref edit, idx++, ref color.b);
            }
            if (colType == ColorType.rgba || colType == ColorType.a)
            {
                flag |= this.DrawValueSlider("A", ref edit, idx, ref color.a);
            }
            if (picker != null && picker.expand && picker.DrawLayout())
            {
                color = picker.Color;
                flag  = true;
            }
            if (flag)
            {
                edit.Set(color);
            }
            return(flag);
        }
        internal bool DrawColorSlider(string label, ref EditColor edit, ColorType colType, IEnumerable <float> vals, ref bool expand, ColorPicker picker = null)
        {
            GUILayout.BeginHorizontal();
            var c       = edit.val;
            var changed = false;

            try {
                if (picker != null)
                {
                    picker.Color = c;
                    if (GUILayout.Button(picker.ColorTex, uiParams.lStyleS, optItemHeight, picker.IconWidth, GUILayout.ExpandWidth(false)))
                    {
                        picker.expand = !picker.expand;
                    }
                }
                if (GUILayout.Button(label, uiParams.lStyle, optItemHeight))
                {
                    expand = !expand;
                }
                if (picker != null && ColorPicker.IsColorCode(picker.ColorCode))
                {
                    if (GUILayout.Button(CopyIcon, uiParams.lStyle, optCPWidth, optItemHeight))
                    {
                        clipHandler.SetClipboard(picker.ColorCode);
                    }

                    var clip = clipHandler.GetClipboard();
                    GUI.enabled &= ColorPicker.IsColorCode(clip);
                    try {
                        if (GUILayout.Button(PasteIcon, uiParams.lStyle, optCPWidth, optItemHeight))
                        {
                            try {
                                if (picker.SetColorCode(clip))
                                {
                                    c       = picker.Color;
                                    changed = true;
                                }
                            } catch (Exception e) {
                                LogUtil.Error("failed to import color-code", e);
                            }
                        }
                    } finally {
                        GUI.enabled = true;
                    }

                    var code = GUILayout.TextField(picker.ColorCode, 7, uiParams.textStyleSC, optCodeWidth);
                    if (code != picker.ColorCode && picker.SetColorCode(code))
                    {
                        c       = picker.Color;
                        changed = true;
                    }
                }

                if (!expand)
                {
                    return(false);
                }

                foreach (var val in vals)
                {
                    var cont = new GUIContent(val.ToString(CultureInfo.InvariantCulture));
                    if (!GUILayout.Button(cont, bStyleSS, getWidthOpt(cont)))
                    {
                        continue;
                    }
                    c.r     = c.g = c.b = val;
                    changed = true;
                }

                if (GUILayout.Button("-", bStyleSS, bWidthOpt))
                {
                    if (c.r < DELTA)
                    {
                        c.r = 0;
                    }
                    else
                    {
                        c.r -= DELTA;
                    }
                    if (c.g < DELTA)
                    {
                        c.g = 0;
                    }
                    else
                    {
                        c.g -= DELTA;
                    }
                    if (c.b < DELTA)
                    {
                        c.b = 0;
                    }
                    else
                    {
                        c.b -= DELTA;
                    }
                    changed = true;
                }

                if (GUILayout.Button("+", bStyleSS, bWidthOpt))
                {
                    if (c.r + DELTA > edit.GetRange(0).editMax)
                    {
                        c.r = edit.GetRange(0).editMax;
                    }
                    else
                    {
                        c.r += DELTA;
                    }
                    if (c.g + DELTA > edit.GetRange(1).editMax)
                    {
                        c.g = edit.GetRange(1).editMax;
                    }
                    else
                    {
                        c.g += DELTA;
                    }
                    if (c.b + DELTA > edit.GetRange(2).editMax)
                    {
                        c.b = edit.GetRange(2).editMax;
                    }
                    else
                    {
                        c.b += DELTA;
                    }
                    changed = true;
                }
            } finally {
                GUILayout.EndHorizontal();
            }

            var idx = 0;

            if (colType == ColorType.rgb || colType == ColorType.rgba)
            {
                changed |= DrawValueSlider("R", ref edit, idx++, ref c.r);
                changed |= DrawValueSlider("G", ref edit, idx++, ref c.g);
                changed |= DrawValueSlider("B", ref edit, idx++, ref c.b);
            }
            if (colType == ColorType.rgba || colType == ColorType.a)
            {
                changed |= DrawValueSlider("A", ref edit, idx, ref c.a);
            }
            if (picker != null)
            {
                if (picker.expand && picker.DrawLayout())
                {
                    c       = picker.Color;
                    changed = true;
                }
            }
            if (changed)
            {
                edit.Set(c);
            }

            return(changed);
        }
 internal bool DrawColorSlider(string label, ref EditColor edit, IEnumerable <float> vals, ref bool expand, ColorPicker picker = null)
 {
     return(DrawColorSlider(label, ref edit, edit.type, vals, ref expand, picker));
 }