zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/XNodeDemo/NewSkill/RunTime/SkillOption_延迟操作.cs

65 lines
1.9 KiB
C#

using ET;
using MongoDB.Bson.Serialization.Attributes;
using Sirenix.OdinInspector;
#if UNITY_EDITOR
using UnityEngine;
using XNode;
#endif
namespace Cal
{
[GUIColor(0.8f, 0.9f, 0.2f)]
[System.Serializable]
[BsonIgnoreExtraElements]
public class SkillOption_ : SkillOptionBase
{
public override SkillOptionType optionType => SkillOptionType.;
[BoxGroup("$optionType", CenterLabel = true)]
[LabelText("延迟时间")]
#if UNITY
[SerializeField]
#endif
public SkillParam time;
[HideInInspector]
public SkillOptionBase[] value;
#if UNITY
[LabelText("操作")]
[BsonIgnore]
[Output] public float options;
public override NodePort GetNodePort(string fieldName)
{
if (fieldName == nameof(value))
{
return GetOutputPort("options");
}
return null;
}
public override void Serilize(SkillOptionBase skillOption)
{
var succeed = GetOutputPort("options");
if (succeed.IsConnected)
{
var targetArr = new SkillOptionBase[0];
foreach (var port in succeed.GetConnections())
{
SkillOptionBase _skillOption = System.Activator.CreateInstance(port.node.GetType()) as SkillOptionBase;
port.node.As<SkillOptionBase>().DeepClone(_skillOption);
port.node.As<SkillOptionBase>().Clear();
UnityEditor.ArrayUtility.Add(ref targetArr, _skillOption);
_skillOption.Serilize(_skillOption);
}
skillOption.As<SkillOption_>().value = targetArr;
}
}
internal override void Clear()
{
value = null;
}
#endif
}
}