コード例 #1
0
    /// <summary>
    /// Exits the client, terminating the game process.
    /// </summary>
    public void Exit()
    {
        this.LogTrace("ExitClient()");

        if (_clientProvider.Get().GetEditorModeEnabled())
        {
            ExitUtil.ExitEditor();
            return;
        }

        // Fire onExit event
        if (_onExit != null)
        {
            _onExit();
        }

        if (((_clientProvider.Get().GetPlatform() == Platform.iOS) && _configProvider.Get().GetClientCleanExitIosEnabled()) ||
            ((_clientProvider.Get().GetPlatform() == Platform.Android) && _configProvider.Get().GetClientCleanExitAndroidEnabled()))
        {
            // If clean exit is enabled, allow Unity to cleanly shut down.
            ExitUtil.CleanExit();
            return;
        }

        // On fall-through, we hard exit by killing the process
        ExitUtil.HardExit();
    }