コード例 #1
0
 public override void OnEnable()
 {
     base.OnEnable();
     _field        = target as UITextArea;
     _picker       = new PrefabPicker(UIType.Button);
     _scrollDrawer = new Drawer_ScrollView();
     _textEditor   = new TextProperty();
 }
コード例 #2
0
 public virtual void ApplyInputDisable(UITextArea panel)
 {
     panel.BackgroundColor = this.InputBgDisabledColor;
     panel.BorderColor     = this.InputEdgeDisabledColor;
     panel.TextColor       = this.InputTextDisabledColor;
 }
コード例 #3
0
 public TextArea(UITextArea textArea, bool subschribeEvents = false)
     : base(textArea, subschribeEvents)
 {
 }
コード例 #4
0
ファイル: TestState2.cs プロジェクト: CXUtk/UI-Editor
        public override void Initialize()
        {
            base.Initialize();
            var button = new UIButton()
            {
                Name     = "tbDebug",
                Size     = new Vector2(10 * 16, 3 * 16),
                Position = new Vector2(10 * 16, 3 * 16) / 2
            };
            var box13 = new UIWindow()
            {
                Name        = "a",
                Size        = new Vector2(800, 640),
                AnchorPoint = new Vector2(0.5f, 0.5f),
                Position    = new Vector2(100, 100)
            };
            var textbox = new UITextArea {
                Name        = "emmm",
                Size        = new Vector2(20 * 16, 6.5f * 16),
                Position    = new Vector2(0, 300),
                Pivot       = new Vector2(0.5f, 0),
                AnchorPoint = new Vector2(0.5f, 0),
                TextAlign   = Enums.Align.TopLeft
            };
            //var menu = new UIMenu() {
            //    Name = "text menu",
            //    Pivot = new Vector2(0.5f, 0),
            //    AnchorPoint = new Vector2(0.5f, 0),
            //};
            var checkbox = new UICheckBox {
                Tooltip  = "Debug模式",
                Name     = "test checkbox",
                Position = new Vector2(90, 90)
            };
            var colorwheel = new UIColorBar()
            {
                Position = new Vector2(200, 200),
                Size     = new Vector2(128, 128),
            };

            //var selector = new UIEnumSelector<TypeCode>() {
            //    Position = new Vector2(140, 280),
            //    Size = new Vector2(100, 30),
            //    Pivot = new Vector2(0, 0),
            //    AnchorPoint = new Vector2(0, 0)
            //};
            //selector.HangElement = box13;

            checkbox.OnCheckedChange += Checkbox_OnCheckedChange;
            button.OnClick           += (e, sender) => {
                switch (textbox.TextAlign)
                {
                case Enums.Align.Top:
                    textbox.TextAlign = Enums.Align.TopRight;
                    break;

                case Enums.Align.TopRight:
                    textbox.TextAlign = Enums.Align.Right;
                    break;

                case Enums.Align.Right:
                    textbox.TextAlign = Enums.Align.BottomRight;
                    break;

                case Enums.Align.BottomRight:
                    textbox.TextAlign = Enums.Align.Bottom;
                    break;

                case Enums.Align.Bottom:
                    textbox.TextAlign = Enums.Align.BottomLeft;
                    break;

                case Enums.Align.BottomLeft:
                    textbox.TextAlign = Enums.Align.Left;
                    break;

                case Enums.Align.Left:
                    textbox.TextAlign = Enums.Align.TopLeft;
                    break;

                case Enums.Align.TopLeft:
                    textbox.TextAlign = Enums.Align.Top;
                    break;
                }
                button.Text = textbox.TextAlign.ToString();
            };
            box13.OnClose += Box1_OnClose;
            AppendChild(box13);
            box13.AppendChild(textbox);
            //{
            //    var item1 = new UIMenuItem();
            //    item1.Text = nameof(item1);
            //    item1.AddItem(new UIMenuItem { Text = "item1.item1" });
            //    item1.AddItem(new UIMenuItem { Text = "item1.item2" });
            //    item1.AddItem(new UIMenuItem { Text = "item1.item3" });
            //    menu.AddItem(item1);
            //    var item2 = new UIMenuItem();
            //    item2.Text = nameof(item2);
            //    item2.AddItem(new UIMenuItem { Text = "item2.item1" });
            //    item2.AddItem(new UIMenuItem { Text = "item2.item2" });
            //    menu.AddItem(item2);
            //    {
            //        var item2_3 = new UIMenuItem();
            //        item2_3.Text = "item2.item3";
            //        item2_3.AddItem(new UIMenuItem { Text = "item231" });
            //        item2_3.AddItem(new UIMenuItem { Text = "item232" });
            //        item2_3.AddItem(new UIMenuItem { Text = "item233" });
            //        item2_3.AddItem(new UIMenuItem { Text = "item234" });
            //        item2.AddItem(item2_3);
            //    }
            //}

            var scrollBarH = new UIScrollBarH()
            {
                AnchorPoint = new Vector2(0.5f, 1),
                Pivot       = new Vector2(0.5f, 1),
                SizeFactor  = new Vector2(1f, 0f),
                Size        = new Vector2(0, 20),
            };

            box13.AppendChild(scrollBarH);
            box13.AppendChild(button);
            box13.AppendChild(checkbox);
            //box13.AppendChild(button2);
            // box13.AppendChild(selector);
            //box13.AppendChild(colorwheel);
            //UIValueSlider slider = new UIValueSlider() {
            //    Position = new Vector2(400, 300),
            //    Size = new Vector2(230, 30),
            //    Min = 0,
            //    Max = 255,
            //};
            //box13.AppendChild(slider);
        }