Пример #1
0
    uint GetIdByType <T>() where T : IMessage
    {
        Type t = typeof(T);

        if (!type2iddic.ContainsKey(t))
        {
            MessageIDAttribute ca = t.GetCustomAttribute <MessageIDAttribute>(false);
            type2iddic[t] = ca.main * MAINNUM + ca.sub;
        }
        return(type2iddic[t]);
    }
Пример #2
0
    public void Quest(IMessage data)
    {
        byte[] arr = null;
        if (data != null)
        {
            data.ToData(out arr);
        }
        MessageIDAttribute att = data.GetType().GetCustomAttribute <MessageIDAttribute>(false);

        Quest(att.main, att.sub, arr);
    }