protected RuleNode()
        {
            if (LastCreatedRuleNode != null)
            {
                LastCreatedRuleNode.NextNode = this;
            }

            LastCreatedRuleNode = this;

            var ruleNodeStyleAsset = AssetDatabase.LoadAssetAtPath <StyleSheet>(k_RuleNodeStylePath);

            styleSheets.Add(ruleNodeStyleAsset);
        }
Exemple #2
0
        static void HandleInput()
        {
            var evt = Event.current;

            if (evt.type != EventType.KeyDown)
            {
                return;
            }

            if (evt.keyCode == KeyCode.Delete || evt.keyCode == KeyCode.Backspace)
            {
                RulesModule.DeleteSelectedRuleNode();

                EditorEvents.RulesUiUsed.Send(new RuleUiArgs
                {
                    label = k_DeleteKeyAnalyticsLabel
                });
            }
            else if (evt.keyCode == KeyCode.Space)
            {
                var targetNode = RuleNode.HoveredAddBarNode ?? RuleNode.SelectedNode;
                RulesModule.AddNode(targetNode);

                EditorEvents.RulesUiUsed.Send(new RuleUiArgs
                {
                    label = k_AddKeyAnalyticsLabel
                });
            }
            else if (evt.keyCode == KeyCode.UpArrow)
            {
                RuleNode.SelectPrevious();

                EditorEvents.RulesUiUsed.Send(new RuleUiArgs
                {
                    label = k_SelectPreviousAnalyticsLabel
                });
            }
            else if (evt.keyCode == KeyCode.DownArrow)
            {
                RuleNode.SelectNext();

                EditorEvents.RulesUiUsed.Send(new RuleUiArgs
                {
                    label = k_SelectNextAnalyticsLabel
                });
            }
        }
 internal static void AddNode(RuleNode targetNode)
 {
     if (targetNode is ReplicatorRow repRow)
     {
         if (!repRow.IsGroup)
         {
             AddContent(repRow.BackingProxy.transform);
         }
     }
     else if (targetNode is ContentRow)
     {
         AddAction(targetNode.BackingObject.transform);
     }
     else if (targetNode is ActionRow)
     {
         AddAction(targetNode.ContainerObject);
     }
 }
        protected void Select(UnityObject obj, Transform viewObject, GameObject selectedRuleNode)
        {
            SelectedNode = this;

            if (obj.GetType() == typeof(Transform))
            {
                Selection.activeTransform = (Transform)obj;
            }
            else
            {
                RulesModule.SetSelectedComponent(obj);
            }

            RulesModule.DisplayElementSelected(m_NodeContainer);
            RulesModule.SelectedRuleNode = selectedRuleNode;
            RulesModule.FrameObject(viewObject);

            EditorGUIUtility.PingObject(obj);
        }