Exemplo n.º 1
0
        // Destroy and recrate the text area to update it text
        public void UpdateTextArea()
        {
            if (currentTarget == null)
            {
                return;
            }
            descriptionField = DescriptionArea();
            Transform panelTransform = RootPanel.transform.Find("Text panel");

            Debug.Assert(panelTransform != null, "Panel transform shound never be null");

            Transform descriptionTransform = panelTransform.gameObject.transform.Find("description field");

            Debug.Assert(descriptionTransform != null, "Description area transform shound never be null");

            if (descriptionTransform == null)
            {
                return;
            }
            descriptionTransform.gameObject.DeleteObject();

            GameObject newTextArea = descriptionField.Build();

            newTextArea.transform.SetParent(panelTransform);
            newTextArea.transform.SetSiblingIndex(1);
            newTextArea.transform.localScale = Vector3.one;
        }
Exemplo n.º 2
0
        public NotepadControl()
        {
            descriptionField = DescriptionArea();

            // this button does nothing but it enable to deselect the textarea and to valide the input without closing the sidescreen
            PButton validationButton = new PButton("button")
            {
                Sprite     = PUITuning.Images.Checked,
                SpriteSize = new Vector2(25, 30),
            };

            PLabel descriptionLabel = new PLabel("description label")
            {
                Text          = "Description",
                TextAlignment = TextAnchor.MiddleCenter,
            };


            PPanel panel = new PPanel("Text panel")
            {
                Direction = PanelDirection.Vertical,
                Alignment = TextAnchor.UpperLeft,
                Spacing   = ROW_SPACING,
                FlexSize  = Vector2.one,
            };

            panel.AddChild(descriptionLabel);
            panel.AddChild(descriptionField);
            panel.AddChild(validationButton);


            PPanel root = new PPanel("NotepadSideScreen")
            {
                Direction = PanelDirection.Vertical,
                Margin    = OUTER_MARGIN,
                Alignment = TextAnchor.MiddleCenter,
                Spacing   = 0,
                BackColor = PUITuning.Colors.BackgroundLight,
                FlexSize  = Vector2.one,
            };

            root.AddChild(panel);
            RootPanel = root.SetKleiBlueColor().Build();
        }