ui test, nine patch image

This commit is contained in:
Michele Scandura 2021-06-03 16:21:05 +01:00
parent 53bfb770ea
commit fd25025889
7 changed files with 95 additions and 3 deletions

View File

@ -107,7 +107,7 @@
#begin handcursorsIndex
/importer:XmlImporter
/processor:
/processor:PassThroughProcessor
/build:handcursorsIndex
#begin icon_delete.png
@ -146,6 +146,18 @@
/processorParam:TextureFormat=Color
/build:icon_room.png
#begin listBackground.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:listBackground.png
#begin location.png
/importer:TextureImporter
/processor:TextureProcessor

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

View File

@ -337,6 +337,16 @@ namespace Sledgemapper
var content = new CampaignList();
var campaigns = await _communicationManager.Api.GetCampaigns();
foreach(var campaign in campaigns)
{
var item = new CampaignListItem();
item.TxtCampaignName.Text=campaign.Name;
item.Background= new NinePatchRegion(
Content.Load<Texture2D>("listBackground"), new Rectangle(0, 0, 418, 98),
new Myra.Graphics2D.Thickness {Left = 11, Right = 11,
Top = 11, Bottom = 11});
content.StackNotesList.AddChild(item);
}
//content.BtnNewCampaign.Text = "N";
@ -454,7 +464,9 @@ namespace Sledgemapper
_state.SelectClosestSnapPoint(screenPosition);
}
if (!newState.IsKeyDown(Keys.LeftControl) && mouseState.LeftButton == ButtonState.Pressed && mouseState.LeftButton == oldMouseState.LeftButton)
if (!newState.IsKeyDown(Keys.LeftControl) && mouseState.LeftButton == ButtonState.Pressed && mouseState.LeftButton == oldMouseState.LeftButton &&
!_desktop.IsMouseOverGUI
)
{
_viewportCenter = new Vector3(_viewportCenter.X + mouseState.Position.X - oldMouseState.Position.X, _viewportCenter.Y + mouseState.Position.Y - oldMouseState.Position.Y, 0);
if (mouseState.Position != oldMouseState.Position)
@ -2362,6 +2374,12 @@ namespace Sledgemapper
};
var content = new LoginRegisterWindow();
#if DEBUG
content.TxtEmail.Text="michele.scandura@outlook.com";
content.TxtPassword.Text="slePharland!79";
#endif
content.RdoLogin.IsPressed = true;
content.RdoLogin.Click += (s, e) =>
{

View File

@ -1,4 +1,4 @@
/* Generated by MyraPad at 01/06/2021 12:43:27 */
/* Generated by MyraPad at 03/06/2021 15:48:34 */
using Myra;
using Myra.Graphics2D;
using Myra.Graphics2D.TextureAtlases;

View File

@ -0,0 +1,45 @@
/* Generated by MyraPad at 03/06/2021 16:16:33 */
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 CampaignListItem: HorizontalStackPanel
{
private void BuildUI()
{
TxtCampaignName = new Label();
TxtCampaignName.Text = "Highfell";
TxtCampaignName.TextColor = ColorStorage.CreateColor(102, 102, 102, 255);
TxtCampaignName.VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
TxtCampaignName.Background = new SolidBrush("#00000000");
TxtCampaignName.Id = "TxtCampaignName";
VerticalAlignment = Myra.Graphics2D.UI.VerticalAlignment.Center;
Width = 300;
Height = 45;
BorderThickness = new Thickness(2);
Padding = new Thickness(10);
Id = "PnlCampaignItem";
Widgets.Add(TxtCampaignName);
}
public Label TxtCampaignName;
}
}

View File

@ -0,0 +1,11 @@
/* Generated by MyraPad at 03/06/2021 16:00:11 */
namespace Sledgemapper.UI
{
public partial class CampaignListItem
{
public CampaignListItem()
{
BuildUI();
}
}
}

View File

@ -0,0 +1,6 @@
<Project>
<Project.ExportOptions Namespace="Sledgemapper.UI" Class="CampaignListItem" OutputPath="C:\src\Map\Sledgemapper\UI" />
<HorizontalStackPanel VerticalAlignment="Center" Width="300" Height="45" BorderThickness="2" Padding="10" Id="PnlCampaignItem">
<Label Text="Highfell" TextColor="#666666FF" VerticalAlignment="Center" Background="#00000000" Id="TxtCampaignName" />
</HorizontalStackPanel>
</Project>