Ejemplo n.º 1
0
        private void AddColorParameter(string label, ParameterOverride <Color> param)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(label, GUILayout.Width(200));
            bool enabled = param.overrideState;

            if (enabled)
            {
                string hash = param.GetHashCode().ToString();
                if (GUILayout.Button("Disable", GUILayout.Width(100)))
                {
                    param.overrideState = false;
                }
                AddColorInput("Red", hash, ref param.value.r);
                AddColorInput("Green", hash, ref param.value.g);
                AddColorInput("Blue", hash, ref param.value.b);
                AddColorInput("Alpha", hash, ref param.value.a);
            }
            else
            {
                if (GUILayout.Button("Enable", GUILayout.Width(100)))
                {
                    param.overrideState = true;
                }
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 2
0
        private void AddVector4Parameter(string label, ParameterOverride <Vector4> param)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(label, GUILayout.Width(200));
            bool enabled = param.overrideState;

            if (enabled)
            {
                string hash = param.GetHashCode().ToString();
                if (GUILayout.Button("Disable", GUILayout.Width(100)))
                {
                    param.overrideState = false;
                }
                AddColorInput("X", hash, ref param.value.x);
                AddColorInput("Y", hash, ref param.value.y);
                AddColorInput("Z", hash, ref param.value.z);
                AddColorInput("W", hash, ref param.value.w);
            }
            else
            {
                if (GUILayout.Button("Enable", GUILayout.Width(100)))
                {
                    param.overrideState = true;
                }
            }
            GUILayout.EndHorizontal();
        }
Ejemplo n.º 3
0
        private void AddIntParameter(string label, ParameterOverride <int> param, int min, int max)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(label, GUILayout.Width(200));
            bool enabled = param.overrideState;

            if (enabled)
            {
                string hash = param.GetHashCode().ToString();
                if (GUILayout.Button("Disable", GUILayout.Width(100)))
                {
                    param.overrideState = false;
                }
                string textValue = string.Empty;
                if (propertyStringStorage.ContainsKey(hash))
                {
                    textValue = propertyStringStorage[hash];
                }
                else
                {
                    textValue = param.value.ToString();
                    propertyStringStorage.Add(hash, textValue);
                }
                string newValue = GUILayout.TextArea(textValue, GUILayout.Width(110));
                if (newValue != textValue)
                {
                    textValue = newValue;
                    if (int.TryParse(textValue, out int v))
                    {
                        param.Override(v);
                    }
                    propertyStringStorage[hash] = textValue;
                }
                if (!propertyFloatStorage.TryGetValue(hash, out float sliderValue))
                {
                    sliderValue = param.value;
                    propertyFloatStorage[hash] = sliderValue;
                }
                float sliderValue2 = GUILayout.HorizontalSlider(sliderValue, min, max, GUILayout.Width(330));
                if (sliderValue2 != sliderValue)
                {
                    param.Override((int)sliderValue2);
                    textValue = ((int)sliderValue2).ToString();
                    propertyStringStorage[hash] = textValue;
                    propertyFloatStorage[hash]  = sliderValue2;
                }
            }
            else
            {
                if (GUILayout.Button("Enable", GUILayout.Width(100)))
                {
                    param.overrideState = true;
                }
            }
            GUILayout.EndHorizontal();
        }