Example #1
0
        public static void Register_OnAddType_OnRemoveType_OnUpdateAdjacentType()
        {
            foreach (BaseType type in types.Values)
            {
                Type typeOftype = type.GetType();

                if (!ItemTypes.IndexLookup.IndexLookupTable.ContainsValue(type.key))
                {
                    Log.Write(string.Format("<color=red>There is no type called {0}</color>"), type.key);
                    types.Remove(type.key);
                    continue;
                }

                if (typeOftype.GetMethod("RegisterOnAdd").DeclaringType == typeOftype)
                {
                    ItemTypesServer.RegisterOnAdd(type.key, type.RegisterOnAdd);
                }

                if (typeOftype.GetMethod("RegisterOnRemove").DeclaringType == typeOftype)
                {
                    ItemTypesServer.RegisterOnRemove(type.key, type.RegisterOnRemove);
                }

                if (typeOftype.GetMethod("RegisterOnUpdateAdjacent").DeclaringType == typeOftype)
                {
                    ItemTypesServer.RegisterOnUpdateAdjacent(type.key, type.RegisterOnUpdateAdjacent);
                }
            }
        }