public static void Load(this BuffHandlerComponent self)
    {
        foreach (Type type in typeof(BuffHandlerComponentSystem).Assembly.GetTypes())
        {
            object[] attrs = type.GetCustomAttributes(typeof(BuffTypeAttribute), false);

            foreach (object attr in attrs)
            {
                BuffTypeAttribute buffTypeAttr = (BuffTypeAttribute)attr;
                BaseBuffHandler   obj          = (BaseBuffHandler)Activator.CreateInstance(type);
                if (!self.BuffHandlerDic.ContainsKey(buffTypeAttr.BuffType))
                {
                    self.BuffHandlerDic.Add(buffTypeAttr.BuffType, obj);
                }
            }
        }
    }
Beispiel #2
0
    public void Load()
    {
        List <Type> types = Game.EventSystem.GetTypes(typeof(BuffTypeAttribute));

        foreach (Type type in types)
        {
            object[] attrs = type.GetCustomAttributes(typeof(BuffTypeAttribute), false);

            foreach (object attr in attrs)
            {
                BuffTypeAttribute buffTypeAttr = (BuffTypeAttribute)attr;
                BaseBuffHandler   obj          = (BaseBuffHandler)Activator.CreateInstance(type);
                if (!this.BuffHandlerDic.ContainsKey(buffTypeAttr.BuffType))
                {
                    this.BuffHandlerDic.Add(buffTypeAttr.BuffType, obj);
                }
            }
        }
    }