Beispiel #1
0
        void ProcessConectedClientMessage(ReceivedClientMessage message)
        {
            message.Client.RefreshLastActivity();

            switch (message.Message.Message.Event)
            {
            case "position":  PositionUpdated?.Invoke(message); break;

            case "netobjcreate":
                var newNetObj = JsonConvert.DeserializeObject <NetObj>(message.Message.Message.Data.ToString());
                _logger.LogInfo("netobjcreate: " + message.Message.Message.Data.ToString());
                NetObjCreated?.Invoke(message.Client, newNetObj);
                break;

            case "request-ownership": OwnershipRequested?.Invoke(message.Client, new Guid(message.Message.Message.Data.ToString())); break;

            default: BadConnectedClientMessage?.Invoke(message); break;
            }
        }
Beispiel #2
0
 public void SendPositionToOtherClients(ReceivedClientMessage message)
 {
     SendMessageToOtherClients(new UdpMessage("position", message.Message.Message.Data), message.Client);
 }