Example #1
0
 private void DrawVariableNameEnterButton(ICacheEntry field)
 {
     if (GUILayout.Button(field.Name(), _alignedButtonStyle, _inspectorNameWidth))
     {
         var val = field.EnterValue();
         if (val != null)
         {
             _nextToPush = new InstanceStackEntry(val, field.Name());
         }
     }
 }
Example #2
0
        private void DrawSingleContentEntry(ICacheEntry entry)
        {
            GUILayout.BeginHorizontal(_inspectorRecordHeight);
            {
                try
                {
                    GUILayout.Label(entry.TypeName(), _inspectorTypeWidth);

                    var value = entry.GetValue();

                    if (entry.CanEnterValue() || value is Exception)
                    {
                        DrawVariableNameEnterButton(entry);
                    }
                    else
                    {
                        GUILayout.TextArea(entry.Name(), GUI.skin.label, _inspectorNameWidth);
                    }

                    if (entry.CanSetValue() && ToStringConverter.CanEditValue(entry, value))
                    {
                        DrawEditableValue(entry, value, GUILayout.ExpandWidth(true));
                    }
                    else
                    {
                        GUILayout.TextArea(ToStringConverter.ObjectToString(value), GUI.skin.label, GUILayout.ExpandWidth(true));
                    }

                    if (DnSpyHelper.IsAvailable && GUILayout.Button("^", _dnSpyButtonOptions))
                    {
                        DnSpyHelper.OpenInDnSpy(entry);
                    }
                }
                catch (Exception ex)
                {
                    RuntimeUnityEditorCore.Logger.Log(LogLevel.Error, $"Failed to draw setting {entry?.Name()} - {ex.Message}");
                    GUILayout.TextArea(ex.Message, GUI.skin.label, GUILayout.ExpandWidth(true));
                }
            }
            GUILayout.EndHorizontal();
        }
Example #3
0
        private void DrawVariableNameEnterButton(ICacheEntry field)
        {
            if (_alignedButtonStyle == null)
            {
                _alignedButtonStyle = new GUIStyle(GUI.skin.button)
                {
                    alignment = TextAnchor.MiddleLeft,
                    wordWrap  = true
                };
            }

            if (GUILayout.Button(field.Name(), _alignedButtonStyle, _inspectorNameWidth))
            {
                var val = field.EnterValue();
                if (val != null)
                {
                    var entry = val as InspectorStackEntryBase ?? new InstanceStackEntry(val, field.Name(), field);
                    Push(entry, IsContextClick());
                }
            }
        }
Example #4
0
 private void DrawVariableName(ICacheEntry field)
 {
     GUILayout.TextArea(field.Name(), GUI.skin.label, _inspectorNameWidth);
 }