コード例 #1
0
        public override void Set(object item, Entity ent)
        {
            base.Set(item, ent);
            Ship = ent as StarShip;

            if (Ship == null)
                return;

            SizeClassList.SelectedItem = Ship.SizeClass;

            if (Ship.OwnerFaction == UInt64.MaxValue)
                FactionID.Value = -1;
            else
                FactionID.Value = (decimal)Ship.OwnerFaction;
        }
コード例 #2
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (DocDirty)
                saveToolStripMenuItem_Click(this, EventArgs.Empty);

            DocDirty = false;

            EntityTypeSelector selector = new EntityTypeSelector();
            if (selector.ShowDialog(this) == DialogResult.OK)
            {
                DocumentFile = null;
                if (selector.IsShip)
                {
                    TheEntity = new StarShip();
                }
                else
                {
                    if (selector.CelestialCategory == CelestialObject.Categories.PlanetaryBody)
                        TheEntity = new Planet();
                    else
                    {
                        TheEntity = new CelestialObject();
                        (TheEntity as CelestialObject).Category = selector.CelestialCategory;
                    }
                }

                TheEntity.Name = selector.EntityName;
                EntityChanged();
            }
        }