Small adjustment to map loading stuff
This commit is contained in:
@@ -9,7 +9,7 @@ public partial class DungeonFloorLayoutNode : EditorPlugin
|
|||||||
{
|
{
|
||||||
// Initialization of the plugin goes here.
|
// Initialization of the plugin goes here.
|
||||||
var script = GD.Load<Script>("res://addons/dungeon_floor_layout/DungeonFloorLayout.cs");
|
var script = GD.Load<Script>("res://addons/dungeon_floor_layout/DungeonFloorLayout.cs");
|
||||||
var texture = GD.Load<Texture2D>("res://addons/dungeon_floor_layout/icon_door.png");
|
var texture = GD.Load<Texture2D>("res://addons/dungeon_floor_layout/icon.png");
|
||||||
AddCustomType(nameof(DungeonFloorLayout), nameof(LayoutType), script, texture);
|
AddCustomType(nameof(DungeonFloorLayout), nameof(LayoutType), script, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
@@ -3,15 +3,15 @@
|
|||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://cgd2d4fusp4pg"
|
uid="uid://cgd2d4fusp4pg"
|
||||||
path="res://.godot/imported/icon_door.png-437da3e7d1cb55961e6afceef56e9ea2.ctex"
|
path="res://.godot/imported/icon.png-f075641bee242eff6dcbc69a1dabede8.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://addons/dungeon_floor_layout/icon_door.png"
|
source_file="res://addons/dungeon_floor_layout/icon.png"
|
||||||
dest_files=["res://.godot/imported/icon_door.png-437da3e7d1cb55961e6afceef56e9ea2.ctex"]
|
dest_files=["res://.godot/imported/icon.png-f075641bee242eff6dcbc69a1dabede8.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ public partial class SpecialFloorLayoutNode : EditorPlugin
|
|||||||
{
|
{
|
||||||
// Initialization of the plugin goes here.
|
// Initialization of the plugin goes here.
|
||||||
var script = GD.Load<Script>("res://addons/special_floor_layout_node/SpecialFloorLayout.cs");
|
var script = GD.Load<Script>("res://addons/special_floor_layout_node/SpecialFloorLayout.cs");
|
||||||
var texture = GD.Load<Texture2D>("res://addons/special_floor_layout_node/icon_door.png");
|
var texture = GD.Load<Texture2D>("res://addons/special_floor_layout_node/icon.png");
|
||||||
AddCustomType(nameof(SpecialFloorLayout), nameof(LayoutType), script, texture);
|
AddCustomType(nameof(SpecialFloorLayout), nameof(LayoutType), script, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
Zennysoft.Game.Ma/addons/special_floor_layout_node/icon.png
Normal file
BIN
Zennysoft.Game.Ma/addons/special_floor_layout_node/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 158 B |
@@ -2,16 +2,16 @@
|
|||||||
|
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://pxevsja7e3s0"
|
uid="uid://dkj2u56olatdq"
|
||||||
path="res://.godot/imported/icon_door.png-d7e4ac87b8cdfac1c9f03b9aff4c7e79.ctex"
|
path="res://.godot/imported/icon.png-f3d3329191ced87c3dfb24631add3cb6.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://addons/special_floor_layout_node/icon_door.png"
|
source_file="res://addons/special_floor_layout_node/icon.png"
|
||||||
dest_files=["res://.godot/imported/icon_door.png-d7e4ac87b8cdfac1c9f03b9aff4c7e79.ctex"]
|
dest_files=["res://.godot/imported/icon.png-f3d3329191ced87c3dfb24631add3cb6.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 161 B |
@@ -23,6 +23,9 @@ public partial class Map : Node3D, IMap
|
|||||||
[Dependency]
|
[Dependency]
|
||||||
public IPlayer Player => this.DependOn<IPlayer>();
|
public IPlayer Player => this.DependOn<IPlayer>();
|
||||||
|
|
||||||
|
[Node]
|
||||||
|
public Node MapOrder { get; set; } = default!;
|
||||||
|
|
||||||
#region Save
|
#region Save
|
||||||
public ISaveChunk<MapInfo> MapChunk { get; set; } = default!;
|
public ISaveChunk<MapInfo> MapChunk { get; set; } = default!;
|
||||||
|
|
||||||
@@ -35,9 +38,6 @@ public partial class Map : Node3D, IMap
|
|||||||
public ISaveChunk<GameData> GameChunk => this.DependOn<ISaveChunk<GameData>>();
|
public ISaveChunk<GameData> GameChunk => this.DependOn<ISaveChunk<GameData>>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
[Export]
|
|
||||||
private Array<LayoutType> Floors { get; set; } = default!;
|
|
||||||
|
|
||||||
public IDungeonFloor CurrentFloor { get; private set; }
|
public IDungeonFloor CurrentFloor { get; private set; }
|
||||||
|
|
||||||
public AutoProp<int> CurrentFloorNumber { get; private set; } = new AutoProp<int>(0);
|
public AutoProp<int> CurrentFloorNumber { get; private set; } = new AutoProp<int>(0);
|
||||||
@@ -69,7 +69,7 @@ public partial class Map : Node3D, IMap
|
|||||||
|
|
||||||
public async Task LoadFloor()
|
public async Task LoadFloor()
|
||||||
{
|
{
|
||||||
var floor = GetChildren().OfType<LayoutType>().ElementAt(CurrentFloorNumber.Value);
|
var floor = MapOrder.GetChildren().OfType<LayoutType>().ElementAt(CurrentFloorNumber.Value);
|
||||||
var sceneToLoad = LayoutToScenePathConverter.Convert(floor);
|
var sceneToLoad = LayoutToScenePathConverter.Convert(floor);
|
||||||
await LoadFloor(sceneToLoad);
|
await LoadFloor(sceneToLoad);
|
||||||
if (CurrentFloor is DungeonFloor dungeonFloor && floor is DungeonFloorLayout dungeonFloorLayout)
|
if (CurrentFloor is DungeonFloor dungeonFloor && floor is DungeonFloorLayout dungeonFloorLayout)
|
||||||
@@ -108,7 +108,6 @@ public partial class Map : Node3D, IMap
|
|||||||
private void ClearCurrentMap()
|
private void ClearCurrentMap()
|
||||||
{
|
{
|
||||||
CurrentFloor?.CallDeferred(MethodName.QueueFree, []);
|
CurrentFloor?.CallDeferred(MethodName.QueueFree, []);
|
||||||
Floors.Remove(Floors.First());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupDungeonFloor()
|
private void SetupDungeonFloor()
|
||||||
|
|||||||
@@ -56,9 +56,8 @@ _data = {
|
|||||||
&"fade_out": SubResource("Animation_v14r0")
|
&"fade_out": SubResource("Animation_v14r0")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Map" type="Node3D" node_paths=PackedStringArray("Floors")]
|
[node name="Map" type="Node3D"]
|
||||||
script = ExtResource("1_bw70o")
|
script = ExtResource("1_bw70o")
|
||||||
Floors = [3, 2, 0, 4, 1, 5, 6]
|
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="."]
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@@ -74,16 +73,19 @@ libraries = {
|
|||||||
&"": SubResource("AnimationLibrary_00xd7")
|
&"": SubResource("AnimationLibrary_00xd7")
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="Overworld (Add SpecialFloorLayout node for special floors and pick the FloorName from the list)" type="Node" parent="."]
|
[node name="MapOrder" type="Node" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
|
||||||
|
[node name="Overworld (Add SpecialFloorLayout node for special floors and pick the FloorName from the list)" type="Node" parent="MapOrder"]
|
||||||
script = ExtResource("2_00xd7")
|
script = ExtResource("2_00xd7")
|
||||||
metadata/_custom_type_script = "uid://cabvj6s31iucg"
|
metadata/_custom_type_script = "uid://cabvj6s31iucg"
|
||||||
|
|
||||||
[node name="Altar (Arrange order of nodes to change default load order)" type="Node" parent="."]
|
[node name="Altar (Arrange order of nodes to change default load order)" type="Node" parent="MapOrder"]
|
||||||
script = ExtResource("2_00xd7")
|
script = ExtResource("2_00xd7")
|
||||||
FloorName = 1
|
FloorName = 1
|
||||||
metadata/_custom_type_script = "uid://cabvj6s31iucg"
|
metadata/_custom_type_script = "uid://cabvj6s31iucg"
|
||||||
|
|
||||||
[node name="Floor01 (Press Populate Map Data Button to load floor from SetAFloors folder)" type="Node" parent="."]
|
[node name="Floor01 (Press Populate Map Data Button to load floor from SetAFloors folder)" type="Node" parent="MapOrder"]
|
||||||
script = ExtResource("3_v14r0")
|
script = ExtResource("3_v14r0")
|
||||||
LayoutWithSpawnRate = Dictionary[String, float]({})
|
LayoutWithSpawnRate = Dictionary[String, float]({})
|
||||||
EnemySpawnRates = {
|
EnemySpawnRates = {
|
||||||
@@ -91,7 +93,7 @@ EnemySpawnRates = {
|
|||||||
}
|
}
|
||||||
metadata/_custom_type_script = "uid://ci7o3nn4mdo8o"
|
metadata/_custom_type_script = "uid://ci7o3nn4mdo8o"
|
||||||
|
|
||||||
[node name="Floor02 (Add DungeonFloorLayout node for regular dungeon floors)" type="Node" parent="."]
|
[node name="Floor02 (Add DungeonFloorLayout node for regular dungeon floors)" type="Node" parent="MapOrder"]
|
||||||
script = ExtResource("3_v14r0")
|
script = ExtResource("3_v14r0")
|
||||||
LayoutWithSpawnRate = Dictionary[String, float]({})
|
LayoutWithSpawnRate = Dictionary[String, float]({})
|
||||||
EnemySpawnRates = {
|
EnemySpawnRates = {
|
||||||
|
|||||||
Reference in New Issue
Block a user