相濡以沫,不如相忘于江湖

专注,才是王道! 加班,代码,泡面,可乐。。
Unity3D 处理Label的颜色代码
UILabel m_name = transform.Find("Name").GetComponent<UILabel>();
m_name.text = GetNameColor(name,1);

string GetNameColor(string name , int quality)
{
	string str;
	switch(quality)
	{
		case 1:
			str = "[ffffff]" + name + [-];
			break;
		case 2:
			str = "[00ff00]" + name + [-];
			break;
		case 3:
			str = "[66ccff]" + name + [-];
			break;
		case 4:
			str = "[ff00ff]" + name + [-];
			break;
		case 5:
			str = "[ffa500]" + name + [-];
			break;
		default:
			str = "";
			break;
	}
	return str;
}

posted on 2013-08-15 15:41  御剑江湖的专栏  阅读(887)  评论(0编辑  收藏  举报