void DrawPageHeader(string title, QColor titleColor, string subtitle, QColor subtitleColor, QTexture iconQTexture) { QUI.Space(SPACE_2); QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth, WindowSettings.pageHeaderHeight); QUI.Space(-WindowSettings.pageHeaderHeight + (WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f) / 2); QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth, WindowSettings.pageHeaderHeight * 0.8f); { QUI.Space((WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f)); QUI.BeginVertical((WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, WindowSettings.pageHeaderHeight * 0.8f); { QUI.FlexibleSpace(); if (!title.IsNullOrEmpty()) { QUI.Space(-SPACE_2); QUI.SetGUIColor(titleColor.Color); QUI.Label(title, PageHeaderTitleStyle, (WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, 26); QUI.ResetColors(); } if (!subtitle.IsNullOrEmpty()) { QUI.Space(-SPACE_2); QUI.SetGUIColor(subtitleColor.Color); QUI.Label(subtitle, PageHeaderSubtitleStyle, (WindowSettings.CurrentPageContentWidth + WindowSettings.pageShadowWidth) / 2, 18); QUI.ResetColors(); } QUI.FlexibleSpace(); } QUI.EndVertical(); QUI.FlexibleSpace(); QUI.DrawTexture(iconQTexture.texture, WindowSettings.pageHeaderHeight * 0.8f, WindowSettings.pageHeaderHeight * 0.8f); QUI.Space((WindowSettings.pageHeaderHeight - WindowSettings.pageHeaderHeight * 0.8f) / 2); } QUI.EndHorizontal(); }
void DrawNews(float width) { if (News == null) { return; } QLabel.text = !showAddNews.target ? "" : "New Article"; QLabel.style = Style.Text.Title; QUI.BeginHorizontal(width, 16); { if (showAddNews.target) { QUI.SetGUIColor(QUI.AccentColorBlue); } QUI.Label(QLabel); QUI.ResetColors(); #if dUI_SOURCE QUI.Space(width - QLabel.x - 104 - 100 * showAddNews.faded); if (QUI.GhostButton(showAddNews.target ? "Save" : "Add News", showAddNews.target ? QColors.Color.Green : QColors.Color.Gray, 100, showAddNews.target)) { showAddNews.target = !showAddNews.target; if (!showAddNews.target) { News.articles.Add(new NewsArticleData(newNewsArticle)); QUI.SetDirty(News); AssetDatabase.SaveAssets(); } newNewsArticle.Reset(); } if (showAddNews.faded > 0.2f) { if (QUI.GhostButton("Cancel", QColors.Color.Red, 100 * showAddNews.faded, showAddNews.target)) { showAddNews.target = false; newNewsArticle.Reset(); } } #else QUI.FlexibleSpace(); #endif } QUI.EndHorizontal(); QUI.Space(SPACE_2); if (QUI.BeginFadeGroup(showAddNews.faded)) { QUI.BeginVertical(width); { QUI.Space(SPACE_4 * showAddNews.faded); QUI.DrawLine(QColors.Color.Blue, width); QUI.Space(SPACE_4 * showAddNews.faded); QUI.SetGUIBackgroundColor(QUI.AccentColorBlue); QUI.BeginHorizontal(width); { QLabel.text = "Title"; QLabel.style = Style.Text.Normal; QUI.Label(QLabel); newNewsArticle.title = QUI.TextField(newNewsArticle.title, width - QLabel.x - 8); } QUI.EndHorizontal(); QUI.Space(SPACE_2 * showAddNews.faded); QUI.BeginHorizontal(width); { QLabel.text = "Content"; QLabel.style = Style.Text.Normal; QUI.Label(QLabel); newNewsArticle.content = EditorGUILayout.TextArea(newNewsArticle.content, GUILayout.Width(width - QLabel.x - 8)); } QUI.EndHorizontal(); QUI.ResetColors(); QUI.Space(SPACE_4 * showAddNews.faded); QUI.DrawLine(QColors.Color.Blue, width); QUI.Space(SPACE_16 * showAddNews.faded); } QUI.EndVertical(); } QUI.EndFadeGroup(); if (News.articles.Count == 0) { //QLabel.text = "There are no news..."; //QLabel.style = Style.Text.Help; //QUI.Label(QLabel); return; } QUI.Space(SPACE_2); for (int i = 0; i < News.articles.Count; i++) { #if dUI_SOURCE DrawNewsArticle(News.articles, i, News, true, width); #else DrawNewsArticle(News.articles, i, News, false, width); #endif QUI.Space(9 + 4); } }
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(); }
void DrawNotificationItems() { if (NotificationItems.arraySize == 0) { QUI.BeginHorizontal(WIDTH_420); { QUI.Label("No UINotification prefabs referenced... Click [+] to start...", WIDTH_420 - 23); QUI.BeginVertical(18); { QUI.Space(-1); if (QUI.ButtonPlus()) { NotificationItems.InsertArrayElementAtIndex(0); } } QUI.EndVertical(); } QUI.EndHorizontal(); return; } QUI.BeginHorizontal(WIDTH_420); { QUI.Space(18); QUI.Label("Notification Name", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormalItalic), (WIDTH_420 - 18 - 18 - 9) / 2f); QUI.Label("Notification Prefab", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormalItalic), (WIDTH_420 - 18 - 18 - 9) / 2f); } QUI.EndHorizontal(); QUI.BeginVertical(WIDTH_420); { for (int i = 0; i < NotificationItems.arraySize; i++) { SaveColors(); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(-4); QUI.Label(" " + i.ToString(), 18); if (NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationPrefab").objectReferenceValue != null) { NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationName").stringValue = NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationPrefab").objectReferenceValue.name; } else { QUI.SetGUIBackgroundColor(DUIColors.RedLight.Color); QUI.SetGUIColor(DUIColors.RedLight.Color); NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationName").stringValue = "Missing UINotification prefab"; } QUI.Label(NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationName").stringValue, (WIDTH_420 - 18 - 18 - 9) / 2f); QUI.PropertyField(NotificationItems.GetArrayElementAtIndex(i).FindPropertyRelative("notificationPrefab"), true, (WIDTH_420 - 18 - 18 - 9) / 2f); QUI.BeginVertical(18); { QUI.Space(-1); if (QUI.ButtonMinus()) { NotificationItems.DeleteArrayElementAtIndex(i); } } QUI.EndVertical(); } QUI.EndHorizontal(); RestoreColors(); } QUI.BeginHorizontal(WIDTH_420); { QUI.Space(WIDTH_420 - 19); QUI.BeginVertical(18); { QUI.Space(-1); if (QUI.ButtonPlus()) { NotificationItems.InsertArrayElementAtIndex(NotificationItems.arraySize); } } QUI.EndVertical(); QUI.Space(2); } QUI.EndHorizontal(); } QUI.EndVertical(); }