Exemplo n.º 1
0
        //---------------------------------------------------------------------------

        public LevelCanvas()
        {
            InitializeComponent();
            DataContext = this;

            LevelManager.Get().RegisterCanvas(this);

            EditManager.Get().Register(EEditMode.Tiles, TilesEditMode);
            EditManager.Get().Register(EEditMode.Eraser, EraserEditMode);
            EditManager.Get().Register(EEditMode.Selection, SelectionEditMode);
            EditManager.Get().Register(EEditMode.Fill, FillEditMode);
            EditManager.Get().Register(EEditMode.Blocker, BlockerEditMode);

            EditManager.Get().ChangeMode(EEditMode.Tiles);

            LayerManager.Get().Register(ELayerMode.First, FirstLayer);
            LayerManager.Get().Register(ELayerMode.Second, SecondLayer);
            LayerManager.Get().Register(ELayerMode.Third, ThirdLayer);

            LayerManager.Get().ChangeMode(ELayerMode.First);

            #region Keybindings
            InputManager.Get().RegisterShortcut(Key.Z, ModifierKeys.Control, () =>
            {
                UndoManager.Get().Undo();
            });

            InputManager.Get().RegisterShortcut(Key.Y, ModifierKeys.Control, () =>
            {
                UndoManager.Get().Redo();
            });

            InputManager.Get().RegisterShortcut(Key.T, ModifierKeys.Control, () =>
            {
                EditManager.Get().ChangeMode(EEditMode.Tiles);
            });

            InputManager.Get().RegisterShortcut(Key.E, ModifierKeys.Control, () =>
            {
                EditManager.Get().ChangeMode(EEditMode.Eraser);
            });

            InputManager.Get().RegisterShortcut(Key.S, ModifierKeys.Control, () =>
            {
                EditManager.Get().ChangeMode(EEditMode.Selection);
            });

            InputManager.Get().RegisterShortcut(Key.F, ModifierKeys.Control, () =>
            {
                EditManager.Get().ChangeMode(EEditMode.Fill);
            });

            InputManager.Get().RegisterShortcut(Key.B, ModifierKeys.Control, () =>
            {
                EditManager.Get().ChangeMode(EEditMode.Blocker);
            });

            InputManager.Get().RegisterShortcut(Key.F1, ModifierKeys.None, () =>
            {
                LayerManager.Get().ChangeMode(ELayerMode.First);
            });

            InputManager.Get().RegisterShortcut(Key.F2, ModifierKeys.None, () =>
            {
                LayerManager.Get().ChangeMode(ELayerMode.Second);
            });

            InputManager.Get().RegisterShortcut(Key.F3, ModifierKeys.None, () =>
            {
                LayerManager.Get().ChangeMode(ELayerMode.Third);
            });
            #endregion
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------------

        private void OnMouseUp(object sender, MouseEventArgs e)
        {
            UndoManager.Get().StopUndo();
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------------

        private void OnRedoClicked(object sender, EventArgs e)
        {
            UndoManager.Get().Redo();
        }
Exemplo n.º 4
0
        //---------------------------------------------------------------------------

        private void OnUndo(object sender, EventArgs e)
        {
            UndoManager.Get().Undo();
        }