Beispiel #1
0
        protected override void OnMouseMove(SadConsole.Input.MouseConsoleState state)
        {
            if (state.Cell != null && trackedRegion.Contains(state.ConsoleCellPosition.X, state.ConsoleCellPosition.Y))
            {
                // Draw the character index and value in the status area
                string[] items = new string[] { "Index: ", state.Cell.Glyph.ToString() + " ", ((char)state.Cell.Glyph).ToString() };

                items[2] = items[2].PadRight(Width - 2 - (items[0].Length + items[1].Length));

                var text = items[0].CreateColored(Color.LightBlue, Theme.WindowTheme.BorderStyle.Background, null) +
                           items[1].CreateColored(Color.LightCoral, Color.Black, null) +
                           items[2].CreateColored(Color.LightCyan, Color.Black, null);

                text.IgnoreBackground = true;
                text.IgnoreEffect     = true;

                Print(1, Height - 2, text);

                // Set the special effect on the current known character and clear it on the last known
                if (lastMouseState == null)
                {
                }
                else if (lastMouseState.ConsoleCellPosition != state.ConsoleCellPosition)
                {
                    SetEffect(lastMouseState.ConsoleCellPosition.X, lastMouseState.ConsoleCellPosition.Y,
                              unhighlightEffect
                              );
                }

                SetEffect(state.ConsoleCellPosition.X, state.ConsoleCellPosition.Y, highlightedEffect);
                lastMouseState = state.Clone();
            }
            else
            {
                DrawSelectedItemString();

                // Clear the special effect on the last known character
                if (lastMouseState != null)
                {
                    SetEffect(lastMouseState.ConsoleCellPosition.X, lastMouseState.ConsoleCellPosition.Y, unhighlightEffect);
                    lastMouseState = null;
                }
            }

            base.OnMouseMove(state);
        }
        protected override void OnMouseMove(SadConsole.Input.MouseConsoleState state)
        {
            if (state.Cell != null && trackedRegion.Contains(state.ConsoleCellPosition.X, state.ConsoleCellPosition.Y))
            {
                isHover    = true;
                hoverGlyph = state.Cell.Glyph;

                // Set the special effect on the current known character and clear it on the last known
                if (lastMouseState == null)
                {
                }
                else if (lastMouseState.ConsoleCellPosition != state.ConsoleCellPosition)
                {
                    SetEffect(lastMouseState.ConsoleCellPosition.X, lastMouseState.ConsoleCellPosition.Y,
                              unhighlightEffect
                              );
                }

                SetEffect(state.ConsoleCellPosition.X, state.ConsoleCellPosition.Y, highlightedEffect);
                lastMouseState = state.Clone();
            }
            else
            {
                isHover = false;

                // Clear the special effect on the last known character
                if (lastMouseState != null)
                {
                    SetEffect(lastMouseState.ConsoleCellPosition.X, lastMouseState.ConsoleCellPosition.Y, unhighlightEffect);
                    lastMouseState = null;
                }
            }

            base.OnMouseMove(state);

            IsDirty = true;
        }