Exemplo n.º 1
0
 private void Awake()
 {
     Highlighted = false;
     HighlightBorder.SetActive(false);
     UpArrow.SetActive(false);
     DownArrow.SetActive(false);
 }
Exemplo n.º 2
0
 public override void Highlight()
 {
     Highlighted = !Highlighted;
     HighlightBorder.SetActive(Highlighted);
     UpArrow.SetActive(Highlighted);
     DownArrow.SetActive(Highlighted);
 }
 public void Highlight()
 {
     Highlighted = !Highlighted;
     HighlightBorder.SetActive(Highlighted);
     UpArrow.SetActive(Highlighted);
     DownArrow.SetActive(Highlighted);
     FinishIndicator.SetActive(Highlighted);
 }
Exemplo n.º 4
0
 public override void draw(SpriteBatch b)
 {
     Draw(b);
     if (_currentRow < _maxRow)
     {
         DownArrow.draw(b);
     }
     if (_currentRow > 0)
     {
         UpArrow.draw(b);
     }
     drawMouse(b);
 }
Exemplo n.º 5
0
 public override void receiveLeftClick(int x, int y, bool playSound = true)
 {
     base.receiveLeftClick(x, y, true);
     if (UpArrow.containsPoint(x, y) && _currentRow > 0)
     {
         Game1.playSound("coin");
         _currentRow--;
         UpArrow.scale = UpArrow.baseScale;
     }
     if (DownArrow.containsPoint(x, y) && _currentRow < _maxRow)
     {
         Game1.playSound("coin");
         _currentRow++;
         DownArrow.scale = DownArrow.baseScale;
     }
     Refresh();
 }
Exemplo n.º 6
0
        public void ListNotes(List <FNFSong.FNFNote> notes)
        {
            try
            {
                if (Form1.pnlField.InvokeRequired)
                {
                    Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Clear(); });
                }

                foreach (FNFSong.FNFNote n in notes)
                {
                    double newcurrentY = Math.Floor(remapToRange(float.Parse(n.Time.ToString()), 0,
                                                                 (float)16 * stepCrochet, 0, Form1.pnlField.Height)) % Form1.pnlField.Height;

                    switch (n.Type)
                    {
                    case FNFSong.NoteType.Left:
                    case FNFSong.NoteType.RLeft:
                        LeftArrow arrow = new LeftArrow();
                        arrow.Location = new Point(0, (int)newcurrentY);
                        if (n.Length > 0)
                        {
                            HeldPart h = new HeldPart(n);
                            h.Location = new Point(arrow.Location.X + (arrow.Width / 2) - 6, (int)newcurrentY);
                            if (Form1.pnlField.InvokeRequired)
                            {
                                Form1.pnlField.BeginInvoke((MethodInvoker) delegate
                                {
                                    Form1.pnlField.Controls.Add(h);
                                    h.SendToBack();
                                });
                            }
                        }
                        if (Form1.pnlField.InvokeRequired)
                        {
                            Form1.pnlField.BeginInvoke((MethodInvoker) delegate
                            {
                                Form1.pnlField.Controls.Add(arrow);
                                arrow.BringToFront();
                            });
                        }
                        break;

                    case FNFSong.NoteType.Down:
                    case FNFSong.NoteType.RDown:
                        DownArrow dArrow = new DownArrow();
                        dArrow.Location = new Point(32, (int)newcurrentY);
                        if (n.Length > 0)
                        {
                            HeldPart h = new HeldPart(n);
                            h.Location = new Point(dArrow.Location.X + (dArrow.Width / 2) - 6, (int)newcurrentY);
                            if (Form1.pnlField.InvokeRequired)
                            {
                                Form1.pnlField.BeginInvoke((MethodInvoker) delegate
                                {
                                    Form1.pnlField.Controls.Add(h);
                                    h.SendToBack();
                                });
                            }
                        }
                        if (Form1.pnlField.InvokeRequired)
                        {
                            Form1.pnlField.BeginInvoke((MethodInvoker) delegate
                            {
                                Form1.pnlField.Controls.Add(dArrow);
                                dArrow.BringToFront();
                            });
                        }
                        break;

                    case FNFSong.NoteType.Up:
                    case FNFSong.NoteType.RUp:
                        UpArrow uArrow = new UpArrow();
                        uArrow.Location = new Point(64, (int)newcurrentY);
                        if (n.Length > 0)
                        {
                            HeldPart h = new HeldPart(n);
                            h.Location = new Point(uArrow.Location.X + (uArrow.Width / 2) - 6, (int)newcurrentY);
                            if (Form1.pnlField.InvokeRequired)
                            {
                                Form1.pnlField.BeginInvoke((MethodInvoker) delegate
                                {
                                    Form1.pnlField.Controls.Add(h);
                                    h.SendToBack();
                                });
                            }
                        }
                        if (Form1.pnlField.InvokeRequired)
                        {
                            Form1.pnlField.BeginInvoke((MethodInvoker) delegate
                            {
                                Form1.pnlField.Controls.Add(uArrow);
                                uArrow.BringToFront();
                            });
                        }
                        break;

                    case FNFSong.NoteType.Right:
                    case FNFSong.NoteType.RRight:
                        RightArrow rArrow = new RightArrow();
                        rArrow.Location = new Point(96, (int)newcurrentY);
                        if (n.Length > 0)
                        {
                            HeldPart h = new HeldPart(n);
                            h.Location = new Point(rArrow.Location.X + (rArrow.Width / 2) - 6, (int)newcurrentY);

                            if (Form1.pnlField.InvokeRequired)
                            {
                                Form1.pnlField.BeginInvoke((MethodInvoker) delegate
                                {
                                    Form1.pnlField.Controls.Add(h);
                                    h.SendToBack();
                                });
                            }
                        }
                        if (Form1.pnlField.InvokeRequired)
                        {
                            Form1.pnlField.BeginInvoke((MethodInvoker) delegate
                            {
                                Form1.pnlField.Controls.Add(rArrow);
                                rArrow.BringToFront();
                            });
                        }
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Form1.WriteToConsole("Failed to render notes.\n" + e);
            }
        }
Exemplo n.º 7
0
        private void LoadGameObjects(IList<string> lines)
        {
            Rows = lines.Count;
            _gameObjects = new GameObjectBase[Rows][];
            for (var row = 0; row < Rows; row++)
            {
                Columns = lines[row].Length;
                _gameObjects[row] = new GameObjectBase[Columns];

                for (var column = 0; column < Columns; column++)
                {
                    switch (lines[row][column])
                    {
                        case '#':
                            _gameObjects[row][column] = Brick.LoadBrick(lines[row][column], row, column);
                            break;
                        case 'p':
                            Thakur.Row = column;
                            Thakur.Column = row;
                            break;
                        case 'G':
                            _gameObjects[row][column] = new Paisa(row, column);
                            break;
                        case 'E':
                            _gameObjects[row][column] = new Taaqat(row, column);
                            break;
                        case 'M':
                            _gameObjects[row][column] = new Mout(row, column);
                            break;
                        case '8':
                            _gameObjects[row][column] = new UpArrow(row, column);
                            break;
                        case '2':
                            _gameObjects[row][column] = new DownArrow(row, column);
                            break;
                        case '4':
                            _gameObjects[row][column] = new LeftArrow(row, column);
                            break;
                        case '6':
                            _gameObjects[row][column] = new RightArrow(row, column);
                            break;
                        case 'd':
                            _gameObjects[row][column] = new SabzDirwaaza(row, column);
                            _dirwaazay.Add((DirwaazaBase)_gameObjects[row][column]);
                            break;
                        case 'c':
                            _gameObjects[row][column] = new SabzChaabi(row, column);
                            _chaabiyaan.Add((ChaabiBase)_gameObjects[row][column]);
                            break;
                        case 't':
                            _gameObjects[row][column] = new SabzTaala(row, column);
                            _taalay.Add((TaalaBase)_gameObjects[row][column]);
                            break;
                        case 'D':
                            _gameObjects[row][column] = new LaalDirwaaza(row, column);
                            _dirwaazay.Add((DirwaazaBase)_gameObjects[row][column]);
                            break;
                        case 'C':
                            _gameObjects[row][column] = new LaalChaabi(row, column);
                            _chaabiyaan.Add((ChaabiBase)_gameObjects[row][column]);
                            break;
                        case 'T':
                            _gameObjects[row][column] = new LaalTaala(row, column);
                            _taalay.Add((TaalaBase)_gameObjects[row][column]);
                            break;
                        case 'V':
                            _gameObjects[row][column] = new Victory(row, column);
                            break;
                        case 'N':
                            _gameObjects[row][column] = new NextBoard(row, column);
                            break;
                    }
                }
            }
        }
Exemplo n.º 8
0
 public override void performHoverAction(int x, int y)
 {
     base.performHoverAction(x, y);
     UpArrow.scale   = UpArrow.containsPoint(x, y) ? Math.Min(UpArrow.scale + 0.02f, UpArrow.baseScale + 0.1f) : Math.Max(UpArrow.scale - 0.02f, UpArrow.baseScale);
     DownArrow.scale = DownArrow.containsPoint(x, y) ? Math.Min(DownArrow.scale + 0.02f, DownArrow.baseScale + 0.1f) : Math.Max(DownArrow.scale - 0.02f, DownArrow.baseScale);
 }
Exemplo n.º 9
0
 public bool ShapeRotate()
 {
     return(UpArrow.ButtonValue());
 }
Exemplo n.º 10
0
        private void KeyPressed(object sender, KeyboardInput.KeyEventArgs e, KeyboardState ks)
        {
            if (Active)
            {
                int oldPos = Cursor.TextCursor;
                switch (e.KeyCode)
                {
                case Keys.Enter:
                    EnterDown?.Invoke(this, e);
                    break;

                case Keys.Up:
                    UpArrow?.Invoke(this, e);
                    break;

                case Keys.Down:
                    DnArrow?.Invoke(this, e);
                    break;

                case Keys.Tab:
                    TabDown?.Invoke(this, e);
                    break;

                case Keys.Left:
                    if (KeyboardInput.CtrlDown)
                    {
                        Cursor.TextCursor = IndexOfLastCharBeforeWhitespace(Cursor.TextCursor, Text.Characters);
                    }
                    else
                    {
                        Cursor.TextCursor--;
                    }
                    ShiftMod(oldPos);
                    break;

                case Keys.Right:
                    if (KeyboardInput.CtrlDown)
                    {
                        Cursor.TextCursor = IndexOfNextCharAfterWhitespace(Cursor.TextCursor, Text.Characters);
                    }
                    else
                    {
                        Cursor.TextCursor++;
                    }
                    ShiftMod(oldPos);
                    break;

                case Keys.Home:
                    Cursor.TextCursor = 0;
                    ShiftMod(oldPos);
                    break;

                case Keys.End:
                    Cursor.TextCursor = Text.Length;
                    ShiftMod(oldPos);
                    break;

                case Keys.Delete:
                    if (DelSelection() == null && Cursor.TextCursor < Text.Length)
                    {
                        Text.RemoveCharacters(Cursor.TextCursor, Cursor.TextCursor + 1);
                    }
                    break;

                case Keys.Back:
                    if (DelSelection() == null && Cursor.TextCursor > 0)
                    {
                        Text.RemoveCharacters(Cursor.TextCursor - 1, Cursor.TextCursor);
                        Cursor.TextCursor--;
                    }
                    break;

                case Keys.A:
                    if (KeyboardInput.CtrlDown)
                    {
                        if (Text.Length > 0)
                        {
                            Cursor.SelectedChar = 0;
                            Cursor.TextCursor   = Text.Length;
                        }
                    }
                    break;

                case Keys.C:
                    if (KeyboardInput.CtrlDown)
                    {
                        clipboard = DelSelection(true);
                    }
                    break;

                case Keys.X:
                    if (KeyboardInput.CtrlDown)
                    {
                        if (Cursor.SelectedChar.HasValue)
                        {
                            clipboard = DelSelection();
                        }
                    }
                    break;

                case Keys.V:
                    if (KeyboardInput.CtrlDown)
                    {
                        if (clipboard != null)
                        {
                            DelSelection();
                            foreach (char c in clipboard)
                            {
                                if (Text.Length < Text.MaxLength)
                                {
                                    Text.InsertCharacter(Cursor.TextCursor, c);
                                    Cursor.TextCursor++;
                                }
                            }
                        }
                    }
                    break;

                case Keys.D2:
                    if (KeyboardInput.CtrlDown && KeyboardInput.AltDown)
                    {
                        if (Text.Length < Text.MaxLength)
                        {
                            Text.InsertCharacter(Cursor.TextCursor, '@');
                            Cursor.TextCursor++;
                        }
                    }
                    break;

                case Keys.D4:
                    if (KeyboardInput.CtrlDown && KeyboardInput.AltDown)
                    {
                        if (Text.Length < Text.MaxLength)
                        {
                            Text.InsertCharacter(Cursor.TextCursor, '$');
                            Cursor.TextCursor++;
                        }
                    }
                    break;
                }
            }
        }