Пример #1
0
 // clean up all resources
 public void CleanUpResource()
 {
     m_activeFile = null;
     m_assetDirContents.Clear();
     BrushMap.Clear();
     AssetMap.Clear();
 }
Пример #2
0
 public LevelContent(Level level, IEnumerable <KeyValuePair <Guid, string> > assetMap)
     : this(level)
 {
     foreach (var kvp in assetMap)
     {
         AssetMap.Add(kvp.Key, kvp.Value);
     }
 }
Пример #3
0
        public Texture2D GetInstanceTexture(string asset)
        {
            if (AssetMap.ContainsValue(asset))
            {
                return(AssetMap.FirstOrDefault(pair => pair.Value == asset).Key);
            }
            Texture2D toReturn = Content.Load <Texture2D>(asset);

            AssetMap[toReturn] = asset;
            return(toReturn);
        }
Пример #4
0
        static public void CreatModelAsset()
        {
            string tgamepath = "Assets/Resources/Game/Models";
            string texpaths  = "Assets/Resources/Game/ModelsTexture";
            string texports  = "Assets/ExportResources";

            List <AssetMap.AssetObject> tfiles = GetFileList(tgamepath, true);

            tfiles.AddRange(GetFileList(texpaths, true));
            tfiles.AddRange(GetFileList(texports, false));
            AssetMap asset = ScriptableObject.CreateInstance <AssetMap>();

            asset.assets = tfiles.ToArray();
            AssetDatabase.CreateAsset(asset, "Assets/Resources/ResourcesMap.asset");
            AssetDatabase.Refresh();
            Debug.Log("生成资源表成功.");
        }
Пример #5
0
        public void Create(AssetMap map, VideoMemory videoMemory)
        {
            var surfaceTileSheet = videoMemory.GetSprite <SurfaceTileSheet>(map.AssetTileSheetName);

            this.Name      = map.Name;
            this.MapWidth  = map.MapWidth;
            this.MapHeight = map.MapHeight;
            this.Tiles     = new MapTileDescriptor[map.MapWidth * map.MapHeight];

            for (int index = 0; index < this.Tiles.Length; index++)
            {
                this.Tiles[index] = map.Tiles[index];
            }

            this.TileSheet = surfaceTileSheet;

            this.Width  = map.MapWidth * surfaceTileSheet.TileWidth;
            this.Height = map.MapHeight * surfaceTileSheet.TileHeight;
        }
Пример #6
0
 public Texture2D GetInstanceTexture(string asset, bool cache = true)
 {
     if (AssetMap.ContainsValue(asset))
     {
         return(AssetMap.FirstOrDefault(pair => pair.Value == asset).Key);
     }
     try
     {
         Texture2D toReturn = Content.Load <Texture2D>(asset);
         if (cache)
         {
             AssetMap[toReturn] = asset;
         }
         return(toReturn);
     }
     catch (ContentLoadException exception)
     {
         Console.Error.WriteLine(exception.ToString());
         return(Content.Load <Texture2D>("newgui/error"));
     }
 }
 public bool TryGetValue(string assetBundleRelativePath, out AssetBundleInfo info)
 {
     return(AssetMap.TryGetValue(assetBundleRelativePath, out info));
 }
 public bool Exists(string assetBundleRelativePath)
 {
     return(AssetMap.ContainsKey(assetBundleRelativePath));
 }