コード例 #1
0
 public override void HandleTargetCardSelection(Board board, QuadMistCard origin, List <QuadMistCard> selectable, ref InputResult result)
 {
     board.ShowBoardCursor();
     if (!this.blacken)
     {
         for (Int32 i = 0; i < (Int32)board.field.Length; i++)
         {
             QuadMistCardUI cardUI = board.GetCardUI(i);
             if (cardUI != (UnityEngine.Object)null && cardUI != board.GetCardUI(origin))
             {
                 cardUI.Black = true;
             }
         }
         this.blacken = true;
     }
     if (this.counter >= Anim.TickToTime(16) && !this.launched)
     {
         foreach (QuadMistCard card in selectable)
         {
             board.GetCardUI(card).Black  = false;
             board.GetCardUI(card).Select = true;
         }
         this.launched = true;
     }
     if (this.launched)
     {
         this.prevBoardSelectX = this.boardSelectX;
         this.prevBoardSelectY = this.boardSelectY;
         board.cursor.gameObject.SetActive(true);
         if (UIManager.Input.GetKeyTrigger(Control.Up) && this.boardSelectY != 0)
         {
             this.delegateInputHandler.LastActiveInputHandler = InputDelegatorHandler.InputType.Keyboard;
             this.boardSelectY--;
         }
         if (UIManager.Input.GetKeyTrigger(Control.Down) && this.boardSelectY != 3)
         {
             this.delegateInputHandler.LastActiveInputHandler = InputDelegatorHandler.InputType.Keyboard;
             this.boardSelectY++;
         }
         if (UIManager.Input.GetKeyTrigger(Control.Left) && this.boardSelectX != 0)
         {
             this.delegateInputHandler.LastActiveInputHandler = InputDelegatorHandler.InputType.Keyboard;
             this.boardSelectX--;
         }
         if (UIManager.Input.GetKeyTrigger(Control.Right) && this.boardSelectX != 3)
         {
             this.delegateInputHandler.LastActiveInputHandler = InputDelegatorHandler.InputType.Keyboard;
             this.boardSelectX++;
         }
         if (this.prevBoardSelectX != this.boardSelectX || this.prevBoardSelectY != this.boardSelectY)
         {
             SoundEffect.Play(QuadMistSoundID.MINI_SE_CURSOL);
             board.PlaceCursor(this.boardSelectX, this.boardSelectY);
             Vector2 boardCursorPosition = new Vector2((Single)this.boardSelectX, (Single)this.boardSelectY);
             Single  num  = 0.429f;
             Single  num2 = -0.525f;
             Single  num3 = -1f;
             Single  num4 = 0.73f;
             boardCursorPosition.x *= num;
             boardCursorPosition.y *= num2;
             boardCursorPosition.x += num3;
             boardCursorPosition.y += num4;
             board.SetBoardCursorPosition(boardCursorPosition);
         }
         if (UIManager.Input.GetKeyTrigger(Control.Confirm))
         {
             this.delegateInputHandler.LastActiveInputHandler = InputDelegatorHandler.InputType.Keyboard;
             if (selectable.Contains(board[this.boardSelectX, this.boardSelectY]))
             {
                 result.index = selectable.IndexOf(board[this.boardSelectX, this.boardSelectY]);
                 result.Used();
                 SoundEffect.Play(QuadMistSoundID.MINI_SE_CARD_MOVE);
             }
         }
         if (result.IsValid())
         {
             QuadMistCardUI[] field = board.field;
             for (Int32 j = 0; j < (Int32)field.Length; j++)
             {
                 QuadMistCardUI quadMistCardUI = field[j];
                 quadMistCardUI.Black  = false;
                 quadMistCardUI.Select = false;
             }
             this.launched = false;
             this.blacken  = false;
             this.counter  = 0f;
             board.cursor.gameObject.SetActive(false);
             board.HideBoardCursor();
         }
     }
     else
     {
         this.counter += Time.deltaTime;
     }
 }
コード例 #2
0
    public override void HandleTargetCardSelection(Board board, QuadMistCard origin, List <QuadMistCard> selectable, ref InputResult result)
    {
        board.ShowBoardCursor();
        Vector3 worldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        if ((this.lastMousePosition - Input.mousePosition).magnitude > 1f)
        {
            worldPoint.z = -6f;
            Vector2 vectorByWorldPoint = board.GetVectorByWorldPoint(worldPoint, false);
            Single  num  = 0.429f;
            Single  num2 = -0.525f;
            Single  num3 = -1f;
            Single  num4 = 0.73f;
            vectorByWorldPoint.x *= num;
            vectorByWorldPoint.y *= num2;
            vectorByWorldPoint.x += num3;
            vectorByWorldPoint.y += num4;
            board.SetBoardCursorPosition(vectorByWorldPoint);
            this.lastMousePosition = Input.mousePosition;
        }
        if (!this.blacken)
        {
            for (Int32 i = 0; i < (Int32)board.field.Length; i++)
            {
                QuadMistCardUI cardUI = board.GetCardUI(i);
                if (cardUI != (UnityEngine.Object)null && cardUI != board.GetCardUI(origin))
                {
                    cardUI.Black = true;
                }
            }
            this.blacken = true;
        }
        if (this.counter >= Anim.TickToTime(16) && !this.launched)
        {
            foreach (QuadMistCard card in selectable)
            {
                board.GetCardUI(card).Black  = false;
                board.GetCardUI(card).Select = true;
            }
            this.launched = true;
        }
        if (this.launched)
        {
            if (Input.GetMouseButtonUp(0))
            {
                SoundEffect.Play(QuadMistSoundID.MINI_SE_CURSOL);
                for (Int32 j = 0; j < selectable.Count; j++)
                {
                    if (board.GetCardUI(selectable[j]).Contains(worldPoint))
                    {
                        result.index = j;
                        result.Used();
                        break;
                    }
                }
                if (result.IsValid())
                {
                    QuadMistCardUI[] field = board.field;
                    for (Int32 k = 0; k < (Int32)field.Length; k++)
                    {
                        QuadMistCardUI quadMistCardUI = field[k];
                        quadMistCardUI.Black  = false;
                        quadMistCardUI.Select = false;
                    }
                    this.launched = false;
                    this.blacken  = false;
                    this.counter  = 0f;
                    board.ShowBoardCursor();
                }
            }
        }
        else
        {
            this.counter += Time.deltaTime;
        }
    }