Пример #1
0
        public IMapPlaceable CreateType(teMapPlaceableData.CommonStructure commonStructure, BinaryReader reader)
        {
            IMapPlaceable value = new teMapPlaceableDummy((int)commonStructure.Size);

            if (Types.TryGetValue(commonStructure.Type, out Type placeableType))
            {
                value = (IMapPlaceable)Activator.CreateInstance(placeableType);
            }
            else if (_misingTypes.Add(commonStructure.Type))
            {
                Debugger.Log(0, "teMapPlaceableManager", $"Unhandled placeable type: {commonStructure.Type}\r\n");
            }
            value.Read(reader);
            return(value);
        }
Пример #2
0
        public IMapPlaceable CreateType(teMapPlaceableData.CommonStructure commonStructure, BinaryReader reader)
        {
            if (Types.ContainsKey(commonStructure.Type))
            {
                IMapPlaceable value = (IMapPlaceable)Activator.CreateInstance(Types[commonStructure.Type]);
                value.Read(reader);
                return(value);
            }

            if (_misingTypes.Add(commonStructure.Type))
            {
                Debugger.Log(0, "teMapPlaceableManager", $"Unhandled placeable type: {commonStructure.Type}\r\n");
            }
            return(null);
        }