コード例 #1
0
        static public void CopyRule(RSRuleData inRuleData)
        {
            Clear();

            s_CurrentTarget = Target.Rule;
            s_CurrentRule   = inRuleData.Clone();
        }
コード例 #2
0
        static public RSRuleData PasteRule()
        {
            if (!HasRule())
            {
                Debug.LogError("No rule copied");
                return(null);
            }

            return(s_CurrentRule.Clone());
        }
コード例 #3
0
        private void RenderRuleListElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            RSRuleData rule = m_SelectionState.Table.Rules[index];

            Rect labelRect = rect;

            labelRect.width -= CLONE_BUTTON_WIDTH + CLONE_BUTTON_SPACING;

            string labelText = rule.GetPreviewString(null, m_Context.Library);

            using (new RSGUI.ColorScope(rule.Enabled ? Color.white : Color.gray))
            {
                EditorGUI.LabelField(labelRect, labelText);
            }

            Rect cloneRect = rect;

            cloneRect.width   = CLONE_BUTTON_WIDTH;
            cloneRect.height -= 4;
            cloneRect.x       = labelRect.xMax + CLONE_BUTTON_SPACING;

            using (new EditorGUI.DisabledScope(EditorApplication.isPlaying))
            {
                if (GUI.Button(cloneRect, "Clone"))
                {
                    RSRuleData clone = rule.Clone();
                    clone.Name += " (Clone)";
                    InsertRule(clone, index + 1);
                }
            }

            if (DetectContextClick(rect))
            {
                ShowRuleElementContextMenu(rule, index);
            }
        }