2023-08-22 19:08:45 +08:00
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
2023-11-06 19:18:24 +08:00
|
|
|
|
using System.Runtime.Serialization;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using UnityEngine;
|
2023-11-06 18:20:55 +08:00
|
|
|
|
using UnityEngine.Serialization;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
|
|
namespace Gameplay.Level
|
|
|
|
|
|
{
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
|
public class LevelData
|
|
|
|
|
|
{
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
|
public class Stage
|
|
|
|
|
|
{
|
|
|
|
|
|
[LabelText("名称")]
|
|
|
|
|
|
private string name;
|
|
|
|
|
|
[LabelText("描述")]
|
|
|
|
|
|
private string desc;
|
2023-11-06 18:20:55 +08:00
|
|
|
|
[FormerlySerializedAs("goal")]
|
2023-08-22 19:08:45 +08:00
|
|
|
|
[LabelText("胜利条件")]
|
2023-11-21 15:04:56 +08:00
|
|
|
|
public ConditionModifier successCondition = new(ConditionUtil.LevelSuccessConditionFilter);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
[LabelText("失败条件")]
|
2023-11-06 18:20:55 +08:00
|
|
|
|
[ListDrawerSettings(CustomAddFunction = "OnAddFailCondition")]
|
|
|
|
|
|
public List<ConditionModifier> failConditions = new();
|
2023-11-06 19:18:24 +08:00
|
|
|
|
|
2023-11-06 18:20:55 +08:00
|
|
|
|
private void OnAddFailCondition()
|
|
|
|
|
|
{
|
2023-11-06 19:18:24 +08:00
|
|
|
|
ConditionModifier conditionModifier = new();
|
|
|
|
|
|
conditionModifier.SetFilterTypes(ConditionUtil.LevelFailConditionFilter);
|
2023-11-06 18:20:55 +08:00
|
|
|
|
failConditions.Add(conditionModifier);
|
|
|
|
|
|
}
|
2023-11-06 19:18:24 +08:00
|
|
|
|
|
|
|
|
|
|
[OnDeserialized]
|
|
|
|
|
|
public void OnAfterDeserialize(System.Runtime.Serialization.StreamingContext context)
|
|
|
|
|
|
{
|
|
|
|
|
|
successCondition.SetFilterTypes(ConditionUtil.LevelSuccessConditionFilter);
|
|
|
|
|
|
foreach (var failCondition in failConditions)
|
|
|
|
|
|
{
|
|
|
|
|
|
failCondition.SetFilterTypes(ConditionUtil.LevelFailConditionFilter);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public enum WeatherType
|
|
|
|
|
|
{
|
|
|
|
|
|
[LabelText("晴天")]
|
|
|
|
|
|
Sunny,
|
|
|
|
|
|
[LabelText("沙尘暴")]
|
|
|
|
|
|
SandStorm,
|
|
|
|
|
|
[LabelText("雨天")]
|
|
|
|
|
|
Rain,
|
|
|
|
|
|
[LabelText("雪天")]
|
|
|
|
|
|
Snow,
|
|
|
|
|
|
[LabelText("雾天")]
|
|
|
|
|
|
Fog,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public enum DayNightType
|
|
|
|
|
|
{
|
|
|
|
|
|
[LabelText("白天")]
|
|
|
|
|
|
Day,
|
|
|
|
|
|
[LabelText("晚上")]
|
|
|
|
|
|
Night,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
[Serializable]
|
|
|
|
|
|
public class NPCInfo
|
|
|
|
|
|
{
|
2023-11-16 15:57:47 +08:00
|
|
|
|
[Sirenix.OdinInspector.ReadOnly]
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public int id;
|
|
|
|
|
|
public int level;
|
2023-11-16 15:57:47 +08:00
|
|
|
|
[Sirenix.OdinInspector.ReadOnly]
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public Vector2Int position;
|
|
|
|
|
|
[LabelText("AI类型")]
|
|
|
|
|
|
public AIType aIType;
|
|
|
|
|
|
[LabelText("特殊触发AI")]
|
|
|
|
|
|
public AttachAIType attachAIType;
|
|
|
|
|
|
[LabelText("朝向")]
|
|
|
|
|
|
public CharacterToward npcToward;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
[LabelText("巡逻信息")]
|
|
|
|
|
|
public List<PatrolInfo> patrolInfos = new List<PatrolInfo>(4);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
|
public class PatrolInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
[HorizontalGroup("PatrolInfo")]
|
|
|
|
|
|
[LabelText("巡逻点位")]
|
|
|
|
|
|
public Vector2Int patrolPoint;
|
|
|
|
|
|
[HorizontalGroup("PatrolInfo")]
|
|
|
|
|
|
[LabelText("等待时间")]
|
|
|
|
|
|
public float waitTime = 0f;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public enum CharacterToward
|
|
|
|
|
|
{
|
|
|
|
|
|
TopLeft,
|
|
|
|
|
|
TopRight,
|
|
|
|
|
|
Right,
|
|
|
|
|
|
BottomRight,
|
|
|
|
|
|
BottomLeft,
|
|
|
|
|
|
Left,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public enum AIType
|
|
|
|
|
|
{
|
|
|
|
|
|
BasicAI,
|
|
|
|
|
|
FallBackAI,
|
2023-10-19 15:00:19 +08:00
|
|
|
|
FallBackIntensifyAI,
|
2023-08-22 19:08:45 +08:00
|
|
|
|
OutflankAI,
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public enum AttachAIType
|
|
|
|
|
|
{
|
|
|
|
|
|
None,
|
|
|
|
|
|
ChainAI,
|
|
|
|
|
|
ProvokeAI,
|
|
|
|
|
|
SpecialBehaviorAI,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-21 15:04:56 +08:00
|
|
|
|
// public LevelData(string id) {
|
|
|
|
|
|
//
|
|
|
|
|
|
// this.id = id;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
public LevelData()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2023-11-06 18:20:55 +08:00
|
|
|
|
|
2023-11-21 15:04:56 +08:00
|
|
|
|
// [LabelText("关卡ID")]
|
|
|
|
|
|
// public string id;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2023-11-21 15:04:56 +08:00
|
|
|
|
// [Sirenix.OdinInspector.ReadOnly]
|
|
|
|
|
|
// [LabelText("地图名称")]
|
|
|
|
|
|
// public string mapName;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
|
|
[LabelText("出战区")]
|
2023-11-16 15:57:47 +08:00
|
|
|
|
[HideInInspector]
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public int preparingRegionId;
|
|
|
|
|
|
|
|
|
|
|
|
[LabelText("出战区朝向")]
|
2023-11-16 15:57:47 +08:00
|
|
|
|
[HideInInspector]
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public CharacterToward preparingRegionToward;
|
|
|
|
|
|
|
|
|
|
|
|
[LabelText("撤退区")]
|
2023-11-16 15:57:47 +08:00
|
|
|
|
[HideInInspector]
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public int fallbackRegionId;
|
|
|
|
|
|
|
|
|
|
|
|
[LabelText("敌方撤退区")]
|
2023-11-16 15:57:47 +08:00
|
|
|
|
[HideInInspector]
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public int enemyFallbackRegionId;
|
|
|
|
|
|
|
2023-12-26 18:19:05 +08:00
|
|
|
|
[LabelText("PVP防守区")]
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public int pvpDefendRegionId;
|
|
|
|
|
|
|
|
|
|
|
|
[LabelText("PVP防守方朝向")]
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
|
public CharacterToward pvpDefendToward;
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
[LabelText("天气")]
|
|
|
|
|
|
public WeatherType weatherType = WeatherType.Sunny;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
|
|
|
|
|
[LabelText("昼夜")]
|
|
|
|
|
|
public DayNightType dayNightType = DayNightType.Day;
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
[LabelText("阶段")]
|
|
|
|
|
|
public List<Stage> stages = new List<Stage>(8);
|
|
|
|
|
|
|
2023-11-08 15:05:19 +08:00
|
|
|
|
[LabelText("星级目标")]
|
|
|
|
|
|
[ListDrawerSettings(HideAddButton = true,HideRemoveButton = true)]
|
2023-11-21 16:15:07 +08:00
|
|
|
|
public List<ConditionModifier> starTarget = new(){new ConditionModifier(ConditionUtil.LevelStarConditionFilter),new ConditionModifier(ConditionUtil.LevelStarConditionFilter),new ConditionModifier(ConditionUtil.LevelStarConditionFilter)};
|
2023-11-08 15:05:19 +08:00
|
|
|
|
|
2023-11-16 15:57:47 +08:00
|
|
|
|
/*[InfoBox("敌人默认朝向为六边形TopLeft,以游戏视角的六边形为模板方向")]
|
|
|
|
|
|
[LabelText("敌人")] */
|
|
|
|
|
|
[HideInInspector]
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public List<NPCInfo> npcInfos = new List<NPCInfo>(16);
|
2023-11-08 15:05:19 +08:00
|
|
|
|
|
|
|
|
|
|
[OnDeserialized]
|
|
|
|
|
|
public void OnAfterDeserialize(StreamingContext context)
|
|
|
|
|
|
{
|
2023-11-21 15:04:56 +08:00
|
|
|
|
if (starTarget.Count != 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
starTarget.Clear();
|
|
|
|
|
|
starTarget.Add(new ConditionModifier());
|
|
|
|
|
|
starTarget.Add(new ConditionModifier());
|
|
|
|
|
|
starTarget.Add(new ConditionModifier());
|
|
|
|
|
|
}
|
2023-11-08 15:05:19 +08:00
|
|
|
|
foreach (var starCondition in starTarget)
|
|
|
|
|
|
{
|
|
|
|
|
|
starCondition.SetFilterTypes(ConditionUtil.LevelStarConditionFilter);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|