- 最后登录
- 2017-5-15
- 注册时间
- 2012-3-1
- 阅读权限
- 90
- 积分
- 32973
  
- 纳金币
- 32806
- 精华
- 12
|
/*CommonTextField.cs*/using UnityEngine;
using System.Collections;public class CommonTextField : MonoBehaviour {
//单行文本框的风格对象
public static GUIStyle style;
//单行文本框的宽度和高度
public static int width = 100;
public static int height = 40;
//初始化
void Start () {
style = new GUIStyle();
//设置未选中情况下背景图片和标题文本颜色
style.normal.background = (Texture2D)Resources.LoadAssetAtPath("Assets/CustomGUI/Texture/textbackground.png", typeof(Texture2D)); style.normal.textColor = Color.white;
//设置选中情况下背景图片和标题文本颜色
style.hover.background = (Texture2D)Resources.LoadAssetAtPath("Assets/CustomGUI/Texture/textbackground.png", typeof(Texture2D)); style.hover.textColor = Color.white;
//设置文本位置为居中左对齐
style.alignment = TextAnchor.MiddleLeft;
//载入字体、设置字体大小
style.font = CommonFont.LoadFont();
style.fontSize = 22;
}
} |
|