-
-
Notifications
You must be signed in to change notification settings - Fork 0
API Features
Host-backed feature modules. All methods are static and must be invoked on the main thread.
public static class Strings
{
public static void Free(IntPtr ptr);
}Frees an unmanaged UTF-8 string previously allocated by the host.
public static class Log
{
public static void PrintLog(string message);
public static void PrintWarning(string message);
public static void PrintError(string message);
public static void Debug(string message);
}Routes log messages into the host's logging system.
public static class Scene
{
public static string GetCurrentScenePath();
}Returns the resource path of the current scene, or an empty string if none.
public static class Config
{
public static string GetCharacterImagePath(string imageName);
public static string GetPluginsDirectory();
}Path helpers. GetPluginsDirectory() returns the host's designated plugin folder.
public static class Timing
{
public static double GetTimeSinceStartup();
}Returns seconds elapsed since host startup.
public static class Story
{
public static string GetCurrentTimelineName();
public static bool IsBattle();
}Timeline / narrative status.
public static partial class Card
{
// Enumeration
public static int GetCardCount();
public static string GetCardNameAt(int index);
public static bool Contains(string name);
// Metadata
public static string GetDisplayName(string name);
public static string GetDescription(string name);
public static string GetImageName(string name);
public static int GetCost(string name);
public static int GetBaseAttack(string name);
public static int GetMaxStack(string name);
public static int GetWeight(string name);
public static int GetAttackType(string name);
public static int GetCardType(string name);
// Applied effects
public static int GetAppliedEffectCount(string name);
public static string GetAppliedEffectId(string name, int index);
public static string GetAppliedEffectName(string name, int index);
public static int GetAppliedEffectCategory(string name, int index);
public static int GetAppliedEffectDuration(string name, int index);
public static bool GetAppliedEffectIsStackable(string name, int index);
public static int GetAppliedEffectMaxStacks(string name, int index);
public static float GetAppliedEffectParam1(string name, int index);
public static float GetAppliedEffectParam2(string name, int index);
}public static CardAttackType GetAttackTypeEnum(string name);
public static CardCategory GetCardTypeEnum(string name);
public static EffectCategory GetAppliedEffectCategoryEnum(string name, int index);
public static CardEffectInfo[] GetAppliedEffects(string name);CardEffectInfo is a readonly record struct containing EffectId, Name, Category, Duration, IsStackable, MaxStacks, Param1, Param2.
public static partial class Entity
{
// Enumeration (raw API)
public static int GetEntityCount();
public static int GetEntityIdAt(int index, IntPtr out16Bytes);
// Lookup and metadata
public static bool Contains(ulong low, ulong high);
public static string GetName(ulong low, ulong high);
public static string GetDisplayName(ulong low, ulong high);
public static string GetImagePath(ulong low, ulong high);
// Attributes
public static int GetMaxHP(ulong low, ulong high);
public static int GetCurrentHP(ulong low, ulong high);
public static int GetAttackPower(ulong low, ulong high);
public static int GetDodgeChance(ulong low, ulong high);
public static int GetShieldValue(ulong low, ulong high);
public static int GetArmorValue(ulong low, ulong high);
public static int GetCurrentCost(ulong low, ulong high);
public static int GetMaxCost(ulong low, ulong high);
// State
public static bool IsAlive(ulong low, ulong high);
public static bool IsDead(ulong low, ulong high);
public static bool CanAct(ulong low, ulong high);
public static bool IsPlayer(ulong low, ulong high);
public static bool IsMob(ulong low, ulong high);
// Effects
public static int GetEffectCount(ulong low, ulong high);
public static string GetEffectId(ulong low, ulong high, int index);
public static string GetEffectName(ulong low, ulong high, int index);
public static int GetEffectCategory(ulong low, ulong high, int index);
public static int GetEffectRemainingDuration(ulong low, ulong high, int index);
public static int GetEffectCurrentStacks(ulong low, ulong high, int index);
public static int GetEffectMaxStacks(ulong low, ulong high, int index);
}public static EntityId GetEntityIdAt(int index);
public static EntityId[] GetAllEntityIds();
// All of the above with EntityId overloads
public static bool Contains(EntityId id);
public static string GetDisplayName(EntityId id);
public static int GetCurrentHP(EntityId id);
// ... (all others)
public static EffectCategory GetEffectCategoryEnum(EntityId id, int index);
public static EntityEffectInfo[] GetAllEffects(EntityId id);EntityEffectInfo is a readonly record struct containing EffectId, Name, Category, RemainingDuration, CurrentStacks, MaxStacks.
public static class EventBus
{
public static void On<T>(EventType type, Action<T> handler) where T : unmanaged;
public static void Off<T>(EventType type, Action<T> handler) where T : unmanaged;
}High-level, strongly-typed event subscription. The generic T must be an unmanaged struct — one of the payloads defined in NativePluginKit.Events.EventData.
Example
EventBus.On<EntityDamagedEvent>(EventType.EntityDamaged, e => { /* ... */ });
EventBus.Off<EntityDamagedEvent>(EventType.EntityDamaged, handler);Internally the EventBus uses GCHandle to pass a converter instance through the userData slot of the raw EventBridge.Register.