Ejemplo n.º 1
0
        // Constructor.
        public EditDoorWindow(Project p, bool createNew)
        {
            InitializeComponent();

            MyProject     = p;
            CreateNew     = createNew;
            ScreenPreview = new UITileViewer(16.0, 16, 16, 16, 16, ScreenPreviewGrid);
            ScreenPreviewGrid.Children.Add(ScreenPreview.Element);
            ScreenPreview.MouseDown    += Tile_Click;
            ScreenPreview.MarkerVisible = true;
            ScreenImage = new BlitImage(256, 256);
            foreach (string name in MyProject.AreaNames)
            {
                AreaListBox.Items.Add(name);
            }

            if (CreateNew)
            {
                AreaListBox.SelectedIndex = MyProject.AreaIndex;
            }
            else
            {
                // Get destination info.
                MyProject.GetDoorDestination(out int areaIndex, out int roomIndex,
                                             out int screenX, out int screenY,
                                             out int doorCapX, out int doorCapY,
                                             out int distanceToSpawn);
                AreaListBox.SelectedIndex = areaIndex;
                RoomListBox.SelectedIndex = roomIndex;
                ScreenX  = screenX;
                ScreenY  = screenY;
                DoorCapX = doorCapX;
                DoorCapY = doorCapY;
                SpawnDistanceInput.Text = Tools.IntToHex(distanceToSpawn, 4);

                // Get other door properties.
                MyProject.GetDoorProperties(out bool isElevator, out bool isElevatorPad,
                                            out int direction, out bool closes);
                if (isElevatorPad)
                {
                    DoorTypeSelect.SelectedIndex = 2;
                }
                else if (isElevator)
                {
                    DoorTypeSelect.SelectedIndex = 1;
                }
                else
                {
                    DoorTypeSelect.SelectedIndex = 0;
                }
                DirectionSelect.SelectedIndex = direction;
                ClosesCheckbox.IsChecked      = closes;

                // Update screen.
                RenderScreen();
                UpdateDoorCap();
                UpdateButtons();
            }
        }
Ejemplo n.º 2
0
//========================================================================================
// Setup & Updating


        private void SetupTileSelector()
        {
            TileSelector                            = new UITileViewer(16.0, 32, 32, 32, 32, TileSelectorViewer);
            TileSelector.MouseDown                 += TileSelector_MouseDown;
            TileSelector.BackgroundColor            = Color.FromRgb(0xFF, 0x00, 0xFF);
            TileSelectorViewer.Content              = TileSelector.Element;
            SelectedTileImage.RenderTransformOrigin = new Point(0.5, 0.5);
        }
Ejemplo n.º 3
0
 private void SetupBtsSelector()
 {
     BtsSelector                 = new UITileViewer(16.0, 8, 17, 8, 17, BtsSelectorViewer);
     BtsSelector.MouseDown      += BtsSelector_MouseDown;
     BtsSelector.BackgroundColor = Color.FromRgb(0x00, 0x00, 0x00);
     BtsSelectorViewer.Content   = BtsSelector.Element;
     // [wip] perhaps Bts tiles should be obtained from MainProject.
     BtsSelector.Screens [0, 0].Source = GraphicsIO.LoadBitmap(Project.BtsTilesFile);
 }
Ejemplo n.º 4
0
 private void SetupMapEditor()
 {
     MapEditor = new UITileViewer(8.0, 64, 32, 64, 32, null);
     MapEditor.MarkerVisible = true;
     MapEditor.MouseDown    += MapEditor_MouseDown;
     MapEditor.MouseUp      += MapEditor_MouseUp;
     MapViewer.Children.Add(MapEditor.Element);
     SelectedMapTileImage.RenderTransformOrigin = new Point(0.5, 0.5);
     MapEditor.Element.SetValue(Grid.CursorProperty, Cursors.Hand);
 }
Ejemplo n.º 5
0
 private void SetupLevelData()
 {
     LevelData = new UITileViewer(16.0, 16, 16, 16, 16, LevelDataViewer);
     LevelData.ViewportChanged += LevelDataViewportChanged;
     LevelData.MouseDown       += LevelViewer_MouseDown;
     LevelData.MouseUp         += LevelViewer_MouseUp;
     LevelData.MouseDrag       += LevelViewer_MouseDrag;
     LevelData.BackgroundColor  = Color.FromRgb(0x00, 0x00, 0x00);
     LevelDataViewer.Content    = LevelData.Element;
 }
Ejemplo n.º 6
0
        public EditRoomPositionWindow(Project p, bool setSize)
        {
            InitializeComponent();

            MainProject = p;
            SetSize     = setSize;

            NewPositionX = MainProject.RoomX;
            NewPositionY = MainProject.RoomY + 1;
            NewWidth     = MainProject.RoomWidthInScreens;
            NewHeight    = MainProject.RoomHeightInScreens;

            RoomSizeEditor = new UITileViewer(16.0, 64, 32, 64, 32, MapViewer);
            RoomSizeEditor.MarkerVisible = true;
            RoomSizeEditor.Screens [0, 0].SetValue(RenderOptions.BitmapScalingModeProperty,
                                                   BitmapScalingMode.NearestNeighbor);
            MapViewer.Content = RoomSizeEditor.Element;
            BlitImage areaMap = MainProject.RenderAreaMap();

            areaMap.DrawRectangle(NewPositionX * 8, NewPositionY * 8, NewWidth * 8, NewHeight * 8,
                                  0x00, 0xFF, 0x00, 0x40);
            ImageSource source = areaMap.ToBitmap();

            RoomSizeEditor.Screens [0, 0].Source = source;

            if (SetSize)
            {
                RoomSizeEditor.MouseUp += RoomSizeEditor_MouseUp;
                Title = "Crop/expand room to new size";
            }
            else
            {
                RoomSizeEditor.MouseDown += RoomSizeEditor_MouseDown;
                Title = "Set room position on map";
            }

            UpdateSelection();
            ContentRendered += ScrollToMarker;
        }
Ejemplo n.º 7
0
//========================================================================================
// Setup & Updating


        private void SetupMapTileSelector()
        {
            MapTileSelector            = new UITileViewer(8.0, 16, 16, 16, 16, null);
            MapTileSelector.MouseDown += MapTileSelector_MouseDown;
            MapTileViewer.Children.Add(MapTileSelector.Element);
        }