public static LegoComponentRef Create(RectTransform rect) { string path = null; var view = rect.FindParent <YuLegoViewHelper>(out path); if (view == null) { throw new Exception("乐高组件必须置于乐高视图下"); } var meta = new LegoComponentRef { RefComponent = GetComponentId(rect), MountPath = path, LogicId = rect.name, MountPosition = LegoRectTransformMeta.Create(rect), }; return(meta); }
private void AddComponentMeta(Transform transform) { var componentMeta = LegoComponentRef.Create(transform.RectTransform()); ComponentRefs.Add(componentMeta); }