Пример #1
0
 public EventMessage(IEventData eventData, SendParameters sendParameters, BroadcastOptions broadcastOptions, string sender)
 {
     this.eventData        = eventData;
     this.sendParameters   = sendParameters;
     this.broadcastOptions = broadcastOptions;
     this.sender           = sender;
 }
        public static BroadcastOptions GetBroadcastOptions(IConfiguration configuration)
        {
            var options = new BroadcastOptions();

            configuration.GetSection("Broadcast").Bind(options);
            return(options);
        }
 public BroadcastServer(BroadcastOptions options,
                        IHttpResponseBuilder httpResponseBuilder,
                        ILogger <BroadcastServer> logger) : base(options.Address, options.Port)
 {
     _httpResponseBuilder = httpResponseBuilder;
     _logger = logger;
 }
Пример #4
0
        protected void PublishChange(IEventData eventData, BroadcastOptions options)
        {
            var sendParameters = new SendParameters {
                Unreliable = false, ChannelId = 0
            };
            var msg = new EventMessage(eventData, sendParameters, options, m_Entity.Name);

            m_Entity.PublishEvent(msg);
        }
Пример #5
0
        public static void SendKinMessage(BroadcastOptions kinMode, IOBAlignment[] aligns, string message)
        {
            if (kinMode == BroadcastOptions.IncludeKin)
            {
                //just forward this request to the overload
                SendKinMessage(aligns, message);
                return;
            }

            //build list of kins to send to
            List <IOBAlignment> kin = new List <IOBAlignment>();

            //add all valid kins first
            foreach (IOBAlignment align in Enum.GetValues(typeof(IOBAlignment)))
            {
                if (align == IOBAlignment.None || align == IOBAlignment.OutCast || align == IOBAlignment.Healer)
                {
                    continue;
                }
                else
                {
                    kin.Add(align);
                }
            }

            //then remove the excluded ones (just easier this way, where the hell is LINQ when you need it ? :< )
            for (int i = kin.Count - 1; i >= 0; i--)
            {
                foreach (IOBAlignment align in aligns)
                {
                    if (kin[i] == align)
                    {
                        kin.RemoveAt(i);
                    }
                }
            }

            SendKinMessage(kin.ToArray(), message);
        }