Fixes Breaking Change with UI windows. (#192)

* Custom UI window constructors were changed.

* Update Submodule.
This commit is contained in:
Acruid
2019-04-12 21:37:09 -07:00
committed by GitHub
parent 6f032f678a
commit 9d7345892f
8 changed files with 36 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
using Content.Client.GameObjects.Components.Construction; using Content.Client.GameObjects.Components.Construction;
using SS14.Client.UserInterface; using SS14.Client.Interfaces.Graphics;
using SS14.Client.UserInterface.Controls; using SS14.Client.UserInterface.Controls;
using SS14.Shared.Utility; using SS14.Shared.Utility;
@@ -7,6 +7,7 @@ namespace Content.Client.Construction
{ {
public class ConstructionButton : Button public class ConstructionButton : Button
{ {
private readonly IDisplayManager _displayManager;
protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Construction/ConstructionButton.tscn"); protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Construction/ConstructionButton.tscn");
public ConstructorComponent Owner public ConstructorComponent Owner
@@ -16,12 +17,22 @@ namespace Content.Client.Construction
} }
ConstructionMenu Menu; ConstructionMenu Menu;
public ConstructionButton(IDisplayManager displayManager)
{
_displayManager = displayManager;
PerformLayout();
}
protected override void Initialize() protected override void Initialize()
{ {
base.Initialize(); base.Initialize();
OnPressed += IWasPressed; OnPressed += IWasPressed;
Menu = new ConstructionMenu(); }
private void PerformLayout()
{
Menu = new ConstructionMenu(_displayManager);
Menu.AddToScreen(); Menu.AddToScreen();
} }

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Client.GameObjects.Components.Construction; using Content.Client.GameObjects.Components.Construction;
@@ -6,6 +6,7 @@ using Content.Shared.Construction;
using SS14.Client.GameObjects; using SS14.Client.GameObjects;
using SS14.Client.Graphics; using SS14.Client.Graphics;
using SS14.Client.Interfaces.GameObjects; using SS14.Client.Interfaces.GameObjects;
using SS14.Client.Interfaces.Graphics;
using SS14.Client.Interfaces.Placement; using SS14.Client.Interfaces.Placement;
using SS14.Client.Interfaces.ResourceManagement; using SS14.Client.Interfaces.ResourceManagement;
using SS14.Client.Placement; using SS14.Client.Placement;
@@ -48,6 +49,7 @@ namespace Content.Client.Construction
// This list is flattened in such a way that the top most deepest category is first. // This list is flattened in such a way that the top most deepest category is first.
List<CategoryNode> FlattenedCategories; List<CategoryNode> FlattenedCategories;
PlacementManager Placement; PlacementManager Placement;
public ConstructionMenu(IDisplayManager displayMan) : base(displayMan) { }
protected override void Initialize() protected override void Initialize()
{ {

View File

@@ -8,6 +8,7 @@ using SS14.Shared.IoC;
using SS14.Shared.Utility; using SS14.Shared.Utility;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using SS14.Client.Interfaces.Graphics;
namespace Content.Client.GameObjects.Components.Actor namespace Content.Client.GameObjects.Components.Actor
{ {
@@ -82,7 +83,7 @@ namespace Content.Client.GameObjects.Components.Actor
{ {
protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Mobs/CharacterWindow.tscn"); protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Mobs/CharacterWindow.tscn");
public CharacterWindow(IEnumerable<ICharacterUI> windowcomponents) public CharacterWindow(IEnumerable<ICharacterUI> windowcomponents) : base(IoCManager.Resolve<IDisplayManager>())
{ {
//TODO: sort window components by priority of window component //TODO: sort window components by priority of window component
foreach(var element in windowcomponents.OrderByDescending(x => x.Priority)) foreach(var element in windowcomponents.OrderByDescending(x => x.Priority))

View File

@@ -4,6 +4,7 @@ using Content.Shared.Construction;
using Content.Shared.GameObjects.Components.Construction; using Content.Shared.GameObjects.Components.Construction;
using SS14.Client.GameObjects; using SS14.Client.GameObjects;
using SS14.Client.Interfaces.GameObjects; using SS14.Client.Interfaces.GameObjects;
using SS14.Client.Interfaces.Graphics;
using SS14.Shared.GameObjects; using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects; using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.GameObjects.Components; using SS14.Shared.Interfaces.GameObjects.Components;
@@ -39,7 +40,7 @@ namespace Content.Client.GameObjects.Components.Construction
case PlayerAttachedMsg _: case PlayerAttachedMsg _:
if (Button == null) if (Button == null)
{ {
Button = new ConstructionButton(); Button = new ConstructionButton(IoCManager.Resolve<IDisplayManager>());
Button.Owner = this; Button.Owner = this;
} }
Button.AddToScreen(); Button.AddToScreen();

View File

@@ -1,9 +1,11 @@
using System; using System;
using Content.Shared.GameObjects.Components.Power; using Content.Shared.GameObjects.Components.Power;
using SS14.Client.GameObjects.Components.UserInterface; using SS14.Client.GameObjects.Components.UserInterface;
using SS14.Client.Interfaces.Graphics;
using SS14.Client.UserInterface.Controls; using SS14.Client.UserInterface.Controls;
using SS14.Client.UserInterface.CustomControls; using SS14.Client.UserInterface.CustomControls;
using SS14.Shared.GameObjects.Components.UserInterface; using SS14.Shared.GameObjects.Components.UserInterface;
using SS14.Shared.IoC;
using SS14.Shared.Utility; using SS14.Shared.Utility;
namespace Content.Client.GameObjects.Components.Power namespace Content.Client.GameObjects.Components.Power
@@ -19,7 +21,7 @@ namespace Content.Client.GameObjects.Components.Power
{ {
base.Open(); base.Open();
_window = new ApcWindow(); _window = new ApcWindow(IoCManager.Resolve<IDisplayManager>());
_window.OnClose += Close; _window.OnClose += Close;
_breakerButton = _window.Contents.GetChild<BaseButton>("Rows/Breaker/Breaker"); _breakerButton = _window.Contents.GetChild<BaseButton>("Rows/Breaker/Breaker");
_breakerButton.OnPressed += _ => SendMessage(new ApcToggleMainBreakerMessage()); _breakerButton.OnPressed += _ => SendMessage(new ApcToggleMainBreakerMessage());
@@ -70,6 +72,8 @@ namespace Content.Client.GameObjects.Components.Power
private class ApcWindow : SS14Window private class ApcWindow : SS14Window
{ {
protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Power/Apc.tscn"); protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Power/Apc.tscn");
public ApcWindow(IDisplayManager displayMan) : base(displayMan) { }
} }
} }
} }

View File

@@ -1,10 +1,11 @@
using Content.Shared.GameObjects; using Content.Shared.GameObjects.Components.Power;
using Content.Shared.GameObjects.Components.Power; using SS14.Client.Interfaces.Graphics;
using SS14.Client.UserInterface.Controls; using SS14.Client.UserInterface.Controls;
using SS14.Client.UserInterface.CustomControls; using SS14.Client.UserInterface.CustomControls;
using SS14.Shared.GameObjects; using SS14.Shared.GameObjects;
using SS14.Shared.Interfaces.GameObjects; using SS14.Shared.Interfaces.GameObjects;
using SS14.Shared.Interfaces.Network; using SS14.Shared.Interfaces.Network;
using SS14.Shared.IoC;
namespace Content.Client.GameObjects.Components.Power namespace Content.Client.GameObjects.Components.Power
{ {
@@ -22,7 +23,7 @@ namespace Content.Client.GameObjects.Components.Power
{ {
LastWindow.Dispose(); LastWindow.Dispose();
} }
LastWindow = new SS14Window LastWindow = new SS14Window(IoCManager.Resolve<IDisplayManager>())
{ {
Title = "Power Debug Tool", Title = "Power Debug Tool",
}; };

View File

@@ -14,6 +14,7 @@ using SS14.Shared.Maths;
using SS14.Shared.Utility; using SS14.Shared.Utility;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using SS14.Client.Interfaces.Graphics;
namespace Content.Client.GameObjects.Components.Storage namespace Content.Client.GameObjects.Components.Storage
{ {
@@ -41,7 +42,7 @@ namespace Content.Client.GameObjects.Components.Storage
{ {
base.OnAdd(); base.OnAdd();
Window = new StorageWindow() Window = new StorageWindow(IoCManager.Resolve<IDisplayManager>())
{ StorageEntity = this }; { StorageEntity = this };
} }
@@ -148,6 +149,8 @@ namespace Content.Client.GameObjects.Components.Storage
protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Storage/Storage.tscn"); protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Storage/Storage.tscn");
public StorageWindow(IDisplayManager displayMan) : base(displayMan) { }
protected override void Initialize() protected override void Initialize()
{ {
base.Initialize(); base.Initialize();