private static void OnLiveReplayAddSpectatorRequestMessageReceived(LiveReplayAddSpectatorRequestMessage message)
        {
            if (LiveReplayManager.TryGet(message.LiveReplayId, out LiveReplay liveReplay) && !liveReplay.ContainsSession(message.SessionId, message.SlotId) && liveReplay.IsInit())
            {
                if (liveReplay.IsFull())
                {
                    ServerRequestManager.SendResponse(new LiveReplayAddSpectatorResponseMessage
                    {
                        ErrorCode = LiveReplayAddSpectatorResponseMessage.Reason.FULL
                    }, message);
                }
                else
                {
                    ServerRequestManager.SendResponse(new LiveReplayAddSpectatorResponseMessage
                    {
                        Success = true
                    }, message);

                    liveReplay.AddSpectator(message.SessionId, message.SlotId);
                }
            }
            else
            {
                ServerRequestManager.SendResponse(new LiveReplayAddSpectatorResponseMessage
                {
                    ErrorCode = LiveReplayAddSpectatorResponseMessage.Reason.NOT_EXISTS
                }, message);
            }
        }
 private static void OnEndLiveReplayMessageReceived(EndLiveReplayMessage message)
 {
     if (LiveReplayManager.TryGet(message.AccountId, out LiveReplay liveReplay))
     {
         liveReplay.SetEnd();
     }
 }
 private static void OnClientUpdateLiveReplayMessageReceived(ClientUpdateLiveReplayMessage message)
 {
     if (LiveReplayManager.TryGet(message.AccountId, out LiveReplay liveReplay))
     {
         liveReplay.SetClientUpdate(message.SubTick, message.Commands);
     }
 }
 private static void OnInitializeLiveReplayMessageReceived(InitializeLiveReplayMessage message)
 {
     if (LiveReplayManager.TryGet(message.AccountId, out LiveReplay liveReplay))
     {
         liveReplay.Init(message.StreamData);
     }
 }
 private static void OnLiveReplayRemoveSpectatorMessageReceived(LiveReplayRemoveSpectatorMessage message)
 {
     if (LiveReplayManager.TryGet(message.AccountId, out LiveReplay liveReplay))
     {
         liveReplay.RemoveSpectator(message.SessionId, message.SlotId);
     }
 }
        private static void OnServerUpdateLiveReplayMessageReceived(ServerUpdateLiveReplayMessage message)
        {
            if (LiveReplayManager.TryGet(message.AccountId, out LiveReplay liveReplay))
            {
                liveReplay.Update(message.Milliseconds);

                if (liveReplay.IsEnded())
                {
                    LiveReplayManager.Remove(liveReplay.GetId());
                }
            }
        }