This commit is contained in:
2026-07-09 21:33:33 +02:00
commit 84a2a365f3
2364 changed files with 950134 additions and 0 deletions
@@ -0,0 +1,47 @@
using System;
using System.Collections;
using System.Linq;
using Sirenix.OdinInspector;
using VOID.Generic.Dict;
using VOID.ScriptableObjects.World;
namespace VOID.Generic.World
{
[Serializable]
public class AreaConnection
{
[HorizontalGroup("Row1")]
[ReadOnly]
public Direction2D direction;
[HorizontalGroup("Row1")]
[DisableIf(nameof(type), AreaConnectionType.Inner)]
[OnValueChanged(nameof(OnConnectionTypeChange))]
[ValueDropdown(nameof(GetConnectionTypes))]
public AreaConnectionType type;
[HorizontalGroup("Row2")]
[DisableIf(nameof(IsNotEditable))]
public AreaConnectionTag tag;
[HorizontalGroup("Row2")]
[DisableIf(nameof(IsNotEditable))]
[MinValue(0)]
public int floor;
private void OnConnectionTypeChange()
{
if (IsNotEditable())
{
tag = null;
floor = 0;
}
}
private bool IsNotEditable() => type is AreaConnectionType.Inner or AreaConnectionType.None;
private IEnumerable GetConnectionTypes() => Enum.GetValues(typeof(AreaConnectionType)).Cast<AreaConnectionType>()
.Where(ct => ct != AreaConnectionType.Inner)
.Select(ct => new ValueDropdownItem(Enum.GetName(typeof(AreaConnectionType), ct), (int)ct));
}
}