コード例 #1
0
ファイル: YxTools.cs プロジェクト: xinrui5577/roomgame
 /// <summary>
 /// 获取对应父级的子物体
 /// </summary>
 /// <param name="index"></param>
 /// <param name="prefabView"></param>
 /// <param name="tranParent"></param>
 /// <returns></returns>
 public static YxView GetChildView(int index, YxView prefabView, Transform tranParent)
 {
     if (tranParent.childCount > index)
     {
         var returnView = tranParent.GetChild(index).GetComponent <YxView>();
         returnView.gameObject.SetActive(true);
         return(returnView);
     }
     return(YxWindowUtils.CreateItem(prefabView, tranParent));
 }
コード例 #2
0
 /// <summary>
 /// 获取对应父级的子物体
 /// </summary>
 /// <param name="index"></param>
 /// <param name="prefabView"></param>
 /// <param name="tranParent"></param>
 /// <returns></returns>
 public static YxView GetChildView(this Transform tranParent, int index, YxView prefabView)
 {
     if (tranParent.childCount > index)
     {
         var returnView = tranParent.GetChild(index).GetComponent <YxView>();
         if (returnView)
         {
             returnView.gameObject.SetActive(true);
         }
         else
         {
             YxDebug.LogError(string.Format("Child Item is not a YxView,index is :{0},please check again!", index));
             returnView = YxWindowUtils.CreateItem(prefabView, tranParent);
         }
         return(returnView);
     }
     return(YxWindowUtils.CreateItem(prefabView, tranParent));
 }