Construction System. (#87)
* Construction WiP * Construction kinda works! * Lots more construction work. * It mostly works!
This commit is contained in:
committed by
GitHub
parent
f051078c79
commit
d7074bf74f
56
Content.Client/Construction/ConstructionButton.cs
Normal file
56
Content.Client/Construction/ConstructionButton.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Content.Client.GameObjects.Components.Construction;
|
||||
using SS14.Client.UserInterface;
|
||||
using SS14.Client.UserInterface.Controls;
|
||||
using SS14.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Construction
|
||||
{
|
||||
public class ConstructionButton : Button
|
||||
{
|
||||
protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Construction/ConstructionButton.tscn");
|
||||
|
||||
public ConstructorComponent Owner
|
||||
{
|
||||
get => Menu.Owner;
|
||||
set => Menu.Owner = value;
|
||||
}
|
||||
ConstructionMenu Menu;
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
OnPressed += IWasPressed;
|
||||
Menu = new ConstructionMenu();
|
||||
Menu.AddToScreen();
|
||||
}
|
||||
|
||||
void IWasPressed(ButtonEventArgs args)
|
||||
{
|
||||
Menu.Open();
|
||||
}
|
||||
|
||||
public void AddToScreen()
|
||||
{
|
||||
UserInterfaceManager.StateRoot.AddChild(this);
|
||||
}
|
||||
|
||||
public void RemoveFromScreen()
|
||||
{
|
||||
if (Parent != null)
|
||||
{
|
||||
Parent.RemoveChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
Menu.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user