Adds interface for LearnableMoves
This commit is contained in:
parent
65d55a95fa
commit
8bb62aa260
|
@ -0,0 +1,20 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using PkmnLibSharp.StaticData;
|
||||||
|
|
||||||
|
using LevelInt = System.Byte;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.FFI.StaticData
|
||||||
|
{
|
||||||
|
internal static class LearnableMoves
|
||||||
|
{
|
||||||
|
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern IntPtr learnable_moves_new();
|
||||||
|
|
||||||
|
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern void learnable_moves_drop(IntPtr p);
|
||||||
|
|
||||||
|
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
internal static extern void learnable_moves_add_level_move(IntPtr p, LevelInt level, IntPtr moveName);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
using PkmnLibSharp.Utils;
|
||||||
|
using Interface = PkmnLibSharp.FFI.StaticData.LearnableMoves;
|
||||||
|
using LevelInt = System.Byte;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.StaticData
|
||||||
|
{
|
||||||
|
public class LearnableMoves : ExternPointer<object>
|
||||||
|
{
|
||||||
|
public LearnableMoves() : base(Interface.learnable_moves_new(), true)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddLevelMove(LevelInt level, string moveName)
|
||||||
|
{
|
||||||
|
Interface.learnable_moves_add_level_move(Ptr, level, moveName.ToPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddLevelMove(LevelInt level, MoveData move)
|
||||||
|
{
|
||||||
|
Interface.learnable_moves_add_level_move(Ptr, level, move.Name.ToPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override object CreateCache() => new object();
|
||||||
|
|
||||||
|
protected override void Destructor() => Interface.learnable_moves_drop(Ptr);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue