Пример #1
0
    void Start()
    {
        //子button的数目必须和进度XML的子节点数目相同
        if (buttonnames == null)
        {
            buttonnames = new List <string>(Date.GetInstance.MODELTOSTEP.Keys);
        }
        if (steps == null)
        {
            steps = new List <List <int> >(Date.GetInstance.MODELTOSTEP.Values);
        }
        if (childitems == null)
        {
            childitems = new Dictionary <string, UIEvents>();
            //Add进字典时,childitems还没有添加完成
            for (int i = 0; i < transform.childCount; i++)
            {
                UIEvents ue = transform.GetChild(i).GetComponent <UIEvents>();
                if (ue)
                {
                    ue.Init(this, buttonnames[i], steps[i][0], steps[i][1], steps[i][2]);
                    childitems.Add(buttonnames[i], ue);
                }
            }
        }

        InitAssigne();
    }
Пример #2
0
 void InitAssigne()
 {
     for (int i = 0; i < transform.childCount; i++)
     {
         UIEvents ue = transform.GetChild(i).GetComponent <UIEvents>();
         if (ue)
         {
             ue.Init(AddContact(childitems[buttonnames[i]]));
         }
     }
 }