2023-08-22 19:08:45 +08:00
|
|
|
using System;
|
|
|
|
|
using UnityEngine;
|
2024-06-04 16:50:16 +08:00
|
|
|
using Sirenix.OdinInspector;
|
2023-11-06 18:20:55 +08:00
|
|
|
using UnityEngine.Serialization;
|
2024-06-04 16:50:16 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Runtime.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
|
|
|
}
|
|
|
|
|
|
2024-06-04 16:50:16 +08:00
|
|
|
[Serializable]
|
|
|
|
|
public class ProtectUnit
|
|
|
|
|
{
|
2024-06-04 17:21:01 +08:00
|
|
|
[HorizontalGroup("Protect")]
|
2024-06-04 16:50:16 +08:00
|
|
|
public int id;
|
|
|
|
|
[HorizontalGroup("Protect")] [LabelText("护送起点")]
|
|
|
|
|
public int protectStartPoint;
|
|
|
|
|
[HorizontalGroup("Protect")] [LabelText("护送终点")]
|
|
|
|
|
public int protectTargetPoint;
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
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;
|
2024-08-28 15:04:25 +08:00
|
|
|
[Sirenix.OdinInspector.ReadOnly]
|
2023-08-22 19:08:45 +08:00
|
|
|
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);
|
2024-07-22 14:46:20 +08:00
|
|
|
[LabelText("编组")] public List<int> groups = new List<int>(4);
|
2023-10-19 15:00:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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()
|
|
|
|
|
{
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
|
2024-06-04 12:59:37 +08:00
|
|
|
[LabelText("占领进度")]
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
public int captureProgress;
|
|
|
|
|
|
|
|
|
|
[LabelText("扛旗终点区")]
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
public int flagTargetRegionId;
|
|
|
|
|
|
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-10-19 15:00:19 +08:00
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
[LabelText("阶段")]
|
|
|
|
|
public List<Stage> stages = new List<Stage>(8);
|
|
|
|
|
|
2024-08-27 14:18:39 +08:00
|
|
|
[LabelText("设置该关卡为评分关卡")] public bool scoreLevel = false;
|
|
|
|
|
|
|
|
|
|
[LabelText("星级目标"), HideIf("scoreLevel")] [ListDrawerSettings(HideAddButton = true, HideRemoveButton = true)]
|
2024-06-04 12:59:37 +08:00
|
|
|
public List<ConditionModifier> starTarget = new()
|
|
|
|
|
{
|
|
|
|
|
new ConditionModifier(ConditionUtil.LevelStarConditionFilter),
|
|
|
|
|
new ConditionModifier(ConditionUtil.LevelStarConditionFilter),
|
|
|
|
|
new ConditionModifier(ConditionUtil.LevelStarConditionFilter)
|
|
|
|
|
};
|
2024-08-27 14:18:39 +08:00
|
|
|
|
|
|
|
|
[LabelText("评分目标"), ShowIf("scoreLevel")] [ListDrawerSettings(CustomAddFunction = "OnAddScoreCondition")]
|
|
|
|
|
public List<ConditionModifier> scoreTarget = new List<ConditionModifier>(15);
|
|
|
|
|
|
|
|
|
|
private void OnAddScoreCondition()
|
|
|
|
|
{
|
|
|
|
|
ConditionModifier conditionModifier = new();
|
|
|
|
|
conditionModifier.SetFilterTypes(ConditionUtil.LevelScoreConditionFilter, true);
|
|
|
|
|
scoreTarget.Add(conditionModifier);
|
|
|
|
|
}
|
2023-11-08 15:05:19 +08:00
|
|
|
|
2023-11-16 15:57:47 +08:00
|
|
|
[HideInInspector]
|
2023-08-22 19:08:45 +08:00
|
|
|
public List<NPCInfo> npcInfos = new List<NPCInfo>(16);
|
2024-06-04 16:50:16 +08:00
|
|
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
public List<ProtectUnit> protectUnitInfos = new List<ProtectUnit>(4);
|
2023-11-08 15:05:19 +08:00
|
|
|
|
2024-08-09 17:31:20 +08:00
|
|
|
|
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);
|
|
|
|
|
}
|
2024-11-01 18:33:42 +08:00
|
|
|
|
|
|
|
|
foreach (var scoreCondition in scoreTarget)
|
|
|
|
|
{
|
|
|
|
|
scoreCondition.SetFilterTypes(ConditionUtil.LevelScoreConditionFilter, scoreLevel);
|
|
|
|
|
}
|
2023-11-08 15:05:19 +08:00
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
}
|
|
|
|
|
}
|