using Newtonsoft.Json;
using System;
using UAssetAPI.UnrealTypes;
namespace UAssetAPI.Kismet.Bytecode.Expressions
{
///
/// A single Kismet bytecode instruction, corresponding to the instruction.
///
public class EX_InstrumentationEvent : KismetExpression
{
///
/// The token of this expression.
///
public override EExprToken Token { get { return EExprToken.EX_InstrumentationEvent; } }
[JsonProperty]
public EScriptInstrumentationType EventType;
[JsonProperty]
public FName EventName;
public EX_InstrumentationEvent()
{
}
///
/// Reads out the expression from a BinaryReader.
///
/// The BinaryReader to read from.
public override void Read(AssetBinaryReader reader)
{
EventType = (EScriptInstrumentationType)reader.ReadByte();
if (EventType.Equals(EScriptInstrumentationType.InlineEvent))
{
EventName = reader.XFER_FUNC_NAME();
}
}
///
/// Writes the expression to a BinaryWriter.
///
/// The BinaryWriter to write from.
/// The iCode offset of the data that was written.
public override int Write(AssetBinaryWriter writer)
{
writer.Write((byte)EventType);
if (EventType.Equals(EScriptInstrumentationType.InlineEvent)) {
writer.XFER_FUNC_NAME(EventName);
return 1 + 2 * sizeof(int);
} else {
return 1;
}
}
}
}