Example #1
0
        private void ProcessMembers(Node node, bool add)
        {
            IList <MemberInfo> members = DebugReflectionUtil.GetMemberInfos(node.GetType());

            foreach (MemberInfo info in members)
            {
                ProcessOnScreenDebugAttributeForMember(info, node, add);
            }
        }
Example #2
0
        private void ProcessClass(CanvasItem node, bool add)
        {
            DebugVisibilityGroups attr = DebugReflectionUtil.FindClassAttributeInNode <DebugVisibilityGroups>(node.GetType());

            if (attr == null)
            {
                return;
            }

            foreach (string name in attr.Groups)
            {
                ProcessVisibilityGroupMember(node, name, add);
            }
        }
Example #3
0
        private void OnNodeAdded(Node node)
        {
            Type type = node.GetType();

            if (DebugReflectionUtil.IsInGodotNamespace(type))
            {
                return;
            }

            ProcessMembers(node, true);
            ProcessMethods(node, true);
            if (node is CanvasItem)
            {
                ProcessClass((CanvasItem)node, true);
                ProcessGroups((CanvasItem)node, true);
            }
        }
Example #4
0
 private void ProcessActionAttributeForMethod(MethodInfo info, Node node, bool add)
 {
     if (!add)
     {
         DebugButtonMenu.RemoveButtonsForNode(node);
         return;
     }
     object[] attrs = DebugReflectionUtil.GetCustomAttributes <DebugAction>(info, true);
     if (attrs.Length == 0)
     {
         return;
     }
     foreach (object objAttr in attrs)
     {
         DebugAction attr = (DebugAction)objAttr;
         DebugButtonMenu.AddActionButton(ReplaceName(attr.Name, node), node, () => info.Invoke(node, attr.Parameters));
     }
 }
Example #5
0
        private void ProcessOnScreenDebugAttributeForMethod(MethodInfo info, Node node, bool add)
        {
            OnScreenDebug attr = DebugReflectionUtil.GetCustomAttribute <OnScreenDebug>(info) as OnScreenDebug;

            if (attr != null)
            {
                if (add)
                {
                    // Add
                    OnScreenDebugManager.AddOnScreenDebugInfo(ReplaceName(attr.DebugCategory, node),
                                                              ReplaceName(attr.Name, node), () => GetValueOfMethod(info, node), attr.Color);
                }
                else
                {
                    // Remove
                    OnScreenDebugManager.RemoveOnScreenDebugInfo(ReplaceName(attr.DebugCategory, node),
                                                                 ReplaceName(attr.Name, node));
                }
            }
        }