public void SliderAccessibilityGetMinimum() { tlog.Debug(tag, $"SliderAccessibilityGetMinimum START"); var testingTarget = new MySlider() { Direction = Slider.DirectionType.Vertical, IsEnabled = true, }; Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <Slider>(testingTarget, "Should return Slider instance."); testingTarget.MinValue = 0.0f; testingTarget.MaxValue = 100.0f; testingTarget.CurrentValue = 30.0f; var result = testingTarget.OnAccessibilityGetMinimum(); tlog.Debug(tag, "AccessibilityGetMinimum : " + result); result = testingTarget.OnAccessibilityGetMaximum(); tlog.Debug(tag, "AccessibilityGetMaximum : " + result); result = testingTarget.OnAccessibilityGetCurrent(); tlog.Debug(tag, "AccessibilityGetCurrent : " + result); testingTarget.Dispose(); tlog.Debug(tag, $"SliderAccessibilityGetMinimum END (OK)"); }
// Use this for initialization void Awake() { singleton = this; slid = GetComponent <Slider> (); slid.minValue = Mathf.Pow(10, -26); slid.maxValue = 1; }
public void SliderOnUpdateDirectionIsHorizontal() { tlog.Debug(tag, $"SliderOnUpdateDirectionIsHorizontal START"); var testingTarget = new MySlider() { Size = new Size(100, 5), Direction = Slider.DirectionType.Horizontal, IsEnabled = true, }; Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <Slider>(testingTarget, "Should return Slider instance."); testingTarget.MinValue = 0.0f; testingTarget.MaxValue = 100.0f; testingTarget.BgTrackColor = Color.Cyan; testingTarget.LowIndicatorImageURL = image_path; testingTarget.LowIndicatorSize = new Size(8, 8); testingTarget.HighIndicatorImageURL = image_path; testingTarget.HighIndicatorSize = new Size(10, 10); SliderStyle style1 = new SliderStyle() { IndicatorType = Slider.IndicatorType.Image, }; testingTarget.ApplyStyle(style1); try { testingTarget.MyOnUpdate(); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } SliderStyle style2 = new SliderStyle() { IndicatorType = Slider.IndicatorType.Text, }; testingTarget.ApplyStyle(style2); try { testingTarget.MyOnUpdate(); } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } testingTarget.Dispose(); tlog.Debug(tag, $"SliderOnUpdateDirectionIsHorizontal END (OK)"); }
public void OnPointerDown(PointerEventData eventData) { CurTap = this; TimeLastTap = Time.time; if (Unit) { MySlider.SetUnit(Unit); } }
/// <summary> /// When Slider is being dragged, deactivates other Slider and adds Execution to Event Handler. /// </summary> public void StartDrag() { SetOtherSliderInteractive(false, MySlider.GetComponent <UnitSlider>()); if (AppManager.Instance.Game.GameState.IsRunning && OnTouchEventCounter == 0) { InputManager.OnTouchEnded += ExecuteOrder; OnTouchEventCounter++; } }
void Start() { back.GetComponent <RectTransform>().sizeDelta = new Vector2(widht, height); back.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; front.GetComponent <RectTransform>().sizeDelta = new Vector2(widht, height); front.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; gameObject.SetActive(false); instance = this; }
private void Start() { // slider Transform _ObjSlider = transform.Find(NAME_SLIDER); if (_ObjSlider == null) { Debug.Log("require " + NAME_SLIDER + " gameobject"); return; } MySlider _MySlider = _ObjSlider.GetComponent <MySlider>(); if (_MySlider == null) { Debug.Log("require MySlider component"); return; } // text Transform _ObjText = transform.Find(NAME_TEXT); if (_ObjText == null) { Debug.Log("require " + NAME_TEXT + " gameobject"); return; } Text _Text = _ObjText.GetComponent <Text>(); if (_Text == null) { Debug.Log("require Text component"); return; } _MySlider.RxOnValueChanged .Where(value => (MIN_VALUE <= value && value <= MAX_VALUE)) .Subscribe(value => { _Text.text = value.ToString(); }) ; }
public void SliderAccessibilityShouldReportZeroChildren() { tlog.Debug(tag, $"SliderAccessibilityShouldReportZeroChildren START"); var testingTarget = new MySlider() { Direction = Slider.DirectionType.Vertical, IsEnabled = true, }; Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <Slider>(testingTarget, "Should return Slider instance."); var result = testingTarget.OnAccessibilityShouldReportZeroChildren(); tlog.Debug(tag, "AccessibilityShouldReportZeroChildren : " + result); testingTarget.Dispose(); tlog.Debug(tag, $"SliderAccessibilityShouldReportZeroChildren END (OK)"); }
private void Awake() { slider = GetComponent <MySlider>(); }