美文网首页
音乐文件路径管理

音乐文件路径管理

作者: 貪狼大人 | 来源:发表于2017-11-01 21:19 被阅读0次
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class ResourseLoad : SingletonMono<ResourseLoad> 
    {
    
        public T ResourceLoadObj<T>(/*meiju*/object obj) where T:Object
        {
            string currentName = obj.GetType().Name;
            //路径
            string filePath = string.Empty;
            switch (currentName)
            {
                case "Music_Main":                
                    {
                        filePath = "Music/Main/" + obj.ToString();
                        break;
                    }
                case "Music_Item":
                    {
                        filePath = "Music/Items/" + obj.ToString();
                        break;
                    }
                case "Music_Feeds":
                    {
                        filePath = "Music/Feeds/" + obj.ToString();
                        break;
                    }
                case "Monsters":
                    {
                        filePath = "Music/Monsters/" + obj.ToString();
                        break;
                    }
                case "Towers":
                    {
                        filePath = "Music/Towers/" + obj.ToString();
                        break;
                    }
                default:
                    break;
            }
            return Resources.Load<T>(filePath);
        }
    }
    
    

    相关文章

      网友评论

          本文标题:音乐文件路径管理

          本文链接:https://www.haomeiwen.com/subject/xeqnpxtx.html