void OpenMenu() { mSceneMenuVisible = true; isVisible = mSceneMenuVisible; mSelectedEntry = null; GUI.FocusControl(kMenuTextField); }
void Execute(SceneMenuCommand pCommand) { pCommand.Execute(); if (!mLastCommandHadError) { SceneView.currentDrawingSceneView.ShowNotification(new GUIContent(pCommand.mName)); } mLastCommandHadError = false; }
void SelectNextMenuEntry() { if (mFilteredMenuCommands.Count == 0) { return; } if (!mFilteredMenuCommands.Contains(mSelectedEntry)) { mSelectedEntry = mFilteredMenuCommands[0]; return; } int idx = mFilteredMenuCommands.IndexOf(mSelectedEntry) - 1 + mFilteredMenuCommands.Count; mSelectedEntry = mFilteredMenuCommands[idx % mFilteredMenuCommands.Count]; }
void FilterCommands(string pFilter) { pFilter = pFilter.ToLower(); mFilteredMenuCommands = new List <SceneMenuCommand>(); foreach (var c in mMenuCommands) { if (c.mName.ToLower().StartsWith(pFilter)) { mFilteredMenuCommands.Add(c); } } if (mFilteredMenuCommands.Count > 0) { mSelectedEntry = mFilteredMenuCommands[0]; } else { mSelectedEntry = null; } }
void RenderMenuEntry(SceneMenuCommand pCommand) { GUILayout.BeginHorizontal(); if (pCommand == mSelectedEntry) { GUI.color = new Color(0.2f, 0.6f, 1.0f, 1.0f); } else { GUI.color = Color.white; } GUILayout.Label(pCommand.mName, EditorStyles.whiteLabel); GUILayout.FlexibleSpace(); GUILayout.Label(pCommand.GetFormattedShortCut(), EditorStyles.whiteLabel); GUILayout.EndHorizontal(); }