本文整理汇总了C#中Localization.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Localization.Get方法的具体用法?C# Localization.Get怎么用?C# Localization.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Localization
的用法示例。
在下文中一共展示了Localization.Get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnLocalize
/// <summary>
/// This function is called by the Localization manager via a broadcast SendMessage.
/// </summary>
void OnLocalize(Localization loc)
{
if (mLanguage != loc.currentLanguage)
{
UIWidget w = GetComponent<UIWidget>();
UILabel lbl = w as UILabel;
UISprite sp = w as UISprite;
// If no localization key has been specified, use the label's text as the key
if (string.IsNullOrEmpty(mLanguage) && string.IsNullOrEmpty(key) && lbl != null) key = lbl.text;
// If we still don't have a key, use the widget's name
string val = string.IsNullOrEmpty(key) ? loc.Get(w.name) : loc.Get(key);
if (lbl != null)
{
lbl.text = val;
}
else if (sp != null)
{
sp.spriteName = val;
sp.MakePixelPerfect();
}
mLanguage = loc.currentLanguage;
}
}
示例2: OnLocalize
private void OnLocalize(Localization loc)
{
if (this.mLanguage != loc.currentLanguage)
{
UIWidget component = base.GetComponent<UIWidget>();
UILabel uILabel = component as UILabel;
UISprite uISprite = component as UISprite;
if (string.IsNullOrEmpty(this.mLanguage) && string.IsNullOrEmpty(this.key) && uILabel != null)
{
this.key = uILabel.text;
}
string str = (!string.IsNullOrEmpty(this.key) ? loc.Get(this.key) : loc.Get(component.name));
if (uILabel != null)
{
uILabel.text = str;
}
else if (uISprite != null)
{
uISprite.spriteName = str;
uISprite.MakePixelPerfect();
}
this.mLanguage = loc.currentLanguage;
}
}
示例3: OnLocalize
/// <summary>
/// Localize the text label.
/// </summary>
void OnLocalize(Localization loc)
{
if (isLocalized && textLabel != null)
{
textLabel.text = loc.Get(mSelectedItem);
}
}
示例4: OnLocalize
/// <summary>
/// Localize the text label.
/// </summary>
void OnLocalize(Localization loc)
{
if (isLocalized && textLabel != null && !string.IsNullOrEmpty(mSelectedItem))
{
textLabel.text = loc.Get(mSelectedItem);
}
}
示例5: OnLocalize
private void OnLocalize(Localization loc)
{
if (this.isLocalized && this.textLabel != null)
{
this.textLabel.text = loc.Get(this.mSelectedItem);
}
}