Beispiel #1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Slider> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement != null || e.NewElement == null)
            {
                return;
            }

            view = (CustomSlider)Element;

            //Control.ValueChanged += HandleValueChanged1;
            Control.Continuous      = false;
            Control.TouchUpOutside += HandleValueChanged1;
            Control.TouchUpInside  += HandleValueChanged;
            //if (!string.IsNullOrEmpty(view.ThumbImage))
            //{
            //    //Assigns a thumb image to the specified control states.
            //    Control.SetThumbImage(UIImage.FromFile(view.ThumbImage), UIControlState.Normal);
            //}
            //else if (view.ThumbColor != Xamarin.Forms.Color.Default ||
            //    view.MaxColor != Xamarin.Forms.Color.Default ||
            //    view.MinColor != Xamarin.Forms.Color.Default)
            //    // Set Progress bar Thumb color
            //    Control.ThumbTintColor = view.ThumbColor.ToUIColor();
            ////this is for Minimum Slider line Color
            //Control.MinimumTrackTintColor = view.MinColor.ToUIColor();
            ////this is for Maximum Slider line Color
            //Control.MaximumTrackTintColor = view.MaxColor.ToUIColor();
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Slider> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                customSlider = e.NewElement as CustomSlider;
            }

            if (e.OldElement != null)
            {
            }

            if (Control != null)
            {
                var thumbSize = new CGSize(THUMB_WIDTH, THUMB_HEIGHT);
                Control.SetThumbImage(Resize(UIImage.FromBundle("thumb.png"), thumbSize), UIControlState.Normal);
                Control.SetMinTrackImage(UIImage.FromBundle("sliderMaxMin-02.png"), UIControlState.Normal);
                Control.SetMaxTrackImage(UIImage.FromBundle("sliderMaxMin-02.png"), UIControlState.Normal);

                Control.MaxValue       = MAXVALUE;
                Control.MinValue       = MINVALUE;
                Control.TouchUpInside += OnTouchUpInside;
                Control.ValueChanged  += OnValueChanged;
            }
        }
Beispiel #3
0
        protected override void OnElementChanged(ElementChangedEventArgs <Slider> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                customSlider = e.NewElement as CustomSlider;
            }

            if (e.OldElement != null)
            {
            }

            if (Control != null)
            {
                var thumbBitmap    = BitmapFactory.DecodeResource(Context.Resources, Resource.Drawable.thumb);
                var thumbWidthPx   = Convert.ToInt32(ConvertDpToPixels(THUMB_WIDTH));
                var thumbHeightPx  = Convert.ToInt32(ConvertDpToPixels(THUMB_HEIGHT));
                var newBmp         = Bitmap.CreateScaledBitmap(thumbBitmap, thumbWidthPx, thumbHeightPx, true);
                var newThumbBitmap = new BitmapDrawable(Context.Resources, newBmp);

                Control.SetThumb(newThumbBitmap);
                Control.ThumbOffset      = (Control.ThumbOffset / 2) + 8;
                Control.ProgressDrawable = new ColorDrawable(Android.Graphics.Color.Transparent);

                Control.Max = MAXVALUE;
                Control.SetOnSeekBarChangeListener(this);
            }
        }
 protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Slider> e)
 {
     base.OnElementChanged(e);
     if (e.OldElement != null || e.NewElement == null)
     {
         return;
     }
     view = (CustomSlider)Element;
     if (!string.IsNullOrEmpty(view.ThumbImage))
     {        // Set Thumb Icon
         Control.SetThumb(Resources.GetDrawable(view.ThumbImage));
         //Control.SetPadding(10,10,10,10);
     }
     else if (view.ThumbColor != Xamarin.Forms.Color.Default ||
              view.MaxColor != Xamarin.Forms.Color.Default ||
              view.MinColor != Xamarin.Forms.Color.Default)
     {
         Control.Thumb.SetColorFilter(view.ThumbColor.ToAndroid(), PorterDuff.Mode.SrcIn);
     }
     Control.ProgressTintList = Android.Content.Res.ColorStateList.ValueOf(view.MinColor.ToAndroid());
     Control.ProgressTintMode = PorterDuff.Mode.SrcIn;
     //this is for Maximum Slider line Color
     Control.ProgressBackgroundTintList = Android.Content.Res.ColorStateList.ValueOf(view.MaxColor.ToAndroid());
     Control.ProgressBackgroundTintMode = PorterDuff.Mode.SrcIn;
 }
Beispiel #5
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
//        if (_sliderSkin == null)
//            _sliderSkin = (GUISkin)EditorGUIUtility.LoadRequired("MyCustomSlider Skin");

        CustomSlider.MyCustomSlider(position, property, EditorStyles.miniButtonMid, label);
    }
Beispiel #6
0
        public static void UpdateSliderLabel(CustomSlider slider, float value)
        {
            TextMeshProUGUI valueLabel = slider.Scrollbar.GetComponentInChildren <TextMeshProUGUI>();

            valueLabel.enableWordWrapping = false;
            //newSlider.SetCurrentValueFromPercentage(value);
            valueLabel.text = value.ToString("N2");
        }
Beispiel #7
0
 private void InitAudioSliders()
 {
     masterSlider = transform.parent.Find("MasterSlider").GetComponent <CustomSlider>();
     musicSlider  = transform.parent.Find("MusicSlider").GetComponent <CustomSlider>();
     soundSlider  = transform.parent.Find("SoundSlider").GetComponent <CustomSlider>();
     masterSlider.gameObject.SetActive(false);
     musicSlider.gameObject.SetActive(false);
     soundSlider.gameObject.SetActive(false);
 }
Beispiel #8
0
 /// <summary>
 /// Decreases volume by a step
 /// and adjusts the progress bar
 /// </summary>
 /// <param name="video">A video object</param>
 /// <param name="slider">A custom slider object</param>
 public static void VolumeDown(DirectXAudioAllias audio, CustomSlider slider)
 {
     if (slider.Value > slider.Minimum)
     {
         slider.Value -= VolumeStep;
         if (CheckException.CheckNull(audio))
         {
             HandleAudio(audio, slider.Value);
         }
     }
 }
Beispiel #9
0
 /// <summary>
 /// Initializes the volume of the video at start
 /// with the value of the progress bar
 /// </summary>
 /// <param name="video">A video object</param>
 /// <param name="slider">A custom slider object</param>
 public static void VolumeInit(DirectXAudioAllias audio, CustomSlider slider)
 {
     if (audio != null)
     {
         audio.Volume = Convert.ToInt32(slider.Value * (ValueNormalizer) + MinVolumeValue);
         if (audio.Volume == MinVolumeValue)
         {
             audio.Volume = NoSound;
         }
     }
 }
Beispiel #10
0
 /// <summary>
 /// Increases volume with a step
 /// and adjusts the progress bar
 /// </summary>
 /// <param name="video">A video object</param>
 /// <param name="slider">A custom slider object</param>
 public static void VolumeUp(DirectXAudioAllias audio, CustomSlider slider)
 {
     if (slider.Value < MaxProgressBarValue)
     {
         slider.Value += VolumeStep;
         if (CheckException.CheckNull(audio))
         {
             HandleAudio(audio, slider.Value);
         }
     }
 }
Beispiel #11
0
 /// <summary>
 /// Initializes the volume of the video at start
 /// with the value of the progress bar
 /// </summary>
 /// <param name="video">A video object</param>
 /// <param name="slider">A custom slider object</param>
 public static void VolumeInit(DirectXAudioAllias audio, CustomSlider slider)
 {
     if (audio != null)
     {
         audio.Volume = Convert.ToInt32(slider.Value * (ValueNormalizer)+MinVolumeValue);
         if(audio.Volume == MinVolumeValue)
         {
             audio.Volume = NoSound;
         }
     }
 }
Beispiel #12
0
 /// <summary>
 /// Increases volume with a step
 /// and adjusts the progress bar
 /// </summary>
 /// <param name="video">A video object</param>
 /// <param name="slider">A custom slider object</param>
 public static void VolumeUp(DirectXAudioAllias audio, CustomSlider slider)
 {
     if (slider.Value < MaxProgressBarValue)
     {
         slider.Value += VolumeStep;
         if (CheckException.CheckNull(audio))
         {
             HandleAudio(audio, slider.Value);
         }
     }
 }
Beispiel #13
0
 private void SliderValueChanged(object sender, System.EventArgs e)
 {
     if (EnabledOSC == true)
     {
         CustomSlider slider = sender as CustomSlider;
         cd = DataContext as ChannelData;
         if (cd != null && slider != null)
         {
             message.SendOSC(cd.Name + "/" + slider.Name, slider.Value.ToString());
         }
     }
 }
     protected override void OnElementChanged(ElementChangedEventArgs<Slider> e)
     {
         base.OnElementChanged(e);
 
         if (null != Control)
         {
             CustomSlider customSlider = (CustomSlider)e.NewElement;
                
             customSlider.DragCompleted += CustomSlider_DragCompleted;
         
         }
     }
    /// <summary>
    /// Specific commands how to return the 3D slider from safe mode to an active state.
    /// </summary>
    private void safemodeOffSlider3D()
    {
        List <GameObject> allSliders = interactionPrefabs.Find(x => x.TagName.Equals("Slider3D")).FoundObjects;

        foreach (GameObject obj in allSliders)
        {
            Transform    full         = obj.transform.GetChild(0);
            CustomSlider customslider = full.GetComponent <CustomSlider>();
            customslider.ReturnToDefaultPos();
            full.GetComponent <Collider>().enabled = true;
            customslider.enabled = true;
        }
    }
 void SetBorderStyle(CustomSlider slider)
 {
     if (slider.IsError == true)
     {
         nativeSlider.ProgressDrawable.SetColorFilter(new PorterDuffColorFilter(Xamarin.Forms.Color.Red.ToAndroid(), PorterDuff.Mode.SrcIn));
         nativeSlider.Thumb.SetColorFilter(new PorterDuffColorFilter(Xamarin.Forms.Color.Red.ToAndroid(), PorterDuff.Mode.SrcIn));
     }
     else
     {
         nativeSlider.ProgressDrawable.SetColorFilter(new PorterDuffColorFilter(Xamarin.Forms.Color.Blue.ToAndroid(), PorterDuff.Mode.SrcIn));
         nativeSlider.Thumb.SetColorFilter(new PorterDuffColorFilter(Xamarin.Forms.Color.Blue.ToAndroid(), PorterDuff.Mode.SrcIn));
     }
 }
 public void Init()
 {
     _sliderInst = transform.GetComponent <CustomSlider>();
     _sliderInst.CurrentValue = GetInitValue();
     lastVal   = GetInitValue();
     _textInst = _sliderInst.Scrollbar.GetComponentInChildren <TMPro.TextMeshProUGUI>();
     _sliderInst.Scrollbar.value = _sliderInst.GetPercentageFromValue(_sliderInst.CurrentValue);
     _sliderInst.Scrollbar.onValueChanged.AddListener(delegate(float value) {
         _sliderInst.SetCurrentValueFromPercentage(value);
         ApplyValue(_sliderInst.CurrentValue);
         RefreshUI();
     });
     RefreshUI();
 }
        void OnGUI()
        {
            var rect1 = EditorGUILayout.GetControlRect();

            value = CustomSlider.MyCustomSlider(rect1, value, EditorStyles.miniButtonMid);
            value = CustomSlider.MyCustomSlider(value, EditorStyles.miniButtonMid, GUILayout.Height(55));

            var rect2 = EditorGUILayout.GetControlRect();

            if (FlashingButton.DrawFlashingButton(rect2, new GUIContent("Hello", "Flashing button"), EditorStyles.miniTextField))
            {
//                Debug.Log("Click");
            }
        }
 void SetBorderStyle(CustomSlider slider)
 {
     if (slider.IsError == true)
     {
         Control.ThumbTintColor        = UIColor.FromRGB(255, 0, 0);
         Control.MinimumTrackTintColor = UIColor.FromRGB(255, 120, 120);
         Control.MaximumTrackTintColor = UIColor.FromRGB(255, 14, 14);
     }
     else
     {
         Control.ThumbTintColor        = UIColor.FromRGB(255, 0, 0);
         Control.MinimumTrackTintColor = UIColor.FromRGB(255, 120, 120);
         Control.MaximumTrackTintColor = UIColor.FromRGB(255, 14, 14);
     }
 }
Beispiel #20
0
        protected override void OnElementChanged(ElementChangedEventArgs <Slider> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || this.Element == null)
            {
                return;
            }

            CustomSlider customSlider = (CustomSlider)this.Element;

            if (null != Control)
            {
                Control.ProgressDrawable.SetColorFilter(customSlider.LineColor.ToAndroid(), PorterDuff.Mode.SrcIn);
                Control.Thumb.SetColorFilter(customSlider.LineColor.ToAndroid(), PorterDuff.Mode.SrcIn);
            }
        }
 private void CheckAssignment()
 {
     if (logoImage == null)
     {
         throw new ArgumentNullException(nameof(logoImage));
     }
     if (loadingBar == null)
     {
         throw new ArgumentNullException(nameof(loadingBar));
     }
     if (infoText == null)
     {
         throw new ArgumentNullException(nameof(infoText));
     }
     slider = loadingBar.GetComponent <CustomSlider>() ??
              throw new ArgumentNullException(nameof(loadingBar) + " is not custom loader!");
     slider.OnSliderFillUp = OnLoadingFinished;
 }
Beispiel #22
0
        public T AddSliderSetting <T>(string name, string hintText, float min, float max, float increment, bool intValues) where T : IncDecSettingsController
        {
            var        volumeSettings    = GetWindowSettings();
            GameObject newSettingsObject = MonoBehaviour.Instantiate(volumeSettings.gameObject, transform);

            newSettingsObject.name = name;

            SwitchSettingsController volume = newSettingsObject.GetComponent <SwitchSettingsController>();
            T newSliderSettingsController   = (T)ReflectionUtil.CopyComponent(volume, typeof(IncDecSettingsController), typeof(T), newSettingsObject);

            MonoBehaviour.DestroyImmediate(volume);

            GameObject.Destroy(newSettingsObject.transform.Find("Value").Find("DecButton").gameObject);
            GameObject.Destroy(newSettingsObject.transform.Find("Value").Find("ValueText").gameObject);
            GameObject.Destroy(newSettingsObject.transform.Find("Value").Find("IncButton").gameObject);

            CustomSlider slider = newSliderSettingsController.gameObject.AddComponent <CustomSlider>();

            slider.Scrollbar      = GameObject.Instantiate(Resources.FindObjectsOfTypeAll <HMUI.Scrollbar>().First(s => s.name != "CustomUISlider"), newSettingsObject.transform.Find("Value"), false);
            slider.Scrollbar.name = "CustomUISlider";
            slider.Scrollbar.GetComponentInChildren <TextMeshProUGUI>().enableWordWrapping = false;
            (slider.Scrollbar.transform as RectTransform).sizeDelta = new Vector2(39.5f, 4.5f);
            (slider.Scrollbar.transform as RectTransform).anchorMin = new Vector2(0, 0.5f);


            slider.Scrollbar.numberOfSteps = (int)((max - min) / increment) + 1;
            slider.MinValue   = min;
            slider.MaxValue   = max;
            slider.IsIntValue = intValues;

            var tmpText = newSettingsObject.GetComponentInChildren <TMP_Text>();

            tmpText.text = name;
            if (hintText != String.Empty)
            {
                BeatSaberUI.AddHintText(tmpText.rectTransform, hintText);
            }

            viewController?.AddSubmenuOption(newSettingsObject);
            AddHooks(newSliderSettingsController);
            return(newSliderSettingsController);
        }
Beispiel #23
0
    protected override void Start()
    {
        lifeSlider = GetComponentInChildren <CustomSlider>(true);

        Assert.IsNotNull(lifeSlider);
        Assert.IsNotNull(behaviour);
        Assert.IsNotNull(loadingZone);
        Assert.IsNotNull(aggroZone);
        Assert.IsNotNull(lostZone);
        Assert.IsNotNull(bloodInstance);

        aggroZone.OnZoneEnter   += OnGotTarget;
        lostZone.OnZoneExit     += OnLostTarget;
        loadingZone.OnZoneEnter += ActivateBehaviour;
        loadingZone.OnZoneExit  += DeactivateBehaviour;

        DeactivateBehaviour();

        base.Start();

        UpdateLifeSlider();
    }
Beispiel #24
0
 /// <summary>
 /// Decreases volume by 10%
 /// </summary>
 /// <param name="slider">A custom slider object</param>
 public void VolumeDown(CustomSlider slider)
 {
     AudioControl.VolumeDown(this.DirectVideo.Audio, slider);
 }
Beispiel #25
0
 /// <summary>
 /// Decreases volume by a step
 /// and adjusts the progress bar
 /// </summary>
 /// <param name="video">A video object</param>
 /// <param name="slider">A custom slider object</param>
 public static void VolumeDown(DirectXAudioAllias audio, CustomSlider slider)
 {
     if (slider.Value > slider.Minimum)
     {
         slider.Value -= VolumeStep;
         if (CheckException.CheckNull(audio))
         {
             HandleAudio(audio, slider.Value);
         }
     }
 }
Beispiel #26
0
 /// <summary>
 /// Get reference to instances
 /// </summary>
 void Start()
 {
     slider = GameObject.FindObjectOfType <CustomSlider>();
     song   = this.GetComponent <AudioSource>();
 }
Beispiel #27
0
 /// <summary>
 /// Decreases volume by 10%
 /// </summary>
 /// <param name="slider">A custom slider object</param>
 public void VolumeDown(CustomSlider slider)
 {
     AudioControl.VolumeDown(this.DirectVideo.Audio, slider);
 }
        public static CustomSlider CreateUISlider(this VRUIViewController parent, float min, float max, float increment, bool intValues, UnityAction <float> onValueChanged = null)
        {
            CustomSlider scrollbar = BeatSaberUI.CreateUISlider(parent.rectTransform, min, max, increment, intValues, onValueChanged);

            return(scrollbar);
        }
Beispiel #29
0
 private void Start()
 {
     slider = transform.parent.GetComponent <CustomSlider>();
 }