private void displayAction(ComboWater script) { GUILayout.Label("Action:", EditorStyles.boldLabel); GUILayout.BeginHorizontal(GUILayout.MaxWidth(500)); GUILayout.Space(20); GUILayout.Label("Function Type:", GUILayout.Width(100)); GUI.backgroundColor = new Color(1, 1, 1, 1); script.actIndex = EditorGUILayout.Popup(script.actIndex, script.action); GUI.backgroundColor = standardBackgroundColor; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(50); GUILayout.Label(script.actionDescription[script.actIndex]); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.Label("Function Parameters:", EditorStyles.boldLabel); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.Space(20); GUILayout.EndHorizontal(); }
public void show(ComboWater script) { GUI.backgroundColor = standardBackgroundColor; GUILayout.BeginHorizontal("box"); GUILayout.Label("Name: ", GUILayout.Width(50)); GUI.backgroundColor = new Color(2, 2, 2, 1); script.name = GUILayout.TextField(script.name, 34, GUILayout.Width(250)); GUI.backgroundColor = standardBackgroundColor; if (script.name.Length == 0) { script.name = "New Combo Part"; } GUILayout.EndHorizontal(); GUILayout.Space(15); displayAction(script); GUILayout.Space(15); displayRequiredInput(script); GUILayout.Space(15); displayPreviousInput(script); }
private void drawSidebar() { GUI.backgroundColor = new Color(2, 2, 2); GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.normal.textColor = Color.black; if (bendingTypeIdx == 0 && AirCombos.Count > 0) { foreach (ComboAir combo in AirCombos) { if (GUILayout.Button(combo.name, buttonStyle)) { selectedAirCombo = combo; } GUILayout.Space(5); } } else if (bendingTypeIdx == 1 && WaterCombos.Count > 0) { foreach (ComboWater combo in WaterCombos) { if (GUILayout.Button(combo.name, buttonStyle)) { selectedWaterCombo = combo; } GUILayout.Space(5); } } else if (bendingTypeIdx == 2 && EarthCombos.Count > 0) { foreach (ComboEarth combo in EarthCombos) { if (GUILayout.Button(combo.name, buttonStyle)) { selectedEarthCombo = combo; } GUILayout.Space(5); } } else if (bendingTypeIdx == 3 && FireCombos.Count > 0) { foreach (ComboFire combo in FireCombos) { if (GUILayout.Button(combo.name, buttonStyle)) { selectedFireCombo = combo; } GUILayout.Space(5); } } }
public override void OnInspectorGUI() { ComboWater script = (ComboWater)target; script.name = EditorGUILayout.TextField(new GUIContent("Name:"), script.name); GUILayout.Space(15); displayAction(script); GUILayout.Space(15); displayRequiredInput(script); GUILayout.Space(15); displayPreviousInput(script); }
private void displayRequiredInput(ComboWater script) { GUILayout.Label("Required Input:", EditorStyles.boldLabel); GUILayout.BeginHorizontal("box"); GUILayout.Space(20); GUILayout.Label("Direction:", GUILayout.Width(100)); GUI.backgroundColor = new Color(1, 1, 1, 1); script.dirIndex = EditorGUILayout.Popup(script.dirIndex, script.direction, GUILayout.Width(60));; GUI.backgroundColor = standardBackgroundColor; GUILayout.EndHorizontal(); GUI.backgroundColor = standardBackgroundColor; GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.Label("Input Values:", EditorStyles.boldLabel); GUILayout.EndHorizontal(); GUILayout.BeginVertical(); for (int i = 0; i < script.requiredInputKeys.Length; i++) { GUILayout.BeginHorizontal(); GUILayout.Space(30); GUI.backgroundColor = standardBackgroundColor; GUILayout.Label(script.requiredInputKeys[i], GUILayout.Width(75)); GUI.backgroundColor = new Color(1, 1, 1); bool value = script.requiredInputValues[i]; script.requiredInputValues[i] = EditorGUILayout.Toggle(value); GUI.backgroundColor = standardBackgroundColor; GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.EndVertical(); }
private void removeSelectedComboPart() { if (bendingTypeIdx == 0) { AirCombos.Remove(selectedAirCombo); } else if (bendingTypeIdx == 1) { WaterCombos.Remove(selectedWaterCombo); } else if (bendingTypeIdx == 2) { EarthCombos.Remove(selectedEarthCombo); } else if (bendingTypeIdx == 3) { FireCombos.Remove(selectedFireCombo); } selectedFireCombo = null; selectedAirCombo = null; selectedWaterCombo = null; selectedEarthCombo = null; }
private void displayPreviousInput(ComboWater script) { GUILayout.BeginVertical(); GUILayout.Label("Previous Input:", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.Label("Previous Count:", GUILayout.Width(95)); GUI.backgroundColor = new Color(1, 1, 1, 1); script.preIndex = EditorGUILayout.IntPopup( script.preIndex, new string[] { "0", "1", "2", "3", "4", "5" }, new int[] { 0, 1, 2, 3, 4, 5 }, GUILayout.Width(35)); GUI.backgroundColor = standardBackgroundColor; GUILayout.EndHorizontal(); if (script.preIndex > 0) { GUI.backgroundColor = new Color(1, 1, 1, 1); if (script.preIndex > 3) { scrollPos = GUILayout.BeginScrollView(scrollPos, false, true); } GUI.backgroundColor = standardBackgroundColor; GUILayout.BeginVertical("box"); for (int i = 0; i < script.preIndex; i++) { GUILayout.BeginVertical("box"); GUILayout.BeginHorizontal(); GUILayout.Space(20); GUILayout.Label("Direction:", GUILayout.Width(75)); GUI.backgroundColor = new Color(1, 1, 1, 1); script.preDirIdx[i] = EditorGUILayout.Popup(script.preDirIdx[i], script.direction, GUILayout.Width(75)); GUI.backgroundColor = standardBackgroundColor; GUILayout.EndHorizontal(); int newValues = script.preFuncIdx[i]; GUILayout.BeginHorizontal(); GUILayout.Space(20); GUI.backgroundColor = new Color(1, 1, 1, 1); newValues = EditorGUILayout.Popup(newValues, script.action, GUILayout.Width(250)); GUI.backgroundColor = standardBackgroundColor; GUILayout.EndHorizontal(); script.preFuncIdx[i] = newValues; GUILayout.Space(10); GUILayout.EndVertical(); } GUILayout.EndVertical(); if (script.preIndex > 3) { GUILayout.EndScrollView(); } } GUILayout.EndVertical(); }
private void UpdateOldCombos() { int updateCount = 0; List <ComboAir> tempAir = new List <ComboAir>(); for (int i = 0; i < AirCombos.Count; i++) { updateCount++; ComboAir air = AirCombos[i]; ComboAir newAir = CreateInstance("ComboAir") as ComboAir; if (newAir != null && air != null) { newAir.name = air.name; newAir.dirIndex = air.dirIndex; newAir.actIndex = air.actIndex; newAir.requiredInputValues = air.requiredInputValues; newAir.preIndex = air.preIndex; newAir.preFuncIdx = air.preFuncIdx; newAir.preDirIdx = air.preDirIdx; tempAir.Add(newAir); } else { Debug.Log("Fail in Air Update"); } } AirCombos = tempAir; List <ComboWater> tempWater = new List <ComboWater>(); for (int i = 0; i < WaterCombos.Count; i++) { updateCount++; ComboWater water = WaterCombos[i]; ComboWater newWater = CreateInstance("ComboWater") as ComboWater; if (newWater != null && water != null) { newWater.name = water.name; newWater.dirIndex = water.dirIndex; newWater.actIndex = water.actIndex; newWater.requiredInputValues = water.requiredInputValues; newWater.preIndex = water.preIndex; newWater.preFuncIdx = water.preFuncIdx; newWater.preDirIdx = water.preDirIdx; tempWater.Add(newWater); } else { Debug.Log("Fail in Water Update"); } } WaterCombos = tempWater; List <ComboEarth> tempEarth = new List <ComboEarth>(); for (int i = 0; i < EarthCombos.Count; i++) { updateCount++; ComboEarth earth = EarthCombos[i]; ComboEarth newEarth = CreateInstance("ComboEarth") as ComboEarth; if (newEarth != null && earth != null) { newEarth.name = earth.name; newEarth.dirIndex = earth.dirIndex; newEarth.actIndex = earth.actIndex; newEarth.requiredInputValues = earth.requiredInputValues; newEarth.preIndex = earth.preIndex; newEarth.preFuncIdx = earth.preFuncIdx; newEarth.preDirIdx = earth.preDirIdx; tempEarth.Add(newEarth); } else { Debug.Log("Fail in Earth Update"); } } EarthCombos = tempEarth; List <ComboFire> tempFire = new List <ComboFire>(); for (int i = 0; i < FireCombos.Count; i++) { updateCount++; ComboFire fire = FireCombos[i]; ComboFire newFire = CreateInstance("ComboFire") as ComboFire; if (newFire != null && fire != null) { newFire.name = fire.name; newFire.dirIndex = fire.dirIndex; newFire.actIndex = fire.actIndex; newFire.requiredInputValues = fire.requiredInputValues; newFire.preIndex = fire.preIndex; newFire.preFuncIdx = fire.preFuncIdx; newFire.preDirIdx = fire.preDirIdx; tempFire.Add(newFire); } else { Debug.Log("Fail in Fire Update"); } } FireCombos = tempFire; combosUpdated = true; }
private void drawTopMenu() { EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); GUI.backgroundColor = typeColor[0]; if (GUILayout.Button("Air")) { bendingTypeIdx = 0; selectedWaterCombo = null; selectedEarthCombo = null; selectedFireCombo = null; } GUI.backgroundColor = typeColor[1]; if (GUILayout.Button("Water")) { bendingTypeIdx = 1; selectedAirCombo = null; selectedEarthCombo = null; selectedFireCombo = null; } GUI.backgroundColor = typeColor[2]; if (GUILayout.Button("Earth")) { bendingTypeIdx = 2; selectedAirCombo = null; selectedWaterCombo = null; selectedFireCombo = null; } GUI.backgroundColor = typeColor[3]; if (GUILayout.Button("Fire")) { bendingTypeIdx = 3; selectedAirCombo = null; selectedWaterCombo = null; selectedEarthCombo = null; } EditorGUILayout.EndHorizontal(); GUILayout.Space(10); GUI.backgroundColor = standardBackgroundColor; GUI.backgroundColor = typeColor[bendingTypeIdx]; GUILayout.BeginHorizontal("box"); GUILayout.Label("Selected: " + bendingTypeNames[bendingTypeIdx], GUILayout.Width(95)); GUILayout.EndHorizontal(); GUI.backgroundColor = standardBackgroundColor; EditorGUILayout.BeginHorizontal("box"); GUI.backgroundColor = new Color(0, 1, 0); if (GUILayout.Button("Create New Combo Part")) { createNewComboPart(bendingTypeIdx); } GUI.backgroundColor = new Color(1, 0, 0); if (GUILayout.Button("Remove Selected Combo Part")) { removeSelectedComboPart(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }