private List<GameObject> GetMark(EBioMarkType type,int len) { var list = _markPool[type]; int needAddCount = 0; int needHideCount = 0; int listCount = list.Count; if (len > listCount) { needAddCount = -list.Count + len; } else { needHideCount = list.Count - len; } for (int i = 0; i < needAddCount; i++) { CreateMark(type); } for (int j = 0; j < needHideCount; j++) { UIUtils.SetActive(list[listCount - j - 1], false); } for (int k = 0; k < len; k++) { UIUtils.SetActive(list[k], true); } return list; }
private GameObject CreateMark(EBioMarkType type) { var origTf = _origGoDict[type]; var dict = _markPool[type]; var newGo = UnityEngine.Object.Instantiate(origTf, _root, false); dict.Add(newGo); return newGo; }
private void UpdateBioLabel(List<Vector3> posList, float rate, EBioMarkType type) { int count = posList.Count; var goList = GetMark(type, count); for (int i = 0; i < count; i++) { ((goList[i].transform) as RectTransform).anchoredPosition = new Vector2(posList[i].x, posList[i].z) * rate; } }
private void UpdateBioLabel(Dictionary <string, MapFixedVector3> posDict, float rate, EBioMarkType type) { int count = posDict.Count; var goList = GetMark(type, count); Dictionary <string, MapFixedVector3> .Enumerator it = posDict.GetEnumerator(); int i = 0; while (it.MoveNext()) { var pos = it.Current.Value.ShiftedUIVector3(); ((goList[i].transform) as RectTransform).anchoredPosition = new Vector2(pos.x, pos.z) * rate; i++; } }