/// <summary> /// 根据normalmodledata数据刷新两列button /// </summary> public void RefreshViewByNormalModleData() { Clear(); pointmap = PointHelper.GetInstance().normaldataformlocaljson;//PointHelper.GetInstance().normalmodelInSceneMap; if (null == pointmap || pointmap.Count == 0) { Debug.LogError("pointmap 为空!!!"); return; } foreach (KeyValuePair <int, Dictionary <int, Vector3> > item in pointmap) { int group = item.Key; GameObject but = SpawnChildren(Groupbuttonitem); Button b = but.GetComponent <Button>(); string groupstr = Tool.NumberToChar(group + 1).ToUpper(); b.GetComponentInChildren <Text>().text = groupstr; b.onClick.AddListener(() => { ResetLastAndSetThis(b); if (dropdownindex == 0) { MSGCenter.Execute(Enums.PointControll.Choise.ToString(), group.ToString()); } ChoisePanel(b); choiseindex = group; }); if (group == choiseindex) { ChoisePanel(b); lastchoiselistbutton = b; } Dictionary <int, Vector3> templist = item.Value; List <GameObject> tempgos = new List <GameObject>(); List <MatchingItemButton> tempbuts = new List <MatchingItemButton>(); foreach (KeyValuePair <int, Vector3> it in templist) { GameObject g = SpawnChildren(Pointbuttonitem); g.SetActive(false); int tempgroup = group; int tempindex = it.Key; g.GetComponentInChildren <Text>().text = groupstr + " " + (tempindex + 1).ToString(); MatchingItemButton Matchingitem = g.GetComponent <MatchingItemButton>(); Matchingitem.Init(tempgroup, tempindex, SetLastMatchingItem); tempgos.Add(g); tempbuts.Add(Matchingitem); } listmap.Add(b, tempgos); buttonmap.Add(group, tempbuts); buttonindex.Add(group, b); } RefreshViewByUserModelData(); }
/// <summary> /// 根据normalmodledata数据刷新两列button /// </summary> public void RefreshViewByNormalModleData() { Dictionary <int, Dictionary <int, Vector3> > normalpointmap = PlayerDataCenter.Instance.Currentnormalpointmap; if (null == normalpointmap || normalpointmap.Count == 0) { Debug.LogError("pointmap 为空!!!"); return; } foreach (KeyValuePair <int, Dictionary <int, Vector3> > item in normalpointmap) { int group = item.Key; GameObject but = SpawnChildren(SpawnChild.FirstPoolItem, Groupbuttonitem.transform.parent); but.transform.SetAsLastSibling(); Button b = but.GetComponent <Button>(); string groupstr = Tool.NumberToChar(group + 1).ToUpper(); b.GetComponentInChildren <Text>().text = groupstr; b.onClick.AddListener(() => { ResetLastGroupItem(b, group); ChoisePanel(b); }); Dictionary <int, Vector3> templist = item.Value; List <GameObject> tempgos = new List <GameObject>(); Dictionary <int, MatchingItemButton> dicbuts = new Dictionary <int, MatchingItemButton>(); foreach (KeyValuePair <int, Vector3> it in templist) { GameObject g = SpawnChildren(SpawnChild.SecendPoolItem, Pointbuttonitem.transform.parent); g.SetActive(false); int tempgroup = group; int tempindex = it.Key; g.transform.SetAsLastSibling(); g.GetComponentInChildren <Text>().text = groupstr + " " + (tempindex + 1).ToString(); MatchingItemButton Matchingitem = g.GetComponent <MatchingItemButton>(); Matchingitem.Init(tempgroup, tempindex, SetLastMatchingItem); tempgos.Add(g); dicbuts.Add(tempindex, Matchingitem); } listmap.Add(b, tempgos); buttonmap.Add(group, dicbuts); if (group == currentgroup) { ChoisePanel(b); } } }