private void DrawElementCallback(Rect rect, int index, bool isactive, bool isfocused) { SerializedProperty property = this.list.serializedProperty.GetArrayElementAtIndex(index); Rect rectName = new Rect( rect.x, rect.y + (rect.height / 2.0f - EditorGUIUtility.singleLineHeight / 2.0f), rect.width / 2.0f, EditorGUIUtility.singleLineHeight ); Rect rectType = new Rect( rectName.x + rectName.width + EditorGUIUtility.standardVerticalSpacing, rectName.y, rect.width / 2.0f - EditorGUIUtility.standardVerticalSpacing, rectName.height ); string name = property.FindPropertyRelative("name").stringValue; name = EditorGUI.DelayedTextField( rectName, GUIContent.none, property.FindPropertyRelative("name").stringValue ); if (name != property.FindPropertyRelative("name").stringValue) { property.FindPropertyRelative("name").stringValue = VariableEditor.ProcessName(name); } EditorGUI.PropertyField(rectType, property.FindPropertyRelative("type"), GUIContent.none); }
private void BindMacroTask(MacroTask macroTask, StudioViewModel viewModel) { switch (macroTask.MacroTaskType) { case EMacroTaskType.Text: ShowOnlyText(); TextBoxTaskText.Text = macroTask.Line; break; case EMacroTaskType.SpecialKey: ShowOnlyComboBox(); ComboBoxItems.ItemsSource = viewModel.SupportedSpecialKeys; SelectComboBoxItem(macroTask.SpecialKey.ToString()); break; case EMacroTaskType.Format: ShowAppropriateFormattingOptions(); break; case EMacroTaskType.Variable: ShowVariableOptions(); VariableEditor.SetInitialValues(viewModel.RegisteredVariables[macroTask.VarName]); break; default: break; } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { // // lblLabel.IsEditing = !lblLabel.IsEditing; // IsEditing = !IsEditing; // lblLabel.IsEditing = IsEditing; // lblVariable.IsEditing = IsEditing; // lblFormula.IsEditing = IsEditing; // if (IsEditing) // { // btnEdit.Content = "Done"; // } // else // { // btnEdit.Content = "Edit"; // } VariableEditor editor = new VariableEditor(Label, Variable, Formula, AllowFiltering); if (editor.ShowDialog() == true) { ChangeLabel(editor.Label); ChangeVariable(editor.Variable); ChangeFormula(editor.Formula); ChangeAllowFiltering(editor.AllowFiltering); } }
void OnGUI() { RunemarkGUI.inspectorTitle.Draw("Dialogue System UI Globals", ""); // If globals doesn't exists create new one. if (_globals == null) { float w = position.width; float h = position.height; Rect r = new Rect(20, 60, w - 40, 30); EditorGUI.HelpBox(r, "You have to create a new Dialogue System Global asset. ", MessageType.Warning); r.y += r.height + 10; if (GUI.Button(r, "Create")) { string path = EditorUtility.SaveFilePanelInProject( "Create a new Dialogue System Global asset", "Dialogue System Global.asset", "asset", "" ); // Check if the path is a Resources folder. if (!path.Contains("Resources")) { var pathArr = path.Split('/').ToList(); string filename = pathArr[pathArr.Count - 1]; pathArr.RemoveAt(pathArr.Count - 1); path = string.Join("/", pathArr.ToArray()); if (!Directory.Exists(path + "/Resources")) { AssetDatabase.CreateFolder(path, "Resources"); } path = path + "/Resources"; path = path + "/" + filename; } RunemarkDebug.Log("Dialogue System Global created. Path: " + path); _globals = AssetCreator.CreateAsset <DialogueSystemGlobals>(path); OnEnable(); } return; } Rect rectLeft = new Rect(5, 45, 250, this.position.height - 50); Rect rectRight = new Rect(265, 45, position.width - 275, this.position.height - 50); EditorGUI.BeginChangeCheck(); _variableList.Draw(rectLeft); VariableEditor.OnInspectorGUI(rectRight, _selected); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(_globals); } }
private static void OnCreate() { //最もよくわかっていない部分 この順番じゃないとダメっぽい ScriptEditor editor = GetWindow <ScriptEditor>(); editor.position = new Rect(100, 100, 1050, 510);//サイズ変更 variableEditor = GetWindow <VariableEditor>(typeof(ScriptEditor)); editor.Focus(); variableEditor.Initialize(); InitializeSceneNames(); }
private void InitializeDockingControls() { dockPanel.SuspendLayout(); dockPanel.Theme = new VS2015LightTheme(); dockPanel.BackColor = SystemColors.Control; dockPanel.DockBackColor = SystemColors.Control; this.Renderer = new RendererBase(); Renderer.BackColor = SystemColors.ControlDark; Renderer.AllowDrop = true; Renderer.HideOnClose = true; _metaEditor = new SearchEditor(Renderer.RenderingEngine); _helpEditor = new HelpEditor(Renderer.RenderingEngine); _switchesTree = new SwitchesTree(Renderer.RenderingEngine); _errorList = new ErrorList(Renderer.RenderingEngine); _triggerExample = new TriggerExample(Renderer.RenderingEngine); _variableEditor = new VariableEditor(Renderer.RenderingEngine); _switchesTree.HideOnClose = true; _metaEditor.HideOnClose = true; _helpEditor.HideOnClose = true; _triggerExample.HideOnClose = true; _variableEditor.HideOnClose = true; _errorList.HideOnClose = true; dockPanel.DockLeftPortion = 220; dockPanel.DockRightPortion = 220; LoadStateFromXml(); Renderer.RenderingEngine.ProjectLoaded += RenderingEngineOnProjectLoaded; Renderer.InitializeEngine(); _switchesTree.UpdateTree(); _metaEditor.UpdateTree(); _helpEditor.UpdateTree(); dockPanel.ResumeLayout(true, true); }
public static bool EditFsmXpathQueryField(Fsm fsm, FsmXpathQuery target) { bool edited = false; target._foldout = FsmEditorGUILayout.BoldFoldout(target._foldout, new GUIContent("xPath Query")); if (target.xPathQuery == null) { target.xPathQuery = new FsmString(); } if (target._foldout) { #if PLAYMAKER_1_8_OR_NEWER PlayMakerInspectorUtils.SetActionEditorVariableSelectionContext(target, target.GetType().GetField("xPathQuery")); #endif target.xPathQuery = VariableEditor.FsmStringField(new GUIContent("xPath Query"), fsm, target.xPathQuery, null); } if (string.IsNullOrEmpty(target.xPathQuery.Value)) { } else { if (target.xPathVariables == null || target.xPathVariables.Length == 0) { if (!target._foldout) { EditorGUILayout.LabelField("xPath Query", target.xPathQuery.Value); } } else { EditorGUILayout.LabelField("xPath Query parsed", target.ParseXpathQuery(fsm)); } } if (target._foldout) { edited = edited || EditFsmXpathQueryVariablesProperties(fsm, target); } return(edited); }
public static bool EditFsmXpathQueryField(Fsm fsm, FsmXpathQuery target) { bool edited = false; target._foldout = FsmEditorGUILayout.BoldFoldout(target._foldout, new GUIContent("xPath Query")); if (target.xPathQuery == null) { target.xPathQuery = new FsmString(); } if (target._foldout) { target.xPathQuery = VariableEditor.FsmStringField(new GUIContent("xPath Query"), fsm, target.xPathQuery, null); } if (string.IsNullOrEmpty(target.xPathQuery.Value)) { } else { if (target.xPathVariables == null || target.xPathVariables.Length == 0) { if (!target._foldout) { EditorGUILayout.LabelField("xPath Query", target.xPathQuery.Value); } } else { EditorGUILayout.LabelField("xPath Query parsed", target.ParseXpathQuery(fsm)); } } if (target._foldout) { edited = edited || EditFsmXpathQueryVariablesProperties(fsm, target); } return(edited); }
public static bool EditFsmPropertiesStorage(Fsm fsm, FsmXmlPropertiesStorage target) { FsmEditorGUILayout.LightDivider(); bool edited = false; int count = 0; if (target != null && target.properties != null && target.propertiesVariables != null) { count = target.properties.Length; for (int i = 0; i < count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("Property item " + i); GUILayout.FlexibleSpace(); if (FsmEditorGUILayout.DeleteButton()) { ArrayUtility.RemoveAt(ref target.properties, i); ArrayUtility.RemoveAt(ref target.propertiesVariables, i); return(true); // we must not continue, an entry is going to be deleted so the loop is broken here. next OnGui, all will be well. } GUILayout.EndHorizontal(); target.properties[i] = VariableEditor.FsmStringField(new GUIContent("Property"), fsm, target.properties[i], null); target.propertiesVariables[i] = VariableEditor.FsmVarPopup(new GUIContent("Value"), fsm, target.propertiesVariables[i]); } } string _addButtonLabel = "Get a Property"; if (count > 0) { _addButtonLabel = "Get another Property"; } GUILayout.BeginHorizontal(); GUILayout.Space(154); if (GUILayout.Button(_addButtonLabel)) { if (target.properties == null) { target.properties = new FsmString[0]; target.propertiesVariables = new FsmVar[0]; } ArrayUtility.Add <FsmString>(ref target.properties, new FsmString()); ArrayUtility.Add <FsmVar>(ref target.propertiesVariables, new FsmVar()); edited = true; } GUILayout.Space(21); GUILayout.EndHorizontal(); return(edited || GUI.changed); }
private bool EditResultProperties(XmlSelectSingleNode _target) { bool edited = false; int count = 0; if (_target.properties != null && _target.propertyValues != null) { count = _target.properties.Length; for (int i = 0; i < count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("Property item " + i); GUILayout.FlexibleSpace(); if (FsmEditorGUILayout.MiniButton(new GUIContent("x"), GUILayout.Width(16))) { ArrayUtility.RemoveAt(ref _target.properties, i); ArrayUtility.RemoveAt(ref _target.propertyValues, i); return(true); // we must not continue, an entry is going to be deleted so the loop is broken here. next OnGui, all will be well. } GUILayout.Space(5); GUILayout.EndHorizontal(); _target.properties[i] = VariableEditor.FsmStringField(new GUIContent("Property"), _target.Fsm, _target.properties[i], null); _target.propertyValues[i] = VariableEditor.FsmStringField(new GUIContent("Value"), _target.Fsm, _target.propertyValues[i], null); FsmEditorGUILayout.LightDivider(); } } string _addButtonLabel = "Get a Property"; if (count > 0) { _addButtonLabel = "Get another Property"; } if (GUILayout.Button(_addButtonLabel)) { if (_target.properties == null) { _target.properties = new FsmString[0]; _target.propertyValues = new FsmString[0]; } ArrayUtility.Add <FsmString>(ref _target.properties, new FsmString()); ArrayUtility.Add <FsmString>(ref _target.propertyValues, new FsmString()); edited = true; } return(edited || GUI.changed); }
public static bool EditFsmXmlSourceField(Fsm fsm, FsmXmlSource source) { source.sourceSelection = EditorGUILayout.Popup("Source selection", source.sourceSelection, source.sourceTypes); if (source.sourceString == null) { source.sourceString = new FsmString(); } source.sourceString.UseVariable = source.sourceSelection == 2; bool showPreview = false; string preview = ""; if (source.sourceSelection == 0) { source._sourceEdit = EditorGUILayout.Foldout(source._sourceEdit, new GUIContent("Edit")); if (source._sourceEdit) { source.sourceString.Value = EditorGUILayout.TextArea(source.sourceString.Value, GUILayout.Height(200)); } } else if (source.sourceSelection == 1) { source.sourcetextAsset = (TextAsset)EditorGUILayout.ObjectField("TextAsset Object", source.sourcetextAsset, typeof(TextAsset), false); if (source.sourcetextAsset != null) { source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview")); showPreview = source._sourcePreview; preview = source.sourcetextAsset.text; } } else if (source.sourceSelection == 2) { source.sourceString = VariableEditor.FsmStringField(new GUIContent("Fsm String"), fsm, source.sourceString, null); if (!source.sourceString.UseVariable) { source.sourceSelection = 0; return(true); } if (!source.sourceString.IsNone) { source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview")); showPreview = source._sourcePreview; preview = source.sourceString.Value; } } else if (source.sourceSelection == 3) { if (source.sourceProxyGameObject == null) { source.sourceProxyGameObject = new FsmGameObject(); source.sourceProxyReference = new FsmString(); } source.sourceProxyGameObject = VariableEditor.FsmGameObjectField(new GUIContent("GameObject"), fsm, source.sourceProxyGameObject); source.sourceProxyReference = VariableEditor.FsmStringField(new GUIContent("Reference"), fsm, source.sourceProxyReference, null); if (source.sourceProxyGameObject != null) { DataMakerXmlProxy proxy = DataMakerCore.GetDataMakerProxyPointer(typeof(DataMakerXmlProxy), source.sourceProxyGameObject.Value, source.sourceProxyReference.Value, true) as DataMakerXmlProxy; if (proxy != null) { if (proxy.XmlTextAsset != null) { source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview")); showPreview = source._sourcePreview; preview = proxy.XmlTextAsset.text; } else { //oupss... } } else { //oupss.. } } } else if (source.sourceSelection == 4) { if (source.inMemoryReference == null) { source.inMemoryReference = new FsmString(); } source.inMemoryReference = VariableEditor.FsmStringField(new GUIContent("Memory Reference"), fsm, source.inMemoryReference, null); if (!string.IsNullOrEmpty(source.inMemoryReference.Value)) { source._sourcePreview = EditorGUILayout.Foldout(source._sourcePreview, new GUIContent("Preview")); showPreview = source._sourcePreview; preview = DataMakerXmlUtils.XmlNodeToString(DataMakerXmlUtils.XmlRetrieveNode(source.inMemoryReference.Value)); } } if (showPreview) { if (string.IsNullOrEmpty(preview)) { GUILayout.Label("-- empty --"); } else { source._scroll = GUILayout.BeginScrollView(source._scroll, "box", GUILayout.Height(200)); GUI.skin.box.alignment = TextAnchor.UpperLeft; GUILayout.Box(preview, "", null); GUILayout.EndScrollView(); } } return(false); }
public static void EditHashSetField(Fsm fsm, FsmString key, FsmString content) { key = VariableEditor.FsmStringField(new GUIContent("Property"), fsm, key, null); content = VariableEditor.FsmStringField(new GUIContent("Value"), fsm, content, null); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.variablesPanel = new System.Windows.Forms.FlowLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.nameLabel = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.variableEditorPlaceholder = new WordGenerator.Controls.VariableEditor(); this.addButton = new System.Windows.Forms.Button(); this.lockButton = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.loadCalSequenceFromCurrentSequence = new System.Windows.Forms.Button(); this.loadCalSequenceFromFile = new System.Windows.Forms.Button(); this.unloadCalSequence = new System.Windows.Forms.Button(); this.calShotSequenceLabel = new System.Windows.Forms.Label(); this.calShotSeqLabInfo = new System.Windows.Forms.Label(); this.runEveryNCheck = new System.Windows.Forms.CheckBox(); this.runCalN = new System.Windows.Forms.NumericUpDown(); this.runEveryLabel = new System.Windows.Forms.Label(); this.runCalLastCheck = new System.Windows.Forms.CheckBox(); this.runCalFirstCheck = new System.Windows.Forms.CheckBox(); this.calibEnabled = new System.Windows.Forms.CheckBox(); this.panel1 = new System.Windows.Forms.Panel(); this.equationHelpButton = new System.Windows.Forms.Button(); this.permanentVariablesButton = new System.Windows.Forms.Button(); this.listFiller = new System.Windows.Forms.GroupBox(); this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.listFillerStep = new System.Windows.Forms.NumericUpDown(); this.listFillerStop = new System.Windows.Forms.NumericUpDown(); this.listFillerStart = new System.Windows.Forms.NumericUpDown(); this.listFillerButton = new System.Windows.Forms.Button(); this.listFillerSelector = new System.Windows.Forms.ComboBox(); this.LockMessage = new System.Windows.Forms.Label(); this.listEditorPanelPlaceholder = new WordGenerator.Controls.ListEditorPanel(); this.runControl1 = new WordGenerator.Controls.RunControl(); this.variablesPanel.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.runCalN)).BeginInit(); this.panel1.SuspendLayout(); this.listFiller.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.listFillerStep)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.listFillerStop)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.listFillerStart)).BeginInit(); this.SuspendLayout(); // // variablesPanel // this.variablesPanel.AutoSize = true; this.variablesPanel.Controls.Add(this.tableLayoutPanel1); this.variablesPanel.Controls.Add(this.variableEditorPlaceholder); this.variablesPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; this.variablesPanel.Location = new System.Drawing.Point(3, 0); this.variablesPanel.Name = "variablesPanel"; this.variablesPanel.Size = new System.Drawing.Size(235, 701); this.variablesPanel.TabIndex = 0; // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 4; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 32.71028F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 67.28972F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 53F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 103F)); this.tableLayoutPanel1.Controls.Add(this.label1, 2, 0); this.tableLayoutPanel1.Controls.Add(this.label2, 0, 0); this.tableLayoutPanel1.Controls.Add(this.nameLabel, 1, 0); this.tableLayoutPanel1.Controls.Add(this.label3, 3, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(229, 19); this.tableLayoutPanel1.TabIndex = 5; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(75, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(34, 13); this.label1.TabIndex = 1; this.label1.Text = "Value"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(3, 0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(15, 19); this.label2.TabIndex = 3; this.label2.Text = "Del"; // // nameLabel // this.nameLabel.AutoSize = true; this.nameLabel.Location = new System.Drawing.Point(26, 0); this.nameLabel.Name = "nameLabel"; this.nameLabel.Size = new System.Drawing.Size(35, 13); this.nameLabel.TabIndex = 0; this.nameLabel.Text = "Name"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(128, 0); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(55, 13); this.label3.TabIndex = 4; this.label3.Text = "Equation?"; // // variableEditorPlaceholder // this.variableEditorPlaceholder.ListLocked = false; this.variableEditorPlaceholder.Location = new System.Drawing.Point(3, 28); this.variableEditorPlaceholder.Name = "variableEditorPlaceholder"; this.variableEditorPlaceholder.Size = new System.Drawing.Size(220, 22); this.variableEditorPlaceholder.TabIndex = 2; this.variableEditorPlaceholder.Visible = false; // // addButton // this.addButton.Location = new System.Drawing.Point(24, 74); this.addButton.Name = "addButton"; this.addButton.Size = new System.Drawing.Size(55, 34); this.addButton.TabIndex = 1; this.addButton.Text = "Add Variable"; this.addButton.UseVisualStyleBackColor = true; this.addButton.Click += new System.EventHandler(this.addButton_Click); // // lockButton // this.lockButton.Location = new System.Drawing.Point(910, 765); this.lockButton.Name = "lockButton"; this.lockButton.Size = new System.Drawing.Size(157, 72); this.lockButton.TabIndex = 3; this.lockButton.Text = "Lock Lists"; this.lockButton.UseVisualStyleBackColor = true; this.lockButton.Click += new System.EventHandler(this.lockButton_Click); // // groupBox1 // this.groupBox1.Controls.Add(this.loadCalSequenceFromCurrentSequence); this.groupBox1.Controls.Add(this.loadCalSequenceFromFile); this.groupBox1.Controls.Add(this.unloadCalSequence); this.groupBox1.Controls.Add(this.calShotSequenceLabel); this.groupBox1.Controls.Add(this.calShotSeqLabInfo); this.groupBox1.Controls.Add(this.runEveryNCheck); this.groupBox1.Controls.Add(this.runCalN); this.groupBox1.Controls.Add(this.runEveryLabel); this.groupBox1.Controls.Add(this.runCalLastCheck); this.groupBox1.Controls.Add(this.runCalFirstCheck); this.groupBox1.Controls.Add(this.calibEnabled); this.groupBox1.Location = new System.Drawing.Point(312, 755); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(353, 135); this.groupBox1.TabIndex = 6; this.groupBox1.TabStop = false; this.groupBox1.Text = "Calibration Shots"; // // loadCalSequenceFromCurrentSequence // this.loadCalSequenceFromCurrentSequence.Location = new System.Drawing.Point(234, 103); this.loadCalSequenceFromCurrentSequence.Name = "loadCalSequenceFromCurrentSequence"; this.loadCalSequenceFromCurrentSequence.Size = new System.Drawing.Size(113, 26); this.loadCalSequenceFromCurrentSequence.TabIndex = 10; this.loadCalSequenceFromCurrentSequence.Text = "Load Current"; this.loadCalSequenceFromCurrentSequence.UseVisualStyleBackColor = true; this.loadCalSequenceFromCurrentSequence.Click += new System.EventHandler(this.loadCalSequenceFromCurrentSequence_Click); // // loadCalSequenceFromFile // this.loadCalSequenceFromFile.Location = new System.Drawing.Point(126, 103); this.loadCalSequenceFromFile.Name = "loadCalSequenceFromFile"; this.loadCalSequenceFromFile.Size = new System.Drawing.Size(104, 26); this.loadCalSequenceFromFile.TabIndex = 9; this.loadCalSequenceFromFile.Text = "Load From File"; this.loadCalSequenceFromFile.UseVisualStyleBackColor = true; this.loadCalSequenceFromFile.Click += new System.EventHandler(this.loadCalSequence_Click); // // unloadCalSequence // this.unloadCalSequence.Location = new System.Drawing.Point(14, 103); this.unloadCalSequence.Name = "unloadCalSequence"; this.unloadCalSequence.Size = new System.Drawing.Size(108, 26); this.unloadCalSequence.TabIndex = 8; this.unloadCalSequence.Text = "Unload Sequence"; this.unloadCalSequence.UseVisualStyleBackColor = true; this.unloadCalSequence.Click += new System.EventHandler(this.unloadCalSequence_Click); // // calShotSequenceLabel // this.calShotSequenceLabel.AutoEllipsis = true; this.calShotSequenceLabel.Location = new System.Drawing.Point(153, 69); this.calShotSequenceLabel.Name = "calShotSequenceLabel"; this.calShotSequenceLabel.Size = new System.Drawing.Size(194, 13); this.calShotSequenceLabel.TabIndex = 7; this.calShotSequenceLabel.Text = "label4"; // // calShotSeqLabInfo // this.calShotSeqLabInfo.AutoSize = true; this.calShotSeqLabInfo.Location = new System.Drawing.Point(11, 69); this.calShotSeqLabInfo.Name = "calShotSeqLabInfo"; this.calShotSeqLabInfo.Size = new System.Drawing.Size(136, 13); this.calShotSeqLabInfo.TabIndex = 6; this.calShotSeqLabInfo.Text = "Calibration Shot Sequence:"; // // runEveryNCheck // this.runEveryNCheck.AutoSize = true; this.runEveryNCheck.Location = new System.Drawing.Point(311, 40); this.runEveryNCheck.Name = "runEveryNCheck"; this.runEveryNCheck.Size = new System.Drawing.Size(15, 14); this.runEveryNCheck.TabIndex = 5; this.runEveryNCheck.UseVisualStyleBackColor = true; this.runEveryNCheck.CheckedChanged += new System.EventHandler(this.runEveryNCheck_CheckedChanged); // // runCalN // this.runCalN.Location = new System.Drawing.Point(263, 38); this.runCalN.Name = "runCalN"; this.runCalN.Size = new System.Drawing.Size(42, 20); this.runCalN.TabIndex = 4; this.runCalN.ValueChanged += new System.EventHandler(this.runCalN_ValueChanged); // // runEveryLabel // this.runEveryLabel.AutoSize = true; this.runEveryLabel.Location = new System.Drawing.Point(198, 40); this.runEveryLabel.Name = "runEveryLabel"; this.runEveryLabel.Size = new System.Drawing.Size(59, 13); this.runEveryLabel.TabIndex = 3; this.runEveryLabel.Text = "Run every:"; // // runCalLastCheck // this.runCalLastCheck.AutoSize = true; this.runCalLastCheck.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.runCalLastCheck.Location = new System.Drawing.Point(102, 39); this.runCalLastCheck.Name = "runCalLastCheck"; this.runCalLastCheck.Size = new System.Drawing.Size(75, 17); this.runCalLastCheck.TabIndex = 2; this.runCalLastCheck.Text = "Run Last?"; this.runCalLastCheck.UseVisualStyleBackColor = true; this.runCalLastCheck.CheckedChanged += new System.EventHandler(this.runCalLastCheck_CheckedChanged); // // runCalFirstCheck // this.runCalFirstCheck.AutoSize = true; this.runCalFirstCheck.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.runCalFirstCheck.Location = new System.Drawing.Point(11, 39); this.runCalFirstCheck.Name = "runCalFirstCheck"; this.runCalFirstCheck.Size = new System.Drawing.Size(74, 17); this.runCalFirstCheck.TabIndex = 1; this.runCalFirstCheck.Text = "Run First?"; this.runCalFirstCheck.UseVisualStyleBackColor = true; this.runCalFirstCheck.CheckedChanged += new System.EventHandler(this.runCalFirstCheck_CheckedChanged); // // calibEnabled // this.calibEnabled.AutoSize = true; this.calibEnabled.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; this.calibEnabled.Location = new System.Drawing.Point(14, 19); this.calibEnabled.Name = "calibEnabled"; this.calibEnabled.Size = new System.Drawing.Size(71, 17); this.calibEnabled.TabIndex = 0; this.calibEnabled.Text = "Enabled?"; this.calibEnabled.UseVisualStyleBackColor = true; this.calibEnabled.CheckedChanged += new System.EventHandler(this.calibEnabled_CheckedChanged); // // panel1 // this.panel1.AutoScroll = true; this.panel1.Controls.Add(this.variablesPanel); this.panel1.Location = new System.Drawing.Point(24, 132); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(272, 741); this.panel1.TabIndex = 7; // // equationHelpButton // this.equationHelpButton.Location = new System.Drawing.Point(158, 74); this.equationHelpButton.Name = "equationHelpButton"; this.equationHelpButton.Size = new System.Drawing.Size(57, 34); this.equationHelpButton.TabIndex = 8; this.equationHelpButton.Text = "Equation Help"; this.equationHelpButton.UseVisualStyleBackColor = true; this.equationHelpButton.Click += new System.EventHandler(this.equationHelpButton_Click); // // permanentVariablesButton // this.permanentVariablesButton.Location = new System.Drawing.Point(82, 74); this.permanentVariablesButton.Name = "permanentVariablesButton"; this.permanentVariablesButton.Size = new System.Drawing.Size(73, 34); this.permanentVariablesButton.TabIndex = 9; this.permanentVariablesButton.Text = "Permanent Variables"; this.permanentVariablesButton.UseVisualStyleBackColor = true; this.permanentVariablesButton.Click += new System.EventHandler(this.permanentVariablesButton_Click); // // listFiller // this.listFiller.Controls.Add(this.label6); this.listFiller.Controls.Add(this.label5); this.listFiller.Controls.Add(this.label4); this.listFiller.Controls.Add(this.listFillerStep); this.listFiller.Controls.Add(this.listFillerStop); this.listFiller.Controls.Add(this.listFillerStart); this.listFiller.Controls.Add(this.listFillerButton); this.listFiller.Controls.Add(this.listFillerSelector); this.listFiller.Location = new System.Drawing.Point(674, 755); this.listFiller.Name = "listFiller"; this.listFiller.Size = new System.Drawing.Size(210, 134); this.listFiller.TabIndex = 10; this.listFiller.TabStop = false; this.listFiller.Text = "List Filler"; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(142, 108); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(29, 13); this.label6.TabIndex = 12; this.label6.Text = "Step"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(142, 82); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(29, 13); this.label5.TabIndex = 11; this.label5.Text = "Stop"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(142, 57); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(29, 13); this.label4.TabIndex = 10; this.label4.Text = "Start"; // // listFillerStep // this.listFillerStep.DecimalPlaces = 3; this.listFillerStep.Location = new System.Drawing.Point(36, 104); this.listFillerStep.Maximum = new decimal(new int[] { 10000, 0, 0, 0}); this.listFillerStep.Minimum = new decimal(new int[] { 10000, 0, 0, -2147483648}); this.listFillerStep.Name = "listFillerStep"; this.listFillerStep.Size = new System.Drawing.Size(94, 20); this.listFillerStep.TabIndex = 9; // // listFillerStop // this.listFillerStop.DecimalPlaces = 3; this.listFillerStop.Location = new System.Drawing.Point(36, 78); this.listFillerStop.Maximum = new decimal(new int[] { 10000, 0, 0, 0}); this.listFillerStop.Minimum = new decimal(new int[] { 10000, 0, 0, -2147483648}); this.listFillerStop.Name = "listFillerStop"; this.listFillerStop.Size = new System.Drawing.Size(94, 20); this.listFillerStop.TabIndex = 8; // // listFillerStart // this.listFillerStart.DecimalPlaces = 3; this.listFillerStart.Location = new System.Drawing.Point(36, 53); this.listFillerStart.Maximum = new decimal(new int[] { 10000, 0, 0, 0}); this.listFillerStart.Minimum = new decimal(new int[] { 10000, 0, 0, -2147483648}); this.listFillerStart.Name = "listFillerStart"; this.listFillerStart.Size = new System.Drawing.Size(94, 20); this.listFillerStart.TabIndex = 7; // // listFillerButton // this.listFillerButton.Location = new System.Drawing.Point(145, 19); this.listFillerButton.Name = "listFillerButton"; this.listFillerButton.Size = new System.Drawing.Size(48, 23); this.listFillerButton.TabIndex = 6; this.listFillerButton.Text = "Fill"; this.listFillerButton.UseVisualStyleBackColor = true; this.listFillerButton.Click += new System.EventHandler(this.listFillerButton_Click); // // listFillerSelector // this.listFillerSelector.FormattingEnabled = true; this.listFillerSelector.Location = new System.Drawing.Point(12, 20); this.listFillerSelector.Name = "listFillerSelector"; this.listFillerSelector.Size = new System.Drawing.Size(111, 21); this.listFillerSelector.TabIndex = 5; this.listFillerSelector.SelectedIndexChanged += new System.EventHandler(this.listFillerSelector_SelectedIndexChanged); // // LockMessage // this.LockMessage.AutoSize = true; this.LockMessage.Location = new System.Drawing.Point(910, 898); this.LockMessage.Name = "LockMessage"; this.LockMessage.Size = new System.Drawing.Size(0, 13); this.LockMessage.TabIndex = 11; // // listEditorPanelPlaceholder // this.listEditorPanelPlaceholder.Location = new System.Drawing.Point(326, 3); this.listEditorPanelPlaceholder.Name = "listEditorPanelPlaceholder"; this.listEditorPanelPlaceholder.Size = new System.Drawing.Size(97, 774); this.listEditorPanelPlaceholder.TabIndex = 2; this.listEditorPanelPlaceholder.Visible = false; // // runControl1 // this.runControl1.IsRunNoSaveEnabled = true; this.runControl1.Location = new System.Drawing.Point(1092, 528); this.runControl1.Name = "runControl1"; this.runControl1.Size = new System.Drawing.Size(119, 300); this.runControl1.TabIndex = 5; // // VariablesAndListPage // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.LockMessage); this.Controls.Add(this.listFiller); this.Controls.Add(this.permanentVariablesButton); this.Controls.Add(this.equationHelpButton); this.Controls.Add(this.panel1); this.Controls.Add(this.groupBox1); this.Controls.Add(this.lockButton); this.Controls.Add(this.listEditorPanelPlaceholder); this.Controls.Add(this.addButton); this.Controls.Add(this.runControl1); this.Name = "VariablesAndListPage"; this.Size = new System.Drawing.Size(1264, 918); this.variablesPanel.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.runCalN)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.listFiller.ResumeLayout(false); this.listFiller.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.listFillerStep)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.listFillerStop)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.listFillerStart)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); }
public static bool EditFsmXpathQueryVariablesProperties(Fsm fsm, FsmXpathQuery target) { if (target == null) { target = new FsmXpathQuery(); } bool edited = false; int count = 0; if (target.xPathVariables != null) { count = target.xPathVariables.Length; for (int i = 0; i < count; i++) { GUILayout.BeginHorizontal(); target.xPathVariables[i] = VariableEditor.FsmVarPopup(new GUIContent("Variable _" + i + "_"), fsm, target.xPathVariables[i]); if (i + 1 == count) { if (FsmEditorGUILayout.DeleteButton()) { ArrayUtility.RemoveAt(ref target.xPathVariables, i); return(true); // we must not continue, an entry is going to be deleted so the loop is broken here. next OnGui, all will be well. } } else { GUILayout.Space(21); } GUILayout.EndHorizontal(); } } string _addButtonLabel = "Add a variable"; if (count > 0) { _addButtonLabel = "Add another variable"; } GUILayout.BeginHorizontal(); GUILayout.Space(154); if (GUILayout.Button(_addButtonLabel)) { if (target.xPathVariables == null) { target.xPathVariables = new FsmVar[0]; } ArrayUtility.Add <FsmVar>(ref target.xPathVariables, new FsmVar()); edited = true; } GUILayout.Space(21); GUILayout.EndHorizontal(); return(edited || GUI.changed); }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { string Property = e.Link.LinkData as string; PropertyInfo info = action.GetType().GetProperty(Property); if (info == null) { MessageBox.Show("Property " + Property + " Does not exist for " + action.GetType().Name); return; } DialogResult result = DialogResult.Cancel; string valueResult = ""; if (info.PropertyType == typeof(NumberValue)) { VariableEditor editor = new VariableEditor(); if (Variables != null) { editor.SetVariable(Variables.Select(x => x.Name)); } else { editor.SetVariable(new string[] { }); } NumberValue val = info.GetMethod.Invoke(action, new object[] { }) as NumberValue; editor.SetDefault(val == null ? "" : val.ToString()); editor.Text = "Variable Editor - " + Property; result = editor.ShowDialog(); if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { new NumberValue(valueResult) }); } } if (info.PropertyType == typeof(TargetKey)) { TargetKeyEditor editor = new TargetKeyEditor(); editor.SetPresets(ActionContext); editor.VariableList = Variables; TargetKey t = info.GetMethod.Invoke(action, new object[] { }) as TargetKey; if (t == null) { t = new TargetKey(); } editor.Target = t; result = editor.ShowDialog(); if (result == DialogResult.OK) { TargetKey target = editor.Target; info.SetMethod.Invoke(action, new object[] { target }); } } //It's an Enum! if (typeof(Enum).IsAssignableFrom(info.PropertyType)) { Enum enumValue = info.GetMethod.Invoke(action, new object[] { }) as Enum; //Find out if it's a flag and open the flag editor if (info.PropertyType.GetCustomAttribute <FlagsAttribute>() != null) { FlagCheckBoxEditor editor = new FlagCheckBoxEditor(); editor.EnumValue = enumValue; result = editor.ShowDialog(); enumValue = editor.EnumValue; } else { EnumEditor editor = new EnumEditor(); editor.EnumValue = enumValue; result = editor.ShowDialog(); enumValue = editor.EnumValue; } if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { enumValue }); valueResult = enumValue.ToString(); } } if (typeof(bool) == info.PropertyType) { bool val = (bool)info.GetMethod.Invoke(action, new object[] { }); BoolEditor editor = new BoolEditor(); editor.Value = val; result = editor.ShowDialog(); if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { editor.Value }); } } if (typeof(string) == info.PropertyType) { string val = (string)info.GetMethod.Invoke(action, new object[] { }); TextPrompt editor = new TextPrompt(); editor.Text = Property; editor.PromptText = val; result = editor.ShowDialog(); if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { editor.PromptText }); } } if (typeof(ActionCollection) == info.PropertyType) { ActionCollection actions = info.GetMethod.Invoke(action, new object[] { }) as ActionCollection; ActionListEditor editor = new ActionListEditor(); if (actions == null) { actions = new ActionCollection(Property); } editor.ActionContext = ActionContext; editor.Variables = Variables; editor.Actions = actions; result = editor.ShowDialog(); if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { editor.Actions }); } } if (result == DialogResult.OK) { UpdateLinkTexts(); } if (LinkClicked != null) { LinkClicked.Invoke(this, new LinkClickedEventArgs(e.Link.LinkData as string)); } }
public static bool EditFsmXmlPropertiesTypes(Fsm fsm, FsmXmlPropertiesTypes target) { FsmEditorGUILayout.LightDivider(); bool edited = false; int count = 0; if (target.properties != null && target.propertiesTypes != null) { count = target.properties.Length; #if PLAYMAKER_1_8_OR_NEWER FieldInfo _fsmStringArray_FieldInfo = target.GetType().GetField("properties"); #endif for (int i = 0; i < count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("Property item " + i); GUILayout.FlexibleSpace(); if (FsmEditorGUILayout.DeleteButton()) { ArrayUtility.RemoveAt(ref target.properties, i); ArrayUtility.RemoveAt(ref target.propertiesTypes, i); return(true); // we must not continue, an entry is going to be deleted so the loop is broken here. next OnGui, all will be well. } GUILayout.EndHorizontal(); #if PLAYMAKER_1_8_OR_NEWER //PlayMakerInspectorUtils.SetActionEditorArrayVariableSelectionContext(target,i,_fsmStringArray_FieldInfo); #endif target.properties[i] = VariableEditor.FsmStringField(new GUIContent("Property"), fsm, target.properties[i], null); target.propertiesTypes[i] = (VariableType)EditorGUILayout.EnumPopup(new GUIContent("Type"), target.propertiesTypes[i]); } } string _addButtonLabel = "Define a Property"; if (count > 0) { _addButtonLabel = "Define another Property"; } GUILayout.BeginHorizontal(); GUILayout.Space(154); if (GUILayout.Button(_addButtonLabel)) { if (target.properties == null) { target.properties = new FsmString[0]; target.propertiesTypes = new VariableType[0]; } ArrayUtility.Add <FsmString>(ref target.properties, new FsmString()); ArrayUtility.Add <VariableType>(ref target.propertiesTypes, VariableType.Float); edited = true; } GUILayout.Space(21); GUILayout.EndHorizontal(); return(edited || GUI.changed); }
public static bool EditFsmPropertiesStorage(Fsm fsm, FsmXmlPropertiesStorage target) { FsmEditorGUILayout.LightDivider(); bool edited = false; int count = 0; if (target != null && target.properties != null && target.propertiesVariables != null) { count = target.properties.Length; for (int i = 0; i < count; i++) { GUILayout.BeginHorizontal(); GUILayout.Label("Property item " + i); GUILayout.FlexibleSpace(); if (FsmEditorGUILayout.DeleteButton()) { ArrayUtility.RemoveAt(ref target.properties, i); ArrayUtility.RemoveAt(ref target.propertiesVariables, i); return(true); // we must not continue, an entry is going to be deleted so the loop is broken here. next OnGui, all will be well. } GUILayout.EndHorizontal(); #if PLAYMAKER_1_8_OR_NEWER // PlayMakerInspectorUtils.SetActionEditorArrayVariableSelectionContext(target,i,target.GetType().GetField("properties").GetType()); #endif target.properties[i] = VariableEditor.FsmStringField(new GUIContent("Property"), fsm, target.properties[i], null); if (target.properties[i].UseVariable) { DataMakerEditorGUILayoutUtils.feedbackLabel("Using variables not supported, Check changeLog for infos", DataMakerEditorGUILayoutUtils.labelFeedbacks.ERROR); } // target.propertiesVariables[i] = VariableEditor.FsmVarPopup(new GUIContent("Value"),fsm,target.propertiesVariables[i]); bool fsmVariableChangedFlag = false; target.propertiesVariables[i] = PlayMakerInspectorUtils.EditorGUILayout_FsmVarPopup("Value", fsm.Variables.GetAllNamedVariables(), target.propertiesVariables[i], out fsmVariableChangedFlag); } } string _addButtonLabel = "Get a Property"; if (count > 0) { _addButtonLabel = "Get another Property"; } GUILayout.BeginHorizontal(); GUILayout.Space(154); if (GUILayout.Button(_addButtonLabel)) { if (target.properties == null) { target.properties = new FsmString[0]; target.propertiesVariables = new FsmVar[0]; } ArrayUtility.Add <FsmString>(ref target.properties, new FsmString()); ArrayUtility.Add <FsmVar>(ref target.propertiesVariables, new FsmVar()); edited = true; } GUILayout.Space(21); GUILayout.EndHorizontal(); return(edited || GUI.changed); }