Example #1
0
        /// <summary>
        /// Parses a gameEventData object, returning a generic event data. We do this instead of
        /// inheritance in case we need to extend events from NLP or another library in the future.
        /// </summary>
        /// <param name="gameEventData"></param>
        /// <returns>A new GenericEventData object with the gameEventData included.</returns>
        public static CommandData Parse(IProtocolEventData gameEventData) {
            return new CommandData() {
                Chats = gameEventData.Chats,
                Players = gameEventData.Players,
                Kills = gameEventData.Kills,
                Moves = gameEventData.Moves,
                Spawns = gameEventData.Spawns,
                Kicks = gameEventData.Kicks,
                Bans = gameEventData.Bans,
                Maps = gameEventData.Maps,
                Settings = gameEventData.Settings

                // Maps?
            };
        }
Example #2
0
        protected void OnProtocolEvent(ProtocolEventType eventType, IProtocolStateDifference difference, IProtocolEventData now = null, IProtocolEventData then = null)
        {
            var handler = this.ProtocolEvent;

            if (handler != null) {
                handler(
                    this,
                    new ProtocolEventArgs() {
                        ProtocolEventType = eventType,
                        ProtocolType = this.ProtocolType as ProtocolType, // Required for serialization. How to get around?
                        StateDifference = difference ?? new ProtocolStateDifference(),
                        Now = now ?? new ProtocolEventData(),
                        Then = then ?? new ProtocolEventData()
                    }
                );
            }
        }