Merge branch 'dev_cyp1' into dev_ar_cyp
# Conflicts: # Assets/Plugins/Android/unityandroidbluetoothlelib.jar # Assets/Resources/UI/language.json # Assets/Scenes/MainScene.unity # Assets/Scripts/Devices/Ble/mobile/BleMobileInterface.cs # Assets/Scripts/Devices/Ble/mobile/BleMobileThread.cs # Assets/Scripts/Scenes/MainController.cs # Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs # Assets/Scripts/UI/Prefab/Rower/RowerDeviceView.cs # Assets/Scripts/UI/Prefab/Rower/RowerGraphChartFeed.cs # Assets/Scripts/UIManager.cs
This commit is contained in:
commit
1d015706db
41 files changed
+14379
-166815
No files matched your search
@@ -37,20 +37,46 @@ public class PFUISlider : MonoBehaviour
|
||||
public bool runCallback = false;
|
||||
public void SetValueChanged(System.Action<float> a)
|
||||
{
|
||||
this.ValueChangedHandler = a;
|
||||
slider = transform.GetComponent<Slider>();
|
||||
slider.onValueChanged.RemoveAllListeners();
|
||||
|
||||
UIManager.AddEvent(slider.gameObject, EventTriggerType.EndDrag, (e) =>
|
||||
{
|
||||
OnValueChanged();
|
||||
});
|
||||
|
||||
slider.onValueChanged.AddListener((f) =>
|
||||
{
|
||||
var step = 1f / (colorGradientList.Count-1);
|
||||
var index = (int)Math.Round(f / step, 0);
|
||||
slider.targetGraphic.color = colorGradientList[index];
|
||||
text.text = $"{valueHandler(f).ToString("#0")}";
|
||||
a.Invoke(f);
|
||||
current = f;
|
||||
});
|
||||
}
|
||||
public void SetValue(float a)
|
||||
|
||||
float current;
|
||||
System.Action<float> ValueChangedHandler;
|
||||
|
||||
private void OnValueChanged()
|
||||
{
|
||||
float f = current;
|
||||
var step = 1f / (colorGradientList.Count - 1);
|
||||
var index = (int)Math.Round(f / step, 0);
|
||||
slider.targetGraphic.color = colorGradientList[index];
|
||||
text.text = $"{valueHandler(f):#0}";
|
||||
this.ValueChangedHandler?.Invoke(f);
|
||||
}
|
||||
public void SetValue(float a,bool silent = false)
|
||||
{
|
||||
a = a > 1 ? 1 : a;
|
||||
a = a < 0 ? 0 : a;
|
||||
slider.value = a;
|
||||
text.text = $"{valueHandler(a):#0}";
|
||||
if(!silent)
|
||||
OnValueChanged();
|
||||
}
|
||||
|
||||
public float GetValue()
|
||||
{
|
||||
return slider.value;
|
||||
}
|
||||
|
||||
public List<Color> SetColorGradient(List<Color> list, int divideCount)
|
||||
|
||||
Reference in new issue
Block a user