本文主要是介绍unity圆形Slider,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
如题
Runtime
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;/// <summary>
/// 环状进度条
/// </summary>public class CircleSlider : Selectable , IDragHandler , IEndDragHandler , IBeginDragHandler
{[SerializeField]private RectTransform m_HandleRect;public RectTransform handleRect{get { return m_HandleRect; }set { if(SetPropertyUtility.SetClass(ref m_HandleRect, value)) { UpdateCachedReferences(); UpdateVisuals(); } }}[SerializeField]private RectTransform m_FillRect;public RectTransform fillrect{get { return m_FillRect; }set { if (SetPropertyUtility.SetClass(ref m_FillRect, value)) { UpdateCachedReferences(); UpdateVisuals(); } }}[SerializeField]private float m_MinValue = 0;public float minValue { get { return m_MinValue; } set { if (SetPropertyUtility.SetStruct(ref m_MinValue, value)) { Set(m_Value); UpdateVisuals(); } } }[SerializeField]private float m_MaxValue = 1;public float maxValue { get { return m_MaxValue; } set { if (SetPropertyUtility.SetStruct(ref m_MaxValue, value)) { Set(m_Value); UpdateVisuals(); } } }[SerializeField]private float m_Value;public float value {get { if (wholeNumbers)return Mathf.Round(m_Value);return m_Value;}set{Set(value); }}[SerializeField]private float m_Angle;public float angle{get{return m_Angle;}set{m_Angle = value;}}[SerializeField]private Image.Origin360 m_FillOrigin;public Image.Origin360 fillOrigin { get { return m_FillOrigin; } set { if (SetPropertyUtility.SetStruct(ref m_FillOrigin, value)) { Set(m_Value); UpdateVisuals(); } } }[SerializeField]private float m_Radius;public float radius { get { return m_Radius; } set { if (SetPropertyUtility.SetStruct(ref m_Radius, value)) { UpdateVisuals(); } } }[SerializeField]private bool m_ClockWise;public bool clockWise {get { return m_ClockWise; }set {if (SetPropertyUtility.SetStruct(ref m_ClockWise, value)){UpdateCachedReferences();UpdateVisuals();} }}[SerializeField]private bool m_WholeNumbers = false;public bool wholeNumbers { get { return m_WholeNumbers; }
这篇关于unity圆形Slider的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!