Exemple #1
0
 private void CreateBrush(Polygon poly, decimal depth)
 {
     var brush = GetBrush(poly, depth, Document.Map.IDGenerator);
     if (brush == null) return;
     IAction action = new Create(Document.Map.WorldSpawn.ID, brush);
     if (Select.SelectCreatedBrush)
     {
         brush.IsSelected = true;
         if (Select.DeselectOthersWhenSelectingCreation)
         {
             action = new ActionCollection(new ChangeSelection(new MapObject[0], Document.Selection.GetSelectedObjects()), action);
         }
     }
     Document.PerformAction("Create " + BrushManager.CurrentBrush.Name.ToLower(), action);
 }
Exemple #2
0
        private void CreateBrush(Box bounds)
        {
            var brush = GetBrush(bounds, Document.Map.IDGenerator);
            if (brush == null) return;

            brush.IsSelected = Select.SelectCreatedBrush;
            IAction action = new Create(Document.Map.WorldSpawn.ID, brush);
            if (Select.SelectCreatedBrush && Select.DeselectOthersWhenSelectingCreation)
            {
                action = new ActionCollection(new ChangeSelection(new MapObject[0], Document.Selection.GetSelectedObjects()), action);
            }

            Document.PerformAction("Create " + BrushManager.CurrentBrush.Name.ToLower(), action);
        }
Exemple #3
0
        private void CreateEntity(Coordinate origin)
        {
            var gd = Editor.Instance.GetSelectedEntity();
            if (gd == null) return;

            var col = gd.Behaviours.Where(x => x.Name == "color").ToArray();
            var colour = col.Any() ? col[0].GetColour(0) : Colour.GetDefaultEntityColour();

            var entity = new Entity(Document.Map.IDGenerator.GetNextObjectID())
            {
                EntityData = new EntityData(gd),
                ClassName = gd.Name,
                Colour = colour,
                Origin = origin
            };

            IAction action = new Create(entity);
            if (Select.SelectCreatedEntity)
            {
                entity.IsSelected = true;
                if (Select.DeselectOthersWhenSelectingCreation)
                {
                    action = new ActionCollection(new ChangeSelection(new MapObject[0], Document.Selection.GetSelectedObjects()), action);
                }
            }

            Document.PerformAction("Create entity: " + gd.Name, action);
            if (Select.SwitchToSelectAfterEntity)
            {
                Mediator.Publish(HotkeysMediator.SwitchTool, HotkeyTool.Selection);
            }
        }