diff --git a/scenes/LevelGraphEditor.tscn b/scenes/LevelGraphEditor.tscn
index a355b85..b50e95a 100644
--- a/scenes/LevelGraphEditor.tscn
+++ b/scenes/LevelGraphEditor.tscn
@@ -35,6 +35,7 @@ offset_bottom = 32.0
text = "level_graph_editor"
[node name="CreateOrEditorPanel" type="Panel" parent="."]
+visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
diff --git a/scripts/map/dateBean/RoomPlacementData.cs b/scripts/map/dateBean/RoomPlacementData.cs
index 3895d16..854a397 100644
--- a/scripts/map/dateBean/RoomPlacementData.cs
+++ b/scripts/map/dateBean/RoomPlacementData.cs
@@ -19,4 +19,16 @@ public class RoomPlacementData
/// 放置的房间模板
///
public Room? Room { get; set; }
+
+ ///
+ /// Parent room slot
+ /// 父级房间的插槽
+ ///
+ public RoomSlot? ParentRoomSlot { get; set; }
+
+ ///
+ /// A slot for the new room
+ /// 新房间的插槽
+ ///
+ public RoomSlot? NewRoomSlot { get; set; }
}
\ No newline at end of file
diff --git a/scripts/map/roomPlacer/PatchworkRoomPlacementStrategy.cs b/scripts/map/roomPlacer/PatchworkRoomPlacementStrategy.cs
index 879d155..1c57ec3 100644
--- a/scripts/map/roomPlacer/PatchworkRoomPlacementStrategy.cs
+++ b/scripts/map/roomPlacer/PatchworkRoomPlacementStrategy.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using ColdMint.scripts.debug;
using ColdMint.scripts.levelGraphEditor;
using ColdMint.scripts.map.dateBean;
using ColdMint.scripts.map.interfaces;
@@ -85,7 +84,7 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
_measuringArea2D?.RemoveChild(_measuringCollisionShape2D);
_measuringCollisionShape2D = null;
}
-
+
if (_measuringArea2D != null)
{
_measuringArea2D?.QueueFree();
@@ -169,7 +168,9 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
var roomPlacementData = new RoomPlacementData
{
Room = newRoom,
- Position = position
+ Position = position,
+ ParentRoomSlot = mainRoomSlot,
+ NewRoomSlot = newRoomSlot
};
useableRoomPlacementData.Add(roomPlacementData);
}
@@ -181,7 +182,20 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
else
{
var index = randomNumberGenerator.Randi() % useableRoomPlacementData.Count;
- return useableRoomPlacementData[(int)index];
+ var roomPlacementData = useableRoomPlacementData[(int)index];
+ //Be sure to mark its slot as a match when you use it.
+ //一定要在使用时,将其插槽标记为匹配。
+ if (roomPlacementData.ParentRoomSlot != null)
+ {
+ roomPlacementData.ParentRoomSlot.Matched = true;
+ }
+
+ if (roomPlacementData.NewRoomSlot != null)
+ {
+ roomPlacementData.NewRoomSlot.Matched = true;
+ }
+
+ return roomPlacementData;
}
}
@@ -287,8 +301,6 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
continue;
}
- mainRoomSlot.Matched = true;
- newRoomSlot.Matched = true;
outMainRoomSlot = mainRoomSlot;
outNewRoomSlot = newRoomSlot;
return Task.FromResult(true);