浏览代码

refactored UI code and removed getter setter from lightestimation

/1.5-preview
Dan 6 年前
当前提交
3064de37
共有 2 个文件被更改,包括 16 次插入32 次删除
  1. 9
      Assets/Scripts/LightEstimation.cs
  2. 39
      Assets/Scripts/LightEstimationUI.cs

9
Assets/Scripts/LightEstimation.cs


{
Light m_Light;
/// <summary>
/// The light affected
/// </summary>
public Light Light
{
get { return m_Light; }
set { m_Light = value; }
}
float? m_Brightness;
public float? Brightness

39
Assets/Scripts/LightEstimationUI.cs


LightEstimation m_LightEstimation;
const string k_UnsupportedText = "Not Supported";
const string k_UnavailableText = "Unavailable";
void Awake()
{

void Update()
{
if (m_LightEstimation.Brightness.HasValue)
{
m_BrightnessVal.text = m_LightEstimation.Brightness.Value.ToString();
}
else
{
m_BrightnessVal.text = k_UnsupportedText;
}
if (m_LightEstimation.ColorTemperature.HasValue)
{
m_ColorTempVal.text = m_LightEstimation.ColorTemperature.Value.ToString();
}
else
{
m_ColorTempVal.text = k_UnsupportedText;
}
SetUIValue(m_LightEstimation.Brightness.HasValue, m_BrightnessVal, m_LightEstimation.Brightness.Value.ToString());
SetUIValue(m_LightEstimation.ColorTemperature.HasValue, m_ColorTempVal, m_LightEstimation.ColorTemperature.Value.ToString());
SetUIValue(m_LightEstimation.ColorCorrection.HasValue, m_ColorCorrectVal, m_LightEstimation.ColorTemperature.Value.ToString());
}
if (m_LightEstimation.ColorCorrection.HasValue)
void SetUIValue(bool ContainsValue, Text UIText, string DisplayValue)
{
if (UIText)
m_ColorCorrectVal.text = m_LightEstimation.ColorCorrection.Value.ToString();
}
else
{
m_ColorCorrectVal.text = k_UnsupportedText;
if (ContainsValue)
{
UIText.text = DisplayValue;
}
else
{
UIText.text = k_UnavailableText;
}
}
}
正在加载...
取消
保存