连接导航网格中。
This commit is contained in:
parent
9401913779
commit
b0c01cfca0
|
@ -3,22 +3,22 @@ connection_data_list:
|
|||
to_id: 4ae948ea-82b7-4b2d-bec2-19ed8a9d4c03
|
||||
from_port: 0
|
||||
to_port: 0
|
||||
- from_id: 4ae948ea-82b7-4b2d-bec2-19ed8a9d4c03
|
||||
to_id: ba32e05c-0c80-4a79-b5ce-5b8150400e05
|
||||
from_port: 0
|
||||
to_port: 0
|
||||
- from_id: 4ae948ea-82b7-4b2d-bec2-19ed8a9d4c03
|
||||
to_id: 8b3d645a-96c0-407e-871d-6f4a0b69557b
|
||||
from_port: 0
|
||||
to_port: 0
|
||||
- from_id: 8b3d645a-96c0-407e-871d-6f4a0b69557b
|
||||
to_id: 7e3ae680-3d7e-4ae9-b82f-5bfbe1c2f613
|
||||
from_port: 0
|
||||
to_port: 0
|
||||
- from_id: ba32e05c-0c80-4a79-b5ce-5b8150400e05
|
||||
to_id: 7e3ae680-3d7e-4ae9-b82f-5bfbe1c2f613
|
||||
from_port: 0
|
||||
to_port: 0
|
||||
# - from_id: 4ae948ea-82b7-4b2d-bec2-19ed8a9d4c03
|
||||
# to_id: ba32e05c-0c80-4a79-b5ce-5b8150400e05
|
||||
# from_port: 0
|
||||
# to_port: 0
|
||||
# - from_id: 4ae948ea-82b7-4b2d-bec2-19ed8a9d4c03
|
||||
# to_id: 8b3d645a-96c0-407e-871d-6f4a0b69557b
|
||||
# from_port: 0
|
||||
# to_port: 0
|
||||
# - from_id: 8b3d645a-96c0-407e-871d-6f4a0b69557b
|
||||
# to_id: 7e3ae680-3d7e-4ae9-b82f-5bfbe1c2f613
|
||||
# from_port: 0
|
||||
# to_port: 0
|
||||
# - from_id: ba32e05c-0c80-4a79-b5ce-5b8150400e05
|
||||
# to_id: 7e3ae680-3d7e-4ae9-b82f-5bfbe1c2f613
|
||||
# from_port: 0
|
||||
# to_port: 0
|
||||
room_node_data_list:
|
||||
- id: c0255eb6-2c75-44f7-9058-0921fe8fb0d8
|
||||
title: 起点房间
|
||||
|
|
|
@ -15,82 +15,82 @@ namespace ColdMint.scripts.loader.sceneLoader;
|
|||
/// </summary>
|
||||
public partial class GameSceneLoader : SceneLoaderTemplate
|
||||
{
|
||||
private Label? _seedLabel;
|
||||
private Label? _seedLabel;
|
||||
|
||||
public override Task InitializeData()
|
||||
{
|
||||
//Loading the blood bar scene
|
||||
//加载血条场景
|
||||
var healthBarUi = GetNode<HealthBarUi>("CanvasLayer/Control/VBoxContainer/HealthBarUi");
|
||||
GameSceneNodeHolder.HealthBarUi = healthBarUi;
|
||||
//Load HotBar
|
||||
//加载HotBar
|
||||
var hotBar = GetNode<HotBar>("CanvasLayer/Control/VBoxContainer/HotBar");
|
||||
GameSceneNodeHolder.HotBar = hotBar;
|
||||
//Backpack Ui container
|
||||
//背包Ui容器
|
||||
var backpackUiContainer = GetNode<Control>("CanvasLayer/BackpackUIContainer");
|
||||
GameSceneNodeHolder.BackpackUiContainer = backpackUiContainer;
|
||||
//Load operation prompt
|
||||
//加载操作提示
|
||||
var operationTip = GetNode<RichTextLabel>("CanvasLayer/Control/VBoxContainer/OperationTip");
|
||||
GameSceneNodeHolder.OperationTipLabel = operationTip;
|
||||
//Loaded weapon container
|
||||
//加载武器容器
|
||||
var weaponContainer = GetNode<Node2D>("WeaponContainer");
|
||||
GameSceneNodeHolder.WeaponContainer = weaponContainer;
|
||||
//Load Packsack container
|
||||
//加载背包容器
|
||||
var packsackContainer = GetNode<Node2D>("PacksackContainer");
|
||||
GameSceneNodeHolder.PacksackContainer = packsackContainer;
|
||||
//Load AICharacter container
|
||||
//加载AICharacter容器
|
||||
var aiCharacterContainer = GetNode<Node2D>("AICharacterContainer");
|
||||
GameSceneNodeHolder.AiCharacterContainer = aiCharacterContainer;
|
||||
//Load player container
|
||||
//加载玩家容器
|
||||
var playerContainer = GetNode<Node2D>("PlayerContainer");
|
||||
GameSceneNodeHolder.PlayerContainer = playerContainer;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
public override Task InitializeData()
|
||||
{
|
||||
//Loading the blood bar scene
|
||||
//加载血条场景
|
||||
var healthBarUi = GetNode<HealthBarUi>("CanvasLayer/Control/VBoxContainer/HealthBarUi");
|
||||
GameSceneNodeHolder.HealthBarUi = healthBarUi;
|
||||
//Load HotBar
|
||||
//加载HotBar
|
||||
var hotBar = GetNode<HotBar>("CanvasLayer/Control/VBoxContainer/HotBar");
|
||||
GameSceneNodeHolder.HotBar = hotBar;
|
||||
//Backpack Ui container
|
||||
//背包Ui容器
|
||||
var backpackUiContainer = GetNode<Control>("CanvasLayer/BackpackUIContainer");
|
||||
GameSceneNodeHolder.BackpackUiContainer = backpackUiContainer;
|
||||
//Load operation prompt
|
||||
//加载操作提示
|
||||
var operationTip = GetNode<RichTextLabel>("CanvasLayer/Control/VBoxContainer/OperationTip");
|
||||
GameSceneNodeHolder.OperationTipLabel = operationTip;
|
||||
//Loaded weapon container
|
||||
//加载武器容器
|
||||
var weaponContainer = GetNode<Node2D>("WeaponContainer");
|
||||
GameSceneNodeHolder.WeaponContainer = weaponContainer;
|
||||
//Load Packsack container
|
||||
//加载背包容器
|
||||
var packsackContainer = GetNode<Node2D>("PacksackContainer");
|
||||
GameSceneNodeHolder.PacksackContainer = packsackContainer;
|
||||
//Load AICharacter container
|
||||
//加载AICharacter容器
|
||||
var aiCharacterContainer = GetNode<Node2D>("AICharacterContainer");
|
||||
GameSceneNodeHolder.AiCharacterContainer = aiCharacterContainer;
|
||||
//Load player container
|
||||
//加载玩家容器
|
||||
var playerContainer = GetNode<Node2D>("PlayerContainer");
|
||||
GameSceneNodeHolder.PlayerContainer = playerContainer;
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override async Task LoadScene()
|
||||
{
|
||||
var debugMode = Config.IsDebug();
|
||||
var recreateMapButton = GetNodeOrNull<Button>("CanvasLayer/Control/RecreateMapButton");
|
||||
if (recreateMapButton != null)
|
||||
{
|
||||
recreateMapButton.Visible = debugMode;
|
||||
recreateMapButton.Pressed += () => { _ = GenerateMap(); };
|
||||
}
|
||||
public override async Task LoadScene()
|
||||
{
|
||||
var debugMode = Config.IsDebug();
|
||||
var recreateMapButton = GetNodeOrNull<Button>("CanvasLayer/Control/RecreateMapButton");
|
||||
if (recreateMapButton != null)
|
||||
{
|
||||
recreateMapButton.Visible = debugMode;
|
||||
recreateMapButton.Pressed += () => { _ = GenerateMap(); };
|
||||
}
|
||||
|
||||
_seedLabel = GetNodeOrNull<Label>("CanvasLayer/Control/SeedLabel");
|
||||
if (_seedLabel != null)
|
||||
{
|
||||
_seedLabel.Visible = debugMode;
|
||||
}
|
||||
_seedLabel = GetNodeOrNull<Label>("CanvasLayer/Control/SeedLabel");
|
||||
if (_seedLabel != null)
|
||||
{
|
||||
_seedLabel.Visible = debugMode;
|
||||
}
|
||||
|
||||
MapGenerator.MapRoot = GetNode<Node>("MapRoot");
|
||||
MapGenerator.LayoutStrategy = new TestLayoutStrategy();
|
||||
MapGenerator.LayoutParsingStrategy = new SequenceLayoutParsingStrategy();
|
||||
MapGenerator.RoomPlacementStrategy = new PatchworkRoomPlacementStrategy();
|
||||
await GenerateMap();
|
||||
}
|
||||
MapGenerator.MapRoot = GetNode<Node>("MapRoot");
|
||||
MapGenerator.LayoutStrategy = new TestLayoutStrategy();
|
||||
MapGenerator.LayoutParsingStrategy = new SequenceLayoutParsingStrategy();
|
||||
MapGenerator.RoomPlacementStrategy = new PatchworkRoomPlacementStrategy();
|
||||
await GenerateMap();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Generate map</para>
|
||||
/// <para>生成地图</para>
|
||||
/// </summary>
|
||||
private async Task GenerateMap()
|
||||
{
|
||||
MapGenerator.Seed = GuidUtils.GetGuid();
|
||||
if (_seedLabel != null)
|
||||
{
|
||||
//If you have a seedLabel, then set the seed to it.
|
||||
//如果有seedLabel,那么将种子设置上去。
|
||||
var seedInfo = TranslationServerUtils.TranslateWithFormat("ui_seed_info", MapGenerator.Seed);
|
||||
_seedLabel.Text = seedInfo ?? $"Seed: {MapGenerator.Seed}";
|
||||
}
|
||||
await MapGenerator.GenerateMap();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>Generate map</para>
|
||||
/// <para>生成地图</para>
|
||||
/// </summary>
|
||||
private async Task GenerateMap()
|
||||
{
|
||||
MapGenerator.Seed = GuidUtils.GetGuid();
|
||||
if (_seedLabel != null)
|
||||
{
|
||||
//If you have a seedLabel, then set the seed to it.
|
||||
//如果有seedLabel,那么将种子设置上去。
|
||||
var seedInfo = TranslationServerUtils.TranslateWithFormat("ui_seed_info", MapGenerator.Seed);
|
||||
_seedLabel.Text = seedInfo ?? $"Seed: {MapGenerator.Seed}";
|
||||
}
|
||||
await MapGenerator.GenerateMap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,100 +20,100 @@ namespace ColdMint.scripts.loader.uiLoader;
|
|||
/// </summary>
|
||||
public partial class SplashScreenLoader : UiLoaderTemplate
|
||||
{
|
||||
private Label? _loadingLabel;
|
||||
private PackedScene? _mainMenuScene;
|
||||
private AnimationPlayer? _animationPlayer;
|
||||
private string _startup = "startup";
|
||||
private Label? _nameLabel;
|
||||
private Label? _loadingLabel;
|
||||
private PackedScene? _mainMenuScene;
|
||||
private AnimationPlayer? _animationPlayer;
|
||||
private string _startup = "startup";
|
||||
private Label? _nameLabel;
|
||||
|
||||
public override void InitializeData()
|
||||
{
|
||||
_mainMenuScene = GD.Load<PackedScene>("res://scenes/mainMenu.tscn");
|
||||
}
|
||||
public override void InitializeData()
|
||||
{
|
||||
_mainMenuScene = GD.Load<PackedScene>("res://scenes/mainMenu.tscn");
|
||||
}
|
||||
|
||||
public override void InitializeUi()
|
||||
{
|
||||
_nameLabel = GetNode<Label>("NameLabel");
|
||||
_loadingLabel = GetNode<Label>("loadingStateLabel");
|
||||
_animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
||||
//Disable animation in Debug mode.
|
||||
//在Debug模式禁用动画。
|
||||
if (Config.IsDebug())
|
||||
{
|
||||
_loadingLabel.Modulate = Colors.White;
|
||||
_nameLabel.Modulate = Colors.White;
|
||||
AnimationFinished(_startup);
|
||||
}
|
||||
else
|
||||
{
|
||||
_animationPlayer.Play(_startup);
|
||||
_animationPlayer.AnimationFinished += AnimationFinished;
|
||||
}
|
||||
}
|
||||
public override void InitializeUi()
|
||||
{
|
||||
_nameLabel = GetNode<Label>("NameLabel");
|
||||
_loadingLabel = GetNode<Label>("loadingStateLabel");
|
||||
_animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
||||
//Disable animation in Debug mode.
|
||||
//在Debug模式禁用动画。
|
||||
if (Config.IsDebug())
|
||||
{
|
||||
_loadingLabel.Modulate = Colors.White;
|
||||
_nameLabel.Modulate = Colors.White;
|
||||
AnimationFinished(_startup);
|
||||
}
|
||||
else
|
||||
{
|
||||
_animationPlayer.Play(_startup);
|
||||
_animationPlayer.AnimationFinished += AnimationFinished;
|
||||
}
|
||||
}
|
||||
|
||||
private async void AnimationFinished(StringName name)
|
||||
{
|
||||
await LoadingGlobalData();
|
||||
if (_mainMenuScene == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
private async void AnimationFinished(StringName name)
|
||||
{
|
||||
await LoadingGlobalData();
|
||||
if (_mainMenuScene == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GetTree().ChangeSceneToPacked(_mainMenuScene);
|
||||
}
|
||||
GetTree().ChangeSceneToPacked(_mainMenuScene);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Load the game's global data</para>
|
||||
/// <para>加载游戏的全局数据</para>
|
||||
/// </summary>
|
||||
private async Task LoadingGlobalData()
|
||||
{
|
||||
//Loading App configuration
|
||||
//加载App配置
|
||||
var appConfigData = AppConfig.LoadFromFile();
|
||||
if (appConfigData != null)
|
||||
{
|
||||
AppConfig.ApplyAppConfig(appConfigData);
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>Load the game's global data</para>
|
||||
/// <para>加载游戏的全局数据</para>
|
||||
/// </summary>
|
||||
private async Task LoadingGlobalData()
|
||||
{
|
||||
//Loading App configuration
|
||||
//加载App配置
|
||||
var appConfigData = AppConfig.LoadFromFile();
|
||||
if (appConfigData != null)
|
||||
{
|
||||
AppConfig.ApplyAppConfig(appConfigData);
|
||||
}
|
||||
|
||||
//Set the minimum log level to Info in debug mode.(Print all logs)
|
||||
//在调试模式下将最小日志等级设置为Info。(打印全部日志)
|
||||
//Disable all logs in the release version.
|
||||
//在发行版禁用所有日志。
|
||||
LogCat.MinLogLevel = Config.IsDebug() ? LogCat.InfoLogLevel : LogCat.DisableAllLogLevel;
|
||||
ContributorDataManager.RegisterAllContributorData();
|
||||
DeathInfoGenerator.RegisterDeathInfoHandler(new SelfDeathInfoHandler());
|
||||
MapGenerator.RegisterRoomInjectionProcessor(new ChanceRoomInjectionProcessor());
|
||||
MapGenerator.RegisterRoomInjectionProcessor(new TimeIntervalRoomInjectorProcessor());
|
||||
//Register the corresponding encoding provider to solve the problem of garbled Chinese path of the compressed package
|
||||
//注册对应的编码提供程序,解决压缩包中文路径乱码问题
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
//创建游戏数据文件夹
|
||||
var dataPath = Config.GetGameDataDirectory();
|
||||
if (!Directory.Exists(dataPath))
|
||||
{
|
||||
Directory.CreateDirectory(dataPath);
|
||||
}
|
||||
//Set the minimum log level to Info in debug mode.(Print all logs)
|
||||
//在调试模式下将最小日志等级设置为Info。(打印全部日志)
|
||||
//Disable all logs in the release version.
|
||||
//在发行版禁用所有日志。
|
||||
LogCat.MinLogLevel = Config.IsDebug() ? LogCat.InfoLogLevel : LogCat.DisableAllLogLevel;
|
||||
ContributorDataManager.RegisterAllContributorData();
|
||||
DeathInfoGenerator.RegisterDeathInfoHandler(new SelfDeathInfoHandler());
|
||||
MapGenerator.RegisterRoomInjectionProcessor(new ChanceRoomInjectionProcessor());
|
||||
MapGenerator.RegisterRoomInjectionProcessor(new TimeIntervalRoomInjectorProcessor());
|
||||
//Register the corresponding encoding provider to solve the problem of garbled Chinese path of the compressed package
|
||||
//注册对应的编码提供程序,解决压缩包中文路径乱码问题
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
//创建游戏数据文件夹
|
||||
var dataPath = Config.GetGameDataDirectory();
|
||||
if (!Directory.Exists(dataPath))
|
||||
{
|
||||
Directory.CreateDirectory(dataPath);
|
||||
}
|
||||
|
||||
//Registered camp
|
||||
//注册阵营
|
||||
var defaultCamp = new Camp(Config.CampId.Default)
|
||||
{
|
||||
FriendInjury = true
|
||||
};
|
||||
CampManager.SetDefaultCamp(defaultCamp);
|
||||
var mazoku = new Camp(Config.CampId.Mazoku);
|
||||
CampManager.AddCamp(mazoku);
|
||||
var aborigines = new Camp(Config.CampId.Aborigines);
|
||||
CampManager.AddCamp(aborigines);
|
||||
//Register ItemTypes from file
|
||||
//从文件注册物品类型
|
||||
ItemTypeRegister.RegisterFromFile();
|
||||
//Hardcoded ItemTypes Register
|
||||
//硬编码注册物品类型
|
||||
ItemTypeRegister.StaticRegister();
|
||||
//静态注册掉落表
|
||||
LootRegister.StaticRegister();
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(500));
|
||||
}
|
||||
}
|
||||
//Registered camp
|
||||
//注册阵营
|
||||
var defaultCamp = new Camp(Config.CampId.Default)
|
||||
{
|
||||
FriendInjury = true
|
||||
};
|
||||
CampManager.SetDefaultCamp(defaultCamp);
|
||||
var mazoku = new Camp(Config.CampId.Mazoku);
|
||||
CampManager.AddCamp(mazoku);
|
||||
var aborigines = new Camp(Config.CampId.Aborigines);
|
||||
CampManager.AddCamp(aborigines);
|
||||
//Register ItemTypes from file
|
||||
//从文件注册物品类型
|
||||
ItemTypeRegister.RegisterFromFile();
|
||||
//Hardcoded ItemTypes Register
|
||||
//硬编码注册物品类型
|
||||
ItemTypeRegister.StaticRegister();
|
||||
//静态注册掉落表
|
||||
LootRegister.StaticRegister();
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(500));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,18 +14,25 @@ public class RoomPlacementData
|
|||
/// <para>放置的位置</para>
|
||||
/// </summary>
|
||||
public Vector2? Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>Place the room template</para>
|
||||
/// <para>放置的房间模板</para>
|
||||
/// </summary>
|
||||
public Room? Room { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>Parent room</para>
|
||||
/// <para>父级房间</para>
|
||||
/// </summary>
|
||||
public Room? ParentRoom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>Parent room slot</para>
|
||||
/// <para>父级房间的插槽</para>
|
||||
/// </summary>
|
||||
public RoomSlot? ParentRoomSlot { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>A slot for the new room</para>
|
||||
/// <para>新房间的插槽</para>
|
||||
|
|
|
@ -16,8 +16,34 @@ public class RoomSlot
|
|||
/// </summary>
|
||||
public bool Matched { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>The starting position of the room slot</para>
|
||||
/// <para>房间插槽的开始位置</para>
|
||||
/// </summary>
|
||||
///<remarks>
|
||||
///<para>As opposed to a tile map. Convert to local location please call <see cref="TileMap.MapToLocal"/></para>
|
||||
///<para>相对于瓦片地图而言的。转换为本地位置请调用<see cref="TileMap.MapToLocal"/></para>
|
||||
/// </remarks>
|
||||
public Vector2I StartPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>The midpoint of the slot</para>
|
||||
/// <para>插槽的中点位置</para>
|
||||
/// </summary>
|
||||
///<remarks>
|
||||
///<para>As opposed to a tile map. Convert to local location please call <see cref="TileMap.MapToLocal"/></para>
|
||||
///<para>相对于瓦片地图而言的。转换为本地位置请调用<see cref="TileMap.MapToLocal"/></para>
|
||||
/// </remarks>
|
||||
public Vector2I MidpointPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <para>The end position of the room slot</para>
|
||||
/// <para>房间插槽的结束位置</para>
|
||||
/// </summary>
|
||||
///<remarks>
|
||||
///<para>As opposed to a tile map. Convert to local location please call <see cref="TileMap.MapToLocal"/></para>
|
||||
///<para>相对于瓦片地图而言的。转换为本地位置请调用<see cref="TileMap.MapToLocal"/></para>
|
||||
/// </remarks>
|
||||
public Vector2I EndPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -194,10 +194,12 @@ public class Room
|
|||
//转为瓦片地图的坐标(中点)
|
||||
var tileMapStartPosition = tileMap.LocalToMap(startPosition);
|
||||
var tileMapEndPosition = tileMap.LocalToMap(endPosition);
|
||||
var midpointPosition = tileMap.LocalToMap(midpointOfRoomSlots);
|
||||
var roomSlot = new RoomSlot
|
||||
{
|
||||
EndPosition = tileMapEndPosition,
|
||||
StartPosition = tileMapStartPosition,
|
||||
MidpointPosition = midpointPosition,
|
||||
//Calculate the orientation of the slot (the midpoint of the room is the origin, the vector pointing to the midpoint of the slot)
|
||||
//计算槽位的方向(房间中点为原点,指向槽位中点的向量)
|
||||
DistanceToMidpointOfRoom = CoordinateUtils.VectorToOrientationArray(midpoint, midpointOfRoomSlots)
|
||||
|
|
|
@ -111,6 +111,27 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
var rootNode = roomPlacementData.Room.RootNode;
|
||||
mapRoot.AddChild(rootNode);
|
||||
rootNode.Position = roomPlacementData.Position.Value;
|
||||
//Place navigation Link
|
||||
//放置导航Link
|
||||
//计算旧房间插槽的绝对位置。
|
||||
if (roomPlacementData.Room != null && roomPlacementData.ParentRoom != null )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
// if (roomPlacementData.NewRoomSlot != null && roomPlacementData.ParentRoomSlot != null &&
|
||||
// roomPlacementData.Position != null)
|
||||
// {
|
||||
// var navigationLink2D = new NavigationLink2D();
|
||||
// navigationLink2D.Position = roomPlacementData.Position.Value;
|
||||
// var startPosition = roomPlacementData.ParentRoomSlot.StartPosition;
|
||||
// var actualStart = startPosition + roomPlacementData.Position.Value;
|
||||
// navigationLink2D.StartPosition = actualStart;
|
||||
// navigationLink2D.EndPosition = roomPlacementData.NewRoomSlot.StartPosition;
|
||||
// mapRoot.AddChild(navigationLink2D);
|
||||
// }
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
|
@ -142,7 +163,7 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
|
||||
//Saves all data in the room template that matches the parent room.
|
||||
//保存房间模板内所有与父房间匹配的数据。
|
||||
var useableRoomPlacementData = new List<RoomPlacementData>();
|
||||
var usableRoomPlacementData = new List<RoomPlacementData>();
|
||||
foreach (var roomRes in roomResArray)
|
||||
{
|
||||
var newRoom = RoomFactory.CreateRoom(roomRes, newRoomNodeData.EnterRoomEventHandlerId,
|
||||
|
@ -169,21 +190,22 @@ public class PatchworkRoomPlacementStrategy : IRoomPlacementStrategy
|
|||
var roomPlacementData = new RoomPlacementData
|
||||
{
|
||||
Room = newRoom,
|
||||
ParentRoom = parentRoomNode,
|
||||
Position = position,
|
||||
ParentRoomSlot = mainRoomSlot,
|
||||
NewRoomSlot = newRoomSlot
|
||||
};
|
||||
useableRoomPlacementData.Add(roomPlacementData);
|
||||
usableRoomPlacementData.Add(roomPlacementData);
|
||||
}
|
||||
|
||||
if (useableRoomPlacementData.Count == 0)
|
||||
if (usableRoomPlacementData.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
var index = randomNumberGenerator.Randi() % useableRoomPlacementData.Count;
|
||||
var roomPlacementData = useableRoomPlacementData[(int)index];
|
||||
var index = randomNumberGenerator.Randi() % usableRoomPlacementData.Count;
|
||||
var roomPlacementData = usableRoomPlacementData[(int)index];
|
||||
//Be sure to mark its slot as a match when you use it.
|
||||
//一定要在使用时,将其插槽标记为匹配。
|
||||
if (roomPlacementData.ParentRoomSlot != null)
|
||||
|
|
Loading…
Reference in New Issue
Block a user