Example #1
0
		void OnGUI()
		{
			scroll = GUILayout.BeginScrollView(scroll, false, true);
			{
				if (asset.vars.Count > 0)
				{
					foreach (DiaQVar q in asset.vars)
					{
						if (GUILayout.Toggle(selected == q, q.name, GUI.skin.button, GUILayout.Width(275))) selected = q;
					}
				}
				else
				{
					GUILayout.Label("No DiaQ Variabled defined");
				}
			}
			GUILayout.EndScrollView();

			EditorGUILayout.BeginHorizontal();
			{
				GUILayout.FlexibleSpace();

				if (selected == null) GUI.enabled = false;
				if (GUILayout.Button("Accept", GUILayout.Width(60), GUILayout.Height(20)))
				{
					if (onUpdate != null) onUpdate(selected.name);
					accepted = true;
				}
				GUI.enabled = true;

				if (GUILayout.Button("Cancel", GUILayout.Width(60), GUILayout.Height(20))) this.Close();
				GUILayout.FlexibleSpace();
			}
			EditorGUILayout.EndHorizontal();
			GUILayout.Space(10);
		}
Example #2
0
		// ============================================================================================================
		#region diaq vars manip

		/// <summary>
		/// Will set the variable to val. Will create var if not exist.
		/// </summary>
		public void SetDiaQVarValue(string name, string val)
		{
			if (string.IsNullOrEmpty(name)) return;
			DiaQVar v= asset.vars.FirstOrDefault(vr => vr.name.Equals(name));
			if (v == null)
			{
				v = new DiaQVar() { name = name, val = val };
				asset.vars.Add(v);
			}
			else v.val = val;
		}