Example #1
0
        public void Invoke(int flag = 0)
        {
            switch (type)
            {
            case ADMSheetType.Button:
                if (callback != null)
                {
                    (callback as Action)();
                }

                break;

            case ADMSheetType.Slider:
                ADMSheetSlider slider = value as ADMSheetSlider;

                if (callback != null)
                {
                    (callback as Action <int, ADMSheetSlider>)(flag, slider);
                }
                else
                {
                    slider.value = Mathf.Clamp(slider.value + flag, slider.min, slider.max);
                }

                break;
            }
        }
Example #2
0
        public bool Draw(bool selected, out int next)
        {
            next = 0;

            switch (type)
            {
            case ADMSheetType.Slider:
                ADMSheetSlider slider = value as ADMSheetSlider;
                bool           button;
                int            result;

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                {
                    button = GUILayout.Button(
                        label,
                        selected ?
                        AltDialogMenu.selectedButtonStyle :
                        GUI.skin.button,
                        GUILayout.Width(AltDialogMenu.sliderWidth)
                        );

                    result = (int)GUILayout.HorizontalSlider(
                        slider.value,
                        slider.min,
                        slider.max,
                        GUILayout.ExpandWidth(true)
                        );
                }
                GUILayout.EndHorizontal();

                if (button || slider.value != result)
                {
                    next = result - slider.value;

                    return(true);
                }

                break;

            default:
                return(GUILayout.Button(
                           label,
                           selected ?
                           AltDialogMenu.selectedButtonStyle :
                           GUI.skin.button,
                           GUILayout.Width(AltDialogMenu.itemWidth)
                           ));
            }

            return(false);
        }