override public void Init(GameObject rParent, string sText) { //build list of lighting presets we're going to show m_Environments = EnvironmentCatalog.m_Instance.AllEnvironments.ToList(); //find the active lighting preset TiltBrush.Environment rCurrentPreset = SceneSettings.m_Instance.GetDesiredPreset(); if (rCurrentPreset != null) { //find the index of our current preset in the preset list int iPresetIndex = -1; m_CurrentPresetDesc = rCurrentPreset.m_Description; for (int i = 0; i < m_Environments.Count; ++i) { if (m_Environments[i].m_Description == m_CurrentPresetDesc) { iPresetIndex = i; break; } } if (iPresetIndex != -1) { //set our current page to show the active preset if we have more than one page if (m_Environments.Count > m_IconCountFullPage) { m_RequestedPageIndex = iPresetIndex / m_IconCountNavPage; } } } SceneSettings.m_Instance.FadingToDesiredEnvironment += OnFadingToDesiredEnvironment; base.Init(rParent, sText); }
public void SetPreset(TiltBrush.Environment rPreset) { m_Preset = rPreset; SetButtonTexture(m_Preset.m_IconTexture); SetDescriptionText(m_Preset.m_Description); }
protected void OnFadingToDesiredEnvironment() { TiltBrush.Environment rCurrentPreset = SceneSettings.m_Instance.GetDesiredPreset(); if (rCurrentPreset != null) { m_CurrentPresetDesc = rCurrentPreset.m_Description; } RefreshPage(); }