-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
200c18b
commit bd17f8c
Showing
13 changed files
with
362 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SerialLoops.Lib.Items | ||
{ | ||
public class DialogueItem : Item | ||
{ | ||
public DialogueItem(string name) : base(name, ItemType.Dialogue) | ||
{ | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Text.RegularExpressions; | ||
using SerialLoops.Lib.Items; | ||
|
||
namespace SerialLoops.Lib.Items | ||
{ | ||
public abstract class Item : ItemDescription | ||
{ | ||
|
||
public Item(string name, ItemDescription.ItemType type) : base(name, type) | ||
{ | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SerialLoops.Lib.Items | ||
{ | ||
public class ItemDescription | ||
{ | ||
|
||
public string Name { get; private set; } | ||
public ItemType Type { get; private set; } | ||
|
||
public ItemDescription(string name, ItemType type) | ||
{ | ||
Name = name; | ||
Type = type; | ||
} | ||
|
||
// Load an item from an ItemDescription | ||
public Item Load() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
// Enum with values for each type of item | ||
public enum ItemType | ||
{ | ||
Map, | ||
Dialogue | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SerialLoops.Lib.Items | ||
{ | ||
public class MapItem : Item | ||
{ | ||
public MapItem(string name) : base(name, ItemType.Map) | ||
{ | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using Eto.Drawing; | ||
using Eto.Forms; | ||
using SerialLoops.Editors; | ||
using SerialLoops.Lib; | ||
using SerialLoops.Lib.Items; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Xml.Linq; | ||
using static System.Windows.Forms.VisualStyles.VisualStyleElement; | ||
|
||
namespace SerialLoops | ||
{ | ||
internal class EditorTabsPanel : Panel | ||
{ | ||
|
||
public static readonly Size EDITOR_BASE_SIZE = new(500, 420); | ||
|
||
public TabControl Tabs { get; private set; } | ||
|
||
private readonly Project _project; | ||
|
||
public EditorTabsPanel(Project project) | ||
{ | ||
_project = project; | ||
InitializeComponent(); | ||
} | ||
|
||
void InitializeComponent() | ||
{ | ||
MinimumSize = EDITOR_BASE_SIZE; | ||
Padding = 0; | ||
|
||
Tabs = new(); | ||
Content = new StackLayout | ||
{ | ||
Orientation = Orientation.Vertical, | ||
MinimumSize = EDITOR_BASE_SIZE, | ||
Items = | ||
{ | ||
Tabs | ||
} | ||
}; | ||
} | ||
|
||
public static Icon GetItemIcon(ItemDescription.ItemType type) | ||
{ | ||
//todo battle with this and figure out loading from a resx? | ||
//return Icon.FromResource($"SerialLoops.Icons.{type}.png", Assembly.GetExecutingAssembly()); | ||
throw new NotImplementedException(); | ||
} | ||
|
||
internal void OpenTab(ItemDescription item) | ||
{ | ||
// If a tab page with the name and type exists, switch to it | ||
foreach (TabPage page in Tabs.Pages) | ||
{ | ||
if (page.Text.Equals(item.Name)) | ||
{ | ||
Tabs.SelectedPage = page; | ||
return; | ||
} | ||
} | ||
|
||
// Open a new editor for the item -- This is where the item can be loaded from the project files | ||
switch (item.Type) | ||
{ | ||
case ItemDescription.ItemType.Map: | ||
Tabs.Pages.Add(new MapEditor(new MapItem(item.Name))); | ||
break; | ||
case ItemDescription.ItemType.Dialogue: | ||
Tabs.Pages.Add(new DialogueEditor(new DialogueItem(item.Name))); | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Eto.Forms; | ||
using SerialLoops.Lib.Items; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SerialLoops.Editors | ||
{ | ||
internal class DialogueEditor : Editor | ||
{ | ||
private DialogueItem _item; | ||
|
||
public DialogueEditor(DialogueItem item) : base(item) | ||
{ | ||
_item = item; | ||
} | ||
|
||
public override Panel GetEditorPanel() | ||
{ | ||
return new StackLayout | ||
{ | ||
Orientation = Orientation.Vertical, | ||
Items = | ||
{ | ||
new Label { Text = "Dialogue Editor..todo" } | ||
} | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Eto.Forms; | ||
using Eto.Drawing; | ||
using SerialLoops.Lib.Items; | ||
|
||
namespace SerialLoops.Editors | ||
{ | ||
internal abstract class Editor : TabPage | ||
{ | ||
|
||
public readonly ItemDescription Description; | ||
|
||
public Editor(ItemDescription description) | ||
{ | ||
Description = description; | ||
InitializeComponent(); | ||
} | ||
|
||
void InitializeComponent() | ||
{ | ||
Text = Description.Name; | ||
MinimumSize = EditorTabsPanel.EDITOR_BASE_SIZE; | ||
//Image = EditorTabsPanel.GetItemIcon(Description.Type); | ||
Padding = 10; | ||
|
||
Panel panel = GetEditorPanel(); | ||
panel.MinimumSize = EditorTabsPanel.EDITOR_BASE_SIZE; | ||
Content = panel; | ||
} | ||
|
||
public abstract Panel GetEditorPanel(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Eto.Forms; | ||
using SerialLoops.Lib.Items; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SerialLoops.Editors | ||
{ | ||
internal class MapEditor : Editor | ||
{ | ||
|
||
private MapItem _item; | ||
|
||
public MapEditor(MapItem map) : base(map) | ||
{ | ||
_item = map; | ||
} | ||
|
||
public override Panel GetEditorPanel() | ||
{ | ||
return new StackLayout | ||
{ | ||
Orientation = Orientation.Vertical, | ||
Items = | ||
{ | ||
new Label { Text = "Map Editor..todo!" } | ||
} | ||
}; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using Eto.Drawing; | ||
using Eto.Forms; | ||
using SerialLoops.Lib; | ||
using SerialLoops.Lib.Items; | ||
using System; | ||
|
||
namespace SerialLoops | ||
{ | ||
internal class ItemExplorerPanel : Scrollable | ||
{ | ||
|
||
public static readonly Size ITEM_EXPLORER_BASE_SIZE = new(200, 420); | ||
|
||
private ListBox _items; | ||
private readonly Project _project; | ||
private readonly EditorTabsPanel _tabs; | ||
|
||
public ItemExplorerPanel(Project project, EditorTabsPanel tabs) | ||
{ | ||
_project = project; | ||
_tabs = tabs; | ||
InitializeComponent(); | ||
} | ||
|
||
void InitializeComponent() | ||
{ | ||
MinimumSize = ITEM_EXPLORER_BASE_SIZE; | ||
Padding = 0; | ||
|
||
_items = new ListBox | ||
{ | ||
Size = ITEM_EXPLORER_BASE_SIZE | ||
}; | ||
_items.Activated += ItemList_ItemSelected; | ||
|
||
Content = new StackLayout | ||
{ | ||
Orientation = Orientation.Vertical, | ||
Items = | ||
{ | ||
_items | ||
} | ||
}; | ||
|
||
// Test items | ||
foreach (ItemDescription item in _project.GetItems()) | ||
{ | ||
_items.Items.Add(item.Name); | ||
} | ||
} | ||
|
||
private void ItemList_ItemSelected(object sender, EventArgs e) | ||
{ | ||
if (_items.SelectedIndex != -1) | ||
{ | ||
ItemDescription item = _project.GetItems()[_items.SelectedIndex]; | ||
_tabs.OpenTab(item); | ||
} | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.