72 lines
1.8 KiB
C#
72 lines
1.8 KiB
C#
using System;
|
|
using PkmnLibSharp.Utilities;
|
|
|
|
namespace PkmnLibSharp.Library
|
|
{
|
|
public enum EffectParameterType : byte
|
|
{
|
|
None = 0,
|
|
Bool = 1,
|
|
Int = 2,
|
|
Float = 3,
|
|
String = 4,
|
|
}
|
|
|
|
public class EffectParameter : PointerWrapper
|
|
{
|
|
internal EffectParameter(IntPtr ptr) : base(ptr){}
|
|
|
|
public EffectParameter(string s) : base(Creaturelib.Generated.EffectParameter.FromString(s.ToPtr()))
|
|
{
|
|
}
|
|
|
|
public EffectParameter(bool b) : base(Creaturelib.Generated.EffectParameter.FromBool(b.ToNative()))
|
|
{
|
|
}
|
|
|
|
public EffectParameter(long l) : base(Creaturelib.Generated.EffectParameter.FromInt(l))
|
|
{
|
|
}
|
|
|
|
public EffectParameter(float f) : base(Creaturelib.Generated.EffectParameter.FromFloat(f))
|
|
{
|
|
}
|
|
|
|
public EffectParameterType ParameterType =>
|
|
(EffectParameterType) Creaturelib.Generated.EffectParameter.GetType(Ptr);
|
|
|
|
public bool AsBool()
|
|
{
|
|
byte b = 0;
|
|
Creaturelib.Generated.EffectParameter.AsBool(Ptr, ref b).Assert();
|
|
return b == 1;
|
|
}
|
|
|
|
public long AsInt()
|
|
{
|
|
long i = 0;
|
|
Creaturelib.Generated.EffectParameter.AsInt(Ptr, ref i).Assert();
|
|
return i;
|
|
}
|
|
|
|
public float AsFloat()
|
|
{
|
|
float f = 0;
|
|
Creaturelib.Generated.EffectParameter.AsFloat(Ptr, ref f).Assert();
|
|
return f;
|
|
}
|
|
|
|
public string AsString()
|
|
{
|
|
var p = IntPtr.Zero;
|
|
Creaturelib.Generated.EffectParameter.AsString(Ptr, ref p).Assert();
|
|
return p.PtrString()!;
|
|
}
|
|
|
|
|
|
protected override void DeletePtr()
|
|
{
|
|
Creaturelib.Generated.EffectParameter.Destruct(Ptr);
|
|
}
|
|
}
|
|
} |