bool DrawAnimatorPresetsTabButton(AnimatorPreset preset) { if (QUI.GhostButton(preset.ToString(), WindowSettings.selectedAnimatorPresetTab == preset ? QColors.Color.Blue : QColors.Color.Gray, ANIMATOR_PRESETS_TAB_BUTTON_WIDTH, ANIMATOR_PRESETS_TAB_BUTTON_HEIGHT, WindowSettings.selectedAnimatorPresetTab == preset)) { WindowSettings.selectedAnimatorPresetTab = preset; QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); return(true); } return(false); }
void DrawPresetList(string category, AnimatorPreset presetType, List <string> list, float width, string emptyMessage = "List is empty...") { QUI.Space(2); if (list.Count == 0) { if (SearchPatternAnimBool.value) { QUI.Label("No matching names found in this category!", DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelSmallItalic)); } else { QUI.BeginHorizontal(width); { QUI.Space(22); QUI.Label(emptyMessage, DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelSmallItalic), width - 60); //if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonPlus), 20, 20)) //{ // list.Add(""); //} } QUI.EndHorizontal(); } return; } QUI.BeginVertical(width); { bool matchFoundInThisCategory = false; for (int i = 0; i < list.Count; i++) { QUI.BeginHorizontal(width); { if (SearchPatternAnimBool.target)//a search pattern has been entered in the search box { try { if (!Regex.IsMatch(list[i], SearchPattern, RegexOptions.IgnoreCase)) { QUI.EndHorizontal(); continue; //this does not match the search pattern --> we do not show this name it } } catch (Exception) { } matchFoundInThisCategory = true; } QUI.Space(20); if (!SearchPatternAnimBool.value) { if (list[i].Equals(selectedAnimatorPresetName)) { SaveColors(); QUI.SetGUIColor(DUIColors.BlueLight.Color); QUI.DrawTexture(DUIResources.backgroundGrey230.texture, (width - 55 - 100), 20); QUI.Space(-20); QUI.Label(list[i], DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelNormal), (width - 55 - 100) * (1 - SearchPatternAnimBool.faded)); QUI.Space(-7); QUI.DrawTexture(DUIResources.pageButtonSelect.active, 100, 20); QUI.Space(-20); QUI.Space(100); RestoreColors(); } else { if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.ButtonBar), (width - 55 - 100), 20)) { SelectedAnimatorPreset(list[i]); } QUI.Space(-(width - 55 - 100)); QUI.Label(list[i], DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelNormal), (width - 55 - 100) * (1 - SearchPatternAnimBool.faded)); QUI.Space(-7); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSelect), 100 * (1 - SearchPatternAnimBool.faded), 20)) { SelectedAnimatorPreset(list[i]); } } QUI.Space(1); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonMinus), 20 * (1 - SearchPatternAnimBool.faded), 20)) { if (EditorUtility.DisplayDialog("Delete the '" + list[i] + "' preset?", "Are you sure you want to proceed?\nOperation cannot be undone!", "Yes", "Cancel")) { switch (presetType) { case AnimatorPreset.InAnimations: UIAnimatorUtil.DeleteInAnimPreset(openedAnimatorPresetCategory, list[i]); RefreshInAnimationsAnimatorPresets(true); break; case AnimatorPreset.OutAnimations: UIAnimatorUtil.DeleteOutAnimPreset(openedAnimatorPresetCategory, list[i]); RefreshOutAnimationsAnimatorPresets(true); break; case AnimatorPreset.Loops: UIAnimatorUtil.DeleteLoopPreset(openedAnimatorPresetCategory, list[i]); RefreshLoopsAnimatorPresets(true); break; case AnimatorPreset.Punches: UIAnimatorUtil.DeletePunchPreset(openedAnimatorPresetCategory, list[i]); RefreshPunchesAnimatorPresets(true); break; } openedAnimatorPresetCategory = category; } } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(2); } if (SearchPatternAnimBool.target) { if (!matchFoundInThisCategory) //if a search pattern is active and no valid names were found for this category we let the developer know { QUI.Label("No matching names found in this category!", DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelSmallItalic)); } } //else //because a search pattern is active, we do no give the developer the option to create a new name //{ // QUI.BeginHorizontal(width); // { // QUI.Space(width - 34); // if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonPlus), 20, 20)) // { // list.Add(""); // } // QUI.Space(2); // } // QUI.EndHorizontal(); //} } QUI.EndVertical(); }