/// <summary> /// 设置标签上显示的文字 /// </summary> /// <param name="vo"></param> public void setValue(MyTreeMenuItemVO vo, MyTreeMenuItem parent) { treeMenu = NGUITools.FindInParents <MyTreeMenu>(gameObject); this.parent = parent; this.value = vo; lable.text = vo.name; }
private void createItem() { List <MyTreeMenuItemVO> vo = new List <MyTreeMenuItemVO>(); for (int i = 0; i < 4; i++) { MyTreeMenuItemVO itemi = new MyTreeMenuItemVO(); itemi.ItemName = "songyu" + i; itemi.value = itemi.ItemName; itemi.name = "宋玉0"; vo.Add(itemi); List <MyTreeMenuItemVO> treeis = new List <MyTreeMenuItemVO>(); itemi.treeMenuItemVO = treeis; for (int j = 0; j < 4; j++) { MyTreeMenuItemVO itemj = new MyTreeMenuItemVO(); itemj.ItemName = "caidan" + j; itemj.value = itemi.value + "_" + itemj.ItemName; itemj.name = "宋玉1"; treeis.Add(itemj); List <MyTreeMenuItemVO> treejs = new List <MyTreeMenuItemVO>(); itemj.treeMenuItemVO = treejs; for (int k = 0; k < 4; k++) { MyTreeMenuItemVO itemk = new MyTreeMenuItemVO(); itemk.ItemName = "yu" + k; itemk.value = itemj.value + "_" + itemk.ItemName; itemk.name = "宋玉2"; treejs.Add(itemk); List <MyTreeMenuItemVO> treeks = new List <MyTreeMenuItemVO>(); itemk.treeMenuItemVO = treeks; for (int l = 0; l < 4; l++) { MyTreeMenuItemVO treek = new MyTreeMenuItemVO(); treek.ItemName = "yezi" + l; treek.value = itemk.value + "_" + treek.ItemName; treek.name = "宋玉3"; treeks.Add(treek); } } } } setValue(vo, null, true); }