Neodroid  0.2.0
Machine Learning Environment Prototyping Tool
DistributionDisplayer.cs
Go to the documentation of this file.
1 using System;
3 using UnityEngine;
4 using UnityEngine.UI;
5 
6 namespace droid.Runtime.Prototyping.Displayers.Canvas {
10  [ExecuteInEditMode]
11  [AddComponentMenu(DisplayerComponentMenuPath._ComponentMenuPath
12  + "Canvas/CanvasBar"
13  + DisplayerComponentMenuPath._Postfix)]
15  [SerializeField] Image[] _images;
16  [SerializeField] [Range(0.0f, 1.0f)] float _value;
17 
20  public float Value {
21  get { return this._value; }
22  set {
23  this._value = value;
24  this.SetFillAmount(value);
25  }
26  }
27 
31  protected override void Setup() {
32  if (this._images == null || this._images.Length == 0) {
33  this._images = this.GetComponentsInChildren<Image>();
34  }
35  }
36 
40  public void SetFillAmount(float amount) {
41  #if NEODROID_DEBUG
42  if (this.Debugging) {
43  Debug.Log($"Setting amount to {amount}");
44  }
45  #endif
46 
47  if (this._images[0]) {
48  this._images[0].fillAmount = amount;
49  }
50  }
51 
52  //public override void Display(Object o) { throw new NotImplementedException(); }
53 
57  public override void Display(float value) {
58  #if NEODROID_DEBUG
59  if (this.Debugging) {
60  Debug.Log("Applying " + value + " To " + this.name);
61  }
62  #endif
63 
64  this.Value = value;
65 
66  this.SetFillAmount(value);
67  }
68 
72  public override void Display(Double value) {
73  #if NEODROID_DEBUG
74  if (this.Debugging) {
75  Debug.Log("Applying " + value + " To " + this.name);
76  }
77  #endif
78 
79  this.Value = (float)value;
80 
81  this.SetFillAmount((float)value);
82  }
83 
87  public override void Display(float[] values) { throw new NotImplementedException(); }
88 
92  public override void Display(String value) { throw new NotImplementedException(); }
93 
97  public override void Display(Vector3 value) { throw new NotImplementedException(); }
98 
102  public override void Display(Vector3[] value) { throw new NotImplementedException(); }
103 
107  public override void Display(Points.ValuePoint points) { throw new NotImplementedException(); }
108 
112  public override void Display(Points.ValuePoint[] points) { throw new NotImplementedException(); }
113 
117  public override void Display(Points.StringPoint point) { throw new NotImplementedException(); }
118 
122  public override void Display(Points.StringPoint[] points) { throw new NotImplementedException(); }
123 
124  public override void PlotSeries(Points.ValuePoint[] points) { throw new NotImplementedException(); }
125  }
126 }