Exemplo n.º 1
0
 public float GetValue()
 {
     UIGaugeManager.ValueType valueType = this._valueType;
     if (valueType != UIGaugeManager.ValueType.Integer)
     {
         return(this._floatValue);
     }
     return((float)this._intValue);
 }
Exemplo n.º 2
0
 public float GetValueToNormalize()
 {
     UIGaugeManager.ValueType valueType = this._valueType;
     if (valueType != UIGaugeManager.ValueType.Integer)
     {
         return(this._floatValue);
     }
     return(Mathf.Clamp01((float)(this._intValue - this._intMin) / (float)(this._intMax - this._intMin)));
 }
Exemplo n.º 3
0
 public void Reflesh()
 {
     UIGaugeManager.ValueType valueType = this._valueType;
     if (valueType != UIGaugeManager.ValueType.Integer)
     {
         if (valueType == UIGaugeManager.ValueType.Float)
         {
             if (this._uiProgressBar != null && this._gaugeType == UIGaugeManager.GaugeType.ProgressBar)
             {
                 this._uiProgressBar.value = this._floatValue;
                 this._uiProgressBar.ForceUpdate();
             }
             if (this._uiImageGauge != null && this._gaugeType == UIGaugeManager.GaugeType.ImageGauge)
             {
                 this._uiImageGauge.value = Mathf.RoundToInt(Mathf.Lerp((float)this._uiImageGauge.min, (float)this._uiImageGauge.max, this._floatValue));
             }
             if (this._uiAnimatedProgressBar != null && this._gaugeType == UIGaugeManager.GaugeType.AnimatedProgressBar)
             {
                 this._uiAnimatedProgressBar.value = this._floatValue;
             }
             if (this._uiMultipleGaugeManager.Count > 0 && this._gaugeType == UIGaugeManager.GaugeType.MultipleGaugeManager)
             {
                 for (int i = 0; i < this._uiMultipleGaugeManager.Count; i++)
                 {
                     if (!(this._uiMultipleGaugeManager[i] == null))
                     {
                         this._uiMultipleGaugeManager[i].SetValue(this._floatValue);
                     }
                 }
             }
         }
     }
     else
     {
         if (this._uiProgressBar != null && this._gaugeType == UIGaugeManager.GaugeType.ProgressBar)
         {
             this._uiProgressBar.value = Mathf.Clamp01((float)this._intValue / (float)this._intMax);
             this._uiProgressBar.ForceUpdate();
         }
         if (this._uiImageGauge != null && this._gaugeType == UIGaugeManager.GaugeType.ImageGauge)
         {
             this._uiImageGauge.min   = this._intMin;
             this._uiImageGauge.max   = this._intMax;
             this._uiImageGauge.value = this._intValue;
         }
         if (this._uiAnimatedProgressBar != null && this._gaugeType == UIGaugeManager.GaugeType.AnimatedProgressBar)
         {
             this._uiAnimatedProgressBar.value = Mathf.Clamp01((float)this._intValue / (float)this._intMax);
         }
         if (this._uiMultipleGaugeManager.Count > 0 && this._gaugeType == UIGaugeManager.GaugeType.MultipleGaugeManager)
         {
             for (int j = 0; j < this._uiMultipleGaugeManager.Count; j++)
             {
                 if (!(this._uiMultipleGaugeManager[j] == null))
                 {
                     this._uiMultipleGaugeManager[j].SetMin(this._intMin);
                     this._uiMultipleGaugeManager[j].SetMax(this._intMax);
                     this._uiMultipleGaugeManager[j].SetValue(this._intValue);
                 }
             }
         }
     }
 }