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