AssetObjectWindow InitializeInternal(AOStateMachineEditor stateMachineEditor, EditorProp packProp, ElementSelectionSystem selectionSystem) { this.stateMachineEditor = stateMachineEditor; this.selectionSystem = selectionSystem; multiEditAssetObjectProp = new EditorProp(new SerializedObject(this))["multiEditAssetObject"]; PacksManagerEditor.UpdateAssetObjectParametersIfDifferentFromDefaults(multiEditAssetObjectProp, packProp, true, true); EditorProp aoParameters = multiEditAssetObjectProp[AOStateMachineEditor.paramsField]; int paramsLength = aoParameters.arraySize; parameterLabels = paramsLength.Generate(i => new GUIContent(aoParameters[i]["name"].stringValue)).ToArray(); int ySize = minSizeWithoutParameters + (parameterYSize * paramsLength); position = new Rect(256, 256, 400, ySize); return(this); }
public void OnGUI() { multiSetParameterIndex = -1; if (CloseIfError()) { Close(); return; } GUIUtils.StartBox(1); if (!selectionSystem.hasSelection) { GUIUtils.Label(noAOsGUI); } else { bool drawingSingle = selectionSystem.singleSelected; SelectionElement firstSelected = selectionSystem.firstSelected; EditorProp assetObjectProp = drawingSingle ? AOStateMachineEditor.GetAOatPoolID(currentState, firstSelected.refIndex) : multiEditAssetObjectProp; if (assetObjectProp == null) { GUIUtils.Label(noAOsGUI); } else { // GUIUtils.Label(drawingSingle ? new GUIContent("<b>" + firstSelected.path + "</b>") : selectEditGUI); GUIUtils.Label(drawingSingle ? new GUIContent("<b>" + firstSelected.gui.text + "</b>") : selectEditGUI); GUILayout.FlexibleSpace(); GUIUtils.BeginIndent(); DrawAOParameters(drawingSingle, assetObjectProp); GUIUtils.EndIndent(); GUILayout.FlexibleSpace(); bool setMessages = DrawMessaging(AOStateMachineEditor.messageBlocksField, sendMessagesGUI, assetObjectProp, drawingSingle); bool setConditions = DrawMessaging(AOStateMachineEditor.conditionsBlockField, conditionsGUI, assetObjectProp, drawingSingle); if (!drawingSingle) { if (multiSetParameterIndex != -1) { CopyParameters( selectionSystem.GetReferenceIndiciesInSelectionOrAllShown(false).Generate(i => AOStateMachineEditor.GetAOatPoolID(currentState, i)), multiEditAssetObjectProp, multiSetParameterIndex ); } if (setMessages || setConditions) { CopyTextBlock( selectionSystem.GetReferenceIndiciesInSelectionOrAllShown(false).Generate(i => AOStateMachineEditor.GetAOatPoolID(currentState, i)), multiEditAssetObjectProp, setMessages ? AOStateMachineEditor.messageBlocksField : AOStateMachineEditor.conditionsBlockField ); } } } } GUILayout.FlexibleSpace(); if (GUIUtils.Button(closeGUI, GUIStyles.button, Colors.blue, Colors.black)) { Close(); } GUIUtils.EndBox(1); stateMachineEditor.so.SaveObject(); }
public static AssetObjectWindow ShowAssetObjectWindow(AOStateMachineEditor stateMachineEditor, EditorProp packProp, ElementSelectionSystem selectionSystem) { return(((AssetObjectWindow)GetWindow(typeof(AssetObjectWindow), true, "Asset Object:", false)).InitializeInternal(stateMachineEditor, packProp, selectionSystem)); }