static public bool Open(TableLineRef inRef) { RuleTableEditor window = GetWindow <RuleTableEditor>(); if (window.TryOpen(inRef)) { window.Show(); return(true); } return(false); }
static public bool Edit(UnityEngine.Object inTarget) { RuleTableEditor window = GetWindow <RuleTableEditor>(); if (window.TryEdit(inTarget)) { window.Show(); return(true); } return(false); }
static public bool Edit(IRSRuleTableSource inSource) { RuleTableEditor window = GetWindow <RuleTableEditor>(); UnityEngine.Object objSource = inSource as UnityEngine.Object; if (objSource != null && window.TryEdit(objSource)) { window.Show(); return(true); } return(false); }
private void RenderLineRef(TableLineRef inLineRef, int inIndex) { using (var scope = new EditorGUILayout.HorizontalScope()) using (new GUIScopes.ColorScope(inLineRef.Enabled ? Color.white : Color.gray)) { if (Event.current.type == EventType.MouseDown) { Rect r = scope.rect; if (r.Contains(Event.current.mousePosition)) { RuleTableEditor.Open(inLineRef); } } string prefix = string.Format("#{0}", inIndex + 1); using (new EditorGUI.DisabledScope(true)) using (new GUIScopes.LabelWidthScope(50)) { RSEditorUtility.EditorPlugin.RuleTableSourceField(EditorGUIUtility.TrTempContent(prefix), inLineRef.TableSource, m_TableMgr, GUILayout.Width(300)); } string ruleName = "[Unknown Rule]"; if (!string.IsNullOrEmpty(inLineRef.RuleId) && inLineRef.TableSource != null) { int ruleIdx = TableUtils.IndexOfRule(inLineRef.TableSource.TableData, inLineRef.RuleId); if (ruleIdx >= 0) { ruleName = inLineRef.TableSource.TableData.Rules[ruleIdx].Name; } } using (new GUIScopes.LabelWidthScope(400)) { if (inLineRef.ActionIndex >= 0) { string actionLabel = string.Format("Rule '{0}' -> Action {1}", ruleName, inLineRef.ActionIndex); EditorGUILayout.LabelField(actionLabel); } else if (inLineRef.ConditionIndex >= 0) { string conditionLabel = string.Format("Rule '{0}' -> Condition {1}", ruleName, inLineRef.ConditionIndex); EditorGUILayout.LabelField(conditionLabel); } else if (!string.IsNullOrEmpty(inLineRef.RuleId)) { string ruleLabel = string.Format("Rule '{0}'", ruleName); EditorGUILayout.LabelField(ruleLabel); } } GUILayout.FlexibleSpace(); if (!string.IsNullOrEmpty(inLineRef.Descriptor)) { GUILayout.Label(inLineRef.Descriptor); } if (GUILayout.Button("...", GUILayout.Width(25))) { RuleTableEditor.Open(inLineRef); } } }