Exemplo n.º 1
0
 public void SetActiveCursorType(CursorType cursorType)
 {
     SetActiveCursorAnimation(GetCursorAnimation(cursorType));
     OnCursorChanged?.Invoke(this, new OnCursorChangedEventArgs {
         cursorType = cursorType
     });
 }
Exemplo n.º 2
0
 private void StandTo(Point point)
 {
     mazeMap[cursorPosition.Y, cursorPosition.X] = (int)MapItem.Empty;
     mazeMap[point.Y, point.X] = (int)MapItem.StartPoint;
     OnCursorChanged?.Invoke(this, new PropertyChangedEventArgs <Point>(cursorPosition, point));
     cursorPosition = point;
     SetVisibility();
     tilePanel.InvalidateVisual();
 }
Exemplo n.º 3
0
        private void Update()
        {
            if (!isInit)
            {
                return;
            }
            long preSpinCount = spinCount;

            if (isMoving)
            {
                moveValue += speed * 0.1f;
            }
            while (moveValue >= 1f)
            {
                moveValue -= 1f;
                CursorUp();
            }
            while (moveValue <= -1f)
            {
                moveValue += 1f;
                CursorDown();
            }
            if (preSpinCount != spinCount) //커서가 변경되었을 때
            //다음 커서값 설정하기
            {
                if (cursorRequest != null)
                {
                    if (dir == RotateDirection.Down)
                    {
                        cursors[cursors.Count - 1] = cursorRequest.settingCursor - cursorRequest.waitCount;
                    }
                    else
                    {
                        cursors[0] = cursorRequest.settingCursor + cursorRequest.waitCount;
                    }
                    cursorRequest.waitCount -= 1;
                    cursorRequest            = null;
                }
                if (stopRequest > 0)
                {
                    stopRequest--;
                }
                if (stopRequest == 0)
                {
                    moveValue = 0f;
                    ApplyMoveValue();
                    state = ReelState.Idle;
                    OnStoped?.Invoke();
                }

                UpdateRenderAll();
                OnCursorChanged?.Invoke(cursor);
            }
        }
Exemplo n.º 4
0
        public void KeyPressedHandler(object sender, KeyPressedEventArgs e)
        {
            HidePath();
            var newPosition = cursorPosition;

            if (e.KeyInfo.Key == ConsoleKey.LeftArrow && cursorPosition.X > 0)
            {
                newPosition.X--;
            }

            if (e.KeyInfo.Key == ConsoleKey.RightArrow && cursorPosition.X < mapSize.Width - 1)
            {
                newPosition.X++;
            }

            if (e.KeyInfo.Key == ConsoleKey.UpArrow && cursorPosition.Y > 0)
            {
                newPosition.Y--;
            }

            if (e.KeyInfo.Key == ConsoleKey.DownArrow && cursorPosition.Y < mapSize.Height - 1)
            {
                newPosition.Y++;
            }

            if (cursorPosition != newPosition)
            {
                OnCursorChanged?.Invoke(this, new PropertyChangedEventArgs <Point>(cursorPosition, newPosition));
                cursorPosition = newPosition;
                canvas1.InvalidateVisual();
            }

            if (e.KeyInfo.Key == ConsoleKey.Spacebar)
            {
                if (MazeMap[cursorPosition.Y, cursorPosition.X] != (int)CurrentMapItem)
                {
                    OnMapChanged?.Invoke(this, new MazeMapItemEventArgs(cursorPosition, CurrentMapItem));
                    MazeMap[cursorPosition.Y, cursorPosition.X] = (int)CurrentMapItem;
                    canvas1.InvalidateVisual();
                }
            }

            if (e.KeyInfo.Key == ConsoleKey.Delete)
            {
                if (MazeMap[cursorPosition.Y, cursorPosition.X] != (int)MapItem.Empty)
                {
                    OnMapChanged?.Invoke(this, new MazeMapItemEventArgs(cursorPosition, CurrentMapItem));
                    MazeMap[cursorPosition.Y, cursorPosition.X] = (int)MapItem.Empty;
                    canvas1.InvalidateVisual();
                }
            }
        }