public EditShipTransfer(Player player, SpaceDockPanel spaceDock, Editor editor, EditorOptions editorOptions, World world, int material_Ship, Map map, ShipExtraArgs shipExtra) { _player = player; _spaceDock = spaceDock; _editor = editor; _editorOptions = editorOptions; _world = world; _material_Ship = material_Ship; _map = map; _shipExtra = shipExtra; }
private static ShipDNA GetDNAFromEditor(Editor editor) { // Get dna from editor string name; List<string> layerNames; SortedList<int, List<DesignPart>> partsByLayer; editor.GetDesign(out name, out layerNames, out partsByLayer); // Create ship dna ShipDNA retVal = new ShipDNA() { ShipName = name, LayerNames = layerNames, PartsByLayer = new SortedList<int, List<ShipPartDNA>>(), }; foreach (int layerIndex in partsByLayer.Keys) { retVal.PartsByLayer.Add(layerIndex, partsByLayer[layerIndex].Select(o => o.Part3D.GetDNA()).ToList()); } return retVal; }
private void ShowShipEditor() { // Spacedock is currently showing. Need to keep it alive, but change out panels SaveSession(false, false); // the editor can be unstable, so this is a good spot to save if (_shipEditor == null) { #region instantiate _shipEditor StackPanel panel = new StackPanel() { Orientation = Orientation.Horizontal, }; //TODO: Make Ok, Cancel, Apply instead Button button = new Button() { FontSize = 20, FontWeight = FontWeights.Bold, Padding = new Thickness(12, 4, 12, 4), Content = "Close", }; button.Click += CloseShipEditor_Click; panel.Children.Add(button); _shipEditorManagementControl = panel; _shipEditor = new Editor(); var resouceDict = new ResourceDictionary() { Source = new Uri("/Game.Newt.v2.AsteroidMiner;component/AstMin2D/Stylesheet.xaml", UriKind.RelativeOrAbsolute), }; _shipEditorBorder = new Border() { Style = resouceDict["dialogBorder"] as Style, Child = _shipEditor, }; #endregion } _editShipTransfer = new EditShipTransfer(_player, _spaceDockPanel, _shipEditor, _editorOptions, _world, _material_Ship, _map, _shipExtra); _editShipTransfer.EditShip(this.Title, _shipEditorManagementControl); //TODO: Uncomment to see contents of view model //TabDebugWindow debugWindow = new TabDebugWindow(_shipEditor.TabControl_DEBUG); //debugWindow.Owner = this; ////debugWindow.Top = this.Top + this.ActualHeight - 200; ////debugWindow.Left = this.Left + this.ActualWidth - 200; //debugWindow.Show(); panelContainer.Child = _shipEditorBorder; }