示例#1
0
 public override void AddPart(PartToolItemBase part2D, PartDesignBase part3D)
 {
     if (part3D != null)
     {
         AddToTab(part3D);
     }
 }
示例#2
0
 public ImpulseEngineToolItem(EditorOptions options, ImpulseEngineType engineType)
     : base(options)
 {
     _engineType = engineType;
     TabName     = PartToolItemBase.TAB_SHIPPART;
     _visual2D   = PartToolItemBase.GetVisual2D(Name, Description, options, this);
 }
示例#3
0
 public ConverterRadiationToEnergyToolItem(EditorOptions options, SolarPanelShape shape)
     : base(options)
 {
     this.Shape   = shape;
     this.TabName = PartToolItemBase.TAB_SHIPPART;
     _visual2D    = PartToolItemBase.GetVisual2D(this.Name, this.Description, options, this);
 }
示例#4
0
        public override void RemovePart(PartToolItemBase part2D, PartDesignBase part3D)
        {
            if (part3D != null)
            {
                RemoveFromTab(part3D);

                this.PreviousRemoved.Add(Tuple.Create(part3D.Token, DateTime.UtcNow));
            }
        }
示例#5
0
 public SensorNetForceToolItem(EditorOptions options)
     : base(options)
 {
     this.TabName = PartToolItemBase.TAB_SHIPPART;
     _visual2D    = PartToolItemBase.GetVisual2D(this.Name, this.Description, options, this);
 }
示例#6
0
 public CameraColorRGBToolItem(EditorOptions options)
     : base(options)
 {
     this.TabName = PartToolItemBase.TAB_SHIPPART;
     _visual2D    = PartToolItemBase.GetVisual2D(this.Name, this.Description, options, this);
 }
示例#7
0
 public ConverterEnergyToFuelToolItem(EditorOptions options)
     : base(options)
 {
     this.TabName = PartToolItemBase.TAB_SHIPPART;
     _visual2D    = PartToolItemBase.GetVisual2D(this.Name, this.Description, options, this);
 }
示例#8
0
 public BrainNEATToolItem(EditorOptions options)
     : base(options)
 {
     TabName   = PartToolItemBase.TAB_SHIPPART;
     _visual2D = PartToolItemBase.GetVisual2D(Name, Description, options, this);
 }
示例#9
0
 public DirectionControllerSphereToolItem(EditorOptions options)
     : base(options)
 {
     this.TabName = PartToolItemBase.TAB_SHIPPART;
     _visual2D    = PartToolItemBase.GetVisual2D(this.Name, this.Description, options, this);
 }
示例#10
0
        private DesignPart CreateDesignPart(ShipPartDNA dna)
        {
            #region Find ToolItem

            // Find the corresponding tool item
            List <PartToolItemBase> toolItems = _partToolItems.Where(o => o.PartType == dna.PartType).ToList();
            if (toolItems.Count == 0)
            {
                throw new ApplicationException("Couldn't find the tool item for \"" + dna.PartType + "\"");
            }

            // Narrow down to one
            PartToolItemBase toolItem = null;
            if (toolItems.Count == 1)           // if there's more than one, then it needs to be further filtered
            {
                toolItem = toolItems[0];
            }
            else if (dna.PartType == ConverterRadiationToEnergy.PARTTYPE)
            {
                #region ConverterRadiationToEnergy

                ConverterRadiationToEnergyDNA dnaCast = (ConverterRadiationToEnergyDNA)dna;

                List <PartToolItemBase> additionalFilter = toolItems.Where(o => ((ConverterRadiationToEnergyToolItem)o).Shape == dnaCast.Shape).ToList();
                if (additionalFilter.Count == 1)
                {
                    toolItem = additionalFilter[0];
                }

                #endregion
            }
            else if (dna.PartType == Thruster.PARTTYPE)
            {
                #region Thruster

                ThrusterDNA dnaCast = (ThrusterDNA)dna;
                if (dnaCast.ThrusterType == ThrusterType.Custom)
                {
                    // Make a new one with the dna's directions
                    toolItem = new ThrusterToolItem(editor1.Options, dnaCast.ThrusterDirections, "Custom");
                }
                else
                {
                    List <PartToolItemBase> additionalFilter = toolItems.Where(o => ((ThrusterToolItem)o).ThrusterType == dnaCast.ThrusterType).ToList();
                    if (additionalFilter.Count == 1)
                    {
                        toolItem = additionalFilter[0];
                    }
                }

                #endregion
            }
            else
            {
                throw new ApplicationException("Should have only found one tool item for this part type: " + dna.PartType);
            }

            if (toolItem == null)
            {
                throw new ApplicationException("Couldn't find the tool item for this part type: " + dna.PartType);
            }

            #endregion

            DesignPart retVal = new DesignPart(editor1.Options);
            retVal.Part2D = toolItem;

            retVal.Part3D = toolItem.GetNewDesignPart();
            retVal.Part3D.SetDNA(dna);

            ModelVisual3D visual = new ModelVisual3D();
            visual.Content = retVal.Part3D.Model;
            retVal.Model   = visual;

            return(retVal);
        }
示例#11
0
 public TabControlParts_DragItem(PartDesignBase part3D, PartToolItemBase part2D = null, Action <TabControlParts_DragItem> dropped = null)
 {
     this.Part2D = part2D;
     this.Part3D = part3D;
     _dropped    = dropped;
 }
示例#12
0
 /// <summary>
 /// This would get called if the user deleted a part, then later hit undo.  That part needs to be removed from the tab control again
 /// </summary>
 public virtual void RemovePart(PartToolItemBase part2D, PartDesignBase part3D)
 {
 }
 public TabControlParts_DragItem(PartDesignBase part3D, PartToolItemBase part2D = null, Action<TabControlParts_DragItem> dropped = null)
 {
     this.Part2D = part2D;
     this.Part3D = part3D;
     _dropped = dropped;
 }
        public override void RemovePart(PartToolItemBase part2D, PartDesignBase part3D)
        {
            if (part3D != null)
            {
                RemoveFromTab(part3D);

                this.PreviousRemoved.Add(Tuple.Create(part3D.Token, DateTime.UtcNow));
            }
        }
 public override void AddPart(PartToolItemBase part2D, PartDesignBase part3D)
 {
     if (part3D != null)
     {
         AddToTab(part3D);
     }
 }
 /// <summary>
 /// This would get called if the user deleted a part, then later hit undo.  That part needs to be removed from the tab control again
 /// </summary>
 public virtual void RemovePart(PartToolItemBase part2D, PartDesignBase part3D)
 {
 }
示例#17
0
 public SensorArcbotWeaponToolItem(EditorOptions options)
     : base(options)
 {
     TabName   = PartToolItemBase.TAB_SHIPPART;
     _visual2D = PartToolItemBase.GetVisual2D(Name, Description, options, this);
 }