制作商店标记中
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.8 KiB |
|
@ -1 +1 @@
|
|||
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[]]}]
|
||||
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[{"Position":{"X":48,"Y":15},"Size":{"X":0,"Y":0},"SpecialMarkType":3,"DelayTime":0,"MarkList":[]}]]}]
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
@ -1 +1 @@
|
|||
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[]]}]
|
||||
[{"Name":"Preinstall1","Weight":100,"Remark":"","AutoFill":true,"WaveList":[[{"Position":{"X":0,"Y":0},"Size":{"X":0,"Y":0},"SpecialMarkType":4,"DelayTime":0,"MarkList":[]}]]}]
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 3.2 KiB |
|
@ -106,6 +106,14 @@ public static class PreinstallMarkManager
|
|||
{
|
||||
return "出口标记";
|
||||
}
|
||||
else if (type == SpecialMarkType.ShopBoss)
|
||||
{
|
||||
return "商店老板标记";
|
||||
}
|
||||
else if (type == SpecialMarkType.Box)
|
||||
{
|
||||
return "奖励箱子标记";
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
|
|
@ -98,11 +98,66 @@ public class RoomPreinstall : IDestroy
|
|||
{
|
||||
var mark = new ActivityMark();
|
||||
if (markInfo.SpecialMarkType == SpecialMarkType.Normal) //普通标记
|
||||
{
|
||||
if (HandlerNormalMark(world, markInfo, mark)) continue;
|
||||
}
|
||||
else if (markInfo.SpecialMarkType == SpecialMarkType.BirthPoint) //玩家出生标记
|
||||
{
|
||||
|
||||
}
|
||||
else if (markInfo.SpecialMarkType == SpecialMarkType.OutPoint) //出口标记
|
||||
{
|
||||
|
||||
}
|
||||
else if (markInfo.SpecialMarkType == SpecialMarkType.ShopBoss) //商店老板标记
|
||||
{
|
||||
|
||||
}
|
||||
else if (markInfo.SpecialMarkType == SpecialMarkType.Box) //奖励宝箱标记
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("暂未支持的类型: " + markInfo.SpecialMarkType);
|
||||
continue;
|
||||
}
|
||||
|
||||
mark.DelayTime = markInfo.DelayTime;
|
||||
mark.MarkType = markInfo.SpecialMarkType;
|
||||
//随机刷新坐标
|
||||
var pos = markInfo.Position.AsVector2();
|
||||
var birthRect = markInfo.Size.AsVector2();
|
||||
var tempPos = new Vector2(
|
||||
world.Random.RandomRangeInt((int)(pos.X - birthRect.X / 2), (int)(pos.X + birthRect.X / 2)),
|
||||
world.Random.RandomRangeInt((int)(pos.Y - birthRect.Y / 2), (int)(pos.Y + birthRect.Y / 2))
|
||||
);
|
||||
mark.Position = RoomInfo.ToGlobalPosition(tempPos);
|
||||
wave.Add(mark);
|
||||
}
|
||||
}
|
||||
|
||||
//自动填充操作
|
||||
if (RoomPreinstallInfo.AutoFill)
|
||||
{
|
||||
world.RandomPool.FillAutoWave(this);
|
||||
}
|
||||
|
||||
//排序操作
|
||||
foreach (var wave in WaveList)
|
||||
{
|
||||
wave.Sort((a, b) => (int)(a.DelayTime * 1000 - b.DelayTime * 1000));
|
||||
}
|
||||
//判断是否有敌人
|
||||
CheckHasEnemy();
|
||||
}
|
||||
|
||||
private static bool HandlerNormalMark(World world, MarkInfo markInfo, ActivityMark mark)
|
||||
{
|
||||
MarkInfoItem markInfoItem;
|
||||
if (markInfo.MarkList.Count == 0)
|
||||
{
|
||||
continue;
|
||||
return true;
|
||||
}
|
||||
else if (markInfo.MarkList.Count == 1)
|
||||
{
|
||||
|
@ -140,7 +195,7 @@ public class RoomPreinstall : IDestroy
|
|||
else //非随机物体
|
||||
{
|
||||
Debug.LogError("未知的随机物体:" + markInfoItem.Id);
|
||||
continue;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -165,48 +220,8 @@ public class RoomPreinstall : IDestroy
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (markInfo.SpecialMarkType == SpecialMarkType.BirthPoint) //玩家出生标记
|
||||
{
|
||||
|
||||
}
|
||||
else if (markInfo.SpecialMarkType == SpecialMarkType.OutPoint) //出口标记
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("暂未支持的类型: " + markInfo.SpecialMarkType);
|
||||
continue;
|
||||
}
|
||||
|
||||
mark.DelayTime = markInfo.DelayTime;
|
||||
mark.MarkType = markInfo.SpecialMarkType;
|
||||
//随机刷新坐标
|
||||
var pos = markInfo.Position.AsVector2();
|
||||
var birthRect = markInfo.Size.AsVector2();
|
||||
var tempPos = new Vector2(
|
||||
world.Random.RandomRangeInt((int)(pos.X - birthRect.X / 2), (int)(pos.X + birthRect.X / 2)),
|
||||
world.Random.RandomRangeInt((int)(pos.Y - birthRect.Y / 2), (int)(pos.Y + birthRect.Y / 2))
|
||||
);
|
||||
mark.Position = RoomInfo.ToGlobalPosition(tempPos);
|
||||
wave.Add(mark);
|
||||
}
|
||||
}
|
||||
|
||||
//自动填充操作
|
||||
if (RoomPreinstallInfo.AutoFill)
|
||||
{
|
||||
world.RandomPool.FillAutoWave(this);
|
||||
}
|
||||
|
||||
//排序操作
|
||||
foreach (var wave in WaveList)
|
||||
{
|
||||
wave.Sort((a, b) => (int)(a.DelayTime * 1000 - b.DelayTime * 1000));
|
||||
}
|
||||
//判断是否有敌人
|
||||
CheckHasEnemy();
|
||||
return false;
|
||||
}
|
||||
|
||||
private void CheckHasEnemy()
|
||||
|
@ -435,9 +450,9 @@ public class RoomPreinstall : IDestroy
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取房间内的玩家生成标记
|
||||
/// 获取房间内的特殊标记
|
||||
/// </summary>
|
||||
public ActivityMark GetPlayerBirthMark()
|
||||
public ActivityMark GetSpecialMark(SpecialMarkType specialMarkType)
|
||||
{
|
||||
if (WaveList.Count == 0)
|
||||
{
|
||||
|
@ -445,7 +460,7 @@ public class RoomPreinstall : IDestroy
|
|||
}
|
||||
|
||||
var activityMarks = WaveList[0];
|
||||
var activityMark = activityMarks.FirstOrDefault(mark => mark.MarkType == SpecialMarkType.BirthPoint);
|
||||
var activityMark = activityMarks.FirstOrDefault(mark => mark.MarkType == specialMarkType);
|
||||
return activityMark;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,4 +16,12 @@ public enum SpecialMarkType
|
|||
/// 地牢出口
|
||||
/// </summary>
|
||||
OutPoint,
|
||||
/// <summary>
|
||||
/// 宝箱房刷新点
|
||||
/// </summary>
|
||||
Box,
|
||||
/// <summary>
|
||||
/// 商店房商店老板刷新点
|
||||
/// </summary>
|
||||
ShopBoss,
|
||||
}
|
|
@ -53,16 +53,7 @@ public class RoomPreinstallInfo
|
|||
/// </summary>
|
||||
public void InitSpecialMark(DungeonRoomType roomType)
|
||||
{
|
||||
var type = SpecialMarkType.Normal;
|
||||
if (roomType == DungeonRoomType.Inlet) //初始房间
|
||||
{
|
||||
type = SpecialMarkType.BirthPoint;
|
||||
}
|
||||
else if (roomType == DungeonRoomType.Outlet) //结束房间
|
||||
{
|
||||
type = SpecialMarkType.OutPoint;
|
||||
}
|
||||
|
||||
var type = GetRoomSpecialMark(roomType);
|
||||
if (type != SpecialMarkType.Normal)
|
||||
{
|
||||
var preloading = WaveList[0];
|
||||
|
@ -74,4 +65,56 @@ public class RoomPreinstallInfo
|
|||
preloading.Add(markInfo);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查是否创建了特殊标记, 如果没有, 则会自动创建并返回false
|
||||
/// </summary>
|
||||
public bool CheckSpecialMark(DungeonRoomType roomType)
|
||||
{
|
||||
var type = GetRoomSpecialMark(roomType);
|
||||
if (type == SpecialMarkType.Normal)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (WaveList.Count> 0)
|
||||
{
|
||||
var markInfos = WaveList[0];
|
||||
foreach (var markInfo in markInfos)
|
||||
{
|
||||
if (markInfo.SpecialMarkType == type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InitSpecialMark(roomType);
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定类型房间中应该存在的特殊标记数据类型
|
||||
/// </summary>
|
||||
public SpecialMarkType GetRoomSpecialMark(DungeonRoomType roomType)
|
||||
{
|
||||
if (roomType == DungeonRoomType.Inlet) //初始房间
|
||||
{
|
||||
return SpecialMarkType.BirthPoint;
|
||||
}
|
||||
else if (roomType == DungeonRoomType.Outlet) //结束房间
|
||||
{
|
||||
return SpecialMarkType.OutPoint;
|
||||
}
|
||||
else if (roomType == DungeonRoomType.Shop) //商店房间
|
||||
{
|
||||
return SpecialMarkType.ShopBoss;
|
||||
}
|
||||
else if (roomType == DungeonRoomType.Reward) //奖励房间
|
||||
{
|
||||
return SpecialMarkType.Box;
|
||||
}
|
||||
|
||||
return SpecialMarkType.Normal;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,9 @@ public static class EditorPlayManager
|
|||
|
||||
private static DungeonConfig _config;
|
||||
|
||||
/// <summary>
|
||||
/// 地牢编辑器中的播放按钮
|
||||
/// </summary>
|
||||
public static void Play(UiBase prevUi)
|
||||
{
|
||||
if (IsPlay)
|
||||
|
|
|
@ -186,6 +186,14 @@ public static class ResourceManager
|
|||
{
|
||||
return LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_BirthMark_png);
|
||||
}
|
||||
else if (markInfo.SpecialMarkType == SpecialMarkType.Box) //宝箱
|
||||
{
|
||||
return LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_BirthMark_png);
|
||||
}
|
||||
else if (markInfo.SpecialMarkType == SpecialMarkType.ShopBoss) //商店老板
|
||||
{
|
||||
return LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_BirthMark_png);
|
||||
}
|
||||
else if (markInfo.MarkList != null) //普通标记
|
||||
{
|
||||
if (markInfo.MarkList.Count > 1) //多个物体
|
||||
|
|
|
@ -480,7 +480,7 @@ public partial class DungeonManager : Node2D
|
|||
yield return 0;
|
||||
|
||||
//初始房间创建玩家标记
|
||||
var playerBirthMark = StartRoomInfo.RoomPreinstall.GetPlayerBirthMark();
|
||||
var playerBirthMark = StartRoomInfo.RoomPreinstall.GetSpecialMark(SpecialMarkType.BirthPoint);
|
||||
|
||||
//创建玩家
|
||||
var player = Player.Current;
|
||||
|
|
|
@ -152,6 +152,11 @@ public partial class MapEditorMapMarkPanel : MapEditorMapMark
|
|||
item.InitWaveList();
|
||||
}
|
||||
|
||||
//检测是否创建特殊标记
|
||||
if (!item.CheckSpecialMark(EditorTileMapManager.SelectRoom.RoomInfo.RoomType))
|
||||
{
|
||||
EventManager.EmitEvent(EventEnum.OnTileMapDirty);
|
||||
}
|
||||
optionButton.AddItem($"{item.Name} ({item.Weight})");
|
||||
}
|
||||
|
||||
|
|