Exemplo n.º 1
0
    public void Show(OnColorChange _onColorChange)
    {
        m_RootGO.SetActive(true);

        if (_onColorChange != null)
        {
            onColorChange = _onColorChange;
        }
    }
 public void SetValue(string hex, bool notify = true)
 {
     hex = hex ?? "000000";
     TryParseHex(hex, out var red, out var green, out var blue);
     currentColor = new Color(red / 255f, green / 255f, blue / 255f);
     ToHex        = hex;
     image.color  = currentColor;
     input.SetTextWithoutNotify(ToHex);
     if (notify)
     {
         OnColorChange?.Invoke();
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Set foreground- and background color
        /// </summary>
        /// <param name="bg">background color</param>
        /// <param name="fg">foreground color</param>
        public static void SetColor(ConsoleColor?bg, ConsoleColor?fg)
        {
            ResetColor(true);
            if (fg.HasValue)
            {
                Console.ForegroundColor = fg.Value;
            }
            if (bg.HasValue)
            {
                Console.BackgroundColor = bg.Value;
            }

            OnColorChange?.Invoke(CurrentColorScheme);
        }
        public void HandleValueChanged()
        {
            var  hex = input.text;
            bool tmp = TryParseHex(hex, out var red, out var green, out var blue);

            if (!tmp)
            {
                hex = "000000";
                input.SetTextWithoutNotify(hex);
            }

            currentColor = new Color(red / 255f, green / 255f, blue / 255f);
            image.color  = currentColor;
            ToHex        = hex;
            OnColorChange?.Invoke();
        }
Exemplo n.º 5
0
        private void Game_OnWndProc(WndEventArgs args)
        {
            if (IsMouseOverSeparator())
            {
                switch (args.Msg)
                {
                case (uint)WindowMessages.LeftButtonDown:
                    if (IsMouseOverSeparator())
                    {
                        _isMoving = true;
                    }
                    break;

                case (uint)WindowMessages.LeftButtonUp:
                    _isMoving = false;
                    break;

                default:
                    return;
                }
            }

            if (args.Msg != (uint)WindowMessages.LeftButtonDown)
            {
                return;
            }

            if (!IsMouseOverCancelButton())
            {
                if (!IsMouseOverConfirmButton())
                {
                    return;
                }

                Color = new ColorBGRA((byte)_slider1.Value, (byte)_slider2.Value, (byte)_slider3.Value, 255);

                FileHandler.WriteToDataFile(_uniqueId, new ColorBGRA((byte)_slider1.Value, (byte)_slider2.Value, (byte)_slider3.Value, 255));

                OnColorChange?.Invoke(this, new OnColorChangeArgs(Color));

                Unload();
            }
            else
            {
                Unload();
            }
        }
Exemplo n.º 6
0
    private void changeColor()
    {
        _timer = Time.time;

        int indexColor = Colors.IndexOf(_currentColor);

        if (Colors.Count <= indexColor + 1)
        {
            _currentColor = Colors[0];
        }
        else
        {
            _currentColor = Colors[indexColor + 1];
        }
        TrafficLight.material.color = _currentColor.Color;
        _collider.enabled           = !_currentColor.AllowTraffic;
        OnColorChange?.Invoke(_currentColor);
    }
Exemplo n.º 7
0
 internal void FireColorChanged()
 {
     OnColorChange?.Invoke();
 }
Exemplo n.º 8
0
 private void FireColorChanged()
 {
     OnColorChange?.Invoke();
 }
Exemplo n.º 9
0
 /// <summary>
 /// Set the color on the specific index.
 /// </summary>
 /// <param name="index">Index of the Color.</param>
 /// <param name="NewColor">New color that will be changed on that index.</param>
 public virtual void SetColor(int index, byte R, byte G, byte B)
 {
     OnColorChange?.Invoke(index, R, G, B);
 }
Exemplo n.º 10
0
 public void Setcolor(int color)
 {
     OnColorChange?.Invoke(color);
     PlayerPrefs.SetInt("ColorId", color);
 }
Exemplo n.º 11
0
 public void Remove(OnColorChange method)
 {
     onColorChange -= method;
 }
Exemplo n.º 12
0
 public void Add(OnColorChange method)
 {
     onColorChange += method;
 }
Exemplo n.º 13
0
 void OnSelected(Color clr)
 {
     GetComponent <Image>().color = clr;
     OnColorChange.Invoke(clr);
 }