Ejemplo n.º 1
0
 public void ShowButtonOverlay(GridButton button, HOTK_Overlay overlay)
 {
     overlay.Scale = Mathf.Min(this.Width * button.width / this.ButtonGrid.gridWidth, this.Height * button.height / this.ButtonGrid.gridHeight);
     overlay.transform.position = transform.position + transform.rotation * new Vector3(-this.Width / 2 + (this.Width / this.ButtonGrid.gridWidth) * (button.x + button.width * 0.5f), -(-this.Height / 2 + (this.Height / this.ButtonGrid.gridHeight) * (button.y + button.height * 0.5f)), 0);
     overlay.transform.rotation = transform.rotation;
     overlay.enabled            = true;
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        nextSpawn = new List <Piece.PieceColor>();
        currentSelectedCoords.x = -1;
        currentSelectedCoords.y = -1;

        for (int i = 0; i < transform.childCount; i++)
        {
            List <GridButton> tempButtons = new List <GridButton>();
            List <Piece>      tempPieces  = new List <Piece>();
            Transform         t           = transform.GetChild(i);
            for (int j = 0; j < t.childCount; j++)
            {
                GridButton b = t.GetChild(j).GetComponent <GridButton>();
                tempButtons.Add(b);
                b.x        = i;
                b.y        = j;
                b.onPress += SelectButton;

                tempPieces.Add(null);
            }
            grid.Add(tempButtons);
            board.Add(tempPieces);
        }
        Init();
    }
Ejemplo n.º 3
0
        void AddButtons()
        {
            char buttonText          = 'A';
            int  gridElementPosition = 1;

            for (int row = 0; row < gridMatrixSize; row++)
            {
                for (int column = 0; column < gridMatrixSize; column++)
                {
                    gridButton = new GridButton
                    {
                        BackgroundColor = Color.LightBlue,
                        Text            = buttonText.ToString(),
                        Padding         = 0,
                        CornerRadius    = 0
                    };

                    gridButton.row    = row;
                    gridButton.column = column;
                    gridButton.Effects.Add(Effect.Resolve("XamarinDocs.FocusEffect"));
                    grid.Children.Add(gridButton, column, row);

                    buttonText++;
                    gridElementPosition++;
                }
            }
        }
Ejemplo n.º 4
0
    private void OnGridButtonClicked(GridButton button)
    {
        if (m_CurrentMode == LevelEditorMode.Layout)
        {
            button.CurrentPieceId++;
            if (button.CurrentPieceId >= LevelCreatorData.LevelSprites.Length)
            {
                button.SetEmpty();
            }
            else
            {
                button.UpdateSprite(LevelCreatorData.LevelSprites[button.CurrentPieceId]);
            }
        }
        else
        if (m_CurrentMode == LevelEditorMode.Start)
        {
            button.SetStartRotation();
        }
        else
        if (m_CurrentMode == LevelEditorMode.Solution)
        {
            button.SetTargetRotation();
        }

        BtnSave.interactable = CheckSaveButtonEnable();
    }
        public static bool UpdateList <T>(GridButton gridButtonPressed, List <T> items, int currnentIndex)
        {
            var currentItem = items[currnentIndex];

            if (gridButtonPressed == GridButton.Delete)
            {
                items.Remove(currentItem);
                return(true);
            }
            else if (gridButtonPressed == GridButton.MoveUp && currnentIndex != 0)
            {
                items.Remove(currentItem);
                items.Insert(currnentIndex - 1, currentItem);
                return(true);
            }
            else if (gridButtonPressed == GridButton.MoveDown && currnentIndex != items.Count - 1)
            {
                items.Remove(currentItem);
                items.Insert(currnentIndex + 1, currentItem);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 6
0
        public static void AddColumnButton(UltraGrid grid, int band, GridButton button)
        {
            var colName = button.ToString();
             var colWidth = button == GridButton.Edit ||
                        button == GridButton.Add
                           ? 34
                           : button == GridButton.Delete
                                ? 46
                                : button == GridButton.Override
                                     ? 60
                                     : 50;

             if (grid.DisplayLayout.Bands[band].Columns.IndexOf(colName) != -1) return;

             grid.DisplayLayout.Bands[band].Columns.Insert(grid.DisplayLayout.Bands[band].Columns.Count, colName);
             var gridColumn = grid.DisplayLayout.Bands[band].Columns[colName];
             gridColumn.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
             gridColumn.CellAppearance.TextHAlign = HAlign.Center;
             gridColumn.CellAppearance.FontData.Name = "Tahoma";
             gridColumn.CellAppearance.FontData.SizeInPoints = 8f;
             gridColumn.CellActivation = Activation.NoEdit;
             gridColumn.CellClickAction = CellClickAction.CellSelect;
             gridColumn.Header.Caption = "";
             gridColumn.Header.Enabled = false;
             gridColumn.RowLayoutColumnInfo.PreferredCellSize = new Size(colWidth, 18);
             gridColumn.Style = ColumnStyle.Button;
        }
Ejemplo n.º 7
0
        public static void SetButtonText(UltraGridRow row, GridButton button)
        {
            var colName = button.ToString();
             var label = button.ToString();
             if (row.Cells.IndexOf(colName) == -1) return;

             var buttonLabel = !string.IsNullOrEmpty(label) ? string.Format("[{0}]", label.ToLower()) : string.Empty;
             row.Cells[colName].Value = buttonLabel;
        }
Ejemplo n.º 8
0
 public void RemoveButtonFromIndex(GridButton button)
 {
     for (int x = button.x; x < button.x + button.width; x++)
     {
         for (int y = button.y; y < button.y + button.height; y++)
         {
             //Debug.Assert(this.SpatialIndex[x, y] == button);
             this.SpatialIndex[x, y] = null;
         }
     }
 }
Ejemplo n.º 9
0
 public void AddButtonToIndex(GridButton button)
 {
     for (int x = button.x; x < button.x + button.width; x++)
     {
         for (int y = button.y; y < button.y + button.height; y++)
         {
             //Debug.Assert(this.SpatialIndex[x, y] == null);
             this.SpatialIndex[x, y] = button;
         }
     }
 }
Ejemplo n.º 10
0
        public void NewGame()
        {
            p1.Reset();
            p2.Reset();

            grid.ColumnDefinitions.Clear();
            grid.Children.Clear();
            grid.RowDefinitions.Clear();

            //Simple Game
            this.game       = new Game(p1, p2);
            this.buttonGrid = new GridButton[3, 3];

            //Create rows, columns
            for (int i = 0; i < 3; i++)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition());
            }

            for (int i = 0; i < 3; i++)
            {
                grid.RowDefinitions.Add(new RowDefinition());
            }

            //Create buttons
            for (int r = 0; r < 3; r++)
            {
                for (int c = 0; c < 3; c++)
                {
                    var info = new ButtonInfo(r, c);

                    GridButton button = new GridButton();
                    button.SetValue(Grid.RowProperty, r);
                    button.SetValue(Grid.ColumnProperty, c);
                    button.InitializeButton(info);
                    grid.Children.Add(button);

                    buttonGrid[r, c] = button;
                }
            }

            //Set Handlers
            GridButton.SetHandlers(
                OnClick,
                () => game.CurrentPlayerToken);

            UpdateGameState(game.GetState());
        }
Ejemplo n.º 11
0
 // Use this for initialization
 void Start()
 {
     gridButtons = new List <GridButton>();
     if (content)
     {
         //GridButton newButton;
         for (int i = 0; i < 12; i++)
         {
             //Debug.Log("Creating button "+i);
             GridButton newButton = Instantiate(gridButtonPrefab, content);
             newButton.onClicked.AddListener(UpdateButtonValues);
             gridButtons.Add(newButton);
             UpdateButtonValues(newButton);
         }
     }
 }
Ejemplo n.º 12
0
    public void ChooseGridComponent(GameObject comp)
    {
        GridButton gbSc = comp.GetComponent <GridButton>();

        switch (gridInteraction)
        {
        case "Double":
            grid[gbSc.gridCoords.x, gbSc.gridCoords.y] *= 2;
            gridInteraction = null;
            break;

        case "Remove":
            grid[gbSc.gridCoords.x, gbSc.gridCoords.y] = 0;
            gridInteraction = null;
            break;

        case "Combine":
            if (combineFrom == null)
            {
                combineFrom = gbSc.gridCoords;
            }
            else if (combineFrom.x != gbSc.gridCoords.x || combineFrom.y != gbSc.gridCoords.y)
            {
                if (grid[combineFrom.x, combineFrom.y] == grid[gbSc.gridCoords.x, gbSc.gridCoords.y])
                {
                    grid[combineFrom.x, combineFrom.y]          = 0;
                    grid[gbSc.gridCoords.x, gbSc.gridCoords.y] *= 2;
                    gridInteraction = null;
                }
            }
            break;

        case "Combat":
            FightController.instance.damageInput       = grid[gbSc.gridCoords.x, gbSc.gridCoords.y];
            grid[gbSc.gridCoords.x, gbSc.gridCoords.y] = 0;
            break;

        default:
            break;
        }
        if (Player.inCombat)
        {
            gridInteraction = "Combat";
        }
        StartCoroutine(UpdateGridUI());
    }
Ejemplo n.º 13
0
    void UpdateButtonValues(GridButton button)
    {
        Color         imageColor = Color.red;
        Color         textColor  = Color.blue;
        string        text       = "T";
        TMP_FontAsset randFont   = button.text.font;

        if (GameControl.instance.colorData.colours.Count > 0)
        {
            int randInt = Random.Range(0, GameControl.instance.colorData.colours.Count);
            imageColor = GameControl.instance.colorData.GetColor(randInt, "button");
            textColor  = GameControl.instance.colorData.GetColor(randInt, "text");
        }
        if (button.text.text == "")         // create new
        {
            button.SetNewAnimal(GetNewAnimal());
            randFont = GameControl.instance.fonts[Random.Range(0, GameControl.instance.fonts.Count)];
            if (useNames)
            {
                text = button.animal.name.ToCharArray()[0].ToString();
            }
            else
            {
                text = Random.Range(1, 10).ToString();
            }
            button.SetValues(imageColor, textColor, text, randFont);
        }
        else if (button.text.text == "1" || (useNames && button.displayIndex == button.animal.name.Length))            // show image only
        {
            button.ShowImage();
        }
        else
        {
            if (useNames)
            {
                text = button.animal.name.ToCharArray()[button.displayIndex].ToString();
            }
            else
            {
                text = (int.Parse(button.text.text) - 1).ToString();
            }
            button.SetValues(imageColor, textColor, text, randFont);
        }
        //Debug.Log("Button values set");
    }
Ejemplo n.º 14
0
    private Texture2D OverlayTextureForButton(GridButton button)
    {
        if (button == null)
        {
            return(OverlayTexture);
        }
        switch (button.buttonType)
        {
        case ButtonType.TwoDirectionRotary:
        case ButtonType.MultiPositionRotary:
            return(OverlayTextureRotary);

        case ButtonType.ThreeWaySwitch:
            return(button.isLeftRight ? OverlayTextureLeftRight : OverlayTextureThreeWay);

        case ButtonType.MultiPositionSwitch:
            return(button.isLeftRight ? OverlayTextureMultiLeftRight : OverlayTextureMultiSwitch);

        default:
            return(OverlayTexture);
        }
    }
Ejemplo n.º 15
0
        /// <summary>
        /// Loads Grid from the current Kit
        /// </summary>
        /// <param name="grid">Contains all the grid information</param>
        public void LoadGrid(Grid grid)
        {
            List <GridButton> buttons = new List <GridButton>();

            int ButtonHeight = 40;
            int Distance     = 20;
            int start_x      = 10;
            int start_y      = 10;
            int ButtonWidth  = (_view.SafeInstance.GetPanelGridWidth() - (Distance * grid.XSize)) / grid.XSize;

            for (int y = 0; y < grid.YSize; y++)
            {
                for (int x = 0; x < grid.XSize; x++)
                {
                    var        gridItem  = grid.GridItems.FirstOrDefault(i => i.X == x && i.Y == y);
                    GridButton tmpButton = new GridButton()
                    {
                        Top    = start_x + (x * ButtonHeight + Distance),
                        Left   = start_y + (y * ButtonWidth + Distance),
                        Width  = ButtonWidth,
                        Height = ButtonHeight,
                    };

                    if (gridItem != null)
                    {
                        tmpButton.MouseDown += (s, e) => { ProcessGridButtonClick(gridItem.ID); };
                        tmpButton.MouseUp   += (s, e) => { _plugin.SampleManager.ProcessNoteOffEvent(gridItem.Note); };

                        tmpButton.Text = gridItem.Name;
                        tmpButton.Note = gridItem.Note;
                    }

                    buttons.Add(tmpButton);
                }
            }

            _view.SafeInstance.LoadGrid(buttons);
        }
Ejemplo n.º 16
0
    //if there is a valid path from (x1, y1) to (x2, y2), move the piece to the corresponding gridbutton
    void MovePiece(int x1, int y1, int x2, int y2)
    {
        Piece      p  = board[x1][y1];
        GridButton gb = grid[x2][y2];

        board[x2][y2] = p;
        board[x1][y1] = null;

        p.gameObject.transform.SetParent(gb.gameObject.transform);
        RectTransform rt = p.GetComponent <RectTransform>();

        rt.offsetMax = Vector2.zero;
        rt.offsetMin = Vector2.zero;

        //////
        /////
        ////
        ////    TODO, add anim/visual movement to pieces
        ////
        /////
        //do fancy animations later
        //StartCoroutine(MoveTransformToLocalZero(p.GetComponent<RectTransform>()));
    }
Ejemplo n.º 17
0
    void Awake()
    {
        var           masterButton = transform.FindChild("Button").GetComponent <GridButton>();
        RectTransform r            = masterButton.GetComponent <RectTransform>();
        float         width        = r.rect.width;
        float         height       = r.rect.height;
        Vector3       basePos      = r.transform.localPosition;
        Vector3       baseScl      = masterButton.transform.localScale;
        Quaternion    baseRot      = masterButton.transform.rotation;

        for (int y = 0; y < 32; y++)
        {
            for (int x = 0; x < 32; x++)
            {
                GridButton btn = Instantiate(masterButton);
                Vector3    pos = new Vector3();
                pos.x = basePos.x + x * width;
                pos.y = basePos.y + y * height;
                btn.transform.SetParent(transform);
                btn.transform.localPosition = pos;
                btn.transform.localScale    = baseScl;
                btn.transform.rotation      = baseRot;
                btn.Tx = x;
                btn.Ty = y;
                btn.WT = this;
                int tx = x;
                int ty = y;
                btn.OnKeyDownEvent.AddListener(() =>
                {
                    WT[tx] = (byte)ty;
                    OnUpdateAction(tx);
                });
            }
        }
        masterButton.gameObject.SetActive(false);
    }
Ejemplo n.º 18
0
 public void addButton(GridButton but)
 {
     myButtons.Add(but);
     gridButtonDict.Add(but.name, but);
 }
Ejemplo n.º 19
0
    private static void CreateProfileOverlay()
    {
        Profile profile = new Profile();

        profile.name      = "Profiles";
        profile.directory = DirectoryInfo.FolderPath;
        profile.grids     = new List <ButtonGrid>(1);
        profile.index     = -1;

        ButtonGrid grid = new ButtonGrid();

        grid.parent = profile;
        profile.grids.Add(grid);
        grid.name     = "Profiles";
        grid.filename = DirectoryInfo.ProfilesTextureName;

        float buttonSize = 0.1f;
        int   gridWidth  = 4;
        int   gridHeight = 2;

        while ((gridWidth * (gridHeight - 1)) < profiles.Count)
        {
            if (gridWidth == gridHeight - 1)
            {
                gridWidth++;
            }
            else
            {
                gridHeight++;
            }
        }

        grid.gridWidth  = gridWidth;
        grid.gridHeight = gridHeight;
        grid.width      = buttonSize * gridWidth;
        grid.height     = buttonSize * gridHeight;
        grid.buttons    = new List <GridButton>(profiles.Count);
        grid.x          = 0;
        grid.y          = 1;
        grid.z          = 0;
        grid.pitch      = 0;
        grid.yaw        = 0;
        grid.roll       = 0;
        grid.alpha      = 1;

        GridButton resetButton = new GridButton();

        resetButton.x        = 0;
        resetButton.y        = 0;
        resetButton.width    = gridWidth / 2;
        resetButton.height   = 1;
        resetButton.text     = "Reset Seated Position";
        resetButton.fontSize = 0.0125;
        resetButton.keypress = null;
        grid.buttons.Add(resetButton);

        GridButton laserButton = new GridButton();

        laserButton.x        = 2;
        laserButton.y        = 0;
        laserButton.width    = gridWidth - (gridWidth / 2);
        laserButton.height   = 1;
        laserButton.text     = "Reset Seated Position";
        laserButton.fontSize = 0.0125;
        laserButton.keypress = null;
        grid.buttons.Add(laserButton);

        int x = 0;
        int y = 1;

        foreach (Profile p in profiles)
        {
            GridButton button = new GridButton();
            button.x        = x;
            button.y        = y;
            button.width    = 1;
            button.height   = 1;
            button.text     = p.name;
            button.fontSize = 0.01;
            button.keypress = null;
            grid.buttons.Add(button);

            x++;
            if (x >= gridWidth)
            {
                x = 0;
                y++;
            }
        }
        grid.RebuildSpatialIndex();

        GameObject    overlay = (GameObject)GameObject.Instantiate(Resources.Load("Overlay"));
        OverlayLoader loader  = overlay.GetComponent <OverlayLoader>();

        overlay.GetComponent <HOTK_Overlay>().OverlayTexture = new Texture2D(16, 16);
        loader.ButtonGrid  = grid;
        ProfileOverlay     = loader;
        ProfileOverlayList = new List <OverlayLoader>(1);
        ProfileOverlayList.Add(ProfileOverlay);
    }
Ejemplo n.º 20
0
 public static void RemoveColumnButton(UltraGrid grid, int band, GridButton button)
 {
     var colName = button.ToString();
      var idx = grid.DisplayLayout.Bands[band].Columns.IndexOf(colName);
      if (idx != -1) grid.DisplayLayout.Bands[band].Columns.Remove(idx);
 }
Ejemplo n.º 21
0
    void UpdateOverlays()
    {
        if (PressedDown(SteamVR_Controller.ButtonMask.ApplicationMenu))
        {
            DataLoader.StartSelectingProfile(DataLoader.Settings.Lasermode ? Hand.transform.position + 0.2f * LaserDirection() : BallPosition(), Head.transform.position);
        }
        if (PressedUp(SteamVR_Controller.ButtonMask.ApplicationMenu) && DataLoader.SelectingProfile)
        {
            DataLoader.StopSelectingProfile(profileIndex);
        }
        bool profileSet = false;

        if (CurrentButton != null)
        {
            isLeftRight = CurrentButton.isLeftRight;
        }

        Vector2 touchPos = TouchpadPos();
        bool    touchModeTouchpadActive   = Mathf.Abs(isLeftRight ? touchPos.x : touchPos.y) >= 0.5;
        bool    touchModeTouchpadPressed  = touchModeTouchpadActive && !this.TouchModeTouchpadWasActive;
        bool    touchModeTouchpadReleased = !touchModeTouchpadActive && this.TouchModeTouchpadWasActive;

        this.TouchModeTouchpadWasActive = touchModeTouchpadActive;

        if (CurrentButton == null)
        {
            bool                 showOverlay    = false;
            OverlayLoader        closestOverlay = null;
            Vector3              closestPos     = new Vector3(0, 0, 1000);
            float                closestDist    = 1000;
            List <OverlayLoader> overlays       = DataLoader.SelectingProfile ? DataLoader.ProfileOverlayList : DataLoader.Overlays;
            foreach (OverlayLoader overlay in overlays)
            {
                float   dist;
                Vector3 relPos = overlay.RelativePosition(DataLoader.Settings.Lasermode ? Hand.transform.position : BallPosition(),
                                                          DataLoader.Settings.Lasermode ? LaserDirection() : Vector3.zero,
                                                          out dist);
                if (overlay.PositionInRange(relPos, 0.1f) && dist < closestDist)
                {
                    closestOverlay = overlay;
                    closestPos     = relPos;
                    closestDist    = dist;
                }
            }

            if (closestOverlay != null)
            {
                if (DataLoader.Settings.Lasermode)
                {
                    SetLaserLength(closestDist);
                }
                GridButton button = closestOverlay.PointedButton(closestPos);
                if (button != null)
                {
                    showOverlay = true;
                    ButtonOverlay.OverlayTexture = OverlayTextureForButton(button);
                    closestOverlay.ShowButtonOverlay(button, ButtonOverlay);
                    if (!DataLoader.SelectingProfile)
                    {
                        if (PressedDown(SteamVR_Controller.ButtonMask.Trigger))
                        {
                            CurrentButton   = button;
                            CurrentKeypress = button.keypress;
                            if (button.buttonType == ButtonType.Normal || button.buttonType == ButtonType.ThreeWaySwitch)
                            {
                                KeyboardInput.Down(button.keypress);
                            }
                            else
                            {
                                RotaryDirection  = PointingDirection();
                                RotaryOriginalUp = PointingUpDirection();
                            }
                            ButtonOverlay.OverlayTexture = OverlayTexturePressed;
                        }
                        else if ((!DataLoader.Settings.OculusTouchMode && PressedDown(SteamVR_Controller.ButtonMask.Touchpad)) ||
                                 (DataLoader.Settings.OculusTouchMode && touchModeTouchpadPressed))
                        {
                            if (button.buttonType == ButtonType.ThreeWaySwitch)
                            {
                                CurrentButton = button;
                                ButtonOverlay.OverlayTexture = OverlayTexturePressed;
                                CurrentKeypress = (CurrentButton.isLeftRight ? touchPos.x : touchPos.y) >= 0 ? button.cwKeypress : button.ccwKeypress;
                                KeyboardInput.Down(CurrentKeypress);
                            }
                            else if (button.buttonType == ButtonType.MultiPositionSwitch)
                            {
                                CurrentButton = button;
                                ButtonOverlay.OverlayTexture = OverlayTexturePressed;
                                int sign         = (CurrentButton.isLeftRight ? touchPos.x : touchPos.y) >= 0 ? 1 : -1;
                                int nextPosition = CurrentButton.currentKeypress + (int)sign;
                                if (nextPosition >= 0 && nextPosition < CurrentButton.multiKeypresses.Count)
                                {
                                    CurrentButton.currentKeypress = nextPosition;
                                    KeyCombo keypress = CurrentButton.multiKeypresses[nextPosition];
                                    KeyboardInput.Down(keypress);
                                    KeyboardInput.Up(keypress);
                                }
                            }
                        }
                    }
                    else
                    {
                        profileIndex = closestOverlay.ButtonGrid.buttons.IndexOf(button);
                        profileSet   = true;
                    }
                }
                if (!DataLoader.SelectingProfile && !closestOverlay.ButtonGrid.locked && PressedDown(SteamVR_Controller.ButtonMask.Grip))
                {
                    MovingOverlay                 = closestOverlay;
                    MovingOriginalPosition        = BallPosition();
                    MovingOriginalRotation        = Hand.transform.rotation;
                    MovingOriginalOverlayPosition = closestOverlay.transform.position;
                    MovingOriginalOverlayRotation = closestOverlay.transform.rotation;
                }
            }
            else if (DataLoader.Settings.Lasermode)
            {
                SetLaserLength(0.2f);
            }

            if (!showOverlay)
            {
                ButtonOverlay.enabled = false;
            }
        }
        else
        {
            if (PressedUp(SteamVR_Controller.ButtonMask.Trigger) || (((!DataLoader.Settings.OculusTouchMode && PressedUp(SteamVR_Controller.ButtonMask.Touchpad)) || (DataLoader.Settings.OculusTouchMode && touchModeTouchpadReleased)) && (CurrentButton.buttonType == ButtonType.ThreeWaySwitch || CurrentButton.buttonType == ButtonType.MultiPositionSwitch)))
            {
                if (CurrentButton.buttonType == ButtonType.Normal || CurrentButton.buttonType == ButtonType.ThreeWaySwitch || CurrentButton.buttonType == ButtonType.MultiPositionSwitch)
                {
                    KeyboardInput.Up(CurrentKeypress);
                }

                ButtonOverlay.OverlayTexture = OverlayTexture;
                CurrentButton   = null;
                CurrentKeypress = null;
            }
            else if (CurrentButton.buttonType == ButtonType.TwoDirectionRotary || CurrentButton.buttonType == ButtonType.MultiPositionRotary)
            {
                float angle = AngleBetween(this.RotaryOriginalUp, PointingUpDirection(), this.RotaryDirection);
                if (Mathf.Abs(angle) >= CurrentButton.rotaryAngle)
                {
                    float sign = Mathf.Sign(angle);
                    this.RotaryOriginalUp = Quaternion.AngleAxis((float)CurrentButton.rotaryAngle * (-sign), this.RotaryDirection) * this.RotaryOriginalUp;
                    if (CurrentButton.buttonType == ButtonType.TwoDirectionRotary)
                    {
                        KeyCombo keypress = sign > 0 ? CurrentButton.cwKeypress : CurrentButton.ccwKeypress;
                        KeyboardInput.Down(keypress);
                        keypressToRelease = keypress;
                    }
                    else if (CurrentButton.buttonType == ButtonType.MultiPositionRotary)
                    {
                        int nextPosition = CurrentButton.currentKeypress + (int)sign;
                        if (nextPosition >= 0 && nextPosition < CurrentButton.multiKeypresses.Count)
                        {
                            CurrentButton.currentKeypress = nextPosition;
                            KeyCombo keypress = CurrentButton.multiKeypresses[nextPosition];
                            KeyboardInput.Down(keypress);
                            keypressToRelease = keypress;
                        }
                    }
                }
            }
        }

        if (!profileSet && DataLoader.SelectingProfile)
        {
            profileIndex = -1;
        }
    }
Ejemplo n.º 22
0
 public ButtonGrid(GridButton[][] buttonGrid)
 {
     this.buttonGrid = buttonGrid;
 }