This commit is contained in:
parent
a8991b474f
commit
4149d744e8
7 changed files with 224 additions and 53 deletions
|
@ -353,22 +353,13 @@ namespace Sledgemapper
|
||||||
Title = "Maps"
|
Title = "Maps"
|
||||||
};
|
};
|
||||||
|
|
||||||
var content = new CampaignList();
|
var content = new MapList();
|
||||||
var campaigns = await _communicationManager.Api.GetMaps(_state.CampaignName);
|
var campaigns = await _communicationManager.Api.GetMaps(_state.CampaignName);
|
||||||
foreach (var campaign in campaigns)
|
foreach (var campaign in campaigns)
|
||||||
{
|
{
|
||||||
var item = new CampaignListItem();
|
var item = new UI.ListItem();
|
||||||
item.TxtCampaignName.Text = campaign.SessionName;
|
item.ItemName.Text = campaign.SessionName;
|
||||||
item.Background = new NinePatchRegion(
|
item.TouchUp += OnMapSelected;
|
||||||
Content.Load<Texture2D>("listBackground"), new Rectangle(0, 0, 418, 25),
|
|
||||||
new Myra.Graphics2D.Thickness
|
|
||||||
{
|
|
||||||
Left = 11,
|
|
||||||
Right = 11,
|
|
||||||
Top = 11,
|
|
||||||
Bottom = 11
|
|
||||||
});
|
|
||||||
item.TouchUp += OnCampaignSelected;
|
|
||||||
content.StackCampaignsList.AddChild(item);
|
content.StackCampaignsList.AddChild(item);
|
||||||
}
|
}
|
||||||
//content.BtnNewCampaign.Text = "N";
|
//content.BtnNewCampaign.Text = "N";
|
||||||
|
@ -403,17 +394,9 @@ namespace Sledgemapper
|
||||||
var players = await _communicationManager.Api.GetPlayers(_state.CampaignName);
|
var players = await _communicationManager.Api.GetPlayers(_state.CampaignName);
|
||||||
foreach (var player in players)
|
foreach (var player in players)
|
||||||
{
|
{
|
||||||
var item = new PlayerListItem();
|
var item = new UI.ListItem();
|
||||||
item.TxtPlayerName.Text = player.UserName;
|
item.ItemName.Text = player.UserName;
|
||||||
item.Background = new NinePatchRegion(
|
|
||||||
Content.Load<Texture2D>("listBackground"), new Rectangle(0, 0, 418, 25),
|
|
||||||
new Myra.Graphics2D.Thickness
|
|
||||||
{
|
|
||||||
Left = 11,
|
|
||||||
Right = 11,
|
|
||||||
Top = 11,
|
|
||||||
Bottom = 11
|
|
||||||
});
|
|
||||||
|
|
||||||
content.StackCampaignsList.AddChild(item);
|
content.StackCampaignsList.AddChild(item);
|
||||||
}
|
}
|
||||||
|
@ -533,17 +516,9 @@ namespace Sledgemapper
|
||||||
var campaigns = await _communicationManager.Api.GetCampaigns();
|
var campaigns = await _communicationManager.Api.GetCampaigns();
|
||||||
foreach (var campaign in campaigns)
|
foreach (var campaign in campaigns)
|
||||||
{
|
{
|
||||||
var item = new CampaignListItem();
|
var item = new UI.ListItem();
|
||||||
item.TxtCampaignName.Text = campaign.Name;
|
item.ItemName.Text = campaign.Name;
|
||||||
//item.Background = new NinePatchRegion(
|
|
||||||
// Content.Load<Texture2D>("listBackground"), new Rectangle(0, 0, 418, 25),
|
|
||||||
// new Myra.Graphics2D.Thickness
|
|
||||||
// {
|
|
||||||
// Left = 11,
|
|
||||||
// Right = 11,
|
|
||||||
// Top = 11,
|
|
||||||
// Bottom = 11
|
|
||||||
// });
|
|
||||||
item.TouchUp += OnCampaignSelected;
|
item.TouchUp += OnCampaignSelected;
|
||||||
content.StackCampaignsList.AddChild(item);
|
content.StackCampaignsList.AddChild(item);
|
||||||
}
|
}
|
||||||
|
@ -565,8 +540,30 @@ namespace Sledgemapper
|
||||||
|
|
||||||
private void OnCampaignSelected(object sender, EventArgs e)
|
private void OnCampaignSelected(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var item = sender as CampaignListItem;
|
var item = sender as UI.ListItem;
|
||||||
_state.CampaignName = item.TxtCampaignName.Text;
|
var localContent = GetParentContentInWindow<Widget>(item);
|
||||||
|
_state.CampaignName = item.ItemName.Text;
|
||||||
|
var list = item.Parent as Myra.Graphics2D.UI.Grid;
|
||||||
|
for (var i=0;i<list.ChildrenCount;i++)
|
||||||
|
{
|
||||||
|
var currentItem = list.GetChild(i) as HorizontalStackPanel;// UI.ListItem;
|
||||||
|
currentItem.Background= new SolidBrush("#D9D9D9FF");
|
||||||
|
}
|
||||||
|
item.Background=new SolidBrush(_settings.OverlayTintColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMapSelected(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var item = sender as UI.ListItem;
|
||||||
|
var localContent = GetParentContentInWindow<Widget>(item);
|
||||||
|
|
||||||
|
var list = item.Parent as Myra.Graphics2D.UI.Grid;
|
||||||
|
for (var i=0;i<list.ChildrenCount;i++)
|
||||||
|
{
|
||||||
|
var currentItem = list.GetChild(i) as HorizontalStackPanel;// UI.ListItem;
|
||||||
|
currentItem.Background= new SolidBrush("#D9D9D9FF");
|
||||||
|
}
|
||||||
|
item.Background=new SolidBrush(_settings.OverlayTintColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OneMenuFileSettingsSelected(object sender, EventArgs e)
|
private void OneMenuFileSettingsSelected(object sender, EventArgs e)
|
||||||
|
@ -2374,39 +2371,38 @@ namespace Sledgemapper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnButtonNoteOkClick(object sender, EventArgs e)
|
private (Window Window ,C Content) GetParentContentInWindow<C>(Widget widget) where C:Widget
|
||||||
{
|
{
|
||||||
var button = ((TextButton)sender);
|
Container container = widget.Parent;
|
||||||
Container container = button.Parent;
|
|
||||||
while (!(container is Window))
|
while (!(container is Window))
|
||||||
{
|
{
|
||||||
container = container.Parent;
|
container = container.Parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
var localWindow = (Window)container;
|
var localWindow = (Window)container;
|
||||||
var localContent = localWindow.Content as NoteWindow;
|
var localContent = localWindow.Content as C;
|
||||||
|
return (localWindow,localContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnButtonNoteOkClick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var button = ((TextButton)sender);
|
||||||
|
var localContent = GetParentContentInWindow<NoteWindow>(button) ;
|
||||||
var note = new Note
|
var note = new Note
|
||||||
{
|
{
|
||||||
X = _state.SelectedNote.X,
|
X = _state.SelectedNote.X,
|
||||||
Y = _state.SelectedNote.Y,
|
Y = _state.SelectedNote.Y,
|
||||||
Text = localContent.NoteText.Text
|
Text = localContent.Content.NoteText.Text
|
||||||
};
|
};
|
||||||
_sessionData.NewNote(note);
|
_sessionData.NewNote(note);
|
||||||
localWindow.Close();
|
localContent.Window.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnButtonNoteCancelClick(object sender, EventArgs e)
|
private void OnButtonNoteCancelClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var button = ((TextButton)sender);
|
var button = ((TextButton)sender);
|
||||||
Container container = button.Parent;
|
var content = GetParentContentInWindow<Widget>(button);
|
||||||
while (!(container is Window))
|
content.Window.Close();
|
||||||
{
|
|
||||||
container = container.Parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
var localWindow = (Window)container;
|
|
||||||
|
|
||||||
localWindow.Close();
|
|
||||||
}
|
}
|
||||||
private async void OnButtonLoginClick(object sender, EventArgs e)
|
private async void OnButtonLoginClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
45
Sledgemapper/UI/ListItem.Generated.cs
Normal file
45
Sledgemapper/UI/ListItem.Generated.cs
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/* Generated by MyraPad at 03/09/2021 16:50:20 */
|
||||||
|
using Myra;
|
||||||
|
using Myra.Graphics2D;
|
||||||
|
using Myra.Graphics2D.TextureAtlases;
|
||||||
|
using Myra.Graphics2D.UI;
|
||||||
|
using Myra.Graphics2D.Brushes;
|
||||||
|
using Myra.Graphics2D.UI.Properties;
|
||||||
|
|
||||||
|
#if MONOGAME || FNA
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
#elif STRIDE
|
||||||
|
using Stride.Core.Mathematics;
|
||||||
|
#else
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Numerics;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Sledgemapper.UI
|
||||||
|
{
|
||||||
|
partial class ListItem: HorizontalStackPanel
|
||||||
|
{
|
||||||
|
private void BuildUI()
|
||||||
|
{
|
||||||
|
ItemName = new Label();
|
||||||
|
ItemName.Text = "Highfell";
|
||||||
|
ItemName.TextColor = ColorStorage.CreateColor(32, 32, 32, 255);
|
||||||
|
ItemName.Margin = new Thickness(10, 0, 0, 0);
|
||||||
|
ItemName.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||||
|
ItemName.Id = "ItemName";
|
||||||
|
|
||||||
|
|
||||||
|
VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
|
||||||
|
Height = 30;
|
||||||
|
BorderThickness = new Thickness(2);
|
||||||
|
Padding = new Thickness(5);
|
||||||
|
Background = new SolidBrush("#D9D9D9FF");
|
||||||
|
Id = "PnlListItem";
|
||||||
|
Widgets.Add(ItemName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Label ItemName;
|
||||||
|
}
|
||||||
|
}
|
11
Sledgemapper/UI/ListItem.cs
Normal file
11
Sledgemapper/UI/ListItem.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* Generated by MyraPad at 03/09/2021 16:19:13 */
|
||||||
|
namespace Sledgemapper.UI
|
||||||
|
{
|
||||||
|
public partial class ListItem
|
||||||
|
{
|
||||||
|
public ListItem()
|
||||||
|
{
|
||||||
|
BuildUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
86
Sledgemapper/UI/MapList.Generated.cs
Normal file
86
Sledgemapper/UI/MapList.Generated.cs
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
/* Generated by MyraPad at 03/09/2021 17:16:12 */
|
||||||
|
using Myra;
|
||||||
|
using Myra.Graphics2D;
|
||||||
|
using Myra.Graphics2D.TextureAtlases;
|
||||||
|
using Myra.Graphics2D.UI;
|
||||||
|
using Myra.Graphics2D.Brushes;
|
||||||
|
using Myra.Graphics2D.UI.Properties;
|
||||||
|
|
||||||
|
#if MONOGAME || FNA
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
#elif STRIDE
|
||||||
|
using Stride.Core.Mathematics;
|
||||||
|
#else
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Numerics;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Sledgemapper.UI
|
||||||
|
{
|
||||||
|
partial class MapList: VerticalStackPanel
|
||||||
|
{
|
||||||
|
private void BuildUI()
|
||||||
|
{
|
||||||
|
var label1 = new Label();
|
||||||
|
label1.Text = "Maps";
|
||||||
|
label1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
|
||||||
|
|
||||||
|
StackCampaignsList = new VerticalStackPanel();
|
||||||
|
StackCampaignsList.DefaultProportion = new Proportion
|
||||||
|
{
|
||||||
|
Type = Myra.Graphics2D.UI.ProportionType.Auto,
|
||||||
|
};
|
||||||
|
StackCampaignsList.Id = "StackCampaignsList";
|
||||||
|
|
||||||
|
var scrollViewer1 = new ScrollViewer();
|
||||||
|
scrollViewer1.Height = 250;
|
||||||
|
scrollViewer1.Content = StackCampaignsList;
|
||||||
|
|
||||||
|
BtnNewCampaign = new TextButton();
|
||||||
|
BtnNewCampaign.Text = "New";
|
||||||
|
BtnNewCampaign.Width = 70;
|
||||||
|
BtnNewCampaign.Height = 20;
|
||||||
|
BtnNewCampaign.Padding = new Thickness(5);
|
||||||
|
BtnNewCampaign.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
|
||||||
|
BtnNewCampaign.Id = "BtnNewCampaign";
|
||||||
|
|
||||||
|
BtnLoadCampaign = new TextButton();
|
||||||
|
BtnLoadCampaign.Text = "Load";
|
||||||
|
BtnLoadCampaign.Width = 70;
|
||||||
|
BtnLoadCampaign.Height = 20;
|
||||||
|
BtnLoadCampaign.Padding = new Thickness(5);
|
||||||
|
BtnLoadCampaign.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
|
||||||
|
BtnLoadCampaign.Id = "BtnLoadCampaign";
|
||||||
|
|
||||||
|
BtnCancelCampaign = new TextButton();
|
||||||
|
BtnCancelCampaign.Text = "Cancel";
|
||||||
|
BtnCancelCampaign.Width = 70;
|
||||||
|
BtnCancelCampaign.Height = 20;
|
||||||
|
BtnCancelCampaign.Padding = new Thickness(5);
|
||||||
|
BtnCancelCampaign.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Center;
|
||||||
|
BtnCancelCampaign.Id = "BtnCancelCampaign";
|
||||||
|
|
||||||
|
var horizontalStackPanel1 = new HorizontalStackPanel();
|
||||||
|
horizontalStackPanel1.Spacing = 15;
|
||||||
|
horizontalStackPanel1.HorizontalAlignment = Myra.Graphics2D.UI.HorizontalAlignment.Right;
|
||||||
|
horizontalStackPanel1.Widgets.Add(BtnNewCampaign);
|
||||||
|
horizontalStackPanel1.Widgets.Add(BtnLoadCampaign);
|
||||||
|
horizontalStackPanel1.Widgets.Add(BtnCancelCampaign);
|
||||||
|
|
||||||
|
|
||||||
|
Spacing = 13;
|
||||||
|
Width = 400;
|
||||||
|
Padding = new Thickness(10);
|
||||||
|
Widgets.Add(label1);
|
||||||
|
Widgets.Add(scrollViewer1);
|
||||||
|
Widgets.Add(horizontalStackPanel1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public VerticalStackPanel StackCampaignsList;
|
||||||
|
public TextButton BtnNewCampaign;
|
||||||
|
public TextButton BtnLoadCampaign;
|
||||||
|
public TextButton BtnCancelCampaign;
|
||||||
|
}
|
||||||
|
}
|
11
Sledgemapper/UI/MapList.cs
Normal file
11
Sledgemapper/UI/MapList.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* Generated by MyraPad at 03/09/2021 17:13:57 */
|
||||||
|
namespace Sledgemapper.UI
|
||||||
|
{
|
||||||
|
public partial class MapList
|
||||||
|
{
|
||||||
|
public MapList()
|
||||||
|
{
|
||||||
|
BuildUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
Sledgemapper/UI/listItem.xmmp
Normal file
6
Sledgemapper/UI/listItem.xmmp
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<Project>
|
||||||
|
<Project.ExportOptions Namespace="Sledgemapper.UI" Class="ListItem" OutputPath="C:\src\Map\Sledgemapper\UI" />
|
||||||
|
<HorizontalStackPanel VerticalAlignment="Center" Height="30" BorderThickness="2" Padding="5" Background="#D9D9D9FF" Id="PnlListItem">
|
||||||
|
<Label Text="Highfell" TextColor="#202020FF" Margin="10, 0, 0, 0" VerticalAlignment="Center" Id="ItemName" />
|
||||||
|
</HorizontalStackPanel>
|
||||||
|
</Project>
|
16
Sledgemapper/UI/mapsList.xmmp
Normal file
16
Sledgemapper/UI/mapsList.xmmp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<Project>
|
||||||
|
<Project.ExportOptions Namespace="Sledgemapper.UI" Class="MapList" OutputPath="C:\src\Map\Sledgemapper\UI" />
|
||||||
|
<VerticalStackPanel Spacing="13" Width="400" Padding="10">
|
||||||
|
<Label Text="Maps" HorizontalAlignment="Center" />
|
||||||
|
<ScrollViewer Height="250">
|
||||||
|
<VerticalStackPanel Id="StackCampaignsList">
|
||||||
|
<VerticalStackPanel.DefaultProportion Type="Auto" />
|
||||||
|
</VerticalStackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
<HorizontalStackPanel Spacing="15" HorizontalAlignment="Right">
|
||||||
|
<TextButton Text="New" Width="70" Height="20" Padding="5" HorizontalAlignment="Center" Id="BtnNewCampaign" />
|
||||||
|
<TextButton Text="Load" Width="70" Height="20" Padding="5" HorizontalAlignment="Center" Id="BtnLoadCampaign" />
|
||||||
|
<TextButton Text="Cancel" Width="70" Height="20" Padding="5" HorizontalAlignment="Center" Id="BtnCancelCampaign" />
|
||||||
|
</HorizontalStackPanel>
|
||||||
|
</VerticalStackPanel>
|
||||||
|
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue