static private EntityScopedIdentifier DoActionField(GUIContent inLabel, EntityScopedIdentifier inIdentifier, RSValidationFlags inFlags, RSValidationContext inContext) { EntityScopeData scope = inIdentifier.Scope; int actionId = inIdentifier.Id; using (new EditorGUILayout.VerticalScope()) { scope = EntityScopeField(inLabel, scope, inFlags.ForMethodScope(), inContext); using (new EditorGUI.IndentLevelScope()) { switch (scope.Type) { case EntityScopeType.Global: actionId = LibraryGUILayout.ActionSelectorGlobal(Content.ActionIdLabel, actionId, inContext.Library); break; case EntityScopeType.Null: EditorGUILayout.HelpBox("Cannot perform action on null entity", MessageType.Error); break; case EntityScopeType.Invalid: EditorGUILayout.HelpBox("Cannot perform action on missing entity", MessageType.Error); break; case EntityScopeType.Self: { if (inFlags.Has(RSValidationFlags.FilterSelection) && !scope.HasLinks() && inContext.Entity != null) { actionId = LibraryGUILayout.ActionSelector(Content.ActionIdLabel, actionId, inContext.Entity, inContext.Library); } else { actionId = LibraryGUILayout.ActionSelectorUnknown(Content.ActionIdLabel, actionId, inContext.Library); } break; } case EntityScopeType.ObjectById: { RSEntityId entityId = scope.IdArg; IRSEntity entity = null; if (inFlags.Has(RSValidationFlags.FilterSelection) && entityId != RSEntityId.Null && !scope.HasLinks() && inContext.Manager != null && (entity = inContext.Manager.Lookup.EntityWithId(entityId)) != null) { actionId = LibraryGUILayout.ActionSelector(Content.ActionIdLabel, actionId, entity, inContext.Library); } else { actionId = LibraryGUILayout.ActionSelectorUnknown(Content.ActionIdLabel, actionId, inContext.Library); } break; } default: actionId = LibraryGUILayout.ActionSelectorUnknown(Content.ActionIdLabel, actionId, inContext.Library); break; } if (actionId == 0) { EditorGUILayout.HelpBox("Cannot perform null action", MessageType.Error); } } } return(new EntityScopedIdentifier(scope, actionId)); }
private void TableParamsGUI() { { TableMode nextMode = (TableMode)EnumGUILayout.EnumField("Search Type", m_Params.TableParams.Mode); if (nextMode != m_Params.TableParams.Mode) { m_SelfUndoTarget.MarkDirty("Switched entity search mode"); m_Params.TableParams.Mode = nextMode; m_Params.TableParams.Clear(); m_SearchQueued = true; } } switch (m_Params.TableParams.Mode) { case TableMode.Action: { int nextAction = LibraryGUILayout.ActionSelector(s_ActionLabel, m_Params.TableParams.ElementSearchId, m_Library); if (nextAction != m_Params.TableParams.ElementSearchId) { m_SelfUndoTarget.MarkDirty("Changed action id"); m_Params.TableParams.ElementSearchId = nextAction; m_SearchQueued = true; } break; } case TableMode.Query: { int nextQuery = LibraryGUILayout.QuerySelector(s_QueryLabel, m_Params.TableParams.ElementSearchId, false, m_Library); if (nextQuery != m_Params.TableParams.ElementSearchId) { m_SelfUndoTarget.MarkDirty("Changed query id"); m_Params.TableParams.ElementSearchId = nextQuery; m_SearchQueued = true; } break; } case TableMode.Trigger: { int nextTrigger = (int)LibraryGUILayout.TriggerSelector(s_TriggerLabel, new RSTriggerId(m_Params.TableParams.ElementSearchId), m_Library); if (nextTrigger != m_Params.TableParams.ElementSearchId) { m_SelfUndoTarget.MarkDirty("Changed trigger id"); m_Params.TableParams.ElementSearchId = nextTrigger; m_SearchQueued = true; } break; } case TableMode.Entity: { RSEntityId entityId = RSEditorUtility.EditorPlugin.EntityIdGUIField(s_EntityLabel, m_Params.TableParams.EntitySearch, m_EntityMgr); if (entityId != m_Params.TableParams.EntitySearch) { m_SelfUndoTarget.MarkDirty("Changed entity search"); m_Params.TableParams.EntitySearch = entityId; m_SearchQueued = true; } break; } case TableMode.String: { string nextString = EditorGUILayout.TextField("Search", m_Params.TableParams.StringSearch); if (nextString != m_Params.TableParams.StringSearch) { m_SelfUndoTarget.MarkDirty("Changed string search"); m_Params.TableParams.StringSearch = nextString; m_SearchQueued = true; } break; } } }