예제 #1
0
        private UISliderControl CreateSlider(UIControlSet set, int inputBehaviorId, string defaultTitle, string overrideTitle, Sprite icon, float minValue, float maxValue, System.Action <int, int, float> valueChangedCallback, System.Action <int, int> cancelCallback)
        {
            // Create slider control
            UISliderControl control = set.CreateSlider(
                uiSliderControlPrefab,
                icon,
                minValue,
                maxValue,
                (int cId, float value) => { valueChangedCallback(inputBehaviorId, cId, value); },
                (int cId) => { cancelCallback(inputBehaviorId, cId); }
                );

            // Title
            string title = string.IsNullOrEmpty(overrideTitle) ? defaultTitle : overrideTitle;

            if (!string.IsNullOrEmpty(title))
            {
                control.showTitle  = true;
                control.title.text = title;
            }
            else
            {
                control.showTitle = false;
            }

            // Icon
            control.showIcon = icon != null;

            return(control);
        }
예제 #2
0
        private UISliderControl CreateSlider(
            UIControlSet set,
            int inputBehaviorId,
            string defaultTitle,
            string overrideTitle,
            Sprite icon,
            float minValue,
            float maxValue,
            Action <int, int, float> valueChangedCallback,
            Action <int, int> cancelCallback)
        {
            UISliderControl slider = set.CreateSlider(this.uiSliderControlPrefab, icon, minValue, maxValue, (Action <int, float>)((cId, value) => valueChangedCallback(inputBehaviorId, cId, value)), (Action <int>)(cId => cancelCallback(inputBehaviorId, cId)));
            string          str    = !string.IsNullOrEmpty(overrideTitle) ? overrideTitle : defaultTitle;

            if (!string.IsNullOrEmpty(str))
            {
                slider.showTitle = true;
                slider.title.set_text(str);
            }
            else
            {
                slider.showTitle = false;
            }
            slider.showIcon = Object.op_Inequality((Object)icon, (Object)null);
            return(slider);
        }
예제 #3
0
        private UISliderControl CreateSlider(UIControlSet set, int inputBehaviorId, string defaultTitle, string overrideTitle, Sprite icon, float minValue, float maxValue, Action <int, int, float> valueChangedCallback, Action <int, int> cancelCallback)
        {
            UISliderControl uisliderControl = set.CreateSlider(this.uiSliderControlPrefab, icon, minValue, maxValue, delegate(int cId, float value)
            {
                valueChangedCallback(inputBehaviorId, cId, value);
            }, delegate(int cId)
            {
                cancelCallback(inputBehaviorId, cId);
            });
            string text = (!string.IsNullOrEmpty(overrideTitle)) ? overrideTitle : defaultTitle;

            if (!string.IsNullOrEmpty(text))
            {
                uisliderControl.showTitle  = true;
                uisliderControl.title.text = text;
            }
            else
            {
                uisliderControl.showTitle = false;
            }
            uisliderControl.showIcon = (icon != null);
            return(uisliderControl);
        }