/// <summary>
        ///     When the session ID is updated by Multiplay, it indicates that a new match has begun. There will also be new match
        ///     data available via the session service endpoint.
        ///     If backfill is dependent on reading the previous match data, this is the first valid point in time to call
        ///     backfill.
        /// </summary>
        void CheckForSessionChange()
        {
            if (DateTime.Now - m_LastConfigCheck < k_ConfigCheckInterval)
            {
                return;
            }

            m_LastConfigCheck = DateTime.Now;

            if (!File.Exists(m_ConfigPath))
            {
                return;
            }

            var newConfig = MultiplayConfig.ReadConfigFile(m_ConfigPath);

            // Diff session/allocation ids to see if config has been updated:
            if (m_MultiplayConfig?.SessionId == newConfig?.SessionId || string.IsNullOrEmpty(newConfig?.SessionId))
            {
                return; // Session ID hasn't changed, don't do anything
            }
            Debug.Log($"Session Id Changed: Old Value '{m_MultiplayConfig?.SessionId ?? "null"}', new Value '{newConfig.SessionId}'");
            m_MultiplayConfig = newConfig;
            var backfillLogic = new BackfillLogic(m_MultiplayConfig, m_ServerSettings);

            backfillLogic.PerformBackfill();
        }
Beispiel #2
0
 public BackfillLogic(MultiplayConfig multiplayConfig, ServerSettings settings)
 {
     m_Settings        = settings ?? throw new ArgumentNullException(nameof(settings));
     m_MultiplayConfig = multiplayConfig ?? throw new ArgumentNullException(nameof(multiplayConfig));
 }