public static Transform create(List <TraficSign> info) { if (rootObj == null) { rootObj = new GameObject().transform; rootObj.name = "TSRoot"; } for (int i = 0; i < info.Count; i++) { GameObject obj = GameObject.Instantiate(commonObj.signPrefab); obj.transform.SetParent(rootObj); obj.name = "TSMesh"; TraficSignMesh self = obj.AddComponent <TraficSignMesh>(); obj.transform.position = info [i].pos; obj.transform.forward = info [i].forward; Texture tex = Resources.Load("sign/" + info[i].typeId) as Texture; obj.transform.FindChild("parking").GetComponent <MeshRenderer> ().material.mainTexture = tex; } return(rootObj); }
public void ShowObj(bool val, int scale = 100) { if (menuObj == null && val == true) { initMenu(); } if (obj == null && val == true) { if (type == 1) { obj = pointCloud.create(CppInterface.GetMPList(id)); } if (type == 2) { obj = KFListObj.create(CppInterface.GetKFList(id), ListId).transform; } if (type == 3) { RdSegData = CppInterface.GetRSList(id); if (showCount > RdSegData.Count || showCount <= 0) { showCount = RdSegData.Count; } obj = RoadMesh.create(RdSegData.GetRange(0, showCount)).transform; } if (type == 5) { ChannelInfo img = ChannelInfo.getChannel(5, id); ChannelInfo feature = ChannelInfo.getChannel(4, id); if (img != null) { commonObj.mMainUI.updateFrameDisplay(img, feature); } } if (type == 6) { List <TraficSign> tmp = CppInterface.GetTSList(id); if (showCount >= 0 && showCount < tmp.Count) { tmp.RemoveRange(showCount, tmp.Count - showCount); } obj = TraficSignMesh.create(tmp).transform; } if (type == 7) { List <ActMapPoint> tmp = CppInterface.GetAMPList(id); obj = ActMPMesh.create(tmp); } } if (obj != null) { obj.gameObject.SetActive(val); if (val) { transform.Find("Text").GetComponent <Text> ().color = getColorFromUI(); } else { transform.Find("Text").GetComponent <Text> ().color = new Color32(0, 0, 0, 255); } } }