//------------------------------------------------------------ // Game Framework // Copyright © 2013-2021 Jiang Yin. All rights reserved. // Homepage: https://gameframework.cn/ // Feedback: mailto:ellan@gameframework.cn //------------------------------------------------------------ using SepCore.Definition; using GameFramework; using StarForce; using SepCore.UI; using UnityEngine; using UnityEngine.Serialization; using UnityGameFramework.Runtime; namespace CustomComponent { public class BuiltinDataComponent : GameFrameworkComponent { [FormerlySerializedAs("m_BuildInfoTextAsset")] [SerializeField] private TextAsset _buildInfoTextAsset = null; [FormerlySerializedAs("m_DefaultDictionaryTextAsset")] [SerializeField] private TextAsset _defaultDictionaryTextAsset = null; [FormerlySerializedAs("m_UpdateResourceFormTemplate")] [SerializeField] private GameObject _updateResourceFormTemplate = null; private BuildInfo m_BuildInfo = null; public BuildInfo BuildInfo => m_BuildInfo; public GameObject UpdateResourceFormTemplate => _updateResourceFormTemplate; public void InitBuildInfo() { if (_buildInfoTextAsset == null || string.IsNullOrEmpty(_buildInfoTextAsset.text)) { Log.Info("Build info can not be found or empty."); return; } m_BuildInfo = Utility.Json.ToObject(_buildInfoTextAsset.text); if (m_BuildInfo == null) { Log.Warning("Parse build info failure."); return; } } public void InitDefaultDictionary() { if (_defaultDictionaryTextAsset == null || string.IsNullOrEmpty(_defaultDictionaryTextAsset.text)) { Log.Info("Default dictionary can not be found or empty."); return; } if (!GameEntry.Localization.ParseData(_defaultDictionaryTextAsset.text)) { Log.Warning("Parse default dictionary failure."); return; } } } }