예제 #1
0
        public Chat(IRemoteGame game, OGPPlayer sender, List <OGPPlayer> players, GameParameters parameters)
        {
            var           participants_uris = new HashSet <string>();
            List <string> procNames         = new List <string>();

            this.game         = game ?? throw new ArgumentNullException(nameof(game));
            this.self         = sender ?? throw new ArgumentNullException(nameof(sender));
            this.participants = players ?? throw new ArgumentNullException(nameof(players));
            this.parameters   = parameters ?? throw new ArgumentNullException(nameof(parameters));

            foreach (var player in players)
            {
                procNames.Add(player.ChatProcessName);
                participants_uris.Add(player.ChatUri);
            }

            this.localClock = new VectorClock(procNames);
            this.multicast  = new RemoteReliableMulticast(participants_uris, sender.ChatUri);
            this.multicast.MessageDeliveredEvent += multicastDeliverMessageEventHandler;
        }
예제 #2
0
 public ChatMessage(OGPPlayer sender, string message, VectorClock clock)
 {
     this.sender  = sender ?? throw new ArgumentNullException(nameof(sender));
     this.message = message ?? throw new ArgumentNullException(nameof(message));
     this.Clock   = clock ?? throw new ArgumentNullException(nameof(clock));
 }