Example #1
0
        override protected void OnButtonPressed()
        {
            if (m_Trash)
            {
                // If we're a trash button, clear our storage index and notify our lord.
                CustomColorPaletteStorage.m_Instance.ClearColor(m_StorageIndex);
            }
            else
            {
                if (m_CurrentState == State.Set)
                {
                    m_ColorController.CurrentColor = m_CustomColor;
                    m_Manager.GetComponent <CustomColorPalette>().TriggerColorPicked(m_CustomColor);
                }
                else if (m_CurrentState == State.ReadyForAdd)
                {
                    Color color = m_ColorController.IsHdr ?
                                  ColorPickerUtils.ClampColorIntensityToLdr(m_ColorController.CurrentColor) :
                                  m_ColorController.CurrentColor;
                    CustomColorPaletteStorage.m_Instance.SetColor(m_StorageIndex, color, true);
                }
            }

            CustomColorPalette palette = m_Manager.GetComponent <CustomColorPalette>();

            if (palette == null)
            {
                Debug.LogWarning("CustomColorButton needs a CustomColorPalette manager.");
            }
            palette.RefreshPaletteButtons();
        }
Example #2
0
 public virtual void SetColor(Color color)
 {
     m_Light.color = color;
     m_ColorIndicator.material.SetColor("_ClampedColor",
                                        ColorPickerUtils.ClampColorIntensityToLdr(m_Light.color));
     m_ColorIndicator.material.SetColor("_TrueColor", color);
 }
Example #3
0
        override public void SetColor(Color rColor)
        {
            var color = Color.white;

            switch (m_ButtonType)
            {
            case LightMode.Ambient:
                color = RenderSettings.ambientLight;
                break;

            case LightMode.Shadow:
                color = App.Scene.GetLight((int)LightMode.Shadow).color;
                break;

            case LightMode.NoShadow:
                color = App.Scene.GetLight((int)LightMode.NoShadow).color;
                break;
            }

            Color mainColor = new Color(color.r * rColor.r, color.g * rColor.g,
                                        color.b * rColor.b, color.a * rColor.a);

            if (m_ButtonType == LightMode.Shadow || m_ButtonType == LightMode.NoShadow)
            {
                // If button is HDR, convert to LDR and set the LDR color as secondary color
                Color ldrColor       = ColorPickerUtils.ClampColorIntensityToLdr(color);
                Color secondaryColor = new Color(ldrColor.r * rColor.r, ldrColor.g * rColor.g,
                                                 ldrColor.b * rColor.b, ldrColor.a * rColor.a);
                SetHDRButtonColor(mainColor, secondaryColor);
            }
            else
            {
                base.SetColor(mainColor);
            }
        }
Example #4
0
        void RefreshLightButtons()
        {
            Color panelColor = GetGazeColor();

            m_LightButtons[0].SetColor(panelColor);
            m_LightButtons[1].SetColor(panelColor);
            m_LightButtons[2].SetColor(panelColor);

            for (int i = -1; i < (int)LightMode.NumLights; i++)
            {
                m_LightButtons[i + 1].SetDescriptionText(LightModeToString((LightMode)i),
                                                         ColorTable.m_Instance.NearestColorTo(GetLightColor((LightMode)i)));
            }

            m_LightButtonHDRMaterial.SetColor(
                "_ClampedColor", ColorPickerUtils.ClampColorIntensityToLdr(m_LightGizmo_Shadow.GetColor()));
        }
Example #5
0
        public void Refresh()
        {
            var shadowColor   = m_LightGizmo_Shadow.SetLight(0);
            var noShadowColor = m_LightGizmo_NoShadow.SetLight(1);

            m_ShadowLightColorIndicator.material.SetColor("_TrueColor", shadowColor);
            m_ShadowLightColorIndicator.material.SetColor("_ClampedColor",
                                                          ColorPickerUtils.ClampColorIntensityToLdr(shadowColor));
            m_NoShadowLightColorIndicator.material.SetColor("_TrueColor", noShadowColor);
            m_NoShadowLightColorIndicator.material.SetColor("_ClampedColor",
                                                            ColorPickerUtils.ClampColorIntensityToLdr(noShadowColor));

            // TODO : Patch this up.
            //if (m_PanelPopUpScript) {
            //  ColorPickerPopUpWindow picker = m_PanelPopUpScript as ColorPickerPopUpWindow;
            //  if (picker) {
            //    picker.RefreshCurrentColor();
            //  }
            //}

            RefreshLightButtons();
            OnPanelMoved();
        }