Exemplo n.º 1
0
    public static void UnregisterCallbacks(
        WillSetupHandler willSetup       = null,
        DidSetupHandler didSetup         = null,
        DidRestoreHandler didRestore     = null,
        WillShutdownHandler willShutdown = null,
        DidShutdownHandler didShutdown   = null
        )
    {
#if !IS_RELEASE
        --callbackCounter;
#endif // !IS_RELEASE

        if (willSetup != null)
        {
            onWillSetupSystems -= willSetup;
        }
        if (didSetup != null)
        {
            onDidSetupSystems -= didSetup;
        }
        if (didRestore != null)
        {
            onDidRestoreSystem -= didRestore;
        }
        if (willShutdown != null)
        {
            onWillShutdownSystems -= willShutdown;
        }
        if (didShutdown != null)
        {
            onDidShutdownSystems -= didShutdown;
        }
    }
Exemplo n.º 2
0
    public static void RegisterCallbacks(
        WillSetupHandler willSetup       = null,
        DidSetupHandler didSetup         = null,
        DidRestoreHandler didRestore     = null,
        WillShutdownHandler willShutdown = null,
        DidShutdownHandler didShutdown   = null
        )
    {
        if (willSetup != null)
        {
            onWillSetupSystems += willSetup;
        }
        if (didSetup != null)
        {
            onDidSetupSystems += didSetup;
        }
        if (didRestore != null)
        {
            onDidRestoreSystem += didRestore;
        }
        if (willShutdown != null)
        {
            onWillShutdownSystems += willShutdown;
        }
        if (didShutdown != null)
        {
            onDidShutdownSystems += didShutdown;
        }

#if !IS_RELEASE
        ++callbackCounter;
#endif // !IS_RELEASE

        if (instance == null)
        {
            return;
        }

        if (isSetup)
        {
            if (willSetup != null)
            {
                willSetup();
            }
            if (didSetup != null)
            {
                didSetup();
            }
        }

        if (instance.restoreResult != null)
        {
            if (didRestore != null)
            {
                didRestore(instance.restoreResult.Value);
            }
        }
    }