public LevelSetsPage(IEditor <CampaignFile> editor) { this.editor = editor; tabs = new ExtendedTabControl(); tabs.AddPage("Properties", properties = new LevelSetsPropertiesView(this.editor), scrollable: true); tabs.AddPage("Levels", levels = new LevelSetsPlaylistView(editor), scrollable: false); TableRow row = new TableRow() { Cells = { new TableCell(listBox = new ReorderableListBox()), new TableCell(tabs), } }; Rows.Add(row); listBox.SelectedKeyChanged += SelectPlaylist; listBox.ItemsReordered += (_, __) => this.editor.Modified = true; listBox.RemoveItem += RemovePlaylist; listBox.AddItem += AddPlaylist; properties.OnModified += PropertiesModified; levels.OnModified += PlaylistLevelsModified; }
public LevelPropertiesWindow(IEditor <CampaignFile> editor, CampaignLevel level) { this.editor = editor; Data = level.CloneObject() ?? new CampaignLevel() { Guid = Guid.NewGuid().ToString() }; Title = $"{(Equals(level, null) ? "Add" : "Edit")} level"; Size = MinimumSize = new Size(600, 400); Padding = new Padding(8); Resizable = true; Content = new StackLayout() { Style = "vertical", Spacing = 8, Items = { new StackLayoutItem(tabs = new ExtendedTabControl(), true), new StackLayoutItem(new StackLayout() { Style = "horizontal", Spacing = 8, Padding = new Padding(0, 8,0, 0), Items = { null, (DefaultButton = new Button(OnConfirm) { Text = "OK", Image = Resources.GetIcon("CheckGreen.ico", 16) }), (AbortButton = new Button(OnCancel) { Text = "Cancel", Image = Resources.GetIcon("CloseRed.ico", 16) }) } }, false) } }; #region General Tab tabs.AddPage("General", generalProperties = new DynamicLayout()); generalProperties.BeginScrollable(BorderType.None); generalProperties.BeginVertical(); generalProperties.AddRow("Unique ID", propLevelGuid = new GuidLabel()); generalProperties.AddRow("Level file", propLevelFile = new ResourceSelector(editor, ResourceType.Level)); generalProperties.AddRow("Level name", propLevelName = new TextBox()); generalProperties.EndVertical(); generalProperties.AddSpace(); generalProperties.EndScrollable(); #endregion //tabs.AddPage("Gameplay", gameplayProperties = new DynamicLayout()); #region Loading Screen Tab tabs.AddPage("Loading screen", loadingScreenProperties = new DynamicLayout()); loadingScreenProperties.BeginScrollable(BorderType.None); loadingScreenProperties.BeginVertical(); loadingScreenProperties.AddRow("Background image", propLoadingBackground = new ResourceSelector(editor, ResourceType.Texture)); loadingScreenProperties.AddRow(string.Empty, new StackLayout() { Style = "no-padding horizontal", Items = { (propLoadingBackgroundPreview = new StretchedImageBox() { Width =160, Height = 90 }), null } }); loadingScreenProperties.AddRow("Overwrite loading text", propLoadingOverwriteText = new BooleanSelector()); loadingScreenProperties.AddRow("Loading text", propLoadingText = new TextBox()); loadingScreenProperties.AddRow("Progress indicator icon", propLoadingBackgroundIcon = new ResourceSelector(editor, ResourceType.Texture)); loadingScreenProperties.AddRow(string.Empty, new StackLayout() { Style = "no-padding horizontal", Items = { (propLoadingBackgroundIconPreview = new StretchedImageBox() { Width =64, Height = 64 }), null } }); loadingScreenProperties.EndVertical(); loadingScreenProperties.AddSpace(); loadingScreenProperties.EndScrollable(); #endregion #region Intro Sequence Tab tabs.AddPage("Intro sequence", introSequenceProperties = new DynamicLayout()); introSequenceProperties.BeginScrollable(BorderType.None); introSequenceProperties.BeginVertical(); // Set whether or not to show the intro, the intro style and text values introSequenceProperties.AddRow("Intro type", propIntroType = new EnumDropDown <LevelTransitionType>()); introSequenceProperties.AddRow("First line", propIntroLine1 = new TextBox()); introSequenceProperties.AddRow("Second line", propIntroLine2 = new TextBox()); introSequenceProperties.EndVertical(); introSequenceProperties.AddSpace(); introSequenceProperties.EndScrollable(); #endregion #region Event Subscribing propLoadingOverwriteText.ValueChanged += OnOverwriteLoadingTextChanged; propIntroType.SelectedValueChanged += OnTransitionTypeChanged; propLoadingBackground.ResourceSelected += OnBackgroundSelected; propLoadingBackgroundIcon.ResourceSelected += OnLoadingIconSelected; #endregion LoadData(Data); }