void DrawNewsArticle(List <NewsArticleData> articles, int index, Object targetObject, bool showDeleteButton, float width) { QLabel.text = articles[index].title; QLabel.style = Style.Text.Subtitle; QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Gray), width, 20); QUI.Space(-20); QUI.BeginHorizontal(width); { QUI.Space(6); QUI.Label(QLabel); QUI.FlexibleSpace(); if (showDeleteButton) { if (QUI.ButtonMinus()) { if (QUI.DisplayDialog("Delete Article", "Delete the '" + QLabel.text + "' article?", "Ok", "Cancel")) { articles.RemoveAt(index); QUI.SetDirty(targetObject); AssetDatabase.SaveAssets(); QUI.ExitGUI(); } } } QUI.Space(SPACE_4); } QUI.EndHorizontal(); QLabel.text = articles[index].content; QLabel.style = Style.Text.Normal; QUI.Space(-8 + (showDeleteButton ? 2 : 0)); EditorGUILayout.LabelField(articles[index].content, QStyles.GetInfoMessageMessageStyle(Style.InfoMessage.Help), GUILayout.Width(width)); QUI.Space(SPACE_4); }
private static GUISkin GenerateSkin() { skin = Q.CreateAsset <GUISkin>(RELATIVE_PATH_SKINS, QUI.IsProSkin ? DARK_SKIN_FILENAME : LIGHT_SKING_FILENAME); List <GUIStyle> styles = new List <GUIStyle>(); // styles.AddRange(OldDefaultStyles()); styles.AddRange(DefaultStyles()); styles.AddRange(BackgroundStyles()); styles.AddRange(QuickButtonStyles()); styles.AddRange(LinkButtonStyles()); styles.AddRange(SlicedButtonStyles()); styles.AddRange(GhostButtonStyles()); styles.AddRange(SlicedBarStyles()); styles.AddRange(GhostBarStyles()); styles.AddRange(GhostTitleStyles()); styles.AddRange(TextStyles()); styles.AddRange(InfoMessageHeaderStyles()); skin.customStyles = styles.ToArray(); skin.label = GUI.skin.label; QUI.SetDirty(skin); AssetDatabase.SaveAssets(); return(skin); }
static void UpgradeDatabases() { #if dUI_SOURCE return; #endif #pragma warning disable CS0162 // Unreachable code detected if (DUIVersion.Instance.performDatabaseUpgrade == false) { return; } DUIData.Instance.ScanForUICanvases(); DUIData.Instance.ScanForUIElements(); DUIData.Instance.ScanForUIButtons(); DUIData.Instance.ScanForUISounds(); DUIData.Instance.ScanForInAnimations(); DUIData.Instance.ScanForOutAnimations(); DUIData.Instance.ScanForLoopAnimations(); DUIData.Instance.ScanForPunchAnimations(); DUIData.Instance.ScanForStateAnimations(); DUIVersion.Instance.performDatabaseUpgrade = false; QUI.SetDirty(DUIVersion.Instance); AssetDatabase.SaveAssets(); #pragma warning restore CS0162 // Unreachable code detected }
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); }
bool DrawUISoundsFilterButton(string buttonText, SoundType soundType) { if (QUI.GhostButton(buttonText, WindowSettings.selectedUISoundsFilter == soundType ? QColors.Color.Blue : QColors.Color.Gray, 120, 20, 10, WindowSettings.selectedUISoundsFilter == soundType)) { WindowSettings.selectedUISoundsFilter = soundType; QUI.SetDirty(WindowSettings); AssetDatabase.SaveAssets(); return(true); } return(false); }
/// <summary> /// Saves a new preset as an asset file in the DefineSymbolsPresets folder. The new preset's filename will be the preset name. /// </summary> void SavePreset(List <string> presetValues, string presetName) { presetValues = QUtils.CleanList(presetValues); DefineSymbols.DefineSymbolsPreset asset = Q.CreateAsset <DefineSymbols.DefineSymbolsPreset>(EZT.RELATIVE_PATH_DEFINE_SYMBOLS_PRESETS, presetName); asset.presetValues = new List <string>(presetValues); QUI.SetDirty(asset); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); RefreshPresetNames(); LoadPreset(presetName); }
void DrawPerformDatabaseUpgrade(float width) { QUI.BeginHorizontal(width); { QLabel.text = "Find"; QLabel.style = Style.Text.Button; if (QUI.GhostButton(QLabel.text, QColors.Color.Gray, QLabel.x + 16, 18)) { // Load object UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(DUI.RELATIVE_PATH_VERSION + "DUIVersion" + ".asset", typeof(UnityEngine.Object)); // Select the object in the project folder Selection.activeObject = obj; // Also flash the folder yellow to highlight it EditorGUIUtility.PingObject(obj); } QUI.Space(SPACE_2); QLabel.text = "DoozyUI " + Internal.DUIVersion.Instance.version; QLabel.style = Style.Text.Button; QUI.Label(QLabel); QUI.Space(SPACE_2); QLabel.text = "Perform Database Upgrade"; QLabel.style = Style.Text.Button; QUI.BeginChangeCheck(); Internal.DUIVersion.Instance.performDatabaseUpgrade = QUI.QToggle("Perform Database Upgrade", Internal.DUIVersion.Instance.performDatabaseUpgrade); if (QUI.EndChangeCheck()) { QUI.SetDirty(Internal.DUIVersion.Instance); AssetDatabase.SaveAssets(); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); }
private void OnLostFocus() { switch (WindowSettings.currentPage) { case Page.None: break; case Page.General: break; case Page.DefineSymbols: break; case Page.DataManager: break; case Page.DataBind: break; case Page.Pooly: #if EZ_POOLY PoolyOnLostFocus(); #endif break; case Page.Ads: break; case Page.Help: break; case Page.About: break; } QUI.SetDirty(WindowSettings); AssetDatabase.SaveAssets(); }
/// <summary> /// Imports a new AES key/iv list from the selected CSV file. Validates the import and returns true if successful, false otherwise. /// </summary> /// <param name="ezEncryptionKeys">Reference to the EzEncryptionKeys ScriptableObject</param> /// <returns>Returns true if successful, false otherwise.</returns> public static bool RestoreEncryptionKeysFromCSV(EzEncryptionKeys ezEncryptionKeys) { try { string path = EditorUtility.OpenFilePanel("Restore from CSV", EZT.PATH + "/DataManager/Editor/KeysBackup/", "csv"); string[] tempStringArray = File.ReadAllLines(path, Encoding.UTF8); string[] tempStrSplit; if (tempStringArray.Length == 0) { return(false); } // Parse the import data once to validate it for (int i = 0; i < tempStringArray.Length; i++) { tempStrSplit = ASCIIEncoding.UTF8.GetString(Convert.FromBase64String(tempStringArray[i])).Split(','); if (!ezEncryptionKeys.ValidateKeyAndIV(Convert.FromBase64String(tempStrSplit[0]), Convert.FromBase64String(tempStrSplit[1]))) { return(false); } } // Import validated, overwrite existing keys ezEncryptionKeys.ClearEncryptionKeysAndIVs(); for (int i = 0; i < tempStringArray.Length; i++) { tempStrSplit = ASCIIEncoding.UTF8.GetString(Convert.FromBase64String(tempStringArray[i])).Split(','); ezEncryptionKeys.AddNewKeyAndIV(Convert.FromBase64String(tempStrSplit[0]), Convert.FromBase64String(tempStrSplit[1])); } QUI.SetDirty(ezEncryptionKeys); AssetDatabase.SaveAssets(); } catch (Exception) { return(false); } return(true); }
private void DrawPrefabs() { // 先画个盒子,再提上去写文字 QUI.Space(SPACE_8); QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Orange), WIDTH_420, 20); QUI.Space(-20); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_4); QUI.Label("PREFAB" + ((poolySpawner.spawnPrefabs != null && poolySpawner.spawnPrefabs.Count > 1) ? "S" : "") + " TO SPAWN(拖预制体进来)", Style.Text.Normal, 200, HEIGHT_16); QUI.Space(SPACE_4); QUI.FlexibleSpace(); if (poolySpawner.spawnPrefabs != null && poolySpawner.spawnPrefabs.Count > 1) { QUI.Label("Spawn Type", Style.Text.Normal, 68); QUI.SetGUIBackgroundColor(AccentColorOrange); QUI.Popup(prefabSpawnType, 80, SpawnTypes); QUI.ResetColors(); } QUI.Space(SPACE_8); } QUI.EndHorizontal(); QUI.Space(SPACE_4); if (poolySpawner.spawnPrefabs == null || poolySpawner.spawnPrefabs.Count == 0) { poolySpawner.spawnPrefabs = new List <PoolySpawner.SpawnPrefab> { new PoolySpawner.SpawnPrefab(null) }; } if (poolySpawner.spawnPrefabs.Count == 1 && poolySpawner.prefabSpawnType == PoolySpawner.SpawnType.Random) { poolySpawner.prefabSpawnType = PoolySpawner.SpawnType.Sequential; } infoMessage["NoPrefabs"].show.target = !poolySpawner.HasPrefabs(); // 画框框提示 DrawInfoMessage("NoPrefabs", WIDTH_420 - 20); for (int i = 0; i < poolySpawner.spawnPrefabs.Count; i++) { QUI.Space(SPACE_2); QUI.BeginHorizontal(WIDTH_420); { tempContent = new GUIContent(i.ToString()); tempContentSize = QStyles.CalcSize(tempContent, Style.Text.Small); QUI.Label(tempContent.text, Style.Text.Small, tempContentSize.x); QUI.BeginChangeCheck(); Transform prefabObject = poolySpawner.spawnPrefabs[i].prefab; QUI.SetGUIBackgroundColor(AccentColorOrange); prefabObject = (Transform)QUI.ObjectField(prefabObject, typeof(Transform), false, (WIDTH_420 - SPACE_2 - tempContentSize.x - SPACE_8 - SPACE_16) - 240 * animBoolSpawnRandomPrefab.faded); QUI.ResetColors(); if (QUI.EndChangeCheck()) { Undo.RecordObject(poolySpawner, "Changed Value For Prefab Slot " + i); poolySpawner.spawnPrefabs[i].prefab = prefabObject; } if (QUI.ButtonMinus()) { if (poolySpawner.spawnPrefabs.Count > 1) { Undo.RecordObject(poolySpawner, "Removed Prefab Slot " + i); poolySpawner.spawnPrefabs.RemoveAt(i); } else if (poolySpawner.spawnPrefabs == null || poolySpawner.spawnPrefabs[0].prefab != null) { Undo.RecordObject(poolySpawner, "Reset Prefab Slot"); poolySpawner.spawnPrefabs = new List <PoolySpawner.SpawnPrefab> { new PoolySpawner.SpawnPrefab(null) }; } QUI.SetDirty(poolySpawner); QUI.ExitGUI(); } animBoolSpawnRandomPrefab.target = prefabSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random; if (poolySpawner.spawnPrefabs != null && poolySpawner.spawnPrefabs.Count > 1 && prefabSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random) { QUI.Space(SPACE_2); QUI.Label("weight", Style.Text.Small, 50 * animBoolSpawnRandomPrefab.faded); QUI.Space(-SPACE_8); QUI.BeginChangeCheck(); int spawnPrefabWeight = poolySpawner.spawnPrefabs[i].weight; QUI.SetGUIBackgroundColor(AccentColorOrange); spawnPrefabWeight = EditorGUILayout.IntSlider(spawnPrefabWeight, 0, 100); QUI.ResetColors(); if (QUI.EndChangeCheck()) { Undo.RecordObject(poolySpawner, "Changed Weight Of Prefab " + i); poolySpawner.spawnPrefabs[i].weight = spawnPrefabWeight; } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); } QUI.Space(SPACE_2); QUI.BeginHorizontal(WIDTH_420); { QUI.FlexibleSpace(); if (QUI.ButtonPlus()) { Undo.RecordObject(poolySpawner, "Added New Prefab Slot"); poolySpawner.spawnPrefabs.Add(new PoolySpawner.SpawnPrefab(null)); QUI.SetDirty(poolySpawner); QUI.ExitGUI(); } QUI.Space(3 + 240 * animBoolSpawnRandomPrefab.faded); } QUI.EndHorizontal(); }
void DrawPageAbout() { DrawPageHeader("About", QColors.Blue, "", QUI.IsProSkin ? QColors.UnityLight : QColors.UnityMild, DUIResources.pageIconAbout); QUI.Space(SPACE_16); QUI.DrawTexture(DUIResources.aboutVersion.texture, 400, 200); if (WindowSettings.CurrentPageContentWidth > WindowSettings.pageWidth - 230) { return; } QUI.Space(-56); QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth); { QUI.FlexibleSpace(); QLabel.text = DUIVersion.Instance.version; QLabel.style = Style.Text.Subtitle; QUI.SetGUIContentColor(QUI.AccentColorBlue); if (editVersion.target) { newVersion = QUI.TextField(newVersion, 104); } else { QUI.Label(QLabel); } QUI.ResetColors(); QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(38); #if dUI_SOURCE QUI.BeginHorizontal(WindowSettings.CurrentPageContentWidth); { QUI.FlexibleSpace(); if (QUI.GhostButton(editVersion.target ? "Update Version" : "Edit Version", editVersion.target ? QColors.Color.Green : QColors.Color.Gray, 100)) { editVersion.target = !editVersion.target; if (editVersion.target) { newVersion = DUIVersion.Instance.version; } else { DUIVersion.Instance.version = newVersion; QUI.SetDirty(DUIVersion.Instance); AssetDatabase.SaveAssets(); } } if (editVersion.faded > 0.2f) { if (QUI.GhostButton("Cancel", QColors.Color.Red, 100)) { editVersion.target = false; newVersion = ""; } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); #endif QUI.Space(SPACE_8); DrawNewsArticle("About DoozyUI", "DoozyUI is a complete UI management system for Unity. " + "It manipulates native Unity components and takes full advantage of their intended usage. " + "This assures maximum compatibility with uGUI, best performance and makes the entire system have a predictable behaviour. " + "Also, by working only with native components, the system will be compaible with any ohter asset that uses uGUI correctly. " + "\n\n" + "Easy to use and understand, given the user has some basic knowledge of how Unity's native UI solution (uGUI) works, DoozyUI has flexible components that can be configured in a lot of ways. " + "Functionality and design go hand in hand in order to offer a pleasant user experience (UX) while using the system." + "\n\n" + "Starting with version 2.8, DoozyUI is officialy VR READY, being capable of handling with ease multiple Canvases set to World Space render mode. " + "The system has been redesigned, from the core up, in order to accomodate a higher degree of flexibility that was needed in order for it to handle a lot of different use case scenarios." + "\n\n" + "The asset 'DoozyUI' has been released on the Unity Asset Store under the 'Doozy Entertainment' brand, owned by the Marlink Trading SRL company.", WindowSettings.CurrentPageContentWidth); }
public static void DrawEditableLinkButtons(List <LinkButtonData> list, float width) { #if !EZ_SOURCE return; #endif #pragma warning disable CS0162 // Unreachable code detected QUI.Space(SPACE_2); QUI.DrawIconBar("Edit Link Buttons", QResources.iconInfo, QColors.Color.Blue, IconPosition.Right, width, 20); if (list != null && list.Count > 0) { QUI.BeginChangeCheck(); for (int i = 0; i < list.Count; i++) { QUI.BeginHorizontal(width); { list[i].text = EditorGUILayout.DelayedTextField(list[i].text, GUILayout.Width(width * 0.4f)); QUI.Space(SPACE_2); list[i].url = EditorGUILayout.DelayedTextField(list[i].url); QUI.Space(SPACE_2); list[i].linkButton = (Style.LinkButton)EditorGUILayout.EnumPopup(list[i].linkButton, GUILayout.Width(width * 0.1f)); QUI.Space(SPACE_2); if (QUI.ButtonMinus()) { list.RemoveAt(i); QUI.SetDirty(EzSourceData.Instance); AssetDatabase.SaveAssets(); QUI.ExitGUI(); } QUI.Space(10); } QUI.EndHorizontal(); } if (QUI.EndChangeCheck()) { QUI.SetDirty(EzSourceData.Instance); AssetDatabase.SaveAssets(); } } else { QUI.BeginHorizontal(width); { QLabel q = new QLabel("There are no link buttons defined... This is not right!", Style.Text.Help); QUI.Label(q); } QUI.EndHorizontal(); } QUI.BeginHorizontal(width); { QUI.FlexibleSpace(); if (QUI.ButtonPlus()) { list.Add(new LinkButtonData()); QUI.SetDirty(EzSourceData.Instance); AssetDatabase.SaveAssets(); } QUI.Space(6); } QUI.EndHorizontal(); #pragma warning restore CS0162 // Unreachable code detected }
void DrawSoundsDatabase(float width) { DrawNewUISoundAndSearch(width); QUI.Space(SPACE_8); DrawUISoundsFilterButtons(width); QUI.Space(SPACE_8); for (int i = 0; i < DUIData.Instance.DatabaseUISounds.sounds.Count; i++) { if (DUIData.Instance.DatabaseUISounds.sounds[i] == null) { continue; } if (WindowSettings.selectedUISoundsFilter == SoundType.UIButtons && DUIData.Instance.DatabaseUISounds.sounds[i].soundType == SoundType.UIElements) { continue; } if (WindowSettings.selectedUISoundsFilter == SoundType.UIElements && DUIData.Instance.DatabaseUISounds.sounds[i].soundType == SoundType.UIButtons) { continue; } QUI.BeginHorizontal(width, 20); { if (SearchPatternAnimBool.target)//a search pattern has been entered in the search box { try { if (!Regex.IsMatch(DUIData.Instance.DatabaseUISounds.sounds[i].soundName, SearchPattern, RegexOptions.IgnoreCase)) { QUI.EndHorizontal(); continue; //this does not match the search pattern --> we do not show this name it } } catch (Exception) { } } QUI.Space(-1); QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, SearchPatternAnimBool.target ? QColors.Color.Orange : QColors.Color.Gray), width + 2, 20); QUI.Space(-2); QUI.Space(-width); SoundType soundType = DUIData.Instance.DatabaseUISounds.sounds[i].soundType; QUI.BeginChangeCheck(); soundType = (SoundType)EditorGUILayout.EnumPopup(soundType, GUILayout.Width(PAGE_UISOUNDS_SOUNDTYPE_BUTTON_WIDTH)); if (QUI.EndChangeCheck()) { Undo.RecordObject(DUIData.Instance, "UpdateSoundType"); DUIData.Instance.DatabaseUISounds.sounds[i].soundType = soundType; QUI.SetDirty(DUIData.Instance.DatabaseUISounds.sounds[i]); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); } QLabel.text = DUIData.Instance.DatabaseUISounds.sounds[i].soundName; #if dUI_MasterAudio QLabel.text = "Controlled by MasterAudio"; #endif QUI.Label(QLabel.text, Style.Text.Normal, (width - PAGE_UISOUNDS_SOUNDTYPE_BUTTON_WIDTH - PAGE_UISOUNDS_HORIZONTAL_SPACE * 3 - PAGE_UISOUNDS_BUTTONS_WIDTH * (1 - SearchPatternAnimBool.faded) - 16) * PAGE_UISOUNDS_SOUNDNAME_FIELD_WIDTH_PERCENT); AudioClip audioClip = DUIData.Instance.DatabaseUISounds.sounds[i].audioClip; QUI.BeginChangeCheck(); audioClip = (AudioClip)EditorGUILayout.ObjectField("", audioClip, typeof(AudioClip), false, GUILayout.Width((width - PAGE_UISOUNDS_SOUNDTYPE_BUTTON_WIDTH - PAGE_UISOUNDS_HORIZONTAL_SPACE * 3 - PAGE_UISOUNDS_BUTTONS_WIDTH * (1 - SearchPatternAnimBool.faded) - 16) * PAGE_UISOUNDS_AUDIOCLIP_FIELD_WIDTH_PERCENT)); if (QUI.EndChangeCheck()) { Undo.RecordObject(DUIData.Instance, "UpdateAudioClipReferene"); DUIData.Instance.DatabaseUISounds.sounds[i].audioClip = audioClip; QUI.SetDirty(DUIData.Instance.DatabaseUISounds.sounds[i]); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); } if (SearchPatternAnimBool.faded < 0.6f) { QUI.Space(PAGE_UISOUNDS_HORIZONTAL_SPACE); if (QUI.ButtonPlay()) { DUIUtils.PreviewSound(DUIData.Instance.DatabaseUISounds.sounds[i].soundName); } } if (SearchPatternAnimBool.faded < 0.4f) { QUI.Space(PAGE_UISOUNDS_HORIZONTAL_SPACE); if (QUI.ButtonStop()) { DUIUtils.StopSoundPreview(DUIData.Instance.DatabaseUISounds.sounds[i].soundName); } QUI.Space(PAGE_UISOUNDS_HORIZONTAL_SPACE); } if (SearchPatternAnimBool.faded < 0.2f) { if (QUI.ButtonCancel()) { if (EditorUtility.DisplayDialog("Delete the '" + DUIData.Instance.DatabaseUISounds.sounds[i].soundName + "' UISound?", "Are you sure you want to proceed?" + "\n\n" + "Operation cannot be undone!", "Yes", "Cancel")) { DUIData.Instance.DatabaseUISounds.DeleteUISound(DUIData.Instance.DatabaseUISounds.sounds[i].soundName); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); QUI.EndHorizontal(); continue; } } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_2); } }
void DrawModuleVersion(string moduleName, Page targetModule, EzModuleVersion emv, AnimBool show, float width) { if (QUI.GhostBar(moduleName + (emv == null ? " has not been installed!" : (" version " + emv.versionNumber)), emv == null ? QColors.Color.Gray : QColors.Color.Green, show, width, 24)) { if (emv == null) { show.target = false; WindowSettings.currentPage = targetModule; } else { show.target = !show.target; if (selectedModuleToEdit == targetModule) { selectedModuleToEdit = Page.None; editModuleAnimBool.target = false; } } } if (emv == null) { return; } if (QUI.BeginFadeGroup(show.faded)) { QUI.BeginVertical(width); { QUI.Space(-9); QUI.BeginHorizontal(width); { EditorGUILayout.LabelField(emv.releaseNotes, QStyles.GetInfoMessageMessageStyle(Style.InfoMessage.Help)); } QUI.EndHorizontal(); #if EZ_SOURCE #pragma warning disable CS0162 // Unreachable code detected QUI.Space(13); QUI.Space(8 * (selectedModuleToEdit == targetModule ? editModuleAnimBool.faded : 0)); QUI.BeginHorizontal(width); { QUI.FlexibleSpace(); if (QUI.GhostButton("Edit Version", QColors.Color.Gray, 100, 16, selectedModuleToEdit == targetModule) || QUI.DetectKeyUp(Event.current, KeyCode.Escape)) { if (selectedModuleToEdit == targetModule) { selectedModuleToEdit = Page.None; editModuleAnimBool.target = false; } else { selectedModuleToEdit = targetModule; editModuleAnimBool.target = true; } } if (selectedModuleToEdit == targetModule && editModuleAnimBool.faded > 0.4f) { QUI.Space(SPACE_4 * editModuleAnimBool.faded); if (QUI.GhostButton("Save Changes", QColors.Color.Green, 100 * editModuleAnimBool.faded, 16)) { QUI.SetDirty(emv); AssetDatabase.SaveAssets(); selectedModuleToEdit = Page.None; editModuleAnimBool.value = false; } } } QUI.EndHorizontal(); if (selectedModuleToEdit == targetModule) { if (QUI.BeginFadeGroup(editModuleAnimBool.faded)) { QUI.BeginVertical(width); { QUI.BeginHorizontal(width); { EditorGUILayout.LabelField("version", QStyles.GetStyle(QStyles.GetStyleName(Style.Text.Small)), GUILayout.Width(80)); QUI.Space(SPACE_2); EditorGUILayout.LabelField("release notes", QStyles.GetStyle(QStyles.GetStyleName(Style.Text.Small))); } QUI.EndHorizontal(); QUI.Space(-SPACE_4); QUI.BeginHorizontal(width); { emv.versionNumber = EditorGUILayout.TextField(emv.versionNumber, GUILayout.Width(80)); QUI.Space(SPACE_2); emv.releaseNotes = EditorGUILayout.TextArea(emv.releaseNotes); } QUI.EndHorizontal(); QUI.Space(SPACE_16); } QUI.EndVertical(); } QUI.EndFadeGroup(); } #endif QUI.Space(9 + 16); } QUI.EndVertical(); } QUI.EndFadeGroup(); #pragma warning restore CS0162 // Unreachable code detected }
void DrawHelpModule(string moduleName, Page targetModule, QTexture moduleIcon, List <LinkButtonData> list, float width) { QUI.DrawIconBar(moduleName, moduleIcon, QColors.Color.Gray, IconPosition.Right, width + 16, 24); QUI.Space(SPACE_4); QUI.DrawLinkButtonsList(list, SPACE_8, width); #if EZ_SOURCE QUI.Space(SPACE_2); QUI.Space(6 * (selectedHelpModuleToEdit == targetModule ? editHelpAnimBool.faded : 0)); QUI.BeginHorizontal(width + 16); { QUI.FlexibleSpace(); if (QUI.GhostButton("Edit Links", QColors.Color.Gray, 100, 16, selectedHelpModuleToEdit == targetModule) || QUI.DetectKeyUp(Event.current, KeyCode.Escape)) { if (selectedHelpModuleToEdit == targetModule) { selectedHelpModuleToEdit = Page.None; editHelpAnimBool.target = false; } else { selectedHelpModuleToEdit = targetModule; editHelpAnimBool.target = true; } } if (selectedHelpModuleToEdit == targetModule && editHelpAnimBool.faded > 0.4f) { QUI.Space(SPACE_4 * editHelpAnimBool.faded); if (QUI.GhostButton("Save Changes", QColors.Color.Green, 100 * editHelpAnimBool.faded, 16)) { QUI.SetDirty(EzSourceData.Instance); AssetDatabase.SaveAssets(); selectedHelpModuleToEdit = Page.None; editHelpAnimBool.value = false; } } } QUI.EndHorizontal(); if (selectedHelpModuleToEdit == targetModule) { if (QUI.BeginFadeGroup(editHelpAnimBool.faded)) { QUI.BeginVertical(width); { DrawEditableLinkButtons(list, width + 16); QUI.Space(SPACE_16 * (selectedHelpModuleToEdit == targetModule ? editHelpAnimBool.faded : 0)); } QUI.EndVertical(); } QUI.EndFadeGroup(); } QUI.Space(SPACE_8); #endif QUI.Space(SPACE_8); }
void DrawStringList(List <string> list, float width, AnimBool aBool) { QUI.Space(SPACE_2 * aBool.faded); if (list.Count == 0) { if (SearchPatternAnimBool.value) { DrawInfoMessage(InfoMessageName.NoResults.ToString(), width); } else { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8 * aBool.faded); DrawInfoMessage(InfoMessageName.EmptyList.ToString(), width - SPACE_8); QUI.Space(-20); QUI.BeginVertical(16, 20); { QUI.Space(SPACE_4); if (QUI.ButtonPlus()) { Undo.RecordObject(DUIData.Instance, "Update List"); list.Add(""); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); } } QUI.EndVertical(); QUI.FlexibleSpace(); } QUI.EndHorizontal(); } return; } QUI.BeginVertical(width); { bool matchFoundInThisCategory = false; for (int i = 0; i < list.Count; i++) { if (SearchPatternAnimBool.target) //a search pattern has been entered in the search box { if (!Regex.IsMatch(list[i], SearchPattern, RegexOptions.IgnoreCase)) { continue; //this does not match the search pattern --> we do not show this name it } matchFoundInThisCategory = true; } QUI.BeginHorizontal(width); { QUI.Space(SPACE_8 * aBool.faded); if (SearchPatternAnimBool.target) //in search mode, show a Label { QUI.Label(list[i], Style.Text.Normal, (width - SPACE_8)); } else //search is disabled, show a text field { string tempString = list[i]; QUI.BeginChangeCheck(); tempString = EditorGUILayout.DelayedTextField(tempString, GUILayout.Width(width - SPACE_8 - 18)); if (QUI.EndChangeCheck()) { if (list.Contains(tempString)) { QUI.DisplayDialog("Attention Required", "There is another entry in this list with the same name.", "Ok"); } else { Undo.RecordObject(DUIData.Instance, "Update List"); list[i] = tempString; list.Sort(); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); } } if (QUI.ButtonMinus()) { Undo.RecordObject(DUIData.Instance, "Update List"); list.RemoveAt(i); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_2 * aBool.faded - (SearchPatternAnimBool.target ? SPACE_2 : 0)); } 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 { DrawInfoMessage(InfoMessageName.NoResults.ToString(), width); } QUI.Space(18); } else //because a search pattern is active, we do not give the developer the option to create a new name { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8 * aBool.faded); QUI.Space(width - SPACE_8 - 14); if (QUI.ButtonPlus()) { Undo.RecordObject(DUIData.Instance, "Update List"); list.Add(""); QUI.SetDirty(DUIData.Instance); AssetDatabase.SaveAssets(); } } QUI.EndHorizontal(); } } QUI.EndVertical(); }
private void DrawLocations() { QUI.BeginHorizontal(WIDTH_420); { QUI.SetGUIBackgroundColor(AccentColorBlue); QUI.BeginChangeCheck(); QUI.Toggle(useSpawnerAsSpawnLocation); if (QUI.EndChangeCheck()) { HandleUtility.Repaint(); SceneView.RepaintAll(); Repaint(); } QUI.ResetColors(); if (useSpawnerAsSpawnLocation.boolValue && poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 0) { spawnPositions.ClearArray(); spawnPositions.InsertArrayElementAtIndex(0); spawnPositions.GetArrayElementAtIndex(0).FindPropertyRelative("spawnPosition").vector3Value = new Vector3(0, 1, 0); serializedObject.ApplyModifiedProperties(); HandleUtility.Repaint(); SceneView.RepaintAll(); Repaint(); } if (useSpawnerAsSpawnLocation.boolValue && poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 0) { spawnPoints.ClearArray(); spawnPoints.InsertArrayElementAtIndex(0); serializedObject.ApplyModifiedProperties(); HandleUtility.Repaint(); SceneView.RepaintAll(); Repaint(); } QUI.Label("使用预制体的坐标作为产生点", Style.Text.Normal, 200); } QUI.EndHorizontal(); if (useSpawnerAsSpawnLocation.boolValue) { return; } else { QUI.Space(-SPACE_4); } animBoolShowSpawnLocationsOptions.target = !useSpawnerAsSpawnLocation.boolValue; if (QUI.BeginFadeGroup(animBoolShowSpawnLocationsOptions.faded)) { QUI.Space(SPACE_8); QUI.BeginVertical(); { QUI.Space(SPACE_4); QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Blue), WIDTH_420, 20); QUI.Space(-20); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_4); QUI.Label("SPAWN AT", Style.Text.Normal, 60); QUI.SetGUIBackgroundColor(AccentColorBlue); QUI.BeginChangeCheck(); { QUI.Popup(spawnAt, 70); } if (QUI.EndChangeCheck()) { Undo.RecordObject(poolySpawner, "SpawnAt Change"); spawnPositions.ClearArray(); spawnPositions.InsertArrayElementAtIndex(0); spawnPositions.GetArrayElementAtIndex(0).FindPropertyRelative("spawnPosition").vector3Value = new Vector3(0, 1, 0); spawnPoints.ClearArray(); spawnPoints.InsertArrayElementAtIndex(0); serializedObject.ApplyModifiedProperties(); } QUI.ResetColors(); QUI.FlexibleSpace(); if ((poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 1 && poolySpawner.spawnAt == PoolySpawner.SpawnAt.Position) || (poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 1 && poolySpawner.spawnAt == PoolySpawner.SpawnAt.Transform)) { QUI.Label("Spawn Type", Style.Text.Normal, 68); QUI.SetGUIBackgroundColor(AccentColorBlue); QUI.Popup(locationSpawnType, 80, SpawnTypes); QUI.ResetColors(); } QUI.Space(SPACE_8); } QUI.EndHorizontal(); QUI.Space(SPACE_4); switch (poolySpawner.spawnAt) { case PoolySpawner.SpawnAt.Position: if (poolySpawner.spawnPositions == null || poolySpawner.spawnPositions.Count == 0) { poolySpawner.spawnPositions = new List <PoolySpawner.SpawnPosition> { new PoolySpawner.SpawnPosition(new Vector3(0, 1, 0)) }; } if (poolySpawner.spawnPositions.Count == 1 && poolySpawner.locationSpawnType == PoolySpawner.SpawnType.Random) { poolySpawner.locationSpawnType = PoolySpawner.SpawnType.Sequential; } for (int i = 0; i < poolySpawner.spawnPositions.Count; i++) { QUI.BeginHorizontal(WIDTH_420); { tempContent = new GUIContent(i.ToString()); tempContentSize = QStyles.CalcSize(tempContent, Style.Text.Small); QUI.Label(tempContent.text, Style.Text.Small, tempContentSize.x); QUI.BeginChangeCheck(); Vector3 spawnPosition = poolySpawner.spawnPositions[i].spawnPosition; QUI.SetGUIBackgroundColor(AccentColorBlue); spawnPosition = QUI.Vector3(spawnPosition, (WIDTH_420 - SPACE_2 - tempContentSize.x - SPACE_8 - SPACE_16 - SPACE_4) - 240 * animBoolRandomSpawnLocation.faded); QUI.ResetColors(); if (QUI.EndChangeCheck()) { Undo.RecordObject(poolySpawner, "Changed Spawn Position " + i); poolySpawner.spawnPositions[i].spawnPosition = spawnPosition; QUI.SetDirty(poolySpawner); } if (QUI.ButtonMinus()) { if (poolySpawner.spawnPositions.Count > 1) { Undo.RecordObject(poolySpawner, "Removed Spawn Position " + i); poolySpawner.spawnPositions.RemoveAt(i); } else if (poolySpawner.spawnPositions == null || poolySpawner.spawnPositions[0].spawnPosition != new Vector3(poolySpawner.transform.position.x, poolySpawner.transform.position.y + 1, poolySpawner.transform.position.z)) { Undo.RecordObject(poolySpawner, "Reset Spawn Position"); poolySpawner.spawnPositions = new List <PoolySpawner.SpawnPosition> { new PoolySpawner.SpawnPosition(new Vector3(poolySpawner.transform.position.x, poolySpawner.transform.position.y + 1, poolySpawner.transform.position.z)) }; } QUI.SetDirty(poolySpawner); QUI.ExitGUI(); } animBoolRandomSpawnLocation.target = locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random; if (poolySpawner.spawnPositions != null && poolySpawner.spawnPositions.Count > 1 && locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random) { QUI.Space(SPACE_2); QUI.Label("weight", Style.Text.Small, 40 * animBoolRandomSpawnLocation.faded); QUI.Space(-SPACE_8); QUI.BeginChangeCheck(); int spawnPositionWeight = poolySpawner.spawnPositions[i].weight; QUI.SetGUIBackgroundColor(AccentColorBlue); spawnPositionWeight = EditorGUILayout.IntSlider(spawnPositionWeight, 0, 100); QUI.ResetColors(); if (QUI.EndChangeCheck()) { Undo.RecordObject(poolySpawner, "Changed Weight Of Spawn Position " + i); poolySpawner.spawnPositions[i].weight = spawnPositionWeight; } } QUI.FlexibleSpace(); QUI.Space(SPACE_8); } QUI.EndHorizontal(); QUI.Space(1); } QUI.Space(SPACE_2); QUI.BeginHorizontal(WIDTH_420); { QUI.FlexibleSpace(); if (QUI.ButtonPlus()) { Undo.RecordObject(poolySpawner, "Added Spawn Position"); poolySpawner.spawnPositions.Add(new PoolySpawner.SpawnPosition(new Vector3(poolySpawner.transform.position.x, poolySpawner.transform.position.y + 1, poolySpawner.transform.position.z))); QUI.SetDirty(poolySpawner); QUI.ExitGUI(); } QUI.Space(3 + 240 * animBoolRandomSpawnLocation.faded); } QUI.EndHorizontal(); break; case PoolySpawner.SpawnAt.Transform: if (poolySpawner.spawnPoints == null || poolySpawner.spawnPoints.Count == 0) { poolySpawner.spawnPoints = new List <PoolySpawner.SpawnPoint> { new PoolySpawner.SpawnPoint(null) }; } if (poolySpawner.spawnPoints.Count == 1 && poolySpawner.locationSpawnType == PoolySpawner.SpawnType.Random) { poolySpawner.locationSpawnType = PoolySpawner.SpawnType.Sequential; } infoMessage["NoSpawnPoint"].show.target = !poolySpawner.HasSpawnPoints(); // 画框框提示 DrawInfoMessage("NoSpawnPoint", WIDTH_420 - 20); for (int i = 0; i < poolySpawner.spawnPoints.Count; i++) { QUI.BeginHorizontal(WIDTH_420); { tempContent = new GUIContent(i.ToString()); tempContentSize = QStyles.CalcSize(tempContent, Style.Text.Small); QUI.Label(tempContent.text, Style.Text.Small, tempContentSize.x); QUI.BeginChangeCheck(); Transform spawnPoint = poolySpawner.spawnPoints[i].spawnPoint; QUI.SetGUIBackgroundColor(AccentColorBlue); spawnPoint = (Transform)QUI.ObjectField(spawnPoint, typeof(Transform), true, (WIDTH_420 - SPACE_2 - tempContentSize.x - SPACE_8 - SPACE_16 - SPACE_4) - 240 * animBoolRandomSpawnLocation.faded); QUI.ResetColors(); if (QUI.IsPersistent(spawnPoint)) { spawnPoint = poolySpawner.spawnPoints[i].spawnPoint; } if (QUI.EndChangeCheck()) { Undo.RecordObject(poolySpawner, "Changed Reference For Spawn Point Slot " + i); poolySpawner.spawnPoints[i].spawnPoint = spawnPoint; QUI.SetDirty(poolySpawner); } QUI.BeginVertical(16); { QUI.Space(SPACE_2); if (QUI.ButtonMinus()) { if (poolySpawner.spawnPoints.Count > 1) { Undo.RecordObject(poolySpawner, "Removed Spawn Point Slot " + i); poolySpawner.spawnPoints.RemoveAt(i); } else if (poolySpawner.spawnPoints == null || poolySpawner.spawnPoints[0].spawnPoint != null) { Undo.RecordObject(poolySpawner, "Reset Spawn Point Slot"); poolySpawner.spawnPoints = new List <PoolySpawner.SpawnPoint> { new PoolySpawner.SpawnPoint(null) }; } QUI.SetDirty(poolySpawner); QUI.ExitGUI(); } } QUI.EndVertical(); animBoolRandomSpawnLocation.target = locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random; if (poolySpawner.spawnPoints != null && poolySpawner.spawnPoints.Count > 1 && locationSpawnType.enumValueIndex == (int)PoolySpawner.SpawnType.Random) { QUI.Space(SPACE_2); QUI.Label("weight", Style.Text.Small, 40); QUI.Space(-SPACE_8); QUI.BeginChangeCheck(); int spawnPointWeight = poolySpawner.spawnPoints[i].weight; QUI.SetGUIBackgroundColor(AccentColorBlue); spawnPointWeight = EditorGUILayout.IntSlider(spawnPointWeight, 0, 100); QUI.ResetColors(); if (QUI.EndChangeCheck()) { Undo.RecordObject(poolySpawner, "Changed Weight Of Spawn Point " + i); poolySpawner.spawnPoints[i].weight = spawnPointWeight; } } QUI.FlexibleSpace(); QUI.Space(SPACE_8); } QUI.EndHorizontal(); QUI.Space(1); } QUI.Space(SPACE_2); QUI.BeginHorizontal(WIDTH_420); { QUI.FlexibleSpace(); if (QUI.ButtonPlus()) { Undo.RecordObject(poolySpawner, "Added Spawn Point Slot"); poolySpawner.spawnPoints.Add(new PoolySpawner.SpawnPoint(null)); QUI.SetDirty(poolySpawner); QUI.ExitGUI(); } QUI.Space(3 + 240 * animBoolRandomSpawnLocation.faded); } QUI.EndHorizontal(); break; } } QUI.EndVertical(); } QUI.EndFadeGroup(); }
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); } }