Support for LibrarySettings.
This commit is contained in:
parent
87cd1b0b40
commit
f37888554f
|
@ -0,0 +1,32 @@
|
|||
// AUTOMATICALLY GENERATED, DO NOT EDIT
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Pkmnlib.Generated
|
||||
{
|
||||
internal static class PokemonLibrary
|
||||
{
|
||||
/// <param name="out">PokemonLibrary *&</param>
|
||||
/// <param name="settings">LibrarySettings *</param>
|
||||
/// <param name="species">SpeciesLibrary *</param>
|
||||
/// <param name="moves">MoveLibrary *</param>
|
||||
/// <param name="items">ItemLibrary *</param>
|
||||
/// <param name="growthRates">GrowthRateLibrary *</param>
|
||||
/// <param name="typeLibrary">TypeLibrary *</param>
|
||||
/// <param name="natures">NatureLibrary *</param>
|
||||
/// <returns>unsigned char</returns>
|
||||
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_PokemonLibrary_Construct")]
|
||||
internal static extern byte Construct(ref IntPtr @out, IntPtr settings, IntPtr species, IntPtr moves, IntPtr items, IntPtr growthRates, IntPtr typeLibrary, IntPtr natures);
|
||||
|
||||
/// <param name="p">const PokemonLibrary *</param>
|
||||
/// <returns>void</returns>
|
||||
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_PokemonLibrary_Destruct")]
|
||||
internal static extern void Destruct(IntPtr p);
|
||||
|
||||
/// <param name="p">const PokemonLibrary *</param>
|
||||
/// <returns>const NatureLibrary *</returns>
|
||||
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_PokemonLibrary_GetNatureLibrary")]
|
||||
internal static extern IntPtr GetNatureLibrary(IntPtr p);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using PkmnLibSharp.Utilities;
|
||||
|
||||
namespace PkmnLibSharp.Library
|
||||
{
|
||||
public class LibrarySettings : PointerWrapper
|
||||
{
|
||||
public byte MaximalLevel => Creatureliblibrary.Generated.LibrarySettings.GetMaximalLevel(Ptr);
|
||||
public byte MaximalMoves => Creatureliblibrary.Generated.LibrarySettings.GetMaximalMoves(Ptr);
|
||||
public ushort ShinyRate => Pkmnlib.Generated.LibrarySettings.GetShinyRate(Ptr);
|
||||
|
||||
public LibrarySettings(byte maximalLevel, byte maximalMoves, ushort shinyRate) : base(
|
||||
Pkmnlib.Generated.LibrarySettings.Construct(maximalLevel, maximalMoves, shinyRate))
|
||||
{
|
||||
}
|
||||
|
||||
protected override void DeletePtr()
|
||||
{
|
||||
Pkmnlib.Generated.LibrarySettings.Destruct(Ptr);
|
||||
}
|
||||
}
|
||||
}
|
BIN
PkmnLibSharp/Native/libpkmnLib.so (Stored with Git LFS)
BIN
PkmnLibSharp/Native/libpkmnLib.so (Stored with Git LFS)
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,39 @@
|
|||
using NUnit.Framework;
|
||||
using PkmnLibSharp.Library;
|
||||
|
||||
namespace PkmnLibSharpTests.Library
|
||||
{
|
||||
public class LibrarySettingsTests
|
||||
{
|
||||
[Test]
|
||||
public void ConstructDestruct()
|
||||
{
|
||||
var s = new LibrarySettings(100, 4, 4096);
|
||||
s.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetMaximalLevel()
|
||||
{
|
||||
var s = new LibrarySettings(100, 4, 4096);
|
||||
Assert.AreEqual(s.MaximalLevel, 100);
|
||||
s.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetMaximalMoves()
|
||||
{
|
||||
var s = new LibrarySettings(100, 4, 4096);
|
||||
Assert.AreEqual(s.MaximalMoves, 4);
|
||||
s.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetShiny()
|
||||
{
|
||||
var s = new LibrarySettings(100, 4, 4096);
|
||||
Assert.AreEqual(s.ShinyRate, 4096);
|
||||
s.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue