Finished first EA Version #1
@@ -28,16 +28,22 @@ public partial class ResearchList : PanelContainer
|
||||
|
||||
private GraphNode CreateItemNode(string id, string texturePath)
|
||||
{
|
||||
Vector2 viewportSize = GetViewport().GetVisibleRect().Size;
|
||||
TextureRect icon = new TextureRect
|
||||
{
|
||||
Texture = GD.Load<Texture2D>(texturePath),
|
||||
StretchMode = TextureRect.StretchModeEnum.KeepAspectCentered
|
||||
};
|
||||
//Step 1: Place the node in the visible field for the player
|
||||
Vector2 nodePosition = new Vector2(viewportSize.X / 32, viewportSize.Y / 4);
|
||||
//Step 2: Modify position by nodeIndex
|
||||
nodePosition = nodePosition + new Vector2(GameData.availableResearch.Count * -icon.Texture.GetWidth() + researchGraph.GetChildCount() * icon.Texture.GetWidth() * 10, 0);
|
||||
|
||||
GraphNode node = new GraphNode
|
||||
{
|
||||
Name = id,
|
||||
Title = id,
|
||||
PositionOffset = new Vector2(GameData.availableResearch.Count * -icon.Texture.GetWidth() + researchGraph.GetChildCount() * icon.Texture.GetWidth() * 10, 0)
|
||||
PositionOffset = nodePosition
|
||||
};
|
||||
|
||||
node.SetSlot(
|
||||
|
||||
Reference in New Issue
Block a user