77 lines
2.5 KiB
C#
77 lines
2.5 KiB
C#
using System;
|
|
using GameFramework;
|
|
|
|
namespace SepCore.CustomUtility
|
|
{
|
|
public static class AssetUtility
|
|
{
|
|
public static string GetConfigAsset(string assetName, bool fromBytes)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/Configs/{0}.{1}", assetName, fromBytes ? "bytes" : "txt");
|
|
}
|
|
|
|
public static string GetDataTableAsset(string assetName, bool fromBytes)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/DataTables/{0}.{1}", assetName, fromBytes ? "bytes" : "txt");
|
|
}
|
|
|
|
public static string GetFontAsset(string assetName)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/Fonts/{0}.ttf", assetName);
|
|
}
|
|
|
|
public static string GetTMPFontAsset(string assetName)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/Fonts/{0}.asset", assetName);
|
|
}
|
|
|
|
public static string GetSceneAsset(string assetName)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/Scenes/{0}.unity", assetName);
|
|
}
|
|
|
|
public static string GetMusicAsset(string assetName)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/Music/{0}.mp3", assetName);
|
|
}
|
|
|
|
public static string GetSoundAsset(string assetName)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/Sounds/{0}.wav", assetName);
|
|
}
|
|
|
|
public static string GetEntityAsset(string assetPath)
|
|
{
|
|
if (string.IsNullOrEmpty(assetPath))
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
if (assetPath.EndsWith(".prefab", StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/Entities/{0}", assetPath);
|
|
}
|
|
|
|
return Utility.Text.Format("Assets/GameMain/Entities/{0}.prefab", assetPath);
|
|
}
|
|
|
|
public static string GetUIFormAsset(string assetName)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/UI/UIForms/{0}.prefab", assetName);
|
|
}
|
|
|
|
public static string GetUISoundAsset(string assetName)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/UI/UISounds/{0}.wav", assetName);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取图片资源路径,assetName 为相对 Assets/GameMain/Textures 的路径,需包含扩展名
|
|
/// </summary>
|
|
public static string GetSpriteAsset(string assetName)
|
|
{
|
|
return Utility.Text.Format("Assets/GameMain/Textures/{0}", assetName);
|
|
}
|
|
}
|
|
}
|