Data/Scripts/WeaponCore/Api/WeaponCoreApi.cs
/// <summary>
/// Ask WeaponCore to send the API methods.
/// <para>Throws an exception if it gets called more than once per session without <see cref="Unload"/>.</para>
/// </summary>
/// <param name="readyCallback">Method to be called when WeaponCore replies.</param>
/// <param name="getWeaponDefinitions">Set to true to fill <see cref="WeaponDefinitions"/>.</param>
Ask WeaponCore to send the API methods.
Throws an exception if it gets called more than once per session without .
Ask WeaponCore to send the API methods . Throws an exception if it gets called more than once per session without .
public void Load(Action readyCallback = null, bool getWeaponDefinitions = false)
        {
            if (_isRegistered)
                throw new Exception($"{GetType().Name}.Load() should not be called multiple times!");
            _readyCallback = readyCallback;
            _getWeaponDefinitions = getWeaponDefinitions;
            _isRegistered = true;
            MyAPIGateway.Utilities.RegisterMessageHandler(Channel, HandleMessage);
            MyAPIGateway.Utilities.SendModMessage(Channel, "ApiEndpointRequest");
        }
public void Load ( Action readyCallback = null , bool getWeaponDefinitions = false ) { if ( _isRegistered ) throw new Exception ( $" { GetType ( ) . Name } .Load() should not be called multiple times! " ) ; _readyCallback = readyCallback ; _getWeaponDefinitions = getWeaponDefinitions ; _isRegistered = true ; MyAPIGateway . Utilities . RegisterMessageHandler ( Channel , HandleMessage ) ; MyAPIGateway . Utilities . SendModMessage ( Channel , " " ) ; }
Ask WeaponCore to send the API methods.
Ask WeaponCore to send the API methods .
readyCallback
Action
Method to be called when WeaponCore replies.
Method to be called when WeaponCore replies .
getWeaponDefinitions
bool
Set to true to fill .
Set to true to fill .