Exemplo n.º 1
0
 public void SetTable(ref Hashtable list)
 {
     while (table.transform.childCount > 0)
     {
         DestroyImmediate(table.transform.GetChild(0).gameObject);
     }
     viewList = new Hashtable();
     //System.Collections.IDictionaryEnumerator enumerator = list.GetEnumerator();
     //while (enumerator.MoveNext())
     //{
     foreach (RoleData r in UserManager.Instance.RoleTable.Values)
     {
         //RoleData r = vv as RoleData;//UserManager.Instance.RoleTable[enumerator.Key] as RoleData;
         GameObject obj = Instantiate(rolePrefabe);
         obj.SetActive(true);
         HeadRole pop = obj.GetComponent <HeadRole>();
         obj.name = r.sort.ToString();
         pop.InitData(r);
         pop.transform.parent     = table.transform;
         pop.transform.localScale = Vector3.one;
         viewList.Add(r.sort, pop);
     }
     table.Reposition();
     scroll.ResetPosition();
     table.repositionNow = true;
 }
Exemplo n.º 2
0
 public void SetRoleList(ref List <RoleData> list)
 {
     while (roleTable.transform.childCount > 0)
     {
         DestroyImmediate(roleTable.transform.GetChild(0).gameObject);
     }
     if (list != null)
     {
         roleViewTable = new Hashtable();
         for (int i = 0; i < list.Count; i++)
         {
             RoleData   r   = list[i] as RoleData;
             GameObject obj = Instantiate(rolePrefabe);
             obj.SetActive(true);
             HeadRole pop = obj.GetComponent <HeadRole>();
             pop.InitData(r, true);
             obj.name                 = r.sort.ToString();
             pop.transform.parent     = roleTable.transform;
             pop.transform.position   = Vector3.zero;
             pop.transform.localScale = Vector3.one;
             roleViewTable.Add(r.csv_id, pop);
         }
         roleTable.Reposition();
         roleScrollView.ResetPosition();
         roleScrollView.Scroll(0);
         roleTable.repositionNow = true;
     }
 }