Finished first EA Version #1
Binary file not shown.
|
After Width: | Height: | Size: 513 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bkr5w2n0ur3b0"
|
||||
path="res://.godot/imported/BronzeGearSymbol.png-fbe63b91e723706590d2614f99b9e000.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Images/Items/BronzeGearSymbol.png"
|
||||
dest_files=["res://.godot/imported/BronzeGearSymbol.png-fbe63b91e723706590d2614f99b9e000.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
+4
-1
@@ -66,7 +66,7 @@ environment = SubResource("Environment_sb48q")
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1558432386]
|
||||
follow_viewport_enabled = true
|
||||
|
||||
[node name="UIHandler" type="Control" parent="CanvasLayer" unique_id=1713248285 node_paths=PackedStringArray("codingWindow", "robotList", "mainCam", "map", "FPS", "RAM", "options", "uiContent", "menu", "inventory")]
|
||||
[node name="UIHandler" type="Control" parent="CanvasLayer" unique_id=1713248285 node_paths=PackedStringArray("codingWindow", "robotList", "mainCam", "map", "FPS", "RAM", "options", "uiContent", "menu", "inventory", "researchList")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -88,6 +88,7 @@ options = NodePath("MainUI/Content/Options")
|
||||
uiContent = NodePath("MainUI/Content")
|
||||
menu = NodePath("MainUI/Content/Menu")
|
||||
inventory = NodePath("MainUI/Content/Inventory")
|
||||
researchList = NodePath("MainUI/Content/Research")
|
||||
|
||||
[node name="MainUI" type="VBoxContainer" parent="CanvasLayer/UIHandler" unique_id=1437975209]
|
||||
layout_mode = 1
|
||||
@@ -397,6 +398,7 @@ size_flags_vertical = 3
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Research" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=1416471893 node_paths=PackedStringArray("researchGraph")]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
@@ -462,6 +464,7 @@ texture_normal = ExtResource("12_3so38")
|
||||
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button2" to="CanvasLayer/UIHandler" method="ShowOptions"]
|
||||
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/Content/Menu/VBoxContainer/Button3" to="CanvasLayer/UIHandler" method="ExitGame"]
|
||||
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Inventory" to="CanvasLayer/UIHandler" method="HandleInventoryButton"]
|
||||
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Research" to="CanvasLayer/UIHandler" method="HandleResearchButton"]
|
||||
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Map" to="CanvasLayer/UIHandler" method="HandleMapButton"]
|
||||
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Robots" to="CanvasLayer/UIHandler" method="HandleRobotListButton"]
|
||||
[connection signal="pressed" from="CanvasLayer/UIHandler/MainUI/FooterContainer/HBoxContainer/Options" to="CanvasLayer/UIHandler" method="HandleMenuButton"]
|
||||
|
||||
@@ -34,8 +34,26 @@ public class ItemData
|
||||
return char.ToUpper(noUnderscore[0]) + noUnderscore.Substring(1);
|
||||
}
|
||||
|
||||
public static string GetReadableName(string input)
|
||||
{
|
||||
string noUnderscore = input.Replace("_", " ").ToLower();
|
||||
return char.ToUpper(noUnderscore[0]) + noUnderscore.Substring(1);
|
||||
}
|
||||
|
||||
public static string GetIndex(string readable)
|
||||
{
|
||||
return readable.ToLower().Replace(" ", "_");
|
||||
}
|
||||
|
||||
public string GetCraftingDisplay()
|
||||
{
|
||||
string result = "";
|
||||
result += GetReadableName() + ": \r";
|
||||
foreach (Ingredient ingredient in Inputs)
|
||||
{
|
||||
result += $"{GetReadableName(ingredient.Item)} ({ingredient.Amount}),\r";
|
||||
}
|
||||
result = result.Remove(result.Length - 2);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class CraftNode : ProgramNode
|
||||
if(GameData.availableResearch[item.Research].state != ResearchState.RESEARCHED) continue;
|
||||
if (item.Inputs.Count > 0)
|
||||
{
|
||||
options.AddItem(item.GetReadableName());
|
||||
options.AddItem(item.GetCraftingDisplay());
|
||||
}
|
||||
}
|
||||
if (selectedItem != null)
|
||||
|
||||
@@ -41,15 +41,14 @@ public class ExploreNode : ProgramNode
|
||||
Vector3 target = pathPoints[0] - startPosition;
|
||||
float distance = target.Length();
|
||||
|
||||
if (distance < 0.1f)
|
||||
if (distance < 0.1f * Mathf.Sqrt(GameData.robotSpeed))
|
||||
{
|
||||
robot.Position = pathPoints[0];
|
||||
Vector3I mapIndex = Pathfinding.GetClosestStartPoint(robot.Position);
|
||||
Tile tile = GameData.map[mapIndex.Y].tiles[mapIndex.X, mapIndex.Z];
|
||||
if (!tile.wasVisited)
|
||||
{
|
||||
tile.wasVisited = true;
|
||||
tile.ContentNode.Visible = true;
|
||||
tile.VisitTile();
|
||||
}
|
||||
pathPoints.Remove(pathPoints[0]);
|
||||
if (pathPoints.Count <= 0)
|
||||
|
||||
@@ -30,8 +30,7 @@ public class MoveNode : ProgramNode
|
||||
Tile tile = GameData.map[mapIndex.Y].tiles[mapIndex.X, mapIndex.Z];
|
||||
if (!tile.wasVisited)
|
||||
{
|
||||
tile.wasVisited = true;
|
||||
tile.ContentNode.Visible = true;
|
||||
tile.VisitTile();
|
||||
}
|
||||
pathPoints.Remove(pathPoints[0]);
|
||||
if (pathPoints.Count <= 0)
|
||||
|
||||
@@ -4,7 +4,7 @@ using Godot;
|
||||
|
||||
public partial class GameData
|
||||
{
|
||||
public static bool DEBUGMODE = true;
|
||||
public static bool DEBUGMODE = false;
|
||||
public static Random rand = new Random(seed);
|
||||
public static Layer[] map;
|
||||
//Current layer the player wants to see
|
||||
|
||||
@@ -16,6 +16,7 @@ public partial class UIHandler : Control
|
||||
[Export] Control uiContent;
|
||||
[Export] PanelContainer menu;
|
||||
[Export] PanelContainer inventory;
|
||||
[Export] ResearchList researchList;
|
||||
|
||||
bool receivedRobotJumpSignal = false;
|
||||
public override void _Ready()
|
||||
@@ -46,6 +47,7 @@ public partial class UIHandler : Control
|
||||
if (Input.IsActionJustPressed("menu")) HandleMenuButton();
|
||||
if (Input.IsActionJustPressed("robot_list")) HandleRobotListButton();
|
||||
if (Input.IsActionJustPressed("inventory")) HandleInventoryButton();
|
||||
if (Input.IsActionJustPressed("research")) HandleResearchButton();
|
||||
|
||||
}
|
||||
|
||||
@@ -57,7 +59,7 @@ public partial class UIHandler : Control
|
||||
public void HandleMapButton()
|
||||
{
|
||||
OpenUIElement(map);
|
||||
map.ShowMap();
|
||||
if(map.Visible) map.ShowMap();
|
||||
}
|
||||
|
||||
public void HandleRobotListButton()
|
||||
@@ -71,6 +73,12 @@ public partial class UIHandler : Control
|
||||
OpenUIElement(inventory);
|
||||
}
|
||||
|
||||
public void HandleResearchButton()
|
||||
{
|
||||
OpenUIElement(researchList);
|
||||
if(researchList.Visible) researchList.SetupGraph();
|
||||
}
|
||||
|
||||
public void DisplayStats()
|
||||
{
|
||||
FPS.Text = Engine.GetFramesPerSecond().ToString() + " FPS";
|
||||
|
||||
@@ -7,16 +7,12 @@ public partial class ResearchList : PanelContainer
|
||||
{
|
||||
[Export] private GraphEdit researchGraph;
|
||||
|
||||
private const float StartXDivisor = 32f;
|
||||
private const float StartYDivisor = 4f;
|
||||
private const float NodeSpacingMultiplier = 10f;
|
||||
|
||||
private List<string> reloadKeys = new List<string>();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
RecalculateResearchStates();
|
||||
SetupGraph();
|
||||
if(Visible) SetupGraph();
|
||||
}
|
||||
|
||||
public void SetupGraph()
|
||||
@@ -25,6 +21,7 @@ public partial class ResearchList : PanelContainer
|
||||
ClearGraph();
|
||||
CreateResearchNodes();
|
||||
CreateResearchConnections();
|
||||
researchGraph.ArrangeNodes();
|
||||
}
|
||||
|
||||
private void ClearGraph()
|
||||
@@ -111,7 +108,6 @@ public partial class ResearchList : PanelContainer
|
||||
{
|
||||
Name = id,
|
||||
Title = id,
|
||||
PositionOffset = GetNodePosition(texture),
|
||||
SelfModulate = stateColor
|
||||
};
|
||||
|
||||
@@ -131,24 +127,6 @@ public partial class ResearchList : PanelContainer
|
||||
return node;
|
||||
}
|
||||
|
||||
private Vector2 GetNodePosition(Texture2D texture)
|
||||
{
|
||||
Vector2 viewportSize = GetViewport().GetVisibleRect().Size;
|
||||
|
||||
float textureWidth = texture?.GetWidth() ?? 64f;
|
||||
|
||||
Vector2 startPosition = new Vector2(
|
||||
viewportSize.X / StartXDivisor,
|
||||
viewportSize.Y / StartYDivisor
|
||||
);
|
||||
|
||||
float xOffset =
|
||||
GameData.availableResearch.Count * -textureWidth +
|
||||
researchGraph.GetChildCount() * textureWidth * NodeSpacingMultiplier;
|
||||
|
||||
return startPosition + new Vector2(xOffset, 0);
|
||||
}
|
||||
|
||||
private void OnResearchPressed(string id)
|
||||
{
|
||||
GameData.availableResearch[id].state = ResearchState.RESEARCHED;
|
||||
@@ -208,4 +186,4 @@ public partial class ResearchList : PanelContainer
|
||||
_ => Colors.Red
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,5 +49,4 @@ public partial class Robot : Node3D
|
||||
isExecuting = true;
|
||||
currentNode = nodes[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Map : PanelContainer
|
||||
{
|
||||
[Export] GridContainer grid;
|
||||
private HashSet<Tile> handledTiles = new HashSet<Tile>();
|
||||
private Dictionary<Tile, TextureRect> textureMap = new Dictionary<Tile, TextureRect>();
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
@@ -76,6 +79,15 @@ public partial class Map : PanelContainer
|
||||
texture.TooltipText = "Not explored";
|
||||
}
|
||||
|
||||
|
||||
textureMap[tiles[x, z]] = texture;
|
||||
|
||||
if (!handledTiles.Contains(tiles[x, z]))
|
||||
{
|
||||
tiles[x, z].OnTileVisited += OnTileVisited;
|
||||
handledTiles.Add(tiles[x, z]);
|
||||
}
|
||||
|
||||
texture.SizeFlagsHorizontal = SizeFlags.ExpandFill;
|
||||
texture.SizeFlagsVertical = SizeFlags.ExpandFill;
|
||||
texture.StretchMode = TextureRect.StretchModeEnum.Scale;
|
||||
@@ -86,6 +98,35 @@ public partial class Map : PanelContainer
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTileVisited(object sender, EventArgs e)
|
||||
{
|
||||
Tile tile = sender as Tile;
|
||||
|
||||
if (tile == null)
|
||||
return;
|
||||
|
||||
if (textureMap.TryGetValue(tile, out TextureRect texture))
|
||||
{
|
||||
UpdateMap(tile, texture);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateMap(Tile tile, TextureRect texture)
|
||||
{
|
||||
if (!IsInstanceValid(texture)) return;
|
||||
|
||||
if (tile.containsResource)
|
||||
{
|
||||
texture.Texture = ResourceDistributor.resources[tile.resource.name];
|
||||
texture.TooltipText = tile.resource.item.GetReadableName() + $"\r(X: {tile.GridPosition.X},Y: {GameData.currentLayer},Z: {tile.GridPosition.Y})";
|
||||
}
|
||||
else
|
||||
{
|
||||
texture.Texture = GenerateTexture(32, new Color(0, 0, 0, 0));
|
||||
texture.TooltipText = "";
|
||||
}
|
||||
}
|
||||
|
||||
public Texture2D GenerateTexture(int size, Color fillColor)
|
||||
{
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ public partial class Tile
|
||||
public bool containsLight, containsDecoration, containsResource;
|
||||
public GameResource resource;
|
||||
public bool wasVisited;
|
||||
public event EventHandler OnTileVisited;
|
||||
|
||||
|
||||
public void SetMeshes(Dictionary<string, MeshInstance3D> tileMeshes)
|
||||
@@ -138,4 +139,10 @@ public partial class Tile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void VisitTile()
|
||||
{
|
||||
wasVisited = true;
|
||||
OnTileVisited?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user