示例#1
0
 void initHeroList()
 {
     if (GameData.user == null)
     {
         return;
     }
     for (int i = 0; i < GameData.user.heroList.Count; i++)
     {
         int        id = GameData.user.heroList[i];
         GameObject g  = Instantiate <GameObject>(heroBtn);
         HeroGrid   hg = g.GetComponent <HeroGrid>();
         hg.setData(id);
         RectTransform rtf = g.transform as RectTransform;
         rtf.parent        = heroList;
         rtf.localScale    = Vector3.one;
         rtf.localPosition = new Vector3(i % 10 * 44 + 25, -i / 10 * 44 + 3);
         myGrid.Add(id, hg);
     }
 }