BuiltinDataComponent.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. using UnityGameFramework.Runtime;
  10. namespace MetaClient
  11. {
  12. public class BuiltinDataComponent : GameFrameworkComponent
  13. {
  14. [SerializeField]
  15. private TextAsset m_BuildInfoTextAsset = null;
  16. [SerializeField]
  17. private TextAsset m_DefaultDictionaryTextAsset = null;
  18. [SerializeField]
  19. private UpdateResourceForm m_UpdateResourceFormTemplate = null;
  20. private BuildInfo m_BuildInfo = null;
  21. public BuildInfo BuildInfo
  22. {
  23. get
  24. {
  25. return m_BuildInfo;
  26. }
  27. }
  28. public UpdateResourceForm UpdateResourceFormTemplate
  29. {
  30. get
  31. {
  32. return m_UpdateResourceFormTemplate;
  33. }
  34. }
  35. public void InitBuildInfo()
  36. {
  37. if (m_BuildInfoTextAsset == null || string.IsNullOrEmpty(m_BuildInfoTextAsset.text))
  38. {
  39. Log.Info("Build info can not be found or empty.");
  40. return;
  41. }
  42. m_BuildInfo = JsonUtility.FromJson<BuildInfo>(m_BuildInfoTextAsset.text);
  43. //m_BuildInfo = Utility.Json.ToObject<BuildInfo>(m_BuildInfoTextAsset.text);
  44. if (m_BuildInfo == null)
  45. {
  46. Log.Warning("Parse build info failure.");
  47. return;
  48. }
  49. }
  50. public void InitDefaultDictionary()
  51. {
  52. if (m_DefaultDictionaryTextAsset == null || string.IsNullOrEmpty(m_DefaultDictionaryTextAsset.text))
  53. {
  54. Log.Info("Default dictionary can not be found or empty.");
  55. return;
  56. }
  57. if (!GameEntry.Localization.ParseData(m_DefaultDictionaryTextAsset.text))
  58. {
  59. Log.Warning("Parse default dictionary failure.");
  60. return;
  61. }
  62. }
  63. }
  64. }