//private static readonly string[] TestTypeNames2 = { "==", "!=", ">", "<", ">=", "<=" };

		public static void OnGUI(EditorWindow ed, DiaQDecision d, DiaQAsset asset, float areaWidth)
		{
			float w = (areaWidth - 104) * 0.5f;

			GUILayout.BeginHorizontal();
			{
				GUILayout.Label("Evaluation");
				if (GUILayout.Button("+", EditorStyles.miniButton, GUILayout.Width(30))) d.tests.Add(new DiaQDecisionTest());
				GUILayout.FlexibleSpace();
			}
			GUILayout.EndHorizontal();
			EditorGUILayout.Space();

			DiaQDecisionTest del = null;
			bool first = true;
			foreach (DiaQDecisionTest t in d.tests)
			{
				GUILayout.BeginHorizontal();
				{
					// delete button
					if (GUILayout.Button("x", EditorStyles.miniButtonLeft, GUILayout.Width(20))) del = t;
					
					// how to combine with previous test
					if (!first) t.combineWithPrev = EditorGUILayout.Popup(t.combineWithPrev, ComBineOptions, EditorStyles.miniButtonMid, GUILayout.Width(30));
					else GUILayout.Button(" ", EditorStyles.miniButtonMid, GUILayout.Width(30));
					first = false;
					
					ShowVariableField(ed, t, asset, w);
					ShowValueField(ed, t, asset, w);

					GUILayout.FlexibleSpace();
				}
				GUILayout.EndHorizontal();
				GUILayout.Space(5);
			}
			if (del != null) d.tests.Remove(del);
		}
Exemple #2
0
		public DiaQDecision Copy()
		{
			DiaQDecision d = new DiaQDecision();
			d.tests = new List<DiaQDecisionTest>(0);
			foreach (DiaQDecisionTest t in this.tests) d.tests.Add(t.Copy());
			return d;
		}
Exemple #3
0
		// ============================================================================================================
		#region Editor helpers - do not access these at runtime

#if UNITY_EDITOR

		public void Init(int id, Type type)
		{
			this.id = id;
			this.type = type;
			this.outputs = new List<NodeLink>();
			CachedString = "-";

			switch (type)
			{
				case Type.Dialogue:
				{
					data = new string[] { "", "" };
					toggle = new bool[] { false, false };
					choices.Add("");
				} break;

				case Type.Decision:
				{
					decision = new DiaQDecision();
				} break;

				case Type.GiveQuest:
				{
					data = new string[] { "" };
					i_data = new int[] { 0 };
				} break;

				case Type.DebugLog:
				{
					data = new string[] { "" };
					i_data = new int[] { 0 };
				} break;

				case Type.SendMessage:
				{
					data = new string[] { "", "", "" };
					i_data = new int[] { 0, 0 };
					f_data = new float[] { 0f };
					o_data = new Object[] { null };
				} break;

				case Type.SetVariable:
				{
					data = new string[] { "", "" };
					i_data = new int[] { 0 };
				} break;

				case Type.Random:
				{
					i_data = new int[] { 3 };
				} break;

				case Type.UpdateCondition:
				{
					data = new string[] { "", "" };
					i_data = new int[] { 0 };
				} break;

				case Type.QuestCheck:
				{
					data = new string[] { "" };
					i_data = new int[] { 0 };
				} break;

				case Type.GiveReward:
				{
					data = new string[] { "" };
					i_data = new int[] { 0, 1, 1, 1 };
				} break;
				case Type.UniRPGEvent:
				{
					data = new string[] { "" };
				} break;

			}
		}