本文整理汇总了C#中ByteReader.ReadDictionary方法的典型用法代码示例。如果您正苦于以下问题:C# ByteReader.ReadDictionary方法的具体用法?C# ByteReader.ReadDictionary怎么用?C# ByteReader.ReadDictionary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ByteReader
的用法示例。
在下文中一共展示了ByteReader.ReadDictionary方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
private void Start()
{
#if !UNITY_METRO
// Check for overridden localization data.
var localizationFilePath = Application.persistentDataPath + "/Localization.txt";
FileInfo localizationFile = new FileInfo(localizationFilePath);
if (localizationFile.Exists)
{
Debug.Log("Found localization file at " + localizationFilePath);
using (var fileStream = localizationFile.OpenRead())
{
using (var binaryReader = new BinaryReader(fileStream))
{
var bytes = binaryReader.ReadBytes((int)localizationFile.Length);
var nguiByteReader = new ByteReader(bytes);
var localizationData = nguiByteReader.ReadDictionary();
Localization.Set("TestLanguage", localizationData);
return;
}
}
}
#endif
// Get current system language.
SystemLanguage systemLanguage = Application.systemLanguage;
Debug.Log(string.Format("System Language: {0}", systemLanguage));
// Check if available, otherwise fallback to English.
TextAsset textAsset = Resources.Load(systemLanguage.ToString(), typeof(TextAsset)) as TextAsset;
if (textAsset == null)
{
systemLanguage = SystemLanguage.English;
Debug.Log(string.Format("Using fallback language: {0}", systemLanguage));
}
Localization.language = systemLanguage.ToString();
}
示例2: Load
/// <summary>
/// Load the specified asset and activate the localization.
/// </summary>
static public void Load (TextAsset asset)
{
ByteReader reader = new ByteReader(asset);
Set(asset.name, reader.ReadDictionary());
}
示例3: Load
/// <summary>
/// Load the specified asset and activate the localization.
/// </summary>
void Load(TextAsset asset)
{
mLanguage = asset.name;
PlayerPrefs.SetString("Language", mLanguage);
ByteReader reader = new ByteReader(asset);
mDictionary = reader.ReadDictionary();
UIRoot.Broadcast("OnLocalize", this);
}
示例4: Set
/// <summary>
/// Set the localization data directly.
/// </summary>
static public void Set (string languageName, byte[] bytes)
{
ByteReader reader = new ByteReader(bytes);
Set(languageName, reader.ReadDictionary());
}
示例5: Load
/// <summary>
/// Load the specified asset and activate the localization.
/// </summary>
public void Load (TextAsset asset)
{
ByteReader reader = new ByteReader(asset);
Set(asset.name, reader.ReadDictionary());
OnLocalizationChanged();
}
示例6: Set
public static void Set(string languageName, byte[] bytes)
{
ByteReader byteReader = new ByteReader(bytes);
Localization.Set(languageName, byteReader.ReadDictionary());
}
示例7: Load
public static void Load(TextAsset asset)
{
ByteReader byteReader = new ByteReader(asset);
Localization.Set(asset.name, byteReader.ReadDictionary());
}
示例8: Load
static public void Load(byte[] asset)
{
mDictionary.Clear();
ByteReader reader = new ByteReader(asset);
mDictionary = reader.ReadDictionary();
}
示例9: MusicPathManager
private MusicPathManager()
{
TextAsset musicPath = Resources.Load("audioSources/MusicPath") as TextAsset;
ByteReader reader = new ByteReader(musicPath);
mDictionary = reader.ReadDictionary();
}