Finished first EA Version #1
Binary file not shown.
|
After Width: | Height: | Size: 135 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cv76v3845c3ff"
|
||||||
|
path="res://.godot/imported/BasicsSymbol.png-a01daba6cb03ee9cf8ccd4490920bec0.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Images/Research/BasicsSymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/BasicsSymbol.png-a01daba6cb03ee9cf8ccd4490920bec0.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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 215 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://chr4p5ns0n3n5"
|
||||||
|
path="res://.godot/imported/BronzeageSymbol.png-1285905aa4eae49f9c832663e55b2f43.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Images/Research/BronzeageSymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/BronzeageSymbol.png-1285905aa4eae49f9c832663e55b2f43.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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 229 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://jrv5xnbfcn2o"
|
||||||
|
path="res://.godot/imported/CopperageSymbol.png-8c4ce73b4c0fc81e445b053ca318cde1.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Images/Research/CopperageSymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/CopperageSymbol.png-8c4ce73b4c0fc81e445b053ca318cde1.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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 215 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cy7c16352g6pq"
|
||||||
|
path="res://.godot/imported/IronageSymbol.png-39224787c5463ca99d1883f6a5875248.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Images/Research/IronageSymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/IronageSymbol.png-39224787c5463ca99d1883f6a5875248.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
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 176 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://67pb1ajfs85y"
|
||||||
|
path="res://.godot/imported/StoneageSymbol.png-e2c2604dc51c02e3cc86b76cc1baf943.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Assets/Images/Research/StoneageSymbol.png"
|
||||||
|
dest_files=["res://.godot/imported/StoneageSymbol.png-e2c2604dc51c02e3cc86b76cc1baf943.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
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10
-5
@@ -3,7 +3,8 @@
|
|||||||
"id": "basics",
|
"id": "basics",
|
||||||
"inputs": [],
|
"inputs": [],
|
||||||
"research": "",
|
"research": "",
|
||||||
"crafttime": 1.0
|
"crafttime": 1.0,
|
||||||
|
"texture": "res://Assets/Images/Research/BasicsSymbol.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "stoneage",
|
"id": "stoneage",
|
||||||
@@ -18,7 +19,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"research": "basics",
|
"research": "basics",
|
||||||
"crafttime": 1.0
|
"crafttime": 1.0,
|
||||||
|
"texture": "res://Assets/Images/Research/StoneageSymbol.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "copperage",
|
"id": "copperage",
|
||||||
@@ -33,7 +35,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"research": "stoneage",
|
"research": "stoneage",
|
||||||
"crafttime": 1.0
|
"crafttime": 1.0,
|
||||||
|
"texture": "res://Assets/Images/Research/CopperageSymbol.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "bronzeage",
|
"id": "bronzeage",
|
||||||
@@ -48,7 +51,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"research": "copperage",
|
"research": "copperage",
|
||||||
"crafttime": 1.0
|
"crafttime": 1.0,
|
||||||
|
"texture": "res://Assets/Images/Research/BronzeageSymbol.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "ironage",
|
"id": "ironage",
|
||||||
@@ -67,6 +71,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"research": "bronzeage",
|
"research": "bronzeage",
|
||||||
"crafttime": 1.0
|
"crafttime": 1.0,
|
||||||
|
"texture": "res://Assets/Images/Research/IronageSymbol.png"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://ban872p4eh4gi" path="res://Assets/Images/RobotSymbol.png" id="11_dahhg"]
|
[ext_resource type="Texture2D" uid="uid://ban872p4eh4gi" path="res://Assets/Images/RobotSymbol.png" id="11_dahhg"]
|
||||||
[ext_resource type="Texture2D" uid="uid://ciehcg34et0q3" path="res://Assets/Images/InventorySymbol.png" id="11_wxwew"]
|
[ext_resource type="Texture2D" uid="uid://ciehcg34et0q3" path="res://Assets/Images/InventorySymbol.png" id="11_wxwew"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b77mo4fhklnja" path="res://Assets/Images/OptionsSymbol.png" id="12_3so38"]
|
[ext_resource type="Texture2D" uid="uid://b77mo4fhklnja" path="res://Assets/Images/OptionsSymbol.png" id="12_3so38"]
|
||||||
|
[ext_resource type="Script" uid="uid://drscsrkfphpy7" path="res://Scripts/Research/ResearchList.cs" id="12_4q8tf"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dt84awx33mulb" path="res://Assets/Images/ResearchSymbol.png" id="13_alh3a"]
|
[ext_resource type="Texture2D" uid="uid://dt84awx33mulb" path="res://Assets/Images/ResearchSymbol.png" id="13_alh3a"]
|
||||||
|
|
||||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_u44n3"]
|
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_u44n3"]
|
||||||
@@ -395,6 +396,19 @@ size_flags_horizontal = 3
|
|||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
theme_override_constants/separation = 10
|
theme_override_constants/separation = 10
|
||||||
|
|
||||||
|
[node name="Research" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI/Content" unique_id=1416471893 node_paths=PackedStringArray("researchGraph")]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("12_4q8tf")
|
||||||
|
researchGraph = NodePath("ResearchGraph")
|
||||||
|
|
||||||
|
[node name="ResearchGraph" type="GraphEdit" parent="CanvasLayer/UIHandler/MainUI/Content/Research" unique_id=414756119]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="FooterContainer" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI" unique_id=1495029884]
|
[node name="FooterContainer" type="PanelContainer" parent="CanvasLayer/UIHandler/MainUI" unique_id=1495029884]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
|
|||||||
+44
-44
@@ -35,6 +35,50 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = ExtResource("1_tt5f1")
|
script = ExtResource("1_tt5f1")
|
||||||
|
|
||||||
|
[node name="Decoration" type="Control" parent="." unique_id=252748481]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="Decoration" unique_id=175718935]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 19.0
|
||||||
|
offset_top = 960.0
|
||||||
|
offset_right = 51.0
|
||||||
|
offset_bottom = 992.0
|
||||||
|
scale = Vector2(3, 3)
|
||||||
|
texture = ExtResource("2_853f1")
|
||||||
|
|
||||||
|
[node name="TextureRect2" type="TextureRect" parent="Decoration" unique_id=1274351412]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 1730.0001
|
||||||
|
offset_top = 51.0
|
||||||
|
offset_right = 1770.0001
|
||||||
|
offset_bottom = 91.0
|
||||||
|
scale = Vector2(3, 3)
|
||||||
|
texture = ExtResource("3_df05h")
|
||||||
|
|
||||||
|
[node name="TextureRect3" type="TextureRect" parent="Decoration" unique_id=1496393482]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 517.0
|
||||||
|
offset_top = 264.0
|
||||||
|
offset_right = 557.0
|
||||||
|
offset_bottom = 304.0
|
||||||
|
scale = Vector2(3, 3)
|
||||||
|
texture = ExtResource("4_8um5k")
|
||||||
|
|
||||||
|
[node name="TextureRect4" type="TextureRect" parent="Decoration" unique_id=606748204]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 1443.0
|
||||||
|
offset_top = 538.0
|
||||||
|
offset_right = 1483.0
|
||||||
|
offset_bottom = 578.0
|
||||||
|
scale = Vector2(3, 3)
|
||||||
|
texture = ExtResource("5_xim88")
|
||||||
|
|
||||||
[node name="Panel" type="Panel" parent="." unique_id=167014122]
|
[node name="Panel" type="Panel" parent="." unique_id=167014122]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@@ -91,49 +135,5 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_bnhvo")
|
|||||||
theme_override_styles/hover = SubResource("StyleBoxFlat_tt5f1")
|
theme_override_styles/hover = SubResource("StyleBoxFlat_tt5f1")
|
||||||
text = "Exit Game"
|
text = "Exit Game"
|
||||||
|
|
||||||
[node name="Decoration" type="Control" parent="." unique_id=252748481]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="Decoration" unique_id=175718935]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_left = 19.0
|
|
||||||
offset_top = 960.0
|
|
||||||
offset_right = 51.0
|
|
||||||
offset_bottom = 992.0
|
|
||||||
scale = Vector2(3, 3)
|
|
||||||
texture = ExtResource("2_853f1")
|
|
||||||
|
|
||||||
[node name="TextureRect2" type="TextureRect" parent="Decoration" unique_id=1274351412]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_left = 1730.0001
|
|
||||||
offset_top = 51.0
|
|
||||||
offset_right = 1770.0001
|
|
||||||
offset_bottom = 91.0
|
|
||||||
scale = Vector2(3, 3)
|
|
||||||
texture = ExtResource("3_df05h")
|
|
||||||
|
|
||||||
[node name="TextureRect3" type="TextureRect" parent="Decoration" unique_id=1496393482]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_left = 517.0
|
|
||||||
offset_top = 264.0
|
|
||||||
offset_right = 557.0
|
|
||||||
offset_bottom = 304.0
|
|
||||||
scale = Vector2(3, 3)
|
|
||||||
texture = ExtResource("4_8um5k")
|
|
||||||
|
|
||||||
[node name="TextureRect4" type="TextureRect" parent="Decoration" unique_id=606748204]
|
|
||||||
layout_mode = 0
|
|
||||||
offset_left = 1443.0
|
|
||||||
offset_top = 538.0
|
|
||||||
offset_right = 1483.0
|
|
||||||
offset_bottom = 578.0
|
|
||||||
scale = Vector2(3, 3)
|
|
||||||
texture = ExtResource("5_xim88")
|
|
||||||
|
|
||||||
[connection signal="button_up" from="CenterContainer/VBoxContainer/btnPlay" to="." method="OnPlayPressed"]
|
[connection signal="button_up" from="CenterContainer/VBoxContainer/btnPlay" to="." method="OnPlayPressed"]
|
||||||
[connection signal="button_up" from="CenterContainer/VBoxContainer/btnExit" to="." method="OnQuitPressed"]
|
[connection signal="button_up" from="CenterContainer/VBoxContainer/btnExit" to="." method="OnQuitPressed"]
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ public class Item
|
|||||||
public CraftingResult Craft(int amount, double delta)
|
public CraftingResult Craft(int amount, double delta)
|
||||||
{
|
{
|
||||||
elapsedCraftTime += delta;
|
elapsedCraftTime += delta;
|
||||||
GD.Print(elapsedCraftTime);
|
|
||||||
if (elapsedCraftTime >= data.CraftTime)
|
if (elapsedCraftTime >= data.CraftTime)
|
||||||
{
|
{
|
||||||
GD.Print("Crafted!");
|
|
||||||
elapsedCraftTime -= data.CraftTime;
|
elapsedCraftTime -= data.CraftTime;
|
||||||
if(!GameData.inventory.AddItem(this, 1))
|
if(!GameData.inventory.AddItem(this, 1))
|
||||||
{
|
{
|
||||||
@@ -28,7 +26,6 @@ public class Item
|
|||||||
amountCrafted++;
|
amountCrafted++;
|
||||||
if (amountCrafted >= amount)
|
if (amountCrafted >= amount)
|
||||||
{
|
{
|
||||||
GD.Print("Finished!");
|
|
||||||
amountCrafted = 0;
|
amountCrafted = 0;
|
||||||
elapsedCraftTime = 0;
|
elapsedCraftTime = 0;
|
||||||
return CraftingResult.FINISHED;
|
return CraftingResult.FINISHED;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public partial class GameData
|
|||||||
public static float tileWidth = 6;
|
public static float tileWidth = 6;
|
||||||
public static float tileHeight = 4;
|
public static float tileHeight = 4;
|
||||||
public static SortedDictionary<string, ItemData> availableItems = ResourceLoader.LoadItems();
|
public static SortedDictionary<string, ItemData> availableItems = ResourceLoader.LoadItems();
|
||||||
|
public static Dictionary<string, ResearchData> availableResearch = ResourceLoader.LoadResearch();
|
||||||
|
|
||||||
//--- PLAYER ADJUSTABLE VALUES ---
|
//--- PLAYER ADJUSTABLE VALUES ---
|
||||||
//Color used in primary objects (e.g. Robots)
|
//Color used in primary objects (e.g. Robots)
|
||||||
|
|||||||
@@ -101,4 +101,21 @@ public partial class ResourceLoader
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Dictionary<string, ResearchData> LoadResearch()
|
||||||
|
{
|
||||||
|
|
||||||
|
FileAccess file = FileAccess.Open("res://Assets/Research.json", FileAccess.ModeFlags.Read);
|
||||||
|
string json = file.GetAsText();
|
||||||
|
|
||||||
|
Dictionary<string, ResearchData> result = new();
|
||||||
|
|
||||||
|
List<ResearchData> researches = JsonSerializer.Deserialize<List<ResearchData>>(json);
|
||||||
|
foreach (ResearchData research in researches)
|
||||||
|
{
|
||||||
|
result.Add(research.Id, research);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
public class Research
|
||||||
|
{
|
||||||
|
public ResearchData data;
|
||||||
|
public bool isResearched = false;
|
||||||
|
public double elapsedResearchTime = 0;
|
||||||
|
public bool paidResources = false;
|
||||||
|
|
||||||
|
public ResearchResult Execute(double delta)
|
||||||
|
{
|
||||||
|
if (!paidResources)
|
||||||
|
{
|
||||||
|
foreach (Ingredient ingredient in data.Inputs)
|
||||||
|
{
|
||||||
|
GameData.inventory.RemoveItem(ingredient.Item, ingredient.Amount);
|
||||||
|
}
|
||||||
|
paidResources = true;
|
||||||
|
}
|
||||||
|
elapsedResearchTime += delta;
|
||||||
|
if (elapsedResearchTime >= data.CraftTime)
|
||||||
|
{
|
||||||
|
isResearched = true;
|
||||||
|
return ResearchResult.FINISHED;
|
||||||
|
}
|
||||||
|
return ResearchResult.RESEARCHING;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dj2epbu26v1nv
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
public class ResearchData
|
||||||
|
{
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public string Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("inputs")]
|
||||||
|
public List<Ingredient> Inputs { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("research")]
|
||||||
|
public string Research { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("crafttime")]
|
||||||
|
public double CraftTime { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("texture")]
|
||||||
|
public string Texture { get; set; }
|
||||||
|
|
||||||
|
public string GetReadableName()
|
||||||
|
{
|
||||||
|
string noUnderscore = Id.Replace("_", " ").ToLower();
|
||||||
|
return char.ToUpper(noUnderscore[0]) + noUnderscore.Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetIndex(string readable)
|
||||||
|
{
|
||||||
|
return readable.ToLower().Replace(" ", "_");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://duwl6bhiry6uh
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://pxegmc5nenad
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
public partial class ResearchList : PanelContainer
|
||||||
|
{
|
||||||
|
[Export] GraphEdit researchGraph;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
foreach (ResearchData research in GameData.availableResearch.Values)
|
||||||
|
{
|
||||||
|
researchGraph.AddChild(CreateItemNode(research.Id, research.Texture));
|
||||||
|
}
|
||||||
|
foreach (ResearchData research in GameData.availableResearch.Values)
|
||||||
|
{
|
||||||
|
researchGraph.ConnectNode(
|
||||||
|
research.Research,
|
||||||
|
0,
|
||||||
|
research.Id,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private GraphNode CreateItemNode(string id, string texturePath)
|
||||||
|
{
|
||||||
|
TextureRect icon = new TextureRect
|
||||||
|
{
|
||||||
|
Texture = GD.Load<Texture2D>(texturePath),
|
||||||
|
StretchMode = TextureRect.StretchModeEnum.KeepAspectCentered
|
||||||
|
};
|
||||||
|
GraphNode node = new GraphNode
|
||||||
|
{
|
||||||
|
Name = id,
|
||||||
|
Title = id,
|
||||||
|
PositionOffset = new Vector2(GameData.availableResearch.Count * -icon.Texture.GetWidth() + researchGraph.GetChildCount() * icon.Texture.GetWidth() * 10, 0)
|
||||||
|
};
|
||||||
|
|
||||||
|
node.SetSlot(
|
||||||
|
0,
|
||||||
|
true,
|
||||||
|
0,
|
||||||
|
Colors.White,
|
||||||
|
true,
|
||||||
|
0,
|
||||||
|
Colors.White
|
||||||
|
);
|
||||||
|
|
||||||
|
node.AddChild(icon);
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://drscsrkfphpy7
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
public enum ResearchResult
|
||||||
|
{
|
||||||
|
FAILED,
|
||||||
|
RESEARCHING,
|
||||||
|
FINISHED
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://cuav7j7m1td2h
|
||||||
Reference in New Issue
Block a user