public static void DrawAdvancedKey(AdvancedKeyEditor advancedKey, string keyText) { int specialKeysValue = advancedKey.specialKeys.intValue; bool shift = (specialKeysValue & SpecialKeyFlags.shift) != 0; bool control = (specialKeysValue & SpecialKeyFlags.control) != 0; bool alt = (specialKeysValue & SpecialKeyFlags.alt) != 0; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel(keyText); EditorGUILayout.LabelField("Shift", GUILayout.Width(30)); shift = EditorGUILayout.Toggle(shift, GUILayout.Width(20)); EditorGUILayout.LabelField("Ctrl", GUILayout.Width(30)); control = EditorGUILayout.Toggle(control, GUILayout.Width(20)); EditorGUILayout.LabelField("Alt", GUILayout.Width(30)); alt = EditorGUILayout.Toggle(alt, GUILayout.Width(20)); EditorGUILayout.PropertyField(advancedKey.key, GUIContent.none); EditorGUILayout.EndHorizontal(); advancedKey.specialKeys.intValue = (shift ? SpecialKeyFlags.shift : 0) | (control ? SpecialKeyFlags.control : 0) | (alt ? SpecialKeyFlags.alt : 0); }
public static void DrawShowKey(SerializedProperty useSameEditorAsBuildShowKey, AdvancedKeyEditor showToggleKeyEditor, AdvancedKeyEditor showToggleKeyBuild) { EditorGUILayout.PropertyField(useSameEditorAsBuildShowKey, Helper.GetGUIContent("Same Show Key Editor and Build", "Use the same Show Key in the Editor and in the Build")); if (useSameEditorAsBuildShowKey.boolValue) { DrawAdvancedKey(showToggleKeyEditor, "Show Toggle Key"); } else { DrawAdvancedKey(showToggleKeyEditor, "Show Toggle Key Editor"); DrawAdvancedKey(showToggleKeyBuild, "Show Toggle Key Build"); } }