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;
}

你可能感兴趣的:(C#,unity3d,label)