Beispiel #1
0
        public void Init(string resId_, string resName_)
        {
            res_id   = resId_;
            res_name = resName_;

            ResCfgVo cfg = ResConfig.GetResCfg(resId_);

            m_url = ResConfig.GetResUrl(res_id, res_name, "");
        }
Beispiel #2
0
        static public string GetResPath(string resId_)
        {
            ResCfgVo vo = GetResCfg(resId_);

            if (vo == null)
            {
                return("");
            }
            return(vo.path);
        }
Beispiel #3
0
        /// <summary>
        /// 获取资源类型
        /// </summary>
        /// <param name="resId_"></param>
        /// <returns></returns>
        static public ResType GetResType(string resId_)
        {
            ResCfgVo vo = GetResCfg(resId_);

            if (vo == null)
            {
                return(ResType.INVALID);
            }
            return(vo.res_type);
        }
Beispiel #4
0
        /// <summary>
        /// 获取资源配置
        /// </summary>
        /// <param name="resId_"></param>
        /// <returns></returns>
        static public ResCfgVo GetResCfg(string resId_)
        {
            ResCfgVo vo = null;

            if (m_id2cfg.ContainsKey(resId_))
            {
                vo = m_id2cfg[resId_];
            }
            else
            {
                Log.Assert("找不到资源配置:" + resId_);
            }
            return(vo);
        }
Beispiel #5
0
        /// <summary>
        /// 获取资源路径
        /// </summary>
        /// <param name="resId_"></param>
        /// <param name="resName_"></param>
        /// <param name="suffix">额外指定后缀,不使用配置里的</param>
        /// <returns></returns>
        static public string GetResUrl(string resId_, string resName_ = null, string suffix_ = null)
        {
            ResCfgVo cfgVo = GetResCfg(resId_);

            string resName = resName_ ?? "";
            string suffix  = suffix_ ?? cfgVo.suffix;

            string path = FileUtility.ModifyFileName(cfgVo.path + resName, suffix);

            //if (cfgVo.location == ResLocation.ASSETS)
            //{
            //    path = FileUtil.AssetsPath(path);
            //}

            return(path);
        }