// Use this for initialization
 void Awake()
 {
     _currentColor        = CurrentColor.None;
     _characterText       = GetComponentInChildren <Text>(true);
     _characterCardSprite = GameObject.Find("CharacterCardSprite").GetComponent <SpriteRenderer>();
     //_characterCardBackdrop = GameObject.Find("CharacterCardBackdrop").GetComponent<SpriteRenderer>();
 }
示例#2
0
 private void rgbSlider_ValueChanged(object sender, RoutedEventArgs e)
 {
     if (((UIElement)e.Source).IsFocused)
     {
         CurrentColor.SetFromRGB((byte)sldR.Value, (byte)sldG.Value, (byte)sldB.Value);
     }
 }
示例#3
0
 private void rgbfSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     if (((UIElement)e.Source).IsFocused)
     {
         CurrentColor.SetFromRGB(sldRf.Value, sldGf.Value, sldBf.Value);
     }
 }
示例#4
0
 private void hslSlider_ValueChanged(object sender, RoutedEventArgs e)
 {
     if (((UIElement)e.Source).IsFocused)
     {
         CurrentColor.SetFromHSL((int)sldHslH.Value, (double)sldHslS.Value / 100, (double)sldHslL.Value / 100);
     }
 }
    public void Show()
    {
        gameObject.SetActive(true);

        switch (_currentColor)
        {
        //Go to the next color
        case CurrentColor.GreenFemale:
            _currentColor = CurrentColor.BlueMale;
            LoadBlueMale();
            break;

        case CurrentColor.BlueMale:
            _currentColor = CurrentColor.GreenMale;
            LoadGreenMale();
            break;

        case CurrentColor.GreenMale:
            _currentColor = CurrentColor.BlueFemale;
            LoadBlueFemale();
            break;

        case CurrentColor.None:
        case CurrentColor.BlueFemale:
        default:
            _currentColor = CurrentColor.GreenFemale;
            LoadGreenFemale();
            break;
        }
    }
示例#6
0
 private void lstboxLast_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (lstboxLast.SelectedIndex != -1)
     {
         CurrentColor.SetColor(lastColors[lstboxLast.SelectedIndex]);
     }
 }
示例#7
0
 void Start()
 {
     healthMesh.text = health.ToString();
     CuP             = GM.GetComponent <CurrentPoints> ();
     CuC             = GM.GetComponent <CurrentColor> ();
     CuS             = GM.GetComponent <CurrentSpeed> ();
 }
示例#8
0
        private void Border_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (!(sender is Border border))
            {
                e.Handled = true;
                return;
            }

            if (Editable && Keyboard.IsKeyDown(Key.LeftCtrl))
            {
                border.Background = new SolidColorBrush(CurrentColor);

                if (border.DataContext is ColorSwatchItem data)
                {
                    data.Color     = CurrentColor;
                    data.HexString = CurrentColor.ToHexString();
                }

                if (!(ColorPickerControl is null))
                {
                    ColorPickerControl.CustomColorsChanged();
                }
            }
            else
            {
                PickingColor?.Invoke(((SolidColorBrush)border.Background).Color);
            }
        }
示例#9
0
        private void ProcessToken(MUDToken token)
        {
            if (token.TokenType == MUDTokenType.Text)
            {
                Run run = new Run(token.Content.ToString());
                run.Foreground = new SolidColorBrush(CurrentColor.ForegroundColor);
                run.Background = new SolidColorBrush(CurrentColor.BackgroundColor);
                this.Interface.OutputConsole.AddRun(run);

                // parse the line now that new text has been added to it.
                LineParser.ParseLine(this.Interface.OutputConsole.LastParagraph(), this);
            }
            else if (token.TokenType == MUDTokenType.Color)
            {
                CurrentColor.Update(token);
            }
            else if (token.TokenType == MUDTokenType.NewLine)
            {
                this.Interface.OutputConsole.AddNewParagraph();
            }
            else if (token.TokenType == MUDTokenType.EraseLine)
            {
                this.Interface.OutputConsole.ClearLastParagraph();
            }
            else if (token.TokenType == MUDTokenType.CursorBackward)
            {
                // do nothing for now. Maybe forever.
            }

            CurrentParseState = CurrentParseState.Execute(token, this);
        }
示例#10
0
 private void txtHEX_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (!(e.Source as Control).IsFocused)
     {
         return;
     }
     CurrentColor.SetFromHex(txtHEX.Text);
 }
示例#11
0
        private void Update()
        {
            CurrentColor = Color.Lerp(CurrentColor, targetColor, lerpFactor * Time.deltaTime);
//        CurrentColor = targetColor;
            if (CurrentColor.Equals(targetColor))
            {
                this.enabled = false;
            }
        }
示例#12
0
 public void Update()
 {
     ElapsedTimeSinceColorChange += Time.Delta;
     if (ElapsedTimeSinceColorChange >= 1.0f)
     {
         SwitchToNextRandomColor();
     }
     window.BackgroundColor = CurrentColor.Lerp(NextColor, ElapsedTimeSinceColorChange);
 }
示例#13
0
 private void setColorFromHistory()
 {
     if (lstHistory.SelectedIndex != -1)
     {
         if (colorHistory[lstHistory.SelectedIndex] != CurrentColor.WpfColor)
         {
             CurrentColor.SetColor(colorHistory[lstHistory.SelectedIndex]);
         }
     }
 }
示例#14
0
 private void SelectCommand_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     System.Windows.Forms.ColorDialog cd = new System.Windows.Forms.ColorDialog();
     cd.FullOpen = true;
     if (cd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         CurrentColor.SetFromRGB(cd.Color.R, cd.Color.G, cd.Color.B);
         colorHistory.Insert(0, CurrentColor.WpfColor);
     }
 }
示例#15
0
        public void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            CurrentColor = state.Settings.GlobalHotkeysEnabled ? Settings.HotkeysOnColor : Settings.HotkeysOffColor;

            Cache.Restart();
            Cache["IndicatorColor"] = CurrentColor.ToArgb();

            if (invalidator != null && Cache.HasChanged)
            {
                invalidator.Invalidate(0, 0, width, height);
            }
        }
示例#16
0
        private void Grid_TextChanged(object sender, RoutedEventArgs e)
        {
            if (!(e.Source as Control).IsFocused)
            {
                return;
            }
            int rVal = 0, gVal = 0, bVal = 0;

            if (int.TryParse(txtR.Text, out rVal) && int.TryParse(txtG.Text, out gVal) && int.TryParse(txtB.Text, out bVal))
            {
                CurrentColor.SetFromRGB((byte)Math.Min(255, rVal), (byte)Math.Min(255, gVal), (byte)Math.Min(255, bVal));
            }
        }
示例#17
0
 private void CMYK_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (!(e.Source as Control).IsFocused)
     {
         return;
     }
     if (int.TryParse(txtCyan.Text, out int c) && int.TryParse(txtMagenta.Text, out int m) &&
         int.TryParse(txtYellow.Text, out int y) && int.TryParse(txtKey.Text, out int k))
     {
         CurrentColor.SetFromCMYK(Math.Min(c, 100) / 100.0, Math.Min(m, 100) / 100.0,
                                  Math.Min(y, 100) / 100.0, Math.Min(k, 100) / 100.0);
     }
 }
示例#18
0
        public void TextToColor(string r, string g, string b)
        {
            Color textColor = new Color
            {
                A = 255,
                R = (byte)Int32.Parse(r),
                G = (byte)Int32.Parse(g),
                B = (byte)Int32.Parse(b)
            };

            // We don't need to rotate if the same color. Even the new Hue is different from old Hue.
            if (CurrentColor.Equals(textColor))
            {
                return;
            }

            EnterColor(textColor, true);
        }
        internal void Update(float inElapsedTimeInSeconds)
        {
            _timeToLive -= inElapsedTimeInSeconds;
            IsAlive      = _timeToLive > 0;

            if (IsAlive)
            {
                float decay = (_lifeTime - _timeToLive) / _lifeTime;
                CurrentColor = CurrentColor.WithAlpha(1 - MathF.Pow(decay, .25f));
            }
            else
            {
                foreach (BoltData bd in BatchInfos.Values)
                {
                    bd.IsReady = false;
                }
            }
        }
示例#20
0
    internal void MakeMove(int i, int j)
    {
        fields[i, j] = CurrentColor.ToFieldState();
        for (int k = 0; k < 8; k++)
        {
            if (CheckSelectionDir(CurrentColor, i, j, di[k], dj[k]))
            {
                ChangeColor(CurrentColor, i, j, di[k], dj[k]);
            }
        }
        CurrentColor = CurrentColor.Other();
        int selectableFields = RevalidateSelectableFields();

        if (selectableFields == 0)
        {
            CurrentColor = CurrentColor.Other();
            GameOver     = RevalidateSelectableFields() == 0;
        }
        SignalUpdate();
    }
示例#21
0
 private void capture_Tick(object sender, EventArgs e)
 {
     imgScreen.Source = msc.CaptureBitmapImage;
     CurrentColor.SetColor(msc.PointerPixelColor);
     lblScreenCoord.Content = String.Format("X: {0} | Y: {1}", msc.MouseScreenPosition.X, msc.MouseScreenPosition.Y);
 }
示例#22
0
    public void SetColor(int state)
    {
        Material[] tempMaterials = new Material[7];
        switch (state)
        {
        case 0:

            for (int m = 0; m < tempMaterials.Length; m++)
            {
                tempMaterials[m] = matList[0];
            }
            for (int i = 0; i < RightColorIndicators.Length; i++)
            {
                RightColorIndicators[i].material = matList[2];
                LeftColorIndicators[i].material  = matList[1];
            }
            player.materials        = tempMaterials;
            player.gameObject.layer = redLayer;

            color = CurrentColor.red;
            break;

        case 1:
            for (int m = 0; m < tempMaterials.Length; m++)
            {
                tempMaterials[m] = matList[2];
            }
            for (int i = 0; i < RightColorIndicators.Length; i++)
            {
                RightColorIndicators[i].material = matList[0];
                LeftColorIndicators[i].material  = matList[1];
            }
            player.materials        = tempMaterials;
            player.gameObject.layer = blueLayer;

            color = CurrentColor.blue;

            break;

        case 2:

            for (int m = 0; m < tempMaterials.Length; m++)
            {
                tempMaterials[m] = matList[0];
            }
            for (int i = 0; i < RightColorIndicators.Length; i++)
            {
                RightColorIndicators[i].material = matList[1];
                LeftColorIndicators[i].material  = matList[2];
            }
            player.materials        = tempMaterials;
            player.gameObject.layer = redLayer;

            color = CurrentColor.red;
            break;

        case 3:
            for (int m = 0; m < tempMaterials.Length; m++)
            {
                tempMaterials[m] = matList[1];
            }
            for (int i = 0; i < RightColorIndicators.Length; i++)
            {
                RightColorIndicators[i].material = matList[0];
                LeftColorIndicators[i].material  = matList[2];
            }
            player.materials        = tempMaterials;
            player.gameObject.layer = GreenLayer;

            color = CurrentColor.green;
            break;

        case 4:
            for (int m = 0; m < tempMaterials.Length; m++)
            {
                tempMaterials[m] = matList[2];
            }
            for (int i = 0; i < RightColorIndicators.Length; i++)
            {
                RightColorIndicators[i].material = matList[1];
                LeftColorIndicators[i].material  = matList[0];
            }
            player.materials        = tempMaterials;
            player.gameObject.layer = blueLayer;

            color = CurrentColor.blue;
            break;

        case 5:
            for (int m = 0; m < tempMaterials.Length; m++)
            {
                tempMaterials[m] = matList[1];
            }
            for (int i = 0; i < RightColorIndicators.Length; i++)
            {
                RightColorIndicators[i].material = matList[2];
                LeftColorIndicators[i].material  = matList[0];
            }
            player.materials        = tempMaterials;
            player.gameObject.layer = GreenLayer;

            color = CurrentColor.green;
            break;
        }
    }
示例#23
0
    private void OutputThreadMethod(TextWriter output)
    {
        Stopwatch stopWatch = new Stopwatch();

        stopWatch.Start();
        _messageDelay = 0;

        while (ThreadAlive)
        {
            try
            {
                Thread.Sleep(25);
                Commands command;
                if (stopWatch.ElapsedMilliseconds <= _messageDelay && _state == IRCConnectionState.Connected)
                {
                    continue;
                }
                lock (_commandQueue)
                {
                    if (_commandQueue.Count == 0)
                    {
                        continue;
                    }
                    command = _commandQueue.Dequeue();
                }

                if (command.CommandIsColor() &&
                    CurrentColor.Equals(command.GetColor(), StringComparison.InvariantCultureIgnoreCase))
                {
                    continue;
                }

                output.WriteLine(command.Command);
                output.Flush();

                stopWatch.Reset();
                stopWatch.Start();

                _messageDelay  = _isModerator ? MessageDelayMod : MessageDelayUser;
                _messageDelay += (command.CommandIsColor() && _isModerator) ? 700 : 0;
            }
            catch
            {
                AddTextToHoldable("[IRC:Disconnect] Connection failed.");
                _state = IRCConnectionState.Disconnected;
            }
        }
        TwitchGame.EnableDisableInput();

        try
        {
            if (_state == IRCConnectionState.Disconnecting)
            {
                Commands setColor = new Commands($"PRIVMSG #{_settings.channelName} :.color {ColorOnDisconnect}");
                if (setColor.CommandIsColor())
                {
                    AddTextToHoldable("[IRC:Disconnect] Color {0} was requested, setting it now.", ColorOnDisconnect);
                    while (stopWatch.ElapsedMilliseconds < _messageDelay)
                    {
                        Thread.Sleep(25);
                    }
                    output.WriteLine(setColor.Command);
                    output.Flush();

                    stopWatch.Reset();
                    stopWatch.Start();
                    while (stopWatch.ElapsedMilliseconds < 1200)
                    {
                        Thread.Sleep(25);
                    }
                }
                _state = IRCConnectionState.Disconnected;
                AddTextToHoldable("[IRC:Disconnect] Disconnected from chat IRC.");
            }

            lock (_commandQueue)
                _commandQueue.Clear();
        }
        catch
        {
            _state = IRCConnectionState.Disconnected;
        }
        if (!gameObject.activeInHierarchy)
        {
            AddTextToHoldable("[IRC:Disconnect] Twitch Plays disabled.");
        }
    }
示例#24
0
 void Start()
 {
     CuC = GM.GetComponent <CurrentColor> ();
     CuB = GM.GetComponent <CurrentButton> ();
 }
示例#25
0
 private void PalWindow_ColorChanged(object sender, ColorChangedEventArgs e)
 {
     CurrentColor.SetColor(e.NewColor);
 }