コード例 #1
0
        public static void RegisterMap(Mod owner, string assetName, MapInformation mapInformation)
        {
            if (!RegisteredMaps.ContainsKey(assetName))
            {
                RegisteredMaps[assetName] = new List <MapInformation>();
            }

            RegisteredMaps[assetName].Add(mapInformation);
        }
コード例 #2
0
        public static TileSheet GetMatchingTileSheetInList(TileSheet toMatch, ReadOnlyCollection <TileSheet> list, MapInformation map)
        {
            TileSheet matchingTileSheet = null;

            foreach (TileSheet injectingTileSheet in list)
            {
                if (MatchTileSheetsByTexture(toMatch, injectingTileSheet))
                {
                    matchingTileSheet = injectingTileSheet;
                }
            }
            if (matchingTileSheet == null)
            {
                throw new Exception($"Could not find matching tilesheet {toMatch.ImageSource} in mod {map.Owner.ModSettings.Name} in map {map.Map.Id}!");
            }

            return(matchingTileSheet);
        }
コード例 #3
0
        public static Layer GetMatchingLayerInList(Layer toMatch, ReadOnlyCollection <Layer> list, MapInformation map)
        {
            Layer matchingLayer = null;

            foreach (Layer injectingLayer in list)
            {
                if (MatchLayersById(toMatch, injectingLayer))
                {
                    matchingLayer = injectingLayer;
                }
            }
            if (matchingLayer == null)
            {
                throw new Exception($"Could not find matching layer {toMatch.Id} in mod {map.Owner.ModSettings.Name} in map {map.Map.Id}!");
            }

            return(matchingLayer);
        }