AssetUtility.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //------------------------------------------------------------
  2. // Game Framework
  3. // Copyright © 2013-2021 Jiang Yin. All rights reserved.
  4. // Homepage: https://gameframework.cn/
  5. // Feedback: mailto:ellan@gameframework.cn
  6. //------------------------------------------------------------
  7. using GameFramework;
  8. namespace MetaClient
  9. {
  10. public static class AssetUtility
  11. {
  12. public static string GetConfigAsset(string assetName, bool fromBytes)
  13. {
  14. return Utility.Text.Format("Assets/GameMain/Configs/{0}.{1}", assetName, fromBytes ? "bytes" : "txt");
  15. }
  16. public static string GetDataTableAsset(string assetName, bool fromBytes)
  17. {
  18. return Utility.Text.Format("Assets/GameMain/DataTables/{0}.{1}", assetName, fromBytes ? "bytes" : "txt");
  19. }
  20. public static string GetDictionaryAsset(string assetName, bool fromBytes)
  21. {
  22. return Utility.Text.Format("Assets/GameMain/Localization/{0}/Dictionaries/{1}.{2}", GameEntry.Localization.Language, assetName, fromBytes ? "bytes" : "xml");
  23. }
  24. public static string GetFontAsset(string assetName)
  25. {
  26. return Utility.Text.Format("Assets/GameMain/Fonts/{0}.ttf", assetName);
  27. }
  28. public static string GetSceneAsset(string assetName)
  29. {
  30. return Utility.Text.Format("Assets/GameMain/Scenes/{0}.unity", assetName);
  31. }
  32. public static string GetMusicAsset(string assetName)
  33. {
  34. return Utility.Text.Format("Assets/GameMain/Music/{0}.mp3", assetName);
  35. }
  36. public static string GetSoundAsset(string assetName)
  37. {
  38. return Utility.Text.Format("Assets/GameMain/Sounds/{0}.wav", assetName);
  39. }
  40. public static string GetEntityAsset(string assetName)
  41. {
  42. return Utility.Text.Format("Assets/GameMain/Entities/{0}.prefab", assetName);
  43. }
  44. public static string GetUIFormAsset(string assetName)
  45. {
  46. return Utility.Text.Format("Assets/GameMain/UI/UIForms/{0}.prefab", assetName);
  47. }
  48. public static string GetUISoundAsset(string assetName)
  49. {
  50. return Utility.Text.Format("Assets/GameMain/UI/UISounds/{0}.wav", assetName);
  51. }
  52. public static string GetUISpriteAsset(string assetName)
  53. {
  54. return Utility.Text.Format("Assets/GameMain/UI/UISounds/{0}.png", assetName);
  55. }
  56. }
  57. }