AssetUtility.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. using UnityEngine;
  9. namespace MetaClient
  10. {
  11. public static class AssetUtility
  12. {
  13. public static string GetConfigAsset(string assetName, bool fromBytes)
  14. {
  15. return Utility.Text.Format("Assets/GameMain/Configs/{0}.{1}", assetName, fromBytes ? "bytes" : "txt");
  16. }
  17. public static string GetDataTableAsset(string assetName, bool fromBytes)
  18. {
  19. return Utility.Text.Format("Assets/GameMain/DataTables/{0}.{1}", assetName, fromBytes ? "bytes" : "txt");
  20. }
  21. public static string GetDictionaryAsset(string assetName, bool fromBytes)
  22. {
  23. return Utility.Text.Format("Assets/GameMain/Localization/{0}/Dictionaries/{1}.{2}", GameEntry.Localization.Language, assetName, fromBytes ? "bytes" : "xml");
  24. }
  25. public static string GetFontAsset(string assetName)
  26. {
  27. return Utility.Text.Format("Assets/GameMain/Fonts/{0}.ttf", assetName);
  28. }
  29. public static string GetSceneAsset(string assetName)
  30. {
  31. return Utility.Text.Format("Assets/GameMain/Scenes/{0}.unity", assetName);
  32. }
  33. public static string GetMusicAsset(string assetName)
  34. {
  35. return Utility.Text.Format("Assets/GameMain/Music/{0}.mp3", assetName);
  36. }
  37. public static string GetSoundAsset(string assetName)
  38. {
  39. return Utility.Text.Format("Assets/GameMain/Sounds/{0}.wav", assetName);
  40. }
  41. public static string GetEntityAsset(string assetName)
  42. {
  43. return Utility.Text.Format("Assets/GameMain/Entities/{0}.prefab", assetName);
  44. }
  45. public static string GetUIFormAsset(string assetName)
  46. {
  47. return Utility.Text.Format("Assets/GameMain/UI/UIForms/{0}.prefab", assetName);
  48. }
  49. public static string GetUISoundAsset(string assetName)
  50. {
  51. return Utility.Text.Format("Assets/GameMain/UI/UISounds/{0}.wav", assetName);
  52. }
  53. public static string GetUISpriteAsset(string assetName)
  54. {
  55. Debug.Log("Assets/GameMain/UI/UISprites/"+assetName+".png");
  56. return Utility.Text.Format("Assets/GameMain/UI/UISprites/{0}.png", assetName);
  57. }
  58. public static string GetMeshAsset(string assetName)
  59. {
  60. return Utility.Text.Format("Assets/GameMain/Meshes/{0}.prefab", assetName);
  61. }
  62. }
  63. }