mirror of
https://github.com/EggLinks/DanhengServer-OpenSource.git
synced 2026-01-02 20:26:03 +08:00
93 lines
3.6 KiB
C#
93 lines
3.6 KiB
C#
using EggLink.DanhengServer.Enums.Scene;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Converters;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace EggLink.DanhengServer.Data.Config;
|
|
|
|
public class PropInfo : PositionInfo
|
|
{
|
|
public int MappingInfoID { get; set; }
|
|
public int AnchorGroupID { get; set; }
|
|
public int AnchorID { get; set; }
|
|
public int PropID { get; set; }
|
|
public int EventID { get; set; }
|
|
public int CocoonID { get; set; }
|
|
public int FarmElementID { get; set; }
|
|
public bool IsClientOnly { get; set; }
|
|
|
|
public PropValueSource? ValueSource { get; set; }
|
|
public string? InitLevelGraph { get; set; }
|
|
|
|
[JsonConverter(typeof(StringEnumConverter))]
|
|
public PropStateEnum State { get; set; } = PropStateEnum.Closed;
|
|
|
|
[JsonIgnore] public Dictionary<int, List<int>> UnlockDoorID { get; set; } = [];
|
|
|
|
[JsonIgnore] public Dictionary<int, List<int>> UnlockControllerID { get; set; } = [];
|
|
|
|
[JsonIgnore] public int MazePieceCount { get; set; }
|
|
|
|
public void Load(GroupInfo info)
|
|
{
|
|
if (ValueSource != null)
|
|
foreach (var v in ValueSource.Values)
|
|
try
|
|
{
|
|
var key = v["Key"];
|
|
var value = v["Value"];
|
|
if (value != null && key != null)
|
|
{
|
|
if (key.ToString() == "ListenTriggerCustomString")
|
|
{
|
|
info.PropTriggerCustomString.TryGetValue(value.ToString(), out var list);
|
|
if (list == null)
|
|
{
|
|
list = [];
|
|
info.PropTriggerCustomString.Add(value.ToString(), list);
|
|
}
|
|
|
|
list.Add(ID);
|
|
}
|
|
else if (key.ToString().Contains("Door") ||
|
|
key.ToString().Contains("Bridge") ||
|
|
key.ToString().Contains("UnlockTarget") ||
|
|
key.ToString().Contains("Rootcontamination") ||
|
|
key.ToString().Contains("Portal"))
|
|
{
|
|
try
|
|
{
|
|
if (UnlockDoorID.ContainsKey(int.Parse(value.ToString().Split(",")[0])) == false)
|
|
UnlockDoorID.Add(int.Parse(value.ToString().Split(",")[0]), []);
|
|
UnlockDoorID[int.Parse(value.ToString().Split(",")[0])]
|
|
.Add(int.Parse(value.ToString().Split(",")[1]));
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
else if (key.ToString().Contains("Controller"))
|
|
{
|
|
try
|
|
{
|
|
if (UnlockControllerID.ContainsKey(int.Parse(value.ToString().Split(",")[0])) == false)
|
|
UnlockControllerID.Add(int.Parse(value.ToString().Split(",")[0]), []);
|
|
UnlockControllerID[int.Parse(value.ToString().Split(",")[0])]
|
|
.Add(int.Parse(value.ToString().Split(",")[1]));
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
}
|
|
|
|
public class PropValueSource
|
|
{
|
|
public List<JObject> Values { get; set; } = [];
|
|
} |