101 lines
2.5 KiB
C#
101 lines
2.5 KiB
C#
using LC.Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Gameplay;
|
|
using PhxhSDK.Phxh;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class MapBlockData
|
|
{
|
|
/// <summary>
|
|
/// 普通地图地格属性
|
|
/// </summary>
|
|
public int TerrainTypeIndex = -1;
|
|
|
|
/// <summary>
|
|
/// 军团使用的地格属性
|
|
/// </summary>
|
|
public int LegionTypeIndex = -1;
|
|
|
|
public bool IsDefaultTerrainType()
|
|
{
|
|
return TerrainTypeIndex == -1;
|
|
}
|
|
|
|
public bool IsDefaultLegionTerrainType()
|
|
{
|
|
return LegionTypeIndex == -1;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取地块属性
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public TerrainTypeProperty GetTerrainTypeProperty()
|
|
{
|
|
Dictionary<int, TerrainTypeProperty> props = TerrainTypeConfig.DicTerrainTypePropertie;
|
|
if (null != props && props.TryGetValue(TerrainTypeIndex, out TerrainTypeProperty terrainTypeProperty))
|
|
return terrainTypeProperty;
|
|
|
|
return TerrainTypeConfig.DefaultTerrainTypeProperty;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取地块属性
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public LegionTerrainTypeProperty GetLegionTerrainTypeProperty()
|
|
{
|
|
var props = LegionTerrainTypeConfig.DicTerrainTypePropertie;
|
|
if (null != props && props.TryGetValue(LegionTypeIndex, out var terrainTypeProperty))
|
|
return terrainTypeProperty;
|
|
|
|
return LegionTerrainTypeConfig.DefaultTerrainTypeProperty;
|
|
}
|
|
|
|
}
|
|
|
|
[Serializable]
|
|
public class TerrainTypeProperty
|
|
{
|
|
public int id = -1;
|
|
public string name;
|
|
public bool banAttack;
|
|
|
|
/// <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;
|
|
|
|
[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;
|
|
|
|
[JsonConverter(typeof(ColorJsonConverter))]
|
|
public Color Color;
|
|
} |