コード例 #1
0
        public MappingWidget(IContainer Parent) : base(Parent)
        {
            Editor.MainWindow.MainEditorWidget = this;
            Grid layout = new Grid(this);

            layout.SetColumns(
                new GridSize(222, Unit.Pixels),
                new GridSize(1, Unit.Pixels),
                new GridSize(1)
                );

            // Left sidebar
            MapSelectPanel = new MapSelectPanel(layout);

            // Left sidebar divider
            Widget LeftSidebarDivider = new Widget(layout);

            LeftSidebarDivider.SetBackgroundColor(28, 50, 73);
            LeftSidebarDivider.SetGridColumn(1);

            Submodes = new SubmodeView(layout);
            Submodes.OnSelectionChanged += delegate(BaseEventArgs e)
            {
                ChangeSubmode();
            };
            Submodes.SetHeaderHeight(31);
            Submodes.SetHeaderSelHeight(1);
            Submodes.SetTextY(6);

            Submodes.SetGridColumn(2);
            Submodes.CreateTab("Tiles");
            //Submodes.CreateTab("Events");
            Submodes.CreateTab("Connections");
            //Submodes.CreateTab("Encounters");
            //Submodes.CreateTab("Properties");
            MapViewerTiles = new MapViewerTiles(Submodes.GetTab(0));
            //MapViewerEvents = new MapViewerEvents(Submodes.GetTab(1));
            MapViewerConnections = new MapViewerConnections(Submodes.GetTab(1));
            //MapViewerEncounters = new MapViewerEncounters(Submodes.GetTab(3));
            //MapViewerProperties = new MapViewerProperties(Submodes.GetTab(4));

            MapImageWidget = new MapImageWidget(MapViewerTiles.MainContainer);
            MapImageWidget.SetZIndex(3); // 1 for normal map connections, 2 for the selected map connection, so 3 for the main map.

            MapViewerTiles.MapWidget = MapImageWidget;
            //MapViewerEvents.MapWidget = MapImageWidget;
            MapViewerConnections.MapWidget = MapImageWidget;
            //MapViewerEncounters.MapWidget = MapImageWidget;
            //mapViewerProperties.MapWidget = MapImageWidget;

            SetHorizontalScroll(0.5);
            SetVerticalScroll(0.5);
        }
コード例 #2
0
 public void TestForOverlapBetweenMaps(MapImageWidget a, MapImageWidget b)
 {
     if (new Rect(a.Position, a.Size).Overlaps(new Rect(b.Position, b.Size)))
     {
         // Intersection of the two maps
         int    nx            = Math.Max(a.Position.X, b.Position.X);
         int    ny            = Math.Max(a.Position.Y, b.Position.Y);
         int    nw            = Math.Min(a.Position.X + a.Size.Width, b.Position.X + b.Size.Width) - nx;
         int    nh            = Math.Min(a.Position.Y + a.Size.Height, b.Position.Y + b.Size.Height) - ny;
         Widget overlapwidget = new Widget(MainContainer);
         overlapwidget.SetZIndex(4); // 1 for map connections, 2 for the selected map connection, 3 for the main map, so 4 for overlaps
         overlapwidget.SetPosition(nx, ny);
         overlapwidget.SetSize(nw, nh);
         overlapwidget.SetBackgroundColor(255, 22, 47, 103);
         TileOverlaps.Add(overlapwidget);
     }
 }