コード例 #1
0
        /// <summary>
        /// Called when a generic message has arrived. Notifies game arena of message
        /// </summary>
        /// <param name="ownerId">The original broadcaster of the message</param>
        /// <param name="payload">The message object</param>
        /// <param name="time">The time the message was sent, used for projecting the state to current time.</param>
        private void ApplyGenericMessage(ulong id, object payload, double time)
        {
            log?.Debug($"Received generic message from client {INetworkEntityExtensions.UnpackClientId(id)}");

            if (payload == null)
            {
                var msg = "Bad or missing payload for generic message.";
                log?.Error(msg);
                throw new RedGrinException(msg);
            }

            GameArena?.HandleGenericMessage(id, payload, time);

            BroadcastIfServer(id, payload, NetworkMessageType.Generic);
        }