コード例 #1
0
ファイル: DiaQDecisionEd.cs プロジェクト: voidserpent/rpgbase
		// ============================================================================================================

		private static void ShowVariableField(EditorWindow ed, DiaQDecisionTest t, DiaQAsset asset, float w)
		{
			GUILayout.BeginVertical();
			{
				// show main variable choise
				t.varType = (DiaQDecisionTest.VarType)EditorGUILayout.EnumPopup(t.varType, EditorStyles.miniButtonMid, GUILayout.Width(w));

				// show additional field for quest related var
				if (t.varType == DiaQDecisionTest.VarType.HasSeenPlayer)
				{
					if (t.valType != DiaQDecisionTest.ValType.True && t.valType != DiaQDecisionTest.ValType.False) t.valType = DiaQDecisionTest.ValType.True;
				}

				else if (t.varType == DiaQDecisionTest.VarType.AcceptedQuest || t.varType == DiaQDecisionTest.VarType.CompletedQuest || t.varType == DiaQDecisionTest.VarType.HandedInQuest)
				{
					if (t.valType != DiaQDecisionTest.ValType.True && t.valType != DiaQDecisionTest.ValType.False) t.valType = DiaQDecisionTest.ValType.True;
					if (t.s_opt1.Length < 2) t.s_opt1 = new string[] { "", "-" };
					if (GUILayout.Button(t.s_opt1[1], EditorStyles.miniButton, GUILayout.Width(w - 16))) DiaQuestSelectWiz.ShowWiz(_OnSelectedQuest, asset, new object[] { t, ed, asset });
				}

				else if (t.varType == DiaQDecisionTest.VarType.DiaQVariable)
				{
					if (t.valType < DiaQDecisionTest.ValType.Empty || t.valType > DiaQDecisionTest.ValType.DiaQVar) t.valType = DiaQDecisionTest.ValType.Empty;
					if (t.s_opt1.Length < 1) t.s_opt1 = new string[] { "" };
					GUILayout.BeginHorizontal();
					t.s_opt1[0] = EditorGUILayout.TextField(t.s_opt1[0], GUILayout.Width(w - 46));
					if (GUILayout.Button("<>", EditorStyles.miniButton, GUILayout.Width(30))) DiaQVarSelectWiz.ShowWiz(_OnSelectedVar, (s) => { t.s_opt1[0] = s; }, asset, new object[] { ed, asset });
					GUILayout.EndHorizontal();
				}

			}
			GUILayout.EndVertical();

			// --------------------------------------------------------------------------------------------------------
			// show test types that can be performed on this type of variable
			if (t.varType >= DiaQDecisionTest.VarType.HasSeenPlayer && t.varType <= DiaQDecisionTest.VarType.DiaQVariable)
			{
				t.testType = (DiaQDecisionTest.TestType)EditorGUILayout.Popup((int)t.testType, TestTypeNames1, EditorStyles.miniButtonMid, GUILayout.Width(30));
			}

		}
コード例 #2
0
ファイル: DiaQDecision.cs プロジェクト: fvivaudo/Rush01
		// ------------------------------------------------------------------------------------------------------------

		public DiaQDecisionTest Copy()
		{
			DiaQDecisionTest t = new DiaQDecisionTest();
			t.combineWithPrev = this.combineWithPrev;
			t.testType = this.testType;
			t.varType = this.varType;
			t.valType = this.valType;

			if (this.s_opt1.Length > 0)
			{
				t.s_opt1 = new string[this.s_opt1.Length];
				this.s_opt1.CopyTo(t.s_opt1, 0);
			}
			if (this.s_opt2.Length > 0)
			{
				t.s_opt2 = new string[this.s_opt2.Length];
				this.s_opt2.CopyTo(t.s_opt2, 0);
			}

			return t;
		}
コード例 #3
0
ファイル: DiaQDecisionEd.cs プロジェクト: voidserpent/rpgbase
		// ============================================================================================================

		private static void ShowValueField(EditorWindow ed, DiaQDecisionTest t, DiaQAsset asset, float w)
		{
			GUILayout.BeginVertical();
			{
				if (t.varType >= DiaQDecisionTest.VarType.HasSeenPlayer && t.varType <= DiaQDecisionTest.VarType.HandedInQuest)
				{
					t.valType = (DiaQDecisionTest.ValType)EditorGUILayout.Popup((int)t.valType, ValTypeNames1, EditorStyles.miniButtonRight, GUILayout.Width(w));
				}

				else if (t.varType == DiaQDecisionTest.VarType.DiaQVariable)
				{
					int sel = ((int)t.valType) - 2;
					if (sel < 0) sel = 0;
					EditorGUI.BeginChangeCheck();
					sel = EditorGUILayout.Popup(sel, ValTypeNames2, EditorStyles.miniButtonRight, GUILayout.Width(w));
					if (EditorGUI.EndChangeCheck())
					{
						t.valType = (DiaQDecisionTest.ValType)(sel + 2);
						t.s_opt2 = (t.valType == DiaQDecisionTest.ValType.Empty ? null : new string[] { "" });
					}

					if (t.valType == DiaQDecisionTest.ValType.String)
					{
						t.s_opt2[0] = EditorGUILayout.TextField(t.s_opt2[0], GUILayout.Width(w - 16));
					}
					else if (t.valType == DiaQDecisionTest.ValType.DiaQVar)
					{
						GUILayout.BeginHorizontal();
						t.s_opt2[0] = EditorGUILayout.TextField(t.s_opt2[0], GUILayout.Width(w-46)); 
						if (GUILayout.Button("<>", EditorStyles.miniButton, GUILayout.Width(30))) DiaQVarSelectWiz.ShowWiz(_OnSelectedVar, (s) => { t.s_opt2[0] = s; }, asset, new object[] { ed, asset });
						GUILayout.EndHorizontal();
					}

				}

			}
			GUILayout.EndVertical();
		}