コード例 #1
0
        private void HandlePlayerConnected(IConnectedPlayer player)
        {
            Plugin.Log?.Info($"Player '{player.userId}' joined");
            var extendedPlayer = new ExtendedPlayer(player);

            players[player.userId] = extendedPlayer;
            playerConnectedEvent?.Invoke(extendedPlayer);
        }
コード例 #2
0
        public void RegisterCallback <T>(ExtendedSessionManager.MessageType serializerType, Action <T, ExtendedPlayer> callback, Func <T> constructor) where T : INetSerializable
        {
            Action <T, IConnectedPlayer> extendedCallback = delegate(T packet, IConnectedPlayer player)
            {
                ExtendedPlayer extendedPlayer = GetExtendedPlayer(player);
                callback(packet, extendedPlayer);
            };

            _packetSerializer.RegisterCallback(serializerType, extendedCallback, constructor);
        }
コード例 #3
0
 private void HandlePlayerPacket(ExtendedPlayerPacket packet, ExtendedPlayer player)
 {
     Plugin.Log?.Info($"Received 'ExtendedPlayerPacket' from '{player.userId}' with '{packet.platformID}'");
     player.platformID = packet.platformID;
 }
コード例 #4
0
 private void OnPlayerConnected(ExtendedPlayer player)
 {
     SendLocalPlayerPacket();
 }