Beispiel #1
0
 void UpdatePopupLabel()
 {
     if (popupElement != null)
     {
         if (control == null || showInstance)
         {
             if (member.IsTargetingPinOrNode)
             {
                 popupElement.text = string.Empty;
             }
             else
             {
                 popupElement.text = popupElement.richText ? uNodeUtility.GetNicelyDisplayName(config.value) : uNodeUtility.GetDisplayName(config.value);
             }
             popupElement.EnableInClassList("Layout", ClassListContains("Layout"));
         }
         else
         {
             popupElement.text    = string.Empty;
             popupElement.tooltip = string.Empty;
             popupElement.EnableInClassList("Layout", false);
         }
         if (oldRichText != popupElement.text)
         {
             if (!string.IsNullOrEmpty(popupElement.text))
             {
                 popupElement.tooltip = uNodeEditorUtility.RemoveHTMLTag(popupElement.text);
             }
             oldRichText = popupElement.text;
         }
     }
 }
Beispiel #2
0
 void Init(bool autoLayout)
 {
     if (config.type is RuntimeType)
     {
         if (config.owner.targetNode.owner.IsRuntimeGraph())
         {
             var field = new ObjectRuntimeField()
             {
                 objectType        = config.type as RuntimeType,
                 value             = config.value as UnityEngine.Object,
                 allowSceneObjects = uNodeEditorUtility.IsSceneObject(config.owner.targetNode)
             };
             field.RegisterValueChangedCallback((e) => {
                 config.OnValueChanged(e.newValue);
                 MarkDirtyRepaint();
             });
             Add(field);
         }
         else
         {
             var button = new Label()
             {
                 text = "null"
             };
             button.AddToClassList("PopupButton");
             button.EnableInClassList("Layout", autoLayout);
             Add(button);
         }
     }
     else
     {
         button = new PopupElement();
         button.EnableInClassList("Layout", autoLayout);
         button.AddManipulator(new LeftMouseClickable(OnClick));
         {
             if (config.value != null && config.value as uNodeRoot == config.owner.targetNode?.owner)
             {
                 button.text = "this";
             }
             else
             {
                 button.text = uNode.uNodeUtility.GetDisplayName(config.value);
             }
             button.tooltip = button.text;
             if (button.text.Length > 25)
             {
                 button.text = button.text.Substring(0, 25);
             }
         }
         Add(button);
     }
 }