Beispiel #1
0
        static void AddVector2ComponentIfAbsent(GameObject go, Vector2ShortcutGroup group,
                                                List <Vector2OscEventHandler> components)
        {
            go.GetComponents(components);
            var found = false;

            foreach (var c in components)
            {
                if (c.Handlers == null)
                {
                    continue;
                }
                if (c.Handlers[0].Shortcut != group.X)
                {
                    continue;
                }
                if (c.Handlers[1].Shortcut != group.Y)
                {
                    continue;
                }
                found = true;
                break;
            }

            if (!found)
            {
                var component = go.AddComponent <Vector2OscEventHandler>();
                component.Setup();
                component.SetHandlers(group);
            }
        }
Beispiel #2
0
        void FindVector2Groups()
        {
            if (!ResolinkEditorSettings.Instance.GroupVector2s)
            {
                return;
            }

            ClearXyzShortcuts();
            k_Vector2Groups.Clear();
            k_Vector2ShortcutPrefixes.Clear();

            foreach (var shortcut in m_Shortcuts)
            {
                foreach (var regex in Regexes.Vector2.All)
                {
                    if (regex.IsMatch(shortcut.Input.Path))
                    {
                        AssignToVectorFieldList(shortcut);
                        break;
                    }
                }
            }

            AddToVector2PrefixSet(k_XShortcuts);
            AddToVector2PrefixSet(k_YShortcuts);

            foreach (var prefix in k_Vector2ShortcutPrefixes)
            {
                if (!AllVector2ComponentsFound(prefix))
                {
                    continue;
                }

                var group = new Vector2ShortcutGroup {
                    X = s_XShortcut, Y = s_YShortcut
                };
                k_Vector2Groups.Add(group);

                m_Shortcuts.Remove(s_XShortcut);
                m_Shortcuts.Remove(s_YShortcut);
            }
        }
Beispiel #3
0
 void DrawVector2Group(Vector2ShortcutGroup group)
 {
     DrawGroupedShortcut(group.X);
     MaybeSeparator();
     DrawGroupedShortcut(group.Y);
 }
Beispiel #4
0
 public void SetHandlers(Vector2ShortcutGroup group)
 {
     Handlers[0].Shortcut = group.X;
     Handlers[1].Shortcut = group.Y;
 }