2014年3月20日木曜日

言語設定値の取得

Unityにて端末に設定されている、言語値の取得サンプル(C#)。


/*
 * @file GetLang.cs
 * @attention 
 * @note  言語設定取得サンプル
 */
using UnityEngine;
public class GetLang : MonoBehaviour {
 GUIStyle labelStyle;

 void Start () {
  labelStyle = new GUIStyle();
  labelStyle.fontSize = 40;// Font size
  labelStyle.normal.textColor = Color.white;
 }

 void OnGUI(){
  float x = Screen.width / 8 ;
  float y = Screen.height / 8;

        string text = Application.systemLanguage.ToString(); //設定言語値取得
        /*  取得値については公式サイト参照
            http://docs.unity3d.com/Documentation/ScriptReference/SystemLanguage.html
        */

  GUI.Label(new Rect(x, y, x, y), text, labelStyle);
 }
}

0 件のコメント:

コメントを投稿