Пример #1
0
        private void RuleInfoGUI()
        {
            if (m_SelectionState.Rule == null)
            {
                return;
            }

            if (m_SelectionState.Rule.Conditions == null)
            {
                m_TargetState.UndoTarget.MarkDirty("Initialized Conditions");
                m_SelectionState.Rule.Conditions = new RSConditionData[0];
            }

            if (m_SelectionState.Rule.Actions == null)
            {
                m_TargetState.UndoTarget.MarkDirty("Initialized Actions");
                m_SelectionState.Rule.Actions = new RSActionData[0];
            }

            RuleGUILayout.RuleData(m_TargetState.UndoTarget, m_SelectionState.Rule, m_SelectionState.Table, GetBaseFlags(), m_Context);

            EditorGUILayout.Separator();

            m_ScrollState.RuleScroll = GUILayout.BeginScrollView(m_ScrollState.RuleScroll, false, false);
            {
                EditorGUILayout.LabelField(Content.RuleConditionListLabel, RSGUIStyles.SubHeaderStyle);

                if (m_ConditionList == null)
                {
                    ConfigureConditionList(m_SelectionState.Rule, ref m_ConditionList);
                }

                m_ConditionList.array = m_SelectionState.Rule.Conditions;
                m_ConditionList.DoLayout();
                using (new EditorGUI.DisabledScope(m_SelectionState.Rule.Conditions.Length == 0))
                {
                    Subset currentSubset = m_SelectionState.Rule.ConditionSubset;
                    Subset nextSubset    = (Subset)EditorGUILayout.EnumPopup(Content.RuleConditionSubsetLabel, currentSubset);
                    if (currentSubset != nextSubset)
                    {
                        m_TargetState.UndoTarget.MarkDirty("Changed Rule Conditions Subset");
                        m_SelectionState.Rule.ConditionSubset = nextSubset;
                    }
                }

                EditorGUILayout.Separator();

                EditorGUILayout.LabelField(Content.RuleActionListLabel, EditorStyles.boldLabel);

                if (m_ActionList == null)
                {
                    ConfigureActionList(m_SelectionState.Rule, ref m_ActionList);
                }

                m_ActionList.array = m_SelectionState.Rule.Actions;
                m_ActionList.DoLayout();
            }
            GUILayout.EndScrollView();
        }
Пример #2
0
        private void RuleTableGUI()
        {
            if (m_SelectionState.Table == null)
            {
                EditorGUILayout.HelpBox("No table selected for editing", MessageType.Info);
                return;
            }

            if (!m_TargetState.UndoTarget.IsValid())
            {
                EditorGUILayout.HelpBox("Target is no longer valid (possibly destroyed?)", MessageType.Error);
                return;
            }

            string currentName = m_SelectionState.Table.Name;
            string nextName    = EditorGUILayout.TextField(Content.TableNameLabel, currentName);

            if (currentName != nextName)
            {
                m_TargetState.UndoTarget.MarkDirty("Changed Rule Table Name");
                m_SelectionState.Table.Name = nextName;
            }

            EditorGUILayout.Separator();

            EditorGUILayout.LabelField(Content.TableRuleListLabel, RSGUIStyles.SubHeaderStyle);

            m_ScrollState.TableScroll = GUILayout.BeginScrollView(m_ScrollState.TableScroll, false, false);
            {
                if (m_RuleList == null)
                {
                    ConfigureRuleList(m_SelectionState.Table, ref m_RuleList);
                }

                m_RuleList.array = m_SelectionState.Table.Rules;
                m_RuleList.DoLayout();
            }
            GUILayout.EndScrollView();
        }