コード例 #1
0
ファイル: UIElements.cs プロジェクト: demelev/UIGenerator
        override internal void Visit(Panel panelDescr, PanelBase panelUI)
        {
            string text_name   = NamesFormatter.ObjectName(this.Name, "Label");
            var    text_object = PrefabsHelper.CreateObject("Text", text_name);
            var    c_text      = text_object.GetComponent <UnityEngine.UI.Text>();

            c_text.text = text;
            text_object.transform.SetParent(panelUI.transform);
        }
コード例 #2
0
        public UIGenerator(string templatesDir)
        {
            string dir = System.IO.Directory.GetCurrentDirectory();

            dir = Path.Combine(dir, templatesDir);

            _fileSystem         = new LocalFileSystem(dir);
            _context            = new Context();
            Template.FileSystem = _fileSystem;
            Template.RegisterFilter(typeof(NamesFormatter));

            s_config = new UIGeneratorConfig()
            {
                PrefabWithPrefix = true
            };

            PrefabsHelper.LoadPrefabs();
        }
コード例 #3
0
ファイル: UIElements.cs プロジェクト: demelev/UIGenerator
        override internal void Visit(Panel panelDescr, PanelBase panelUI)
        {
            var    fields      = panelDescr.ComponentType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
            string button_name = NamesFormatter.ObjectName(this.Name, "Button");

            var button = PrefabsHelper.CreateObject("Button", button_name);

            button.transform.SetParent(panelUI.transform);

            UnityButton ui_button = button.GetComponent <UnityButton>();

            string field_name = NamesFormatter.PrivateMember(this.Name, "Button");

            foreach (var field in fields)
            {
                if (field.Name == field_name)
                {
                    field.SetValue(panelUI, ui_button);
                }
            }
        }
コード例 #4
0
ファイル: UIElements.cs プロジェクト: demelev/UIGenerator
        override internal void Visit(Panel panelDescr, PanelBase panelUI)
        {
            string list_name = NamesFormatter.ObjectName(this.Name, "List");

            var list = PrefabsHelper.CreateObject("Scroll View", list_name);

            list.transform.SetParent(panelUI.transform);
            list.transform.ResetTransform();

            /*
             * var fields = panelDescr.ComponentType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
             * string field_name = NamesFormatter.PrivateMember(this.Name, "List");
             * foreach(var field in fields)
             *{
             *    if (field.Name == field_name)
             *    {
             *        field.SetValue(panelUI, list);
             *    }
             *}
             */
        }