Ejemplo n.º 1
0
        override public void FrequentStep()
        {
            base.FrequentStep();

            twin cursorPos = UpdateCursorPos();

            if (!xxi.Input_Key_ShowPalette())
            {
                xxi.SetState(xxi.state_edit);
            }
            else
            {
                KeyCode k = xxi.keys.GetCurrentKey();
                if (paletteGrid.CellPosInBounds(cursorPos))
                {
                    AuthorCell cell           = (AuthorCell)paletteGrid.GetCell(cursorPos);
                    bool       cellSelectable = (cell != null && cell.type != (byte)AuthorCell_SuperType.Unused);
                    bool       inputIsNumber  = (k >= KeyCode.Alpha0 && k <= KeyCode.Alpha9);
                    bool       inputIsAlpha   = (k >= KeyCode.A && k <= KeyCode.Z);

                    if (cellSelectable && (inputIsNumber || inputIsAlpha))
                    {
                        xxi.Input_SetKeyCellValue(k, cell.value);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        override public void FrequentStep()
        {
            base.FrequentStep();

            twin cursorPos = editGrid.PointToCellPos(xxi.pcam.MouseWorldPoint());

            if (xxi.Input_MouseDown_LeftButton() && editGrid.CellPosInBounds(cursorPos))
            {
                if (cursorPositions == null)
                {
                    cursorPositions = MagicWand(cursorPos);
                }
                else
                {
                    cursorPositions = null;
                }
            }
            if (cursorPositions == null)
            {
                UpdateCursors(cursorPos);
            }

            twin dir;

            if (xxi.Input_KeyDown_PushToggle())
            {
                xxi.SaveRoom(editGrid);
                xxi.SetState(xxi.state_play);
            }
            else if (xxi.Input_Key_ShowPalette())
            {
                xxi.SaveRoom(editGrid);
                xxi.SetState(xxi.state_editpalette);
            }
            else if (xxi.Input_KeyDown_Dir(out dir))
            {
                MoveRoomCoord(dir);
            }
            else
            {
                ushort cellValue;
                if (xxi.Input_Key_CellValue(out cellValue))
                {
                    if (cursorPositions != null)                       // multi select cursor
                    {
                        foreach (twin pos in cursorPositions)
                        {
                            Paint(pos, cellValue);
                        }
                    }
                    else                         // basic hover cursor
                    {
                        Paint(cursorPos, cellValue);
                    }
                }
            }
        }