public static void SetAllChildrenRelation(GComponent comp, RelationType relationType = RelationType.Size) { if (comp == null) { return; } if (comp.numChildren > 0) { GObject[] childrenArr = comp.GetChildren(); for (int i = 0, len = childrenArr.Length; i < len; i++) { GObject child = childrenArr[i]; child.AddRelation(comp, relationType); SetAllChildrenRelation(child.asCom, relationType); } } }
/// <summary> /// 创建页面对象 /// </summary> public string CreateObject(string _packageName, string _viewName) { GObject tempMainView = UIPackage.CreateObject(_packageName, _viewName).asCom; tempMainView.SetSize(GRoot.inst.width, GRoot.inst.height); tempMainView.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(tempMainView); string tempPackageViewName = GetPackageViewName(_packageName, _viewName); string tempObjectId = GetObjectId(tempPackageViewName, tempMainView); if (packageList.ContainsKey(tempPackageViewName)) { packageList[tempPackageViewName].Add(tempObjectId, tempMainView); } else { Dictionary <string, GObject> tempList = new Dictionary <string, GObject>(); tempList.Add(tempObjectId, tempMainView); packageList.Add(tempPackageViewName, tempList); } return(tempPackageViewName + "/" + tempObjectId); }