Пример #1
0
        public static HeadInfo Bind(Transform trans, object data)
        {
            if (mMount == null)
            {
                return(null);                          //for test
            }
            HeadInfo hi = null;

            if (mHeadInfos.Count > 0 && mHeadInfos[0].target == null)
            {
                hi = mHeadInfos[0];
                hi.gameObject.SetActive(true);
            }
            else
            {
                GameObject go = ResLoad.get("UI/HeadInfo", ResideType.InScene).gameObject();
                go.transform.SetParent(mMount, false);
                hi = go.GetComponent <HeadInfo>();
                mHeadInfos.Add(hi);
            }
            hi.target = trans;
            hi.Init(data);
            return(hi);
        }
Пример #2
0
 static void Recycle(HeadInfo hi)
 {
     hi.gameObject.SetActive(false);
     mHeadInfos.Remove(hi);
     mHeadInfos.Insert(0, hi);
 }