public LevelSetsPropertiesView(IEditor <CampaignFile> editor_) { editor = editor_; Style = "vertical"; properties = new PropertiesListBase(); properties.AddRow("Name", nameBox = new TextBox()); properties.AddRow("Description", descriptionBox = new TextBox()); properties.AddRow("Icon", iconBox = new ResourceSelector(editor, ResourceType.Texture)); properties.AddRow(null, new StackLayout() { Style = "no-padding horizontal", Items = { (iconPreview = new StretchedImageBox() { Height = 96, Width = 96, }), null } }); properties.AddRow("Campaign playlist", campaignDisplayBox = new BooleanSelector()); properties.AddRow("Sprint playlist", sprintDisplayBox = new BooleanSelector()); properties.AddRow("Unique ID", guidBox = new GuidLabel()); //properties.AddRow("Playlist locking", new EnumDropDown<PlaylistUnlock>()); //properties.AddRow("Individual level locking", new EnumDropDown<LevelUnlock>()); //properties.AddRow("Difficulty rating", new EnumDropDown<Difficulty>()); properties.CompleteRows(); Items.Add(new StackLayoutItem(properties) { Expand = false }); nameBox.TextChanged += NotifyModified; descriptionBox.TextChanged += NotifyModified; iconBox.ResourceSelected += NotifyModified; iconBox.ResourceSelected += IconSelected; guidBox.TextChanged += NotifyModified; sprintDisplayBox.ValueChanged += NotifyModified; campaignDisplayBox.ValueChanged += NotifyModified; }
public LevelSetsPlaylistView(IEditor <CampaignFile> editor) { this.editor = editor; collection = new ObservableCollection <CampaignLevel>(); Style = "no-padding vertical"; Spacing = 0; Items.Add(new StackLayoutItem(new StackLayout() { Spacing = 0, Style = "no-padding horizontal", Items = { null, (addButton = new Button(AddLevel) { Style = "icon", Image = Resources.GetIcon("AddGreen.ico", 16) }), (editButton = new Button(EditLevel) { Style = "icon", Image = Resources.GetIcon("Pencil.ico", 16), Enabled = false }), (removeButton = new Button(RemoveLevel) { Style = "icon", Image = Resources.GetIcon("CloseRed.ico",16), Enabled = false }), (moveUpButton = new Button(MoveLevelUp) { Style = "icon", Image = Resources.GetIcon("UpBlue.ico", 16), Enabled = false }), (moveDownButton = new Button(MoveLevelDown) { Style = "icon", Image = Resources.GetIcon("DownBlue.ico",16), Enabled = false }), null } }, false)); Items.Add(new StackLayoutItem(levelList = new GridView <CampaignLevel>() { GridLines = GridLines.Both, Columns = { new GridColumn() { HeaderText = string.Empty, Editable = false, Sortable = false, Resizable = false, Width = 20, DataCell = new TextBoxCell() { Binding = Binding.Property <CampaignLevel, string>(lvl => $"{collection.IndexOf(lvl) + 1}") } }, new GridColumn() { HeaderText = "Level name", Editable = false, Sortable = false, Resizable = true, Width = 190, DataCell = new TextBoxCell() { Binding = Binding.Property <CampaignLevel, string>(lvl => $"{lvl.Name}") } }, new GridColumn() { HeaderText = "Title", Editable = false, Sortable = false, Resizable = true, Width = 190, DataCell = new TextBoxCell() { Binding = Binding.Property <CampaignLevel, string>(lvl => $"{lvl.Title}") } } }, ContextMenu = new ContextMenu ( addMenuButton = new ButtonMenuItem(AddLevel) { Image = Resources.GetIcon("AddGreen.ico"), Text = "Add new level to playlist" }, editMenuButton = new ButtonMenuItem(EditLevel) { Image = Resources.GetIcon("Pencil.ico"), Text = "Edit level information" }, removeMenuButton = new ButtonMenuItem(RemoveLevel) { Image = Resources.GetIcon("CloseRed.ico"), Text = "Remove level from playlist" }, new SeparatorMenuItem(), moveUpMenuButton = new ButtonMenuItem(MoveLevelUp) { Image = Resources.GetIcon("UpBlue.ico"), Text = "Move level up" }, moveDownMenuButton = new ButtonMenuItem(MoveLevelDown) { Image = Resources.GetIcon("DownBlue.ico"), Text = "Move level down" } ) }, true)); Items.Add(new StackLayoutItem(new StackLayout() { Spacing = 0, Style = "no-padding horizontal", BackgroundColor = Color.FromArgb(48, 48, 48), Height = THUMBNAIL_HEIGHT_SMALL, Items = { new StackLayoutItem(selectionThumbnail = new StretchedImageBox() { Image = Resources.GetImage("NoLevelImageFound.png"), Width = THUMBNAIL_WIDTH_SMALL, Height = THUMBNAIL_HEIGHT_SMALL }, false), new StackLayoutItem(new StackLayout() { Style = "vertical", HorizontalContentAlignment = HorizontalAlignment.Left, Spacing = 4, Padding = new Padding(18), Items = { (selectionHeader = new Label() { TextColor = Colors.White, Font = new Font(FontFamilies.Sans, 12, FontStyle.Bold) }), (selectionText = new Label() { TextColor = Colors.White, Font = new Font(FontFamilies.Sans, 10, FontStyle.None) }) } }, true) } }, false)); levelList.DataStore = collection; levelList.CellDoubleClick += EditLevel; levelList.SelectionChanged += SelectionChanged; OnModified += (sender, e) => editor.Modified = true; }
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); }