Dont lose references to libraries
This commit is contained in:
parent
471c082527
commit
ce54b8c2c2
|
@ -10,6 +10,7 @@ namespace PkmnLibSharp.Battling
|
||||||
private StatCalculator? _statCalculator;
|
private StatCalculator? _statCalculator;
|
||||||
private DamageLibrary? _damageLibrary;
|
private DamageLibrary? _damageLibrary;
|
||||||
private MiscLibrary? _miscLibrary;
|
private MiscLibrary? _miscLibrary;
|
||||||
|
private ScriptResolver? _scriptResolver;
|
||||||
private ExperienceLibrary? _experienceLibrary;
|
private ExperienceLibrary? _experienceLibrary;
|
||||||
|
|
||||||
public PokemonLibrary StaticLibrary
|
public PokemonLibrary StaticLibrary
|
||||||
|
@ -89,6 +90,12 @@ namespace PkmnLibSharp.Battling
|
||||||
Pkmnlib.Generated.BattleLibrary.Construct(ref ptr, staticLibrary.Ptr, statCalculator.Ptr, damageLibrary.Ptr,
|
Pkmnlib.Generated.BattleLibrary.Construct(ref ptr, staticLibrary.Ptr, statCalculator.Ptr, damageLibrary.Ptr,
|
||||||
experienceLibrary.Ptr, scriptResolver.Ptr, miscLibrary.Ptr).Assert();
|
experienceLibrary.Ptr, scriptResolver.Ptr, miscLibrary.Ptr).Assert();
|
||||||
Initialize(ptr);
|
Initialize(ptr);
|
||||||
|
_static = staticLibrary;
|
||||||
|
_statCalculator = statCalculator;
|
||||||
|
_damageLibrary = damageLibrary;
|
||||||
|
_experienceLibrary = experienceLibrary;
|
||||||
|
_scriptResolver = scriptResolver;
|
||||||
|
_miscLibrary = miscLibrary;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DeletePtr()
|
protected override void DeletePtr()
|
||||||
|
|
|
@ -115,7 +115,7 @@ namespace PkmnLibSharp.Library
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal PokemonLibrary(IntPtr ptr) : base(ptr)
|
public PokemonLibrary(IntPtr ptr) : base(ptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +127,13 @@ namespace PkmnLibSharp.Library
|
||||||
Pkmnlib.Generated.PokemonLibrary.Construct(ref ptr, settings.Ptr, species.Ptr, moves.Ptr, items.Ptr,
|
Pkmnlib.Generated.PokemonLibrary.Construct(ref ptr, settings.Ptr, species.Ptr, moves.Ptr, items.Ptr,
|
||||||
growthRates.Ptr, types.Ptr, natures.Ptr).Assert();
|
growthRates.Ptr, types.Ptr, natures.Ptr).Assert();
|
||||||
Initialize(ptr);
|
Initialize(ptr);
|
||||||
|
_settings = settings;
|
||||||
|
_species = species;
|
||||||
|
_moves = moves;
|
||||||
|
_items = items;
|
||||||
|
_growthRateLibrary = growthRates;
|
||||||
|
_typeLibrary = types;
|
||||||
|
_natureLibrary = natures;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DeletePtr()
|
protected override void DeletePtr()
|
||||||
|
|
Loading…
Reference in New Issue