protected internal static IEnumerable <Control> LocalPropertyList(object obj, IViewVariablesManagerInternal vvm,
                                                                          IResourceCache resCache)
        {
            var styleOther = false;
            var type       = obj.GetType();

            var members = new List <(MemberInfo, VVAccess, object value, Action <object> onValueChanged, Type)>();

            foreach (var fieldInfo in type.GetAllFields())
            {
                var attr = fieldInfo.GetCustomAttribute <ViewVariablesAttribute>();
                if (attr == null)
                {
                    continue;
                }

                members.Add((fieldInfo, attr.Access, fieldInfo.GetValue(obj), v => fieldInfo.SetValue(obj, v),
                             fieldInfo.FieldType));
            }

            foreach (var propertyInfo in type.GetAllProperties())
            {
                var attr = propertyInfo.GetCustomAttribute <ViewVariablesAttribute>();
                if (attr == null)
                {
                    continue;
                }

                members.Add((propertyInfo, attr.Access, propertyInfo.GetValue(obj),
                             v => propertyInfo.GetSetMethod(true).Invoke(obj, new[] { v }), propertyInfo.PropertyType));
            }

            members.Sort((a, b) => string.Compare(a.Item1.Name, b.Item1.Name, StringComparison.Ordinal));

            foreach (var(memberInfo, access, value, onValueChanged, memberType) in members)
            {
                var data = new ViewVariablesBlobMembers.MemberData
                {
                    Editable   = access == VVAccess.ReadWrite,
                    Name       = memberInfo.Name,
                    Type       = memberType.AssemblyQualifiedName,
                    TypePretty = memberType.ToString(),
                    Value      = value
                };

                var propertyEdit = new ViewVariablesPropertyControl(vvm, resCache);
                propertyEdit.SetStyle(styleOther = !styleOther);
                var editor = propertyEdit.SetProperty(data);
                editor.OnValueChanged += onValueChanged;
                // TODO: should this maybe not be hardcoded?
                if (editor is ViewVariablesPropertyEditorReference refEditor)
                {
                    refEditor.OnPressed += () => vvm.OpenVV(data.Value);
                }

                yield return(propertyEdit);
            }
        }
        private void WireReference(ViewVariablesPropertyEditor prop, object value)
        {
            if (!(prop is ViewVariablesPropertyEditorReference reference))
            {
                return;
            }

            // TODO: Won't work when networked, fix this.
            reference.OnPressed += () => _viewVariables.OpenVV(value);
        }