NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/GameWrapper/Map/MapBlockData.cs

101 lines
2.6 KiB
C#
Raw Normal View History

2023-12-20 19:25:48 +08:00
using LC.Newtonsoft.Json;
2023-08-22 19:08:45 +08:00
using System;
2025-06-24 17:08:33 +08:00
using System.Collections.Generic;
2023-08-22 19:08:45 +08:00
using Gameplay;
2023-11-30 15:47:49 +08:00
using PhxhSDK.Phxh;
2024-03-26 12:19:26 +08:00
using Sirenix.OdinInspector;
2023-08-22 19:08:45 +08:00
using UnityEngine;
2023-11-19 22:57:17 +08:00
[Serializable]
2023-08-22 19:08:45 +08:00
public class MapBlockData
{
2025-08-25 17:34:39 +08:00
/// <summary>
/// 普通地图地格属性
/// </summary>
2023-12-18 19:42:46 +08:00
public int TerrainTypeIndex = -1;
2025-08-25 17:34:39 +08:00
/// <summary>
/// 军团使用的地格属性
/// </summary>
public int LegionTypeIndex = -1;
2024-03-26 12:19:26 +08:00
2023-08-22 19:08:45 +08:00
public bool IsDefaultTerrainType()
{
return TerrainTypeIndex == -1;
}
2025-08-25 17:34:39 +08:00
public bool IsDefaultLegionTerrainType()
{
return LegionTypeIndex == -1;
}
2023-08-22 19:08:45 +08:00
2025-06-25 14:29:40 +08:00
/// <summary>
/// 获取地块属性
/// </summary>
/// <returns></returns>
2023-08-22 19:08:45 +08:00
public TerrainTypeProperty GetTerrainTypeProperty()
{
2025-06-25 14:29:40 +08:00
Dictionary<int, TerrainTypeProperty> props = TerrainTypeConfig.DicTerrainTypePropertie;
if (null != props && props.TryGetValue(TerrainTypeIndex, out TerrainTypeProperty terrainTypeProperty))
return terrainTypeProperty;
2024-03-26 12:19:26 +08:00
2023-08-22 19:08:45 +08:00
return TerrainTypeConfig.DefaultTerrainTypeProperty;
}
2025-08-25 17:34:39 +08:00
/// <summary>
2025-08-27 19:39:34 +08:00
/// 获取军团地块属性 (军团地图专属!!)
2025-08-25 17:34:39 +08:00
/// </summary>
/// <returns></returns>
public LegionTerrainTypeProperty GetLegionTerrainTypeProperty()
{
var props = LegionTerrainTypeConfig.DicTerrainTypePropertie;
if (null != props && props.TryGetValue(LegionTypeIndex, out var terrainTypeProperty))
return terrainTypeProperty;
return LegionTerrainTypeConfig.DefaultTerrainTypeProperty;
}
2023-08-22 19:08:45 +08:00
}
[Serializable]
public class TerrainTypeProperty
{
2025-06-25 14:29:40 +08:00
public int id = -1;
2023-08-22 19:08:45 +08:00
public string name;
public bool banAttack;
2025-06-24 13:09:34 +08:00
/// <summary>
/// 通行标记
/// </summary>
2025-06-24 17:45:47 +08:00
[LabelText("通行标记")]public List<int> crossTagIds = new List<int>();
2025-06-24 13:09:34 +08:00
2024-03-26 12:19:26 +08:00
public bool AddBuff;
2023-08-22 19:08:45 +08:00
2025-06-26 16:10:52 +08:00
[ShowIf("AddBuff")] public List<int> configIds = new List<int>();
2023-08-22 19:08:45 +08:00
[HideInInspector] public string buffObjectPath;
2025-08-25 17:34:39 +08:00
[JsonConverter(typeof(ColorJsonConverter))]
public Color Color;
}
[Serializable]
public class LegionTerrainTypeProperty
{
public int id = -1;
public string name;
/// <summary>
/// 通行标记
/// </summary>
[LabelText("通行标记")] public List<int> crossTagIds = new List<int>();
public bool AddBuff;
[ShowIf("AddBuff")] public List<int> configIds = new List<int>();
[HideInInspector] public string buffObjectPath;
2024-03-26 12:19:26 +08:00
[JsonConverter(typeof(ColorJsonConverter))]
public Color Color;
}