Example #1
0
        static Player()
        {
            var messageTypes = Helpers.GetNonabstractSubclasses(typeof(ServerMessage));

            s_handlerMap = new Dictionary <Type, Action <Player, ServerMessage> >(messageTypes.Count());

            foreach (var type in messageTypes)
            {
                var method = WrapperGenerator.CreateActionWrapper <Player, ServerMessage>("ReceiveMessage", type);
                if (method != null)
                {
                    s_handlerMap[type] = method;
                }
            }
        }
Example #2
0
        static ChangeHandler()
        {
            var changeTypes = Helpers.GetNonabstractSubclasses(typeof(ChangeData));

            s_changeHandlerMap = new Dictionary <Type, Action <ChangeHandler, ChangeData> >(changeTypes.Count());

            foreach (var type in changeTypes)
            {
                var method = WrapperGenerator.CreateActionWrapper <ChangeHandler, ChangeData>("HandleChange", type);
                if (method == null)
                {
                    throw new NotImplementedException(String.Format("No HandleChange method found for {0}", type.Name));
                }
                s_changeHandlerMap[type] = method;
            }
        }
Example #3
0
        static ReportHandler()
        {
            var reportTypes = Helpers.GetNonabstractSubclasses(typeof(GameReport));

            s_reportHandlerMap = new Dictionary <Type, Action <ReportHandler, GameReport> >(reportTypes.Count());

            foreach (var type in reportTypes)
            {
                var method = WrapperGenerator.CreateActionWrapper <ReportHandler, GameReport>("HandleReport", type);
                if (method == null)
                {
                    throw new NotImplementedException(String.Format("No HandleReport method found for {0}", type.Name));
                }
                s_reportHandlerMap[type] = method;
            }
        }