private void AddAtlasPathNode(string atlasName, string fullPath) { if (AtlasPathNodeList == null) { AtlasPathNodeList = new List <AtlasPathNode>(); } string _atlasName = atlasName.Substring(0, atlasName.Length - 12);// 删除".spriteatlas"; string _atlasRelativePath = fullPath.Split(new string[] { "Export/" }, StringSplitOptions.RemoveEmptyEntries)[1]; AtlasPathNode _AtlasPathNode = GetAtlasPath(_atlasName); if (_AtlasPathNode == null) { _AtlasPathNode = new AtlasPathNode { AtlasName = _atlasName }; RefreshAtlasPath(_AtlasPathNode, _atlasRelativePath); AtlasPathNodeList.Add(_AtlasPathNode); } else { RefreshAtlasPath(_AtlasPathNode, _atlasRelativePath); } }
/// <summary> /// 获得可以使用的图集路径 /// 高清图集如果不存在,就自动加载低清的 /// 保底是低清必须存在 /// </summary> /// <returns></returns> private string GetExistingSpriteAtlasPath(string atlasName) { AtlasPathNode atlasPathNode = AtlasConfigController.Instance.GetAtlasPath(atlasName); if (atlasPathNode == null) { DebugUtil.LogError("SpriteAtlas Path Error:" + atlasName); return(null); } if (!AssetConfigController.Instance.UseAssetBundle)// 不使用ab的情况下,恒定使用hd图集 { return(atlasPathNode.HdPath); } if (!IsSdVariant)// 要求使用高清 { string abPath = string.Format("{0}.ab", atlasPathNode.HdPath.Substring(0, atlasPathNode.HdPath.Length - atlasName.Length - 1).ToLower()); if (FilePathTools.IsFileExists(abPath))// 高清图集存在 { return(atlasPathNode.HdPath); } } return(atlasPathNode.SdPath);// 返回低清图集 }
/// <summary> /// 获取正常图集的ab包路径 /// </summary> /// <param name="atlasName"></param> /// <returns></returns> public string GetNormalSpriteAtlasPath(string atlasName) { AtlasPathNode atlasPathNode = AtlasConfigController.Instance.GetAtlasPath(atlasName); string abPath = string.Empty; if (IsSdVariant) { abPath = string.Format("{0}.ab", atlasPathNode.SdPath.Substring(0, atlasPathNode.SdPath.Length - atlasName.Length - 1).ToLower()); } else { abPath = string.Format("{0}.ab", atlasPathNode.HdPath.Substring(0, atlasPathNode.HdPath.Length - atlasName.Length - 1).ToLower()); } return(abPath); }
private void RefreshAtlasPath(AtlasPathNode atlasPathNode, string relativePath) { string relativePathWithoutExt = relativePath.Substring(0, relativePath.Length - 12);// 删除".spriteatlas"; if (relativePathWithoutExt.Contains("/Sd/")) { atlasPathNode.SdPath = relativePathWithoutExt; } else if (relativePathWithoutExt.Contains("/Hd/")) { atlasPathNode.HdPath = relativePathWithoutExt; } else { atlasPathNode.HdPath = relativePathWithoutExt; atlasPathNode.SdPath = relativePathWithoutExt; } }