Commit d8c3b4a2 authored by Maxime POULAIN's avatar Maxime POULAIN
Browse files

Merge branch 'main' into develop

parents 8714c4b5 864fa4ad
using System;
using System.Collections.Generic;
using System.Text;
using Urho;
using Urho.Gui;
namespace ZZZZZZ.GUI.Buttons
{
public class ButtonCustom : BorderImage
{
public Text Text { get; }
public Rect Rectangle { get; }
public Vector2 Position { get; }
public new bool Enabled
{
get => Opacity < 0.4f;
set => Opacity = value ? 0.9f : 0.3f;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using Urho;
using Urho.Gui;
using ZZZZZZ.Utils;
namespace ZZZZZZ.GUI.Menus
{
public abstract class Menu
{
public event Action<UIElement> Clicked
{
add => _clicked += value;
remove => _clicked -= value;
}
protected List<UIElement> Elements { get; }
protected BorderImage Background { get; }
protected Action<UIElement> _clicked;
public Menu()
{
Elements = new List<UIElement>();
Background = new BorderImage
{
Opacity = 0.2f
};
Application.Current.UI.UIMouseClick += UI_UIMouseClick;
}
private void UI_UIMouseClick(UIMouseClickEventArgs obj)
{
try
{
var element = Elements.First(x => ToolBox.IsPosInRect(obj.X, obj.Y, x.CombinedScreenRect));
_clicked?.Invoke(element);
}
catch (InvalidOperationException) { }
}
public void Hide() => Elements.ForEach(x => x.Visible = false);
public void Show() => Elements.ForEach(x => x.Visible = true);
public void Destroy() => Elements.ForEach(x => Application.Current.UI.Root.RemoveChild(x));
}
}
......@@ -13,3 +13,17 @@ Projet tutoré F2 - ZZZZZZ
[Loic YON](https://perso.isima.fr/loic/index.fr.php)
## Serveur
### Docker
Build container
`docker build --tag local/zzzzzz-server:alpha`
Run container
`docker run -p 3000:3000 -p 3001:3001/udp -p 3002:3002/udp --rm -it local/zzzzzz-server:alpha`
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment