Ejemplo n.º 1
0
        private void ScanControl(Transform control)
        {
            UpdateViewSetting(control);
            var index      = 0;
            var childCount = control.childCount;

            while (index < childCount)
            {
                var child = control.GetChild(index);

                if (child.name.StartsWith("LegoContainer"))
                {
                    AddOperateMeta(LegoUIType.Container, child);
                    var builder = new YuLegoMetaBuilder(true, IsCreateScript);
                    builder.BuildMeta(child.gameObject);
                    index++;
                    continue;
                }

                if (IsLegoComponent(child))
                {
                    if (!isSingleBuild)
                    {
                        AddOperateMeta(LegoUIType.Component, child);
                        var builder = new YuLegoMetaBuilder(isSingleBuild, IsCreateScript);
                        builder.BuildMeta(child.gameObject);
                        index++;
                        continue;
                    }

                    AddOperateMeta(LegoUIType.Component, child);
                    index++;
                    continue;
                }

                if (IsComplex(child))
                {
                    if (child.name.StartsWith("ScrollView"))
                    {
                        var content = child.Find("ScrollRect/Content");
                        if (content.childCount == 0)
                        {
                            Debug.LogError($"滚动视图{child.name}下没有组件!");
                        }
                        else
                        {
                            var component = content.GetChild(0);
                            BuildScrollViewComponentMeta(component);
                        }
                    }

                    AddOperateMeta(GetViewElementType(child), child);
                    index++;
                    continue;
                }

                AddOperateMeta(GetViewElementType(child), child);
                index++;
            }
        }
            private static void SingleBuildMetaAndScript()
            {
                var selectGo = Selection.activeGameObject;
                var builder  = new YuLegoMetaBuilder(true, true);

                builder.BuildMeta(selectGo);
                AssetDatabase.Refresh();
            }
            private static void LoopBuildMetaAndScript()
            {
                var gos = Selection.gameObjects;

                foreach (var go in gos)
                {
                    var builder = new YuLegoMetaBuilder(false, true);
                    builder.BuildMeta(go);
                }

                AssetDatabase.Refresh();
            }
Ejemplo n.º 4
0
        private void BuildScrollViewComponentMeta(Transform control)
        {
            var builder = new YuLegoMetaBuilder(true, true);

            builder.BuildMeta(control.gameObject);
        }