public ConnectionWidget(IContainer Parent) : base(Parent) { Font f = Font.Get("Fonts/Ubuntu-B", 14); MapLabel = new Label(this); MapLabel.SetPosition(12, 6); MapLabel.SetText("Map"); MapLabel.SetFont(f); XLabel = new Label(this); XLabel.SetPosition(15, 60); XLabel.SetText("X"); XLabel.SetFont(f); YLabel = new Label(this); YLabel.SetPosition(94, 60); YLabel.SetText("Y"); YLabel.SetFont(f); MapBox = new BrowserBox(this); MapBox.SetPosition(23, 27); MapBox.SetSize(145, 25); MapBox.SetFont(f); MapBox.SetReadOnly(true); XBox = new NumericBox(this); XBox.SetPosition(24, 79); XBox.SetSize(66, 27); XBox.OnValueChanged += delegate(BaseEventArgs e) { if (Initialized) { SetOffset(XBox.Value, YBox.Value); } }; YBox = new NumericBox(this); YBox.SetPosition(101, 79); YBox.SetSize(66, 27); YBox.OnValueChanged += delegate(BaseEventArgs e) { if (Initialized) { SetOffset(XBox.Value, YBox.Value); } }; ExitButton = new ExitButton(this); ExitButton.SetPosition(250, 7); ExitButton.SetSize(16, 16); Sprites["hover"] = new Sprite(this.Viewport, new SolidBitmap(2, 120, new Color(47, 160, 193))); Sprites["hover"].Visible = false; this.OnWidgetSelected += WidgetSelected; SetSize(272, 120); }
public MapPropertiesWindow(Map Map) { this.OldMap = Map; this.Map = Map.Clone(); this.SetTitle($"Map Properties - {Utilities.Digits(Map.ID, 3)}: {Map.DevName}"); MinimumSize = MaximumSize = new Size(540, 460); SetSize(MaximumSize); this.Center(); Label settings = new Label(this); settings.SetText("Info"); settings.SetFont(Font.Get("Fonts/Ubuntu-B", 14)); settings.SetPosition(12, 26); GroupBox box1 = new GroupBox(this); box1.SetPosition(19, 47); box1.SetSize(450, 203); Font f = Font.Get("Fonts/ProductSans-M", 12); Label namelabel = new Label(box1); namelabel.SetText("Working Name:"); namelabel.SetFont(f); namelabel.SetPosition(7, 6); MapName = new TextBox(box1); MapName.SetPosition(6, 22); MapName.SetSize(136, 27); MapName.SetInitialText(Map.DevName); MapName.OnTextChanged += delegate(BaseEventArgs e) { this.Map.DevName = MapName.Text; }; Label displaynamelabel = new Label(box1); displaynamelabel.SetText("In-game Name:"); displaynamelabel.SetFont(f); displaynamelabel.SetPosition(7, 52); DisplayName = new TextBox(box1); DisplayName.SetPosition(6, 68); DisplayName.SetSize(136, 27); DisplayName.SetInitialText(Map.DisplayName); DisplayName.OnTextChanged += delegate(BaseEventArgs e) { this.Map.DisplayName = DisplayName.Text; }; Label widthlabel = new Label(box1); widthlabel.SetText("Width:"); widthlabel.SetFont(f); widthlabel.SetPosition(7, 99); Width = new NumericBox(box1); Width.SetPosition(6, 115); Width.MinValue = 1; Width.MaxValue = 255; Width.SetSize(66, 27); Width.SetValue(this.Map.Width); Width.OnValueChanged += delegate(BaseEventArgs e) { this.Map.Width = Width.Value; }; Label heightlabel = new Label(box1); heightlabel.SetText("Height:"); heightlabel.SetFont(f); heightlabel.SetPosition(78, 99); Height = new NumericBox(box1); Height.SetPosition(77, 115); Height.MinValue = 1; Height.MaxValue = 255; Height.SetSize(66, 27); Height.SetValue(this.Map.Height); Height.OnValueChanged += delegate(BaseEventArgs e) { this.Map.Height = Height.Value; }; Tilesets = new ListBox(box1); Tilesets.SetPosition(162, 22); List <ListItem> tilesetitems = new List <ListItem>(); for (int i = 0; i < this.Map.TilesetIDs.Count; i++) { int id = this.Map.TilesetIDs[i]; Tileset tileset = Data.Tilesets[id]; tilesetitems.Add(new ListItem(tileset)); } Tilesets.SetItems(tilesetitems); Tilesets.SetButtonText("Add Tileset"); Tilesets.ListDrawer.OnButtonClicked += AddTileset; Autotiles = new ListBox(box1); Autotiles.SetPosition(312, 22); List <ListItem> autotileitems = new List <ListItem>(); for (int i = 0; i < this.Map.AutotileIDs.Count; i++) { int id = this.Map.AutotileIDs[i]; Autotile autotile = Data.Autotiles[id]; autotileitems.Add(new ListItem(autotile)); } Autotiles.SetItems(autotileitems); Autotiles.SetButtonText("Add Autotile"); Autotiles.ListDrawer.OnButtonClicked += AddAutotile; Label tilesetslabel = new Label(box1); tilesetslabel.SetText("Tilesets:"); tilesetslabel.SetFont(f); tilesetslabel.SetPosition(163, 6); Label autotileslabel = new Label(box1); autotileslabel.SetText("Autotiles:"); autotileslabel.SetFont(f); autotileslabel.SetPosition(313, 6); CreateButton("Cancel", Cancel); CreateButton("OK", OK); }
public EditEvent(Map map, Event ev, bool NewEvent = false) { this.MapData = map; this.OldEvent = ev; this.EventData = ev.Clone(); SetTitle($"{(NewEvent ? "New" : "Edit")} event (ID: {Utilities.Digits(EventData.ID, 3)})"); MinimumSize = MaximumSize = new Size(752, 690); SetSize(MaximumSize); Center(); EventGroupBox MainPropertyBox = new EventGroupBox(this); MainPropertyBox.SetPosition(8, 25); MainPropertyBox.SetSize(232, 72); Font f = new Font("Fonts/ProductSans-M", 12); Label NameLabel = new Label(MainPropertyBox); NameLabel.SetFont(f); NameLabel.SetText("Name:"); NameLabel.SetPosition(8, 12); TextBox NameBox = new TextBox(MainPropertyBox); NameBox.SetPosition(46, 7); NameBox.TextArea.SetTextY(2); NameBox.TextArea.SetCaretY(4); NameBox.SetSize(180, 27); NameBox.SetInitialText(EventData.Name); NameBox.OnTextChanged += delegate(BaseEventArgs e) { EventData.Name = NameBox.Text; MarkChanges(); }; Label WidthLabel = new Label(MainPropertyBox); WidthLabel.SetFont(f); WidthLabel.SetText("Width:"); WidthLabel.SetPosition(6, 44); NumericBox WidthBox = new NumericBox(MainPropertyBox); WidthBox.SetPosition(46, 38); WidthBox.SetSize(63, 27); WidthBox.MinValue = 1; WidthBox.MaxValue = 999; WidthBox.SetValue(EventData.Width); WidthBox.OnValueChanged += delegate(BaseEventArgs e) { EventData.Width = WidthBox.Value; TabController.Tabs.ForEach(tc => ((EventPageContainer)tc.Widgets[0]).GraphicWidget.ConfigureGrid()); MarkChanges(); }; Label HeightLabel = new Label(MainPropertyBox); HeightLabel.SetFont(f); HeightLabel.SetText("Height:"); HeightLabel.SetPosition(119, 44); NumericBox HeightBox = new NumericBox(MainPropertyBox); HeightBox.SetPosition(163, 38); HeightBox.SetSize(63, 27); HeightBox.MinValue = 1; HeightBox.MaxValue = 999; HeightBox.SetValue(EventData.Height); HeightBox.OnValueChanged += delegate(BaseEventArgs e) { EventData.Height = HeightBox.Value; MarkChanges(); }; Button NewPageButton = new Button(this); NewPageButton.SetPosition(414, 43); NewPageButton.SetSize(67, 59); NewPageButton.SetText("New\nPage"); NewPageButton.OnClicked += delegate(BaseEventArgs e) { NewPage(); }; Button CopyPageButton = new Button(this); CopyPageButton.SetPosition(481, 43); CopyPageButton.SetSize(67, 59); CopyPageButton.SetText("Copy\nPage"); CopyPageButton.OnClicked += delegate(BaseEventArgs e) { CopyPage(); }; Button PastePageButton = new Button(this); PastePageButton.SetPosition(548, 43); PastePageButton.SetSize(67, 59); PastePageButton.SetText("Paste\nPage"); PastePageButton.OnClicked += delegate(BaseEventArgs e) { PastePage(); }; Button ClearPageButton = new Button(this); ClearPageButton.SetPosition(615, 43); ClearPageButton.SetSize(67, 59); ClearPageButton.SetText("Clear\nPage"); ClearPageButton.OnClicked += delegate(BaseEventArgs e) { ClearPage(); }; DeletePageButton = new Button(this); DeletePageButton.SetPosition(682, 43); DeletePageButton.SetSize(67, 59); DeletePageButton.SetText("Delete\nPage"); if (EventData.Pages.Count == 1) { DeletePageButton.SetEnabled(false); } DeletePageButton.OnClicked += delegate(BaseEventArgs e) { DeletePage(); }; TabController = new TabView(this); TabController.SetXOffset(8); TabController.SetPosition(1, 106); TabController.SetSize(750, 544); TabController.SetHeaderColor(59, 91, 124); for (int i = 0; i < EventData.Pages.Count; i++) { TabContainer tc = TabController.CreateTab(string.IsNullOrWhiteSpace(EventData.Pages[i].Name) ? "Untitled" : EventData.Pages[i].Name); EventPageContainer epc = new EventPageContainer(this, EventData, EventData.Pages[i], tc); epc.SetSize(750, 515); EventPageContainers.Add(epc); } CreateButton("Apply", Apply); CreateButton("Cancel", Cancel); CreateButton("OK", OK); ApplyButton.SetEnabled(false); }
public GameVariablePicker(int GroupID, int VariableID) : base() { this.GroupID = GroupID; this.VariableID = VariableID; MinimumSize = MaximumSize = new Size(361, 409); SetTitle("Choose Game Variable"); SetSize(MaximumSize); Center(); CategoryLabel = new Label(this); CategoryLabel.SetPosition(10, 28); CategoryLabel.SetText("Categories"); CategoryLabel.SetFont(Font.Get("Fonts/Ubuntu-B", 14)); VariableLabel = new Label(this); VariableLabel.SetPosition(194, 28); VariableLabel.SetText("Variables"); VariableLabel.SetFont(Font.Get("Fonts/Ubuntu-B", 14)); GroupBox = new ListBox(this); GroupBox.SetPosition(6, 48); GroupBox.SetSize(167, 254); RedrawGroupBox(); GroupBox.OnSelectionChanged += delegate(BaseEventArgs e) { GroupNameBox.SetInitialText(Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].Name ?? ""); RedrawVariableBox(); VariableBox.SetSelectedIndex(0, true); VariableBox.MainContainer.VScrollBar.SetValue(0); }; VariableBox = new ListBox(this); VariableBox.SetPosition(185, 48); VariableBox.SetSize(167, 254); VariableBox.OnSelectionChanged += delegate(BaseEventArgs e) { VariableNameBox.SetInitialText(Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].Variables[VariableBox.SelectedIndex].Name ?? ""); }; VariableBox.OnDoubleClicked += delegate(BaseEventArgs e) { this.VariableID = VariableBox.SelectedIndex + 1; OK(new BaseEventArgs()); }; GroupNameLabel = new Label(this); GroupNameLabel.SetPosition(9, 311); GroupNameLabel.SetText("Name:"); GroupNameLabel.SetFont(Font.Get("Fonts/ProductSans-M", 12)); GroupNameBox = new TextBox(this); GroupNameBox.SetPosition(56, 307); GroupNameBox.SetSize(117, 27); GroupNameBox.OnTextChanged += delegate(BaseEventArgs e) { Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].Name = GroupNameBox.Text; GroupBox.Redraw(); }; VariableNameLabel = new Label(this); VariableNameLabel.SetPosition(193, 311); VariableNameLabel.SetText("Name:"); VariableNameLabel.SetFont(Font.Get("Fonts/ProductSans-M", 12)); VariableNameBox = new TextBox(this); VariableNameBox.SetPosition(235, 307); VariableNameBox.SetSize(117, 27); VariableNameBox.OnTextChanged += delegate(BaseEventArgs e) { Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].Variables[VariableBox.SelectedIndex].Name = VariableNameBox.Text; VariableBox.Redraw(); }; ChangeMaxGroups = new Button(this); ChangeMaxGroups.SetPosition(9, 340); ChangeMaxGroups.SetSize(163, 29); ChangeMaxGroups.SetText("Change Maximum"); ChangeMaxGroups.OnClicked += delegate(BaseEventArgs e) { PopupWindow win = new PopupWindow(); win.SetSize(270, 125); win.SetTitle("Set Variable Group capacity"); Label label = new Label(win); label.SetText("Set the maximum available number of groups."); label.SetPosition(5, 35); Label label2 = new Label(win); label2.SetText("Capacity:"); label2.SetPosition(75, 60); NumericBox num = new NumericBox(win); num.SetSize(66, 27); num.SetPosition(130, 55); num.SetValue(Editor.ProjectSettings.VariableGroupCapacity); num.MinValue = 1; win.CreateButton("Cancel", delegate(BaseEventArgs e) { win.Close(); }); win.CreateButton("OK", delegate(BaseEventArgs e) { int NewValue = num.Value; if (NewValue == Editor.ProjectSettings.VariableGroupCapacity) { win.Close(); return; } else if (NewValue > Editor.ProjectSettings.VariableGroupCapacity) { int Extra = NewValue - Editor.ProjectSettings.VariableGroupCapacity; for (int i = 0; i < Extra; i++) { Editor.ProjectSettings.Variables.Add(new GameVariableGroup() { ID = Editor.ProjectSettings.Variables.Count + 1 }); } Editor.ProjectSettings.VariableGroupCapacity = NewValue; RedrawGroupBox(); win.Close(); } else { int Lost = Editor.ProjectSettings.VariableGroupCapacity - NewValue; MessageBox box = new MessageBox("Warning", $"By resizing the Variable Group capacity from {Editor.ProjectSettings.VariableGroupCapacity} to {NewValue}, {Lost} entries will be removed.\n" + "This may cause unforeseen problems if Game Variables from these groups are still in use.\n" + "Would you like to proceed and delete these Variable Groups?", ButtonType.YesNoCancel, IconType.Warning); box.OnButtonPressed += delegate(BaseEventArgs e) { if (box.Result == 0) // Yes -> resize Switch Group capacity and delete Switch Groups { for (int i = Editor.ProjectSettings.Variables.Count - 1; i >= 0; i--) { if (i == NewValue) { break; } Editor.ProjectSettings.Variables[i] = null; } Editor.ProjectSettings.Variables.RemoveRange(NewValue, Lost); Editor.ProjectSettings.VariableGroupCapacity = NewValue; RedrawGroupBox(); win.Close(); } else // No, cancel -> do nothing { win.Close(); } }; } }); win.Center(); }; ChangeMaxVariables = new Button(this); ChangeMaxVariables.SetPosition(188, 340); ChangeMaxVariables.SetSize(163, 29); ChangeMaxVariables.SetText("Change Maximum"); ChangeMaxVariables.OnClicked += delegate(BaseEventArgs e) { PopupWindow win = new PopupWindow(); win.SetSize(270, 125); win.SetTitle("Set Variable capacity"); Label label = new Label(win); label.SetText("Set the maximum available number of variables."); label.SetPosition(5, 35); Label label2 = new Label(win); label2.SetText("Capacity:"); label2.SetPosition(75, 60); NumericBox num = new NumericBox(win); num.SetSize(66, 27); num.SetPosition(130, 55); num.SetValue(Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].VariableCapacity); num.MinValue = 1; win.CreateButton("Cancel", delegate(BaseEventArgs e) { win.Close(); }); win.CreateButton("OK", delegate(BaseEventArgs e) { int NewValue = num.Value; if (NewValue == Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].VariableCapacity) { win.Close(); return; } else if (NewValue > Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].VariableCapacity) { int Extra = NewValue - Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].VariableCapacity; for (int i = 0; i < Extra; i++) { Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].Variables.Add(new GameVariable() { ID = Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].Variables.Count + 1 }); } Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].VariableCapacity = NewValue; RedrawVariableBox(); win.Close(); } else { int Lost = Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].VariableCapacity - NewValue; MessageBox box = new MessageBox("Warning", $"By resizing the Variable capacity from {Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].VariableCapacity} to {NewValue}, {Lost} entries will be removed.\n" + "This may cause unforeseen problems if any of these Variables are still in use.\n" + "Would you like to proceed and delete these Variables?", ButtonType.YesNoCancel, IconType.Warning); box.OnButtonPressed += delegate(BaseEventArgs e) { if (box.Result == 0) // Yes -> resize Switch Group capacity and delete Switch Groups { for (int i = Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].Variables.Count - 1; i >= 0; i--) { if (i == NewValue) { break; } Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].Variables[i] = null; } Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].Variables.RemoveRange(NewValue, Lost); Editor.ProjectSettings.Variables[GroupBox.SelectedIndex].VariableCapacity = NewValue; RedrawVariableBox(); win.Close(); } else // No, cancel -> do nothing { win.Close(); } }; } }); win.Center(); }; GroupBox.SetSelectedIndex(this.GroupID - 1); VariableBox.SetSelectedIndex(this.VariableID - 1); CreateButton("Cancel", Cancel); CreateButton("OK", OK); }
public DatabaseDataList(IContainer Parent) : base(Parent) { Sprites["listbox"] = new Sprite(this.Viewport); Sprites["header"] = new Sprite(this.Viewport); Sprites["header"].X = 10; Sprites["header"].Y = 10; ListContainer = new Container(this); ListContainer.SetPosition(3, 44); ListContainer.VAutoScroll = true; VScrollBar vslist = new VScrollBar(this); vslist.SetPosition(187, 41); ListContainer.SetVScrollBar(vslist); DataList = new ListDrawer(ListContainer); List <ListItem> Tilesets = new List <ListItem>(); for (int i = 1; i < Game.Data.Tilesets.Count; i++) { Game.Tileset t = Game.Data.Tilesets[i]; Tilesets.Add(new ListItem($"{Utilities.Digits(i, 3)}: {t?.Name}", t)); } DataList.SetItems(Tilesets); DataList.OnSelectionChanged += delegate(BaseEventArgs e) { TilesetEditor.SetTileset(DataList.SelectedItem.Object as Game.Tileset, DataList.SelectedIndex + 1); }; ChangeAmountButton = new Button(this); ChangeAmountButton.SetSize(154, 37); ChangeAmountButton.SetText("Change Amount..."); ChangeAmountButton.OnClicked += delegate(BaseEventArgs e) { PopupWindow win = new PopupWindow(); win.SetSize(270, 125); win.SetTitle("Set tileset capacity"); Label label = new Label(win); label.SetText("Set the maximum available number of tilesets."); label.SetPosition(5, 35); Label label2 = new Label(win); label2.SetText("Capacity:"); label2.SetPosition(75, 60); NumericBox num = new NumericBox(win); num.SetSize(66, 27); num.SetPosition(130, 55); num.SetValue(Editor.ProjectSettings.TilesetCapacity); num.MinValue = 1; Button CancelButton = new Button(win); CancelButton.SetText("Cancel"); CancelButton.SetPosition(win.Size.Width - CancelButton.Size.Width - 5, win.Size.Height - CancelButton.Size.Height - 5); CancelButton.OnClicked += delegate(BaseEventArgs e) { win.Close(); }; Button OKButton = new Button(win); OKButton.SetText("OK"); OKButton.SetPosition(CancelButton.Position.X - OKButton.Size.Width, CancelButton.Position.Y); OKButton.OnClicked += delegate(BaseEventArgs e) { int NewValue = num.Value; if (NewValue == Editor.ProjectSettings.TilesetCapacity) { win.Close(); return; } else if (NewValue > Editor.ProjectSettings.TilesetCapacity) { int Extra = NewValue - Editor.ProjectSettings.TilesetCapacity; for (int i = 0; i < Extra; i++) { Game.Data.Tilesets.Add(null); } Editor.ProjectSettings.TilesetCapacity = NewValue; RefreshList(); win.Close(); } else { int Lost = Editor.ProjectSettings.TilesetCapacity - NewValue; int DefinedCount = 0; for (int i = Game.Data.Tilesets.Count - 1; i >= 0; i--) { if (i == NewValue) { break; } if (Game.Data.Tilesets[i] != null) { DefinedCount++; } } if (DefinedCount > 0) { MessageBox box = new MessageBox("Warning", $"By resizing the tileset capacity from {Editor.ProjectSettings.TilesetCapacity} to {NewValue}, {Lost} entries will be removed, " + $"of which {DefinedCount} {(DefinedCount == 1 ? "is a" : "are")} defined tileset{(DefinedCount == 1 ? "" : "s")}.\n" + "Would you like to proceed and delete these tilesets?", ButtonType.YesNoCancel, IconType.Warning); box.OnButtonPressed += delegate(BaseEventArgs e) { if (box.Result == 0) // Yes -> resize tileset capacity and delete tilesets { for (int i = Game.Data.Tilesets.Count - 1; i >= 0; i--) { if (i == NewValue) { break; } foreach (KeyValuePair <int, Game.Map> kvp in Game.Data.Maps) { if (kvp.Value.TilesetIDs.Contains(i)) { kvp.Value.RemoveTileset(i); } } if (Game.Data.Tilesets[i] != null) { Game.Data.Tilesets[i].TilesetBitmap.Dispose(); Game.Data.Tilesets[i].TilesetListBitmap.Dispose(); } Game.Data.Tilesets[i] = null; } Game.Data.Tilesets.RemoveRange(NewValue + 1, Lost); Editor.ProjectSettings.TilesetCapacity = NewValue; RefreshList(); win.Close(); } else // No, cancel -> do nothing { win.Close(); } }; } else { Game.Data.Tilesets.RemoveRange(NewValue + 1, Lost); Editor.ProjectSettings.TilesetCapacity = NewValue; RefreshList(); win.Close(); } } }; win.Center(); }; }
public ChooseGraphic(EventGraphic graphic) { this.OldGraphic = graphic; this.GraphicData = graphic.Clone(); SetTitle("Choose Graphic"); MinimumSize = MaximumSize = new Size(735, 421); SetSize(MaximumSize); Center(); Label GraphicLabel = new Label(this); GraphicLabel.SetFont(Font.Get("Fonts/Ubuntu-B", 16)); GraphicLabel.SetText("Current Graphic"); GraphicLabel.SetPosition(559, 35); Color outline = new Color(59, 91, 124); Color inline = new Color(17, 27, 38); Color filler = new Color(24, 38, 53); Sprites["gfxbox"] = new Sprite(this.Viewport); Sprites["gfxbox"].X = 542; Sprites["gfxbox"].Y = 59; Sprites["gfxbox"].Bitmap = new Bitmap(177, 177); Sprites["gfxbox"].Bitmap.Unlock(); Sprites["gfxbox"].Bitmap.DrawRect(0, 0, 177, 177, outline); Sprites["gfxbox"].Bitmap.DrawRect(1, 1, 175, 175, inline); Sprites["gfxbox"].Bitmap.FillRect(2, 2, 173, 173, filler); Sprites["gfxbox"].Bitmap.FillRect(163, 163, 13, 13, outline); Sprites["gfxbox"].Bitmap.DrawLine(162, 1, 162, 162, inline); Sprites["gfxbox"].Bitmap.DrawLine(163, 1, 163, 162, outline); Sprites["gfxbox"].Bitmap.DrawLine(164, 1, 164, 162, inline); Sprites["gfxbox"].Bitmap.DrawLine(165, 162, 174, 162, inline); Sprites["gfxbox"].Bitmap.DrawLine(1, 162, 162, 162, inline); Sprites["gfxbox"].Bitmap.DrawLine(1, 163, 162, 163, outline); Sprites["gfxbox"].Bitmap.DrawLine(1, 164, 162, 164, inline); Sprites["gfxbox"].Bitmap.DrawLine(162, 165, 162, 174, inline); Sprites["gfxbox"].Bitmap.Lock(); Container GraphicContainer = new Container(this); GraphicContainer.SetPosition(544, 61); GraphicContainer.SetSize(160, 160); GraphicContainer.HAutoScroll = true; GraphicContainer.VAutoScroll = true; VScrollBar vs = new VScrollBar(this); vs.SetPosition(708, 62); vs.SetSize(10, 158); GraphicContainer.SetVScrollBar(vs); HScrollBar hs = new HScrollBar(this); hs.SetPosition(545, 225); hs.SetSize(158, 10); GraphicContainer.SetHScrollBar(hs); Graphic = new PictureBox(GraphicContainer); Cursor = new CursorWidget(GraphicContainer); Cursor.ConsiderInAutoScrollCalculation = false; Font f = Font.Get("Fonts/ProductSans-M", 12); TypeLabel = new Label(this); TypeLabel.SetPosition(547, 244); TypeLabel.SetFont(f); TypeLabel.SetText("Type: File"); Label DirectionLabel = new Label(this); DirectionLabel.SetFont(f); DirectionLabel.SetText("Direction:"); DirectionLabel.SetPosition(547, 269); DirectionBox = new DropdownBox(this); DirectionBox.SetPosition(609, 263); DirectionBox.SetSize(110, 25); DirectionBox.SetItems(new List <ListItem>() { new ListItem("Down"), new ListItem("Left"), new ListItem("Right"), new ListItem("Up") }); DirectionBox.SetSelectedIndex(GraphicData.Direction / 2 - 1); DirectionBox.OnSelectionChanged += delegate(BaseEventArgs e) { GraphicData.Direction = (DirectionBox.SelectedIndex + 1) * 2; if (GraphicData.NumDirections == 1) { GraphicData.NumDirections = 4; NumDirectionsBox.SetSelectedIndex(1); } RedrawGraphic(); }; Label NumDirectionsLabel = new Label(this); NumDirectionsLabel.SetFont(f); NumDirectionsLabel.SetText("Number of Directions:"); NumDirectionsLabel.SetPosition(547, 308); NumDirectionsBox = new DropdownBox(this); NumDirectionsBox.SetPosition(679, 304); NumDirectionsBox.SetSize(40, 25); NumDirectionsBox.SetItems(new List <ListItem>() { new ListItem("1"), new ListItem("4") }); NumDirectionsBox.SetSelectedIndex(GraphicData.NumDirections == 1 ? 0 : 1); NumDirectionsBox.OnSelectionChanged += delegate(BaseEventArgs e) { GraphicData.NumDirections = NumDirectionsBox.SelectedIndex == 0 ? 1 : 4; RedrawGraphic(); }; Label NumFramesLabel = new Label(this); NumFramesLabel.SetFont(f); NumFramesLabel.SetText("Number of Frames:"); NumFramesLabel.SetPosition(547, 348); NumFramesBox = new NumericBox(this); NumFramesBox.SetPosition(669, 343); NumFramesBox.SetSize(50, 27); NumFramesBox.MinValue = 1; NumFramesBox.MaxValue = 999; NumFramesBox.SetValue(GraphicData.NumFrames); NumFramesBox.OnValueChanged += delegate(BaseEventArgs e) { GraphicData.NumFrames = NumFramesBox.Value; RedrawGraphic(); }; FileExplorer = new FileExplorer(this); FileExplorer.SetPosition(1, 24); FileExplorer.SetSize(529, 396); FileExplorer.SetBaseDirectory(Data.ProjectPath); FileExplorer.SetFileExtensions("png"); string dir = ""; if (GraphicData.Param != null) { List <string> dirs = ((string)GraphicData.Param).Split('/').ToList(); for (int i = 0; i < dirs.Count - 1; i++) { dir += dirs[i]; if (i != dirs.Count - 2) { dir += "/"; } } } else { dir = "gfx/characters"; } FileExplorer.SetDirectory(dir); FileExplorer.OnFileSelected += delegate(BaseEventArgs e) { string param = FileExplorer.SelectedFilename.Replace(Data.ProjectPath + "/", "").Replace(".png", ""); if (param != (string)this.GraphicData.Param) { this.GraphicData = new EventGraphic(); this.GraphicData.Type = ":file"; this.GraphicData.Param = param; DirectionBox.SetSelectedIndex(0); NumDirectionsBox.SetSelectedIndex(1); NumFramesBox.SetValue(4); RedrawGraphic(); } }; FileExplorer.SetSelectedFile((string)GraphicData.Param + ".png"); CreateButton("Cancel", Cancel); Buttons[0].SetPosition(Size.Width - 99, Buttons[0].Position.Y); CreateButton("OK", OK); Buttons[1].SetPosition(Size.Width - 188, Buttons[1].Position.Y); RedrawGraphic(); }
public EventPageContainer(EditEvent eew, Event EventData, EventPage PageData, IContainer Parent) : base(Parent) { this.EditEventWindow = eew; this.EventData = EventData; this.PageData = PageData; Font BoldFont = Font.Get("Fonts/Ubuntu-B", 14); Font f = Font.Get("Fonts/ProductSans-M", 12); Label CommandsLabel = new Label(this); CommandsLabel.SetFont(BoldFont); CommandsLabel.SetPosition(306, 4); CommandsLabel.SetText("Commands"); CommandBox CommandBox = new CommandBox(this); CommandBox.SetPosition(305, 22); CommandBox.SetSize(438, 493); CommandBox.SetEventPage(EventData, PageData); Label PropsLabel = new Label(this); PropsLabel.SetPosition(8, 4); PropsLabel.SetFont(BoldFont); PropsLabel.SetText("Page Properties"); EventGroupBox PropBox = new EventGroupBox(this); PropBox.SetPosition(7, 22); PropBox.SetSize(291, 157); Label NameLabel = new Label(PropBox); NameLabel.SetFont(f); NameLabel.SetText("Page Name:"); NameLabel.SetPosition(7, 12); TextBox NameBox = new TextBox(PropBox); NameBox.SetPosition(77, 7); NameBox.SetSize(208, 27); NameBox.SetInitialText(string.IsNullOrWhiteSpace(PageData.Name) ? "Untitled" : PageData.Name); NameBox.OnTextChanged += delegate(BaseEventArgs e) { PageData.Name = NameBox.Text; EditEventWindow.UpdateNames(); MarkChanges(); }; Label ConditionsLabel = new Label(PropBox); ConditionsLabel.SetPosition(8, 40); ConditionsLabel.SetFont(f); ConditionsLabel.SetText("Conditions:"); ConditionBox ConditionBox = new ConditionBox(PropBox); ConditionBox.SetPosition(6, 61); ConditionBox.SetSize(279, 65); ConditionBox.SetConditions(PageData.Conditions); Button EditConditionsButton = new Button(PropBox); EditConditionsButton.SetText("Edit"); EditConditionsButton.SetPosition(230, 126); EditConditionsButton.SetSize(59, 29); EditConditionsButton.OnClicked += delegate(BaseEventArgs e) { ConditionBox.Edit(delegate(BaseEventArgs e) { PageData.Conditions = ConditionBox.Conditions; }); }; Label TriggerLabel = new Label(this); TriggerLabel.SetPosition(11, 366); TriggerLabel.SetFont(BoldFont); TriggerLabel.SetText("Trigger"); EventGroupBox TriggerGroupBox = new EventGroupBox(this); TriggerGroupBox.SetPosition(7, 384); TriggerGroupBox.SetSize(121, 71); Label TriggerParamLabel = new Label(TriggerGroupBox); TriggerParamLabel.SetPosition(11, 41); TriggerParamLabel.SetFont(f); TriggerParamLabel.SetText("Sight:"); NumericBox ParamBox = new NumericBox(TriggerGroupBox); ParamBox.SetPosition(62, 36); ParamBox.SetSize(55, 27); ParamBox.MinValue = 0; ParamBox.MaxValue = 999; if (PageData.TriggerParam is int || PageData.TriggerParam is long) { ParamBox.SetValue(Convert.ToInt32(PageData.TriggerParam)); } ParamBox.OnValueChanged += delegate(BaseEventArgs e) { if (PageData.TriggerMode == TriggerMode.PlayerTouch || PageData.TriggerMode == TriggerMode.EventTouch) { PageData.TriggerParam = ParamBox.Value; MarkChanges(); } }; DropdownBox TriggerTypeBox = new DropdownBox(TriggerGroupBox); TriggerTypeBox.SetItems(new List <ListItem>() { new ListItem("Action"), new ListItem("Player Touch"), new ListItem("Event Touch"), new ListItem("Autorun"), new ListItem("Parallel Process") }); TriggerTypeBox.SetSelectedIndex((int)PageData.TriggerMode); TriggerTypeBox.OnSelectionChanged += delegate(BaseEventArgs e) { PageData.TriggerMode = (TriggerMode)TriggerTypeBox.SelectedIndex; if (TriggerTypeBox.SelectedIndex != 1 && TriggerTypeBox.SelectedIndex != 2) { TriggerParamLabel.SetEnabled(false); ParamBox.SetEnabled(false); PageData.TriggerParam = null; } else { TriggerParamLabel.SetEnabled(true); ParamBox.SetEnabled(true); if (PageData.TriggerParam == null) { PageData.TriggerParam = 0; ParamBox.SetValue(0); } } MarkChanges(); }; TriggerTypeBox.OnSelectionChanged.Invoke(new BaseEventArgs()); TriggerTypeBox.SetPosition(5, 7); TriggerTypeBox.SetSize(112, 25); Label GraphicLabel = new Label(this); GraphicLabel.SetFont(BoldFont); GraphicLabel.SetPosition(10, 183); GraphicLabel.SetText("Graphic"); GraphicWidget = new GraphicWidget(this); GraphicWidget.SetPosition(7, 201); GraphicWidget.SetEvent(EventData, PageData); Label AutoMoveLabel = new Label(this); AutoMoveLabel.SetFont(BoldFont); AutoMoveLabel.SetPosition(140, 183); AutoMoveLabel.SetText("Auto-Moveroute"); EventGroupBox AutoMoveGroupBox = new EventGroupBox(this); AutoMoveGroupBox.SetPosition(136, 201); AutoMoveGroupBox.SetSize(162, 93); Label AutoMoveTypeLabel = new Label(AutoMoveGroupBox); AutoMoveTypeLabel.SetFont(f); AutoMoveTypeLabel.SetPosition(15, 10); AutoMoveTypeLabel.SetText("Type:"); DropdownBox AutoMoveTypeBox = new DropdownBox(AutoMoveGroupBox); AutoMoveTypeBox.SetPosition(49, 7); AutoMoveTypeBox.SetSize(110, 25); AutoMoveTypeBox.SetItems(new List <ListItem>() { new ListItem("WIP") }); AutoMoveTypeBox.SetSelectedIndex(0); Button EditAutoMoveButton = new Button(AutoMoveGroupBox); EditAutoMoveButton.SetPosition(73, 32); EditAutoMoveButton.SetSize(90, 31); EditAutoMoveButton.SetText("Edit Route"); EditAutoMoveButton.SetFont(BoldFont); EditAutoMoveButton.OnClicked += delegate(BaseEventArgs e) { new MessageBox("Error", "WIP", IconType.Error); }; Label AutoMoveMoveDelayLabel = new Label(AutoMoveGroupBox); AutoMoveMoveDelayLabel.SetPosition(24, 68); AutoMoveMoveDelayLabel.SetFont(f); AutoMoveMoveDelayLabel.SetText("Move Delay:"); NumericBox AutoMoveStepDelayBox = new NumericBox(AutoMoveGroupBox); AutoMoveStepDelayBox.SetPosition(93, 62); AutoMoveStepDelayBox.SetSize(66, 27); AutoMoveStepDelayBox.MinValue = 0; AutoMoveStepDelayBox.MaxValue = 999; AutoMoveLabel.SetEnabled(false); AutoMoveTypeLabel.SetEnabled(false); AutoMoveTypeBox.SetEnabled(false); EditAutoMoveButton.SetEnabled(false); AutoMoveMoveDelayLabel.SetEnabled(false); AutoMoveStepDelayBox.SetEnabled(false); Label SettingsLabel = new Label(this); SettingsLabel.SetFont(BoldFont); SettingsLabel.SetPosition(140, 298); SettingsLabel.SetText("Event Settings"); EventGroupBox SettingsGroupBox = new EventGroupBox(this); SettingsGroupBox.SetPosition(136, 316); SettingsGroupBox.SetSize(162, 199); Label MoveSpeedLabel = new Label(SettingsGroupBox); MoveSpeedLabel.SetFont(f); MoveSpeedLabel.SetText("Move Speed:"); MoveSpeedLabel.SetPosition(6, 7); DropdownBox MoveSpeedBox = new DropdownBox(SettingsGroupBox); MoveSpeedBox.SetPosition(83, 3); MoveSpeedBox.SetSize(76, 25); MoveSpeedBox.SetItems(new List <ListItem>() { new ListItem("Walking"), new ListItem("Running"), new ListItem("Cycling") }); MoveSpeedBox.SetSelectedIndex(PageData.Settings.MoveSpeed == 0.25f ? 0 : PageData.Settings.MoveSpeed == 0.125f ? 1 : 2); MoveSpeedBox.OnSelectionChanged += delegate(BaseEventArgs e) { PageData.Settings.MoveSpeed = new float[] { 0.25f, 0.125f, 0.1f }[MoveSpeedBox.SelectedIndex]; MarkChanges(); }; Label IdleSpeedLabel = new Label(SettingsGroupBox); IdleSpeedLabel.SetFont(f); IdleSpeedLabel.SetText("Idle Speed:"); IdleSpeedLabel.SetPosition(6, 37); DropdownBox IdleSpeedBox = new DropdownBox(SettingsGroupBox); IdleSpeedBox.SetPosition(83, 33); IdleSpeedBox.SetSize(76, 25); IdleSpeedBox.SetItems(new List <ListItem>() { new ListItem("Walking"), new ListItem("Running"), new ListItem("Cycling") }); IdleSpeedBox.SetSelectedIndex(PageData.Settings.IdleSpeed == 0.25f ? 0 : PageData.Settings.IdleSpeed == 0.125f ? 1 : 2); IdleSpeedBox.OnSelectionChanged += delegate(BaseEventArgs e) { PageData.Settings.IdleSpeed = new float[] { 0.25f, 0.125f, 0.1f }[IdleSpeedBox.SelectedIndex]; MarkChanges(); }; CheckBox MoveAnimBox = new CheckBox(SettingsGroupBox); MoveAnimBox.SetPosition(5, 63); MoveAnimBox.SetText("Move Animation"); MoveAnimBox.SetFont(f); MoveAnimBox.SetChecked(PageData.Settings.MoveAnimation); MoveAnimBox.OnCheckChanged += delegate(BaseEventArgs e) { PageData.Settings.MoveAnimation = MoveAnimBox.Checked; MarkChanges(); }; CheckBox IdleAnimBox = new CheckBox(SettingsGroupBox); IdleAnimBox.SetPosition(5, 83); IdleAnimBox.SetText("Idle Animation"); IdleAnimBox.SetFont(f); IdleAnimBox.SetChecked(PageData.Settings.IdleAnimation); IdleAnimBox.OnCheckChanged += delegate(BaseEventArgs e) { PageData.Settings.IdleAnimation = IdleAnimBox.Checked; MarkChanges(); }; PassableBox = new CheckBox(SettingsGroupBox); PassableBox.SetPosition(5, 103); PassableBox.SetText("Passable"); PassableBox.SetFont(f); PassableBox.SetChecked(PageData.Settings.Passable); PassableBox.OnCheckChanged += delegate(BaseEventArgs e) { PageData.Settings.Passable = PassableBox.Checked; MarkChanges(); }; CheckBox SavePositionBox = new CheckBox(SettingsGroupBox); SavePositionBox.SetPosition(5, 123); SavePositionBox.SetText("Save Position"); SavePositionBox.SetFont(f); SavePositionBox.SetChecked(PageData.Settings.SavePosition); SavePositionBox.OnCheckChanged += delegate(BaseEventArgs e) { PageData.Settings.SavePosition = SavePositionBox.Checked; MarkChanges(); }; CheckBox DirectionLockBox = new CheckBox(SettingsGroupBox); DirectionLockBox.SetPosition(5, 143); DirectionLockBox.SetText("Direction Lock"); DirectionLockBox.SetFont(f); DirectionLockBox.SetChecked(PageData.Settings.DirectionLock); DirectionLockBox.OnCheckChanged += delegate(BaseEventArgs e) { PageData.Settings.DirectionLock = DirectionLockBox.Checked; MarkChanges(); }; Label PriorityLabel = new Label(SettingsGroupBox); PriorityLabel.SetFont(f); PriorityLabel.SetPosition(6, 168); PriorityLabel.SetText("Priority:"); DropdownBox PriorityBox = new DropdownBox(SettingsGroupBox); PriorityBox.SetPosition(54, 164); PriorityBox.SetSize(105, 25); PriorityBox.SetItems(new List <ListItem>() { new ListItem("WIP") }); PriorityBox.SetSelectedIndex(0); }