当前位置: 首页>>代码示例>>C#>>正文


C# Localization.Get方法代码示例

本文整理汇总了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;
        }
    }
开发者ID:rmkeezer,项目名称:fpsgame,代码行数:29,代码来源:UILocalize.cs

示例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;
     }
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:24,代码来源:UILocalize.cs

示例3: OnLocalize

 /// <summary>
 /// Localize the text label.
 /// </summary>
 void OnLocalize(Localization loc)
 {
     if (isLocalized && textLabel != null)
     {
         textLabel.text = loc.Get(mSelectedItem);
     }
 }
开发者ID:shinobushiva,项目名称:Perfume-Unity,代码行数:10,代码来源:UIPopupList.cs

示例4: OnLocalize

 /// <summary>
 /// Localize the text label.
 /// </summary>
 void OnLocalize(Localization loc)
 {
     if (isLocalized && textLabel != null && !string.IsNullOrEmpty(mSelectedItem))
     {
         textLabel.text = loc.Get(mSelectedItem);
     }
 }
开发者ID:Boerlam001,项目名称:DungeonGrind,代码行数:10,代码来源:UIPopupList.cs

示例5: OnLocalize

 private void OnLocalize(Localization loc)
 {
     if (this.isLocalized && this.textLabel != null)
     {
         this.textLabel.text = loc.Get(this.mSelectedItem);
     }
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:7,代码来源:UIPopupList.cs


注:本文中的Localization.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。