//设置内容 public void SetText(string s) { // for (int i = 0; i < modelList.Count; i++) { modelList[i].gameObject.SetActive(false); modelList[i].transform.parent = null; } modelList.Clear(); byte[] byteArray = System.Text.Encoding.Default.GetBytes(s); for (int i = 0; i < byteArray.Length; i++) { ModelTextObj obj = ModelTextManager.GetInstance().GetModelTextObj((char)byteArray[i]); modelList.Add(obj); obj.gameObject.SetActive(true); obj.transform.parent = transform; obj.textobj.GetComponent <Renderer>().material = m; obj.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0)); obj.transform.localScale = new Vector3(1, 1, 1); } SetObjPos(); }
ModelTextObj AddNum(int charindex, int count) { if (charindex < 0 || charindex >= 36) { return(null); } string resname = charName + charindex; GameObject obj = (GameObject)Resources.Load(resname); ModelTextObj mt = null; for (int i = 0; i < count; i++) { GameObject _obj = MonoBehaviour.Instantiate(obj); _obj.SetActive(false); mt = _obj.GetComponent <ModelTextObj>(); modelList[charindex].Add(mt); } return(mt); }