void DrawListenSelector() { if (triggerOnGameEvent.boolValue || triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue) { return; } SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Listen for", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 58); QUI.Space(SPACE_4); QUI.PropertyField(triggerOnGameEvent, 12); QUI.Label("game event", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 72); QUI.Space(SPACE_4); QUI.PropertyField(triggerOnButtonClick, 12); QUI.Label("button click", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 68); QUI.Space(SPACE_4); QUI.PropertyField(triggerOnButtonDoubleClick, 12); QUI.Label("double click", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 70); QUI.Space(SPACE_4); QUI.PropertyField(triggerOnButtonLongClick, 12); QUI.Label("long click", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 64); } QUI.EndHorizontal(); RestoreColors(); }
void DrawGameEventOptions() { if (!triggerOnGameEvent.boolValue) { return; } buttonCategory.stringValue = DUI.DEFAULT_CATEGORY_NAME; buttonName.stringValue = DUI.DEFAULT_BUTTON_NAME; ValiateUIButtonNameAndCategory(); SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Listen for", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 58); QUI.PropertyField(triggerOnGameEvent, 12); QUI.Label("game event", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 70); QUI.Space(SPACE_8); QUI.PropertyField(dispatchAll, 12); QUI.Label("dispatch all", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 142); } QUI.EndHorizontal(); if (dispatchAll.boolValue) { gameEvent.stringValue = ""; return; } QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Game Event", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 72); EditorGUILayout.DelayedTextField(gameEvent, GUIContent.none, GUILayout.Width(344)); } QUI.EndHorizontal(); RestoreColors(); }
void DrawOrientation(float width) { QStyles.GetStyle(QStyles.GetStyleName(Style.GhostButton.Purple)).alignment = TextAnchor.MiddleRight; if (QUI.GhostButton("update orientation", QColors.Color.Purple, width, 32, 10)) { UpdateOrientationInEditMode(); } QStyles.GetStyle(QStyles.GetStyleName(Style.GhostButton.Purple)).alignment = TextAnchor.MiddleCenter; QUI.Space(-32); switch (orientationManager.CurrentOrientation) { case OrientationManager.Orientation.Landscape: QUI.DrawTexture(DUIResources.miniIconOrientationLandscape.texture, 160, 32); break; case OrientationManager.Orientation.Portrait: QUI.DrawTexture(DUIResources.miniIconOrientationPortrait.texture, 160, 32); break; case OrientationManager.Orientation.Unknown: QUI.DrawTexture(DUIResources.miniIconOrientationUnknown.texture, 160, 32); break; } QUI.Space(SPACE_2); QUI.SetGUIBackgroundColor(QUI.AccentColorPurple); QUI.PropertyField(onOrientationChange, true, new GUIContent("OnOrientationChange"), width); QUI.ResetColors(); }
public static void DrawUnityEvents(bool enabled, AnimBool showEvents, SerializedProperty unityEvent, string unityEventTitle, float width, float miniBarHeight) { if (QUI.GhostBar("Unity Events", enabled ? QColors.Color.Blue : QColors.Color.Gray, showEvents, width, miniBarHeight)) { showEvents.target = !showEvents.target; } QUI.BeginHorizontal(width); { QUI.Space(8 * showEvents.faded); if (QUI.BeginFadeGroup(showEvents.faded)) { QUI.SetGUIBackgroundColor(enabled ? AccentColorBlue : AccentColorGray); QUI.BeginVertical(width - 16); { QUI.Space(2 * showEvents.faded); QUI.PropertyField(unityEvent, new GUIContent() { text = unityEventTitle }, width - 8); QUI.Space(2 * showEvents.faded); } QUI.EndVertical(); QUI.ResetColors(); } QUI.EndFadeGroup(); } QUI.EndHorizontal(); }
void DrawOrientation() { QUI.Space(-SPACE_4); switch (orientationManager.CurrentOrientation) { case OrientationManager.Orientation.Landscape: if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ButtonStyle.OrientationLandscape), 420, 28)) { UpdateOrientationInEditMode(); } break; case OrientationManager.Orientation.Portrait: if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ButtonStyle.OrientationPortrait), 420, 28)) { UpdateOrientationInEditMode(); } break; case OrientationManager.Orientation.Unknown: if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ButtonStyle.OrientationUnknown), 420, 28)) { UpdateOrientationInEditMode(); } break; } QUI.Space(SPACE_2); SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.PurpleLight.Color); QUI.PropertyField(onOrientationChange, true, new GUIContent("OnOrientationChange"), WIDTH_420); RestoreColors(); }
void DrawSettings(float width) { QUI.QToggle("Auto disable Button Clicks when an UIElement is in trasition", autoDisableButtonClicks); QUI.Space(SPACE_4); //CONTROLLER INPUT MODE QUI.BeginHorizontal(width); { if ((ControllerInputMode)backButtonInputMode.enumValueIndex == ControllerInputMode.None) { QUI.SetGUIBackgroundColor(QUI.AccentColorRed); } QUI.QObjectPropertyField("'Back' button Input Mode", backButtonInputMode, 260, 20, false); QUI.ResetColors(); QUI.Space(SPACE_2); if ((ControllerInputMode)backButtonInputMode.enumValueIndex != ControllerInputMode.None) { QUI.QToggle("enable alternate inputs", enableBackButtonAlternateInputs); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); if ((ControllerInputMode)backButtonInputMode.enumValueIndex != ControllerInputMode.None) { QUI.BeginHorizontal(width); { if ((ControllerInputMode)backButtonInputMode.enumValueIndex == ControllerInputMode.KeyCode) { QUI.QObjectPropertyField("Key Code", backButtonKeyCode, width / 2 - 1, 20, false); QUI.Space(SPACE_2); GUI.enabled = enableBackButtonAlternateInputs.boolValue; if (!enableBackButtonAlternateInputs.boolValue) { QUI.SetGUIBackgroundColor(QUI.AccentColorRed); } QUI.QObjectPropertyField("Alternate", backButtonKeyCodeAlt, width / 2 - 1, 20, false); QUI.ResetColors(); GUI.enabled = true; } else if ((ControllerInputMode)backButtonInputMode.enumValueIndex == ControllerInputMode.VirtualButton) { QUI.QObjectPropertyField("Virtual Button", backButtonVirtualButtonName, width / 2 - 1, 20, false); QUI.Space(SPACE_2); GUI.enabled = enableBackButtonAlternateInputs.boolValue; if (!enableBackButtonAlternateInputs.boolValue) { QUI.SetGUIBackgroundColor(QUI.AccentColorRed); } QUI.QObjectPropertyField("Alternate", backButtonVirtualButtonNameAlt, width / 2 - 1, 20, false); QUI.ResetColors(); GUI.enabled = true; } QUI.FlexibleSpace(); } QUI.EndHorizontal(); } }
public override void OnInspectorGUI() { DrawHeader(DUIResources.headerUINotification.texture, WIDTH_420, HEIGHT_42); if (refreshData) //refresh needs to be executed this way because OnEnable is called 3 times when entering PlayMode, thus adding a lot of wait time for the developer (that is unacceptable); until we figure out why that happends, this solution will have to do. { RefreshData(); refreshData = false; } if (!ControlPanelWindow.Selected && ControlPanelSelected) { RefreshData(); ControlPanelSelected = false; } else if (ControlPanelWindow.Selected && !ControlPanelSelected) { ControlPanelSelected = true; } serializedObject.Update(); SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); DrawListenForBackButton(); DrawTargetCanvas(); RestoreColors(); infoMessage["EmptyTargetCanvasName"].show.target = string.IsNullOrEmpty(targetCanvasName.stringValue); DrawInfoMessage("EmptyTargetCanvasName", WIDTH_420); QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); DrawNotificationContainer(); RestoreColors(); infoMessage["MissingNotificationContainer"].show.target = notificationContainer.objectReferenceValue == null; DrawInfoMessage("MissingNotificationContainer", WIDTH_420); if (!infoMessage["MissingNotificationContainer"].show.value) { if (uiNotification.notificationContainer != null) { infoMessage["BadNotificationContainer"].show.target = uiNotification.notificationContainer.transform.parent != uiNotification.transform; DrawInfoMessage("BadNotificationContainer", WIDTH_420); } QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); DrawOverlay(); QUI.Space(SPACE_4); DrawTitle(); DrawMessage(); DrawIcon(); QUI.Space(SPACE_4); DrawButtons(); DrawSpecialElements(); DrawEffects(); QUI.Space(SPACE_4); DrawCloseButton(); RestoreColors(); } serializedObject.ApplyModifiedProperties(); QUI.Space(SPACE_4); }
public override void OnInspectorGUI() { serializedObject.Update(); switch (poolyDespawner.despawnAfter) { case PoolyDespawner.DespawnAfter.Time: DrawHeader(EZResources.editorHeaderPoolyDespawnerTime.texture, WIDTH_420, 42); DrawTime(); break; case PoolyDespawner.DespawnAfter.SoundPlayed: DrawHeader(EZResources.editorHeaderPoolyDespawnerSoundPlayed.texture, WIDTH_420, 42); useRealTime.boolValue = false; DrawSound(); break; case PoolyDespawner.DespawnAfter.EffectPlayed: DrawHeader(EZResources.editorHeaderPoolyDespawnerEffectPlayed.texture, WIDTH_420, 42); useRealTime.boolValue = false; DrawEffect(); break; case PoolyDespawner.DespawnAfter.Collision: DrawHeader(EZResources.editorHeaderPoolyDespawnerCollider.texture, WIDTH_420, 42); useRealTime.boolValue = false; DrawCollision(); break; case PoolyDespawner.DespawnAfter.Trigger: DrawHeader(EZResources.editorHeaderPoolyDespawnerTrigger.texture, WIDTH_420, 42); useRealTime.boolValue = false; DrawTrigger(); break; case PoolyDespawner.DespawnAfter.Collision2D: DrawHeader(EZResources.editorHeaderPoolyDespawnerCollider2D.texture, WIDTH_420, 42); useRealTime.boolValue = false; DrawCollision2D(); break; case PoolyDespawner.DespawnAfter.Trigger2D: DrawHeader(EZResources.editorHeaderPoolyDespawnerTrigger2D.texture, WIDTH_420, 42); useRealTime.boolValue = false; DrawTrigger2D(); break; } QUI.Space(SPACE_4); QUI.SetGUIBackgroundColor(accentColorPurple); QUI.PropertyField(OnDespawn, new GUIContent("OnDespawn"), WIDTH_420); QUI.ResetColors(); QUI.Space(SPACE_4); serializedObject.ApplyModifiedProperties(); QUI.Space(SPACE_4); }
void DrawDefineSymbolsBuildTargetGroup(float width) { QUI.BeginVertical(width); { QUI.GhostTitle("BUILD TARGET GROUP", QColors.Color.Blue, width); QUI.Space(SPACE_4); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); if (QUI.GhostButton("Copy to Symbols Preset >>>", QColors.Color.Blue, width - SPACE_8, 24)) { presetSymbols.Clear(); presetSymbols.AddRange(symbols); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_4); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Blue.Color : QColors.BlueLight.Color); selectedBuildTargetGroup = (BuildTargetGroup)EditorGUILayout.EnumPopup(selectedBuildTargetGroup, GUILayout.Width(width - SPACE_8 - (106 * selectedBuildTargetGroupIsTheActivePlatform.faded))); QUI.ResetColors(); if (selectedBuildTargetGroupIsTheActivePlatform.faded > 0.05f) { QUI.Label("is the Active Platform", Style.Text.Small, 106 * selectedBuildTargetGroupIsTheActivePlatform.faded); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); if (selectedBuildTargetGroup != previouslySelectedBuildTargetGroup) { symbols = QUtils.GetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup); previouslySelectedBuildTargetGroup = selectedBuildTargetGroup; Repaint(); } QUI.Space(SPACE_8 + SPACE_16); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); DrawActiveSymbolsList(width - 26); QUI.FlexibleSpace(); } QUI.EndHorizontal(); } QUI.EndVertical(); }
void DrawButtonNameOptions() { if (!triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue) { return; } gameEvent.stringValue = ""; DrawTopButtons(); SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Listen for", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 58); if (triggerOnButtonClick.boolValue) { QUI.PropertyField(triggerOnButtonClick, 12); QUI.Label("button click", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 68); } else if (triggerOnButtonDoubleClick.boolValue) { QUI.PropertyField(triggerOnButtonDoubleClick, 12); QUI.Label("double click", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 70); } else if (triggerOnButtonLongClick.boolValue) { QUI.PropertyField(triggerOnButtonLongClick, 12); QUI.Label("long click", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 64); } QUI.Space(SPACE_8); QUI.PropertyField(dispatchAll, 12); QUI.Label("dispatch all", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 142); } QUI.EndHorizontal(); if (dispatchAll.boolValue) { gameEvent.stringValue = ""; return; } DrawButtonCategory(); DrawButtonName(); RestoreColors(); }
void DrawEvents() { if (!triggerOnGameEvent.boolValue && !triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue) { return; } if (triggerOnGameEvent.boolValue && (!dispatchAll.boolValue && string.IsNullOrEmpty(gameEvent.stringValue))) { return; } if ((triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue) && (!dispatchAll.boolValue && string.IsNullOrEmpty(buttonName.stringValue))) { return; } SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); QUI.PropertyField(onTriggerEvent, new GUIContent("On Trigger Event"), WIDTH_420); RestoreColors(); QUI.ResetColors(); if (QUI.Button(DUIStyles.GetStyle(showGameEvents.target ? DUIStyles.ButtonStyle.GameEvents : DUIStyles.ButtonStyle.GameEventsCollapsed), WIDTH_420, 18)) { showGameEvents.target = !showGameEvents.target; } if (QUI.BeginFadeGroup(showGameEvents.faded)) { SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); QUI.BeginVertical(WIDTH_420); { QUI.Space(SPACE_2); QUI.DrawList(gameEvents, WIDTH_420, "Not sending any Game Event on trigger... Click [+] to start..."); QUI.Space(SPACE_2); } QUI.EndVertical(); RestoreColors(); } QUI.EndFadeGroup(); }
void DrawEvents(float width) { if (!triggerOnGameEvent.boolValue && !triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue) { return; } if (triggerOnGameEvent.boolValue && (!dispatchAll.boolValue && string.IsNullOrEmpty(gameEvent.stringValue))) { return; } if ((triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue) && (!dispatchAll.boolValue && string.IsNullOrEmpty(buttonName.stringValue))) { return; } QUI.SetGUIBackgroundColor(AccentColorBlue); QUI.PropertyField(onTriggerEvent, new GUIContent("On Trigger Event"), width); QUI.ResetColors(); QUI.Space(SPACE_4); QUI.DrawCollapsableList("Game Events", showGameEventsAnimBool, gameEvents.arraySize > 0 ? QColors.Color.Blue : QColors.Color.Gray, gameEvents, width, 18, "Not sending any Game Events on trigger... Click [+] to start..."); }
/// <summary> /// Draws a list's line. /// </summary> /// <param name="list">Target list</param> /// <param name="index">Line index</param> /// <param name="readOnly">Should the line be editable? If FALSE it will draw a Label. If TRUE it will draw a TextField with - and + buttons</param> /// <param name="width">Width of the line</param> /// <returns></returns> string DrawListItem(List <string> list, int index, bool readOnly, float width, float height) { if (readOnly) { QUI.Label(list[index], Style.Text.Normal, width, height); } else { QUI.BeginHorizontal(width); { list[index] = EditorGUILayout.TextField(list[index], GUILayout.Width(width - 41), GUILayout.Height(height)); if (index == 0 && string.IsNullOrEmpty(list[index])) { } else { QUI.SetGUIBackgroundColor(QColors.RedLight.Color); if (QUI.ButtonMinus()) { list.Remove(list[index]); QUI.ResetColors(); return(""); } QUI.ResetColors(); QUI.Space(1); QUI.SetGUIBackgroundColor(QColors.GreenLight.Color); if (QUI.ButtonPlus()) { list.Insert(index, ""); } QUI.ResetColors(); } } QUI.EndHorizontal(); } return(list[index]); }
void DrawEffect() { QUI.SetGUIBackgroundColor(accentColorPurple); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Despawn After", Style.Text.Normal, 86); QUI.BeginChangeCheck(); QUI.PropertyField(despawnAfter, 100); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex; } } } QUI.FlexibleSpace(); QUI.BeginChangeCheck(); QUI.Toggle(playOnSpawn); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.playOnSpawn = playOnSpawn.boolValue; } } } QUI.Label("Play On Spawn", Style.Text.Normal, 84); } QUI.EndHorizontal(); if (poolyDespawner.pSystem == null) { QUI.Label("ParticleSystem: Not Found", Style.Text.Normal, WIDTH_420); infoMessage["poolyDespawner.pSystem"].show.target = true; } else { QUI.Label("ParticleSystem: " + poolyDespawner.pSystem.gameObject.name, Style.Text.Normal, WIDTH_420); QUI.BeginHorizontal(WIDTH_420); { QUI.BeginChangeCheck(); QUI.PropertyField(useParticleSystemDuration, 12); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.useParticleSystemDuration = useParticleSystemDuration.boolValue; } } } QUI.Label("Duration: " + poolyDespawner.pSystem.main.duration + " seconds", Style.Text.Normal, WIDTH_420 - 12); } QUI.EndHorizontal(); QUI.BeginHorizontal(WIDTH_420); { QUI.BeginChangeCheck(); QUI.PropertyField(useParticleSystemStartDelay, 12); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.useParticleSystemStartDelay = useParticleSystemStartDelay.boolValue; } } } QUI.Label("Start Delay: " + poolyDespawner.pSystem.main.startDelay.constant + " seconds", Style.Text.Normal, WIDTH_420); } QUI.EndHorizontal(); QUI.BeginHorizontal(WIDTH_420); { QUI.BeginChangeCheck(); QUI.PropertyField(useParticleSystemStartLifetime, 12); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.useParticleSystemStartLifetime = useParticleSystemStartLifetime.boolValue; } } } QUI.Label("Start Lifetime: " + poolyDespawner.pSystem.main.startLifetime.constant + " seconds", Style.Text.Normal, WIDTH_420); } QUI.EndHorizontal(); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Extra Time", Style.Text.Normal, 65); QUI.BeginChangeCheck(); QUI.PropertyField(extraTime, 40); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.extraTime = extraTime.floatValue; } } } QUI.Label("seconds", Style.Text.Normal, 50); } QUI.EndHorizontal(); QUI.Space(SPACE_2); QUI.Button(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Purple), WIDTH_420, 20); QUI.Space(-20); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(2); QUI.Label("Total Duration until despawn: " + poolyDespawner.pSystemTotalDuration + " seconds", Style.Text.Normal, WIDTH_420); } QUI.EndHorizontal(); infoMessage["poolyDespawner.pSystem"].show.target = false; } QUI.ResetColors(); DrawInfoMessage("poolyDespawner.pSystem", WIDTH_420); }
void DrawSound() { QUI.SetGUIBackgroundColor(accentColorPurple); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Despawn After", Style.Text.Normal, 86); QUI.BeginChangeCheck(); QUI.PropertyField(despawnAfter, 100); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex; } } } QUI.FlexibleSpace(); QUI.BeginChangeCheck(); QUI.Toggle(playOnSpawn); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.playOnSpawn = playOnSpawn.boolValue; } } } QUI.Label("Play On Spawn", Style.Text.Normal, 84); } QUI.EndHorizontal(); if (poolyDespawner.aSource == null) { QUI.Label("AudioSource: Not Found", Style.Text.Normal, WIDTH_420); infoMessage["poolyDespawner.aSource"].show.target = true; infoMessage["poolyDespawner.aSource.clip"].show.target = false; } else if (poolyDespawner.aSource.clip == null) { QUI.Label("AudioSource: " + poolyDespawner.aSource.gameObject.name, Style.Text.Normal, WIDTH_420); QUI.Label("AudioClip: Not Found", Style.Text.Normal, WIDTH_420); infoMessage["poolyDespawner.aSource"].show.target = false; infoMessage["poolyDespawner.aSource.clip"].show.target = true; } else { QUI.Label("AudioSource: " + poolyDespawner.aSource.gameObject.name, Style.Text.Normal, WIDTH_420); QUI.Label("AudioClip: " + poolyDespawner.aSource.clip.name, Style.Text.Normal, WIDTH_420); QUI.Label("Duration: " + poolyDespawner.aSource.clip.length + " seconds", Style.Text.Normal, WIDTH_420); infoMessage["poolyDespawner.aSource"].show.target = false; infoMessage["poolyDespawner.aSource.clip"].show.target = false; } QUI.ResetColors(); DrawInfoMessage("poolyDespawner.aSource", WIDTH_420); DrawInfoMessage("poolyDespawner.aSource.clip", WIDTH_420); }
void DrawTime() { QUI.SetGUIBackgroundColor(accentColorPurple); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Despawn After", Style.Text.Normal, 86); QUI.BeginChangeCheck(); QUI.PropertyField(despawnAfter, 100); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex; } } } QUI.FlexibleSpace(); QUI.Label("Auto Start", Style.Text.Normal, 60); QUI.BeginChangeCheck(); QUI.PropertyField(autoStart, 100); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.autoStart = (PoolyDespawner.AutoStart)autoStart.enumValueIndex; } } } } QUI.EndHorizontal(); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Duration", Style.Text.Normal, 52); QUI.BeginChangeCheck(); QUI.PropertyField(duration, 40); if (duration.floatValue <= 0) { duration.floatValue = 0; } if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.duration = duration.floatValue; } } } QUI.Space(SPACE_8); QUI.BeginChangeCheck(); QUI.Toggle(useRealTime); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.useRealTime = useRealTime.boolValue; } } } QUI.Label("use RealTime instead of GameTime", Style.Text.Normal); QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.ResetColors(); infoMessage["duration.floatValue"].show.target = duration.floatValue <= 0; DrawInfoMessage("duration.floatValue", WIDTH_420); }
void DrawDefineSymbolsSymbolsPreset(float width) { QUI.BeginVertical(width); { QUI.GhostTitle("SYMBOLS PRESET", QColors.Color.Green, width); QUI.Space(SPACE_4); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); if (QUI.GhostButton("<<< Copy to Build Target Group", QColors.Color.Green, width - SPACE_8, 24)) { List <string> tempList = presetSymbols; tempList = QUtils.CleanList(tempList); presetSymbols.Clear(); presetSymbols.AddRange(tempList); symbols.Clear(); symbols.AddRange(presetSymbols); QUtils.SetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup, symbols); if (presetSymbols.Count == 0) { presetSymbols.Add(""); } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_4); if (defineSymbolsNewPreset.value) //NEW PRESET { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); QUI.Label("Enter a new preset name...", Style.Text.Small, width - SPACE_8); } QUI.EndHorizontal(); QUI.Space(-SPACE_4); QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); GUI.SetNextControlName("newPresetName"); newPresetName = QUI.TextField(newPresetName, EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color, (width - SPACE_8 - 16 - 2 - 16) * defineSymbolsNewPreset.faded); //if the user hits Enter while either the key or value fields were being edited bool keyboardReturnPressed = Event.current.isKey && Event.current.keyCode == KeyCode.Return && Event.current.type == EventType.KeyUp && (GUI.GetNameOfFocusedControl() == "newPresetName"); QUI.Space(-2); if (QUI.ButtonOk() || keyboardReturnPressed) { newPresetName = newPresetName.Trim(); if (newPresetName.Equals(DEFAULT_PRESET_NAME)) { QUI.DisplayDialog("Enter a new preset name", "You are trying to save a preset with the defaut preset name '" + DEFAULT_PRESET_NAME + "'. Please enter another preset name.", "Ok"); } else if (string.IsNullOrEmpty(newPresetName)) { QUI.DisplayDialog("Enter a new preset name", "You are trying to save a preset with no name. Please enter a name.", "Ok"); } else if (Q.GetResource <DefineSymbols.DefineSymbolsPreset>(EZT.RESOURCES_PATH_DEFINE_SYMBOLS_PRESETS, newPresetName) != null) { if (QUI.DisplayDialog("Overwrite preset?", "There is a preset with the same name '" + newPresetName + "' in the presets list. Are you sure you want to overwrite it?", "Overwrite", "Cancel")) { AssetDatabase.MoveAssetToTrash(EZT.RELATIVE_PATH_DEFINE_SYMBOLS_PRESETS + newPresetName + ".asset"); SavePreset(presetSymbols, newPresetName); selectedPresetName = newPresetName; RefreshPresetNames(); defineSymbolsNewPreset.target = false; newPresetName = ""; } } else { SavePreset(presetSymbols, newPresetName); selectedPresetName = newPresetName; RefreshPresetNames(); defineSymbolsNewPreset.target = false; newPresetName = ""; } } QUI.Space(2); //if the user hits Escape while either the key or value fields were being edited bool keyboardEscapePressed = Event.current.isKey && Event.current.keyCode == KeyCode.Escape && Event.current.type == EventType.KeyUp && (GUI.GetNameOfFocusedControl() == "newPresetName"); if (QUI.ButtonCancel() || keyboardEscapePressed) { defineSymbolsNewPreset.target = false; newPresetName = ""; } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(5); } else //NORMAL VIEW { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); QUI.BeginChangeCheck(); QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color); selectedPresetIndex = EditorGUILayout.Popup(selectedPresetIndex, presets, GUILayout.Width(width - SPACE_8)); QUI.ResetColors(); if (QUI.EndChangeCheck()) { Undo.RecordObject(this, "Select Preset"); selectedPresetName = presets[selectedPresetIndex]; } QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_2); if (loadedPresetName.Equals(selectedPresetName) || selectedPresetName.Equals(DEFAULT_PRESET_NAME)) { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); if (selectedPresetName.Equals(DEFAULT_PRESET_NAME)) { if (QUI.GhostButton("Create a New Preset with current symbols", QColors.Color.Green, width - SPACE_8)) { defineSymbolsNewPreset.target = true; newPresetName = ""; } } else { if (QUI.GhostButton("NEW", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2)) { defineSymbolsNewPreset.target = true; newPresetName = ""; } QUI.Space(SPACE_2); if (QUI.GhostButton("RELOAD", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2)) { LoadPreset(selectedPresetName); } QUI.Space(SPACE_2); if (QUI.GhostButton("SAVE", QColors.Color.Green, ((width - SPACE_8) / 4) - SPACE_2)) { SavePreset(presetSymbols, selectedPresetName); } QUI.Space(SPACE_2); if (QUI.GhostButton("DELETE", QColors.Color.Red, ((width - SPACE_8) / 4) - SPACE_2)) { if (QUI.DisplayDialog("Delete preset?", "Are you sure you want to delete the '" + selectedPresetName + "' preset?", "Yes", "No")) { DeletePreset(selectedPresetName); } } } QUI.FlexibleSpace(); } QUI.EndHorizontal(); } else { QUI.BeginHorizontal(width); { QUI.Space(SPACE_8); if (QUI.GhostButton("Load Preset", QColors.Color.Green, width - SPACE_8)) { LoadPreset(selectedPresetName); } QUI.FlexibleSpace(); } QUI.EndHorizontal(); } } QUI.Space(-SPACE_8 - SPACE_4); DrawSelectedPresetsList(width); } QUI.EndVertical(); }
void DrawTrigger() // 3D触碰后消失 { QUI.SetGUIBackgroundColor(QColors.PurpleLight.Color); QUI.BeginHorizontal(WIDTH_420); { XiaoShiType(); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex; } } } QUI.FlexibleSpace(); if (!orDespawnAfterTime.boolValue) { QUI.BeginChangeCheck(); QUI.Toggle(orDespawnAfterTime); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.orDespawnAfterTime = orDespawnAfterTime.boolValue; } } } QUI.Label("延时", Style.Text.Normal, 50); } else { QUI.BeginChangeCheck(); QUI.Toggle(orDespawnAfterTime); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.orDespawnAfterTime = orDespawnAfterTime.boolValue; } } } QUI.Label("延时", Style.Text.Normal, 30); QUI.BeginChangeCheck(); QUI.PropertyField(duration, 40); if (duration.floatValue <= 0) { duration.floatValue = 0; } if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.duration = duration.floatValue; } } } QUI.Label("秒", Style.Text.Normal, 50); } } QUI.EndHorizontal(); QUI.ResetColors(); infoMessage["duration.floatValue"].show.target = duration.floatValue <= 0 && orDespawnAfterTime.boolValue; DrawInfoMessage("duration.floatValue", WIDTH_420); QUI.SetGUIBackgroundColor(accentColorPurple); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("接触后,“消失”在那调用:", Style.Text.Normal, 138); QUI.Space(SPACE_8); QUI.BeginChangeCheck(); QUI.Toggle(despawnOnTriggerEnter); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnOnTriggerEnter = despawnOnTriggerEnter.boolValue; } } } QUI.Label("Enter", Style.Text.Normal, 34); QUI.Space(SPACE_8); QUI.BeginChangeCheck(); QUI.Toggle(despawnOnTriggerStay); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnOnTriggerStay = despawnOnTriggerStay.boolValue; } } } QUI.Label("Stay", Style.Text.Normal, 28); QUI.Space(SPACE_8); QUI.BeginChangeCheck(); QUI.Toggle(despawnOnTriggerExit); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnOnTriggerExit = despawnOnTriggerExit.boolValue; } } } QUI.Label("Exit", Style.Text.Normal, 24); QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_4); QUI.BeginHorizontal(WIDTH_420); { QUI.PropertyField(onlyWithTag, 12); QUI.Label("仅和 tag 碰撞", Style.Text.Normal, 120); QUI.BeginChangeCheck(); targetTag.stringValue = EditorGUILayout.TagField(targetTag.stringValue); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.targetTag = targetTag.stringValue; } } } QUI.Space(SPACE_4); } QUI.EndHorizontal(); QUI.ResetColors(); }
void DrawNewUISoundAndSearch(float width) { QUI.BeginHorizontal(width); { #region New UISound if (SearchPatternAnimBool.faded < 0.2f) { if (QUI.GhostButton("New UISound", QColors.Color.Green, 100 * (1 - SearchPatternAnimBool.faded), 20, NewUISoundAnimBool.value) || DetectKeyCombo_Alt_N()) { NewUISoundAnimBool.target = !NewUISoundAnimBool.target; if (NewUISoundAnimBool.target) { NewUISoundName = ""; SearchPatternAnimBool.target = false; } } } if (NewUISoundAnimBool.target) { SearchPatternAnimBool.target = false; QUI.SetGUIBackgroundColor(QColors.GreenLight.Color); QUI.SetNextControlName("NewUISoundName"); NewUISoundName = EditorGUILayout.TextField(NewUISoundName, GUILayout.Width((width - 149) * NewUISoundAnimBool.faded)); QUI.ResetColors(); if (!NewUISoundAnimBool.value && Event.current.type == EventType.Layout) //if NewUISoundAnimBool.target is true and NewUISoundAnimBool.value is false -> in transition -> select the text in the control { QUI.FocusControl("NewUISoundName"); QUI.FocusTextInControl("NewUISoundName"); } if (QUI.ButtonOk() || (DetectKey_Return() && QUI.GetNameOfFocusedControl().Equals("NewUISoundName"))) { if (NewUISoundName.IsNullOrEmpty()) { EditorUtility.DisplayDialog("Info", "Cannot create an unnamed UISound. Try again.", "Ok"); } else { if (DUIData.Instance.DatabaseUISounds.Contains(NewUISoundName)) { EditorUtility.DisplayDialog("Info", "A UISound named '" + NewUISoundName + "' already exists in the database. Try again.", "Ok"); } else { DUIData.Instance.DatabaseUISounds.CreateUISound(NewUISoundName, selectedUISoundsDatabaseFilter, null); NewUISoundAnimBool.target = false; } } } QUI.Space(1); if (QUI.ButtonCancel() || QUI.DetectKeyDown(Event.current, KeyCode.Escape)) { NewUISoundName = string.Empty; NewUISoundAnimBool.target = false; } } #endregion QUI.FlexibleSpace(); #region Search if (SearchPatternAnimBool.value) { NewUISoundAnimBool.target = false; QUI.SetGUIBackgroundColor(QColors.OrangeLight.Color); QUI.SetNextControlName("SearchPattern"); SearchPattern = EditorGUILayout.TextField(SearchPattern, GUILayout.Width((width - 104) * SearchPatternAnimBool.faded)); QUI.ResetColors(); if (SearchPatternAnimBool.target && Event.current.type == EventType.Layout) //if SearchPatternAnimBool.target is true and SearchPatternAnimBool.value is false -> in transition -> select the text in the control { QUI.FocusControl("SearchPattern"); QUI.FocusTextInControl("SearchPattern"); } } if (NewUISoundAnimBool.faded < 0.2f) { if (QUI.GhostButton(SearchPatternAnimBool.value ? "Clear Search" : "Search", QColors.Color.Orange, 100 * (1 - NewUISoundAnimBool.faded), 20, SearchPatternAnimBool.value) || DetectKeyCombo_Alt_S() || //Toggle Search (DetectKey_Escape() && SearchPatternAnimBool.target)) //Clear Search { SearchPatternAnimBool.target = !SearchPatternAnimBool.target; if (SearchPatternAnimBool.target) { SearchPattern = string.Empty; NewUISoundAnimBool.target = false; } } } #endregion } QUI.EndHorizontal(); }
void DrawEnergyBars() { #if dUI_EnergyBarToolkit QUI.DrawTexture(DUIResources.barEnergyBars.texture, WIDTH_420, 18); SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.PurpleLight.Color); QUI.Space(SPACE_2); if (sceneLoader.energyBars == null || sceneLoader.energyBars.Count == 0) { QUI.BeginHorizontal(WIDTH_420); { QUI.Label("No Energy Bars referenced... Click [+] to start...", WIDTH_420 - 27); QUI.BeginVertical(18); { QUI.Space(-1); if (QUI.ButtonPlus()) { Undo.RecordObject(sceneLoader, "Added Energy Bar"); sceneLoader.energyBars = new List <EnergyBar> { null }; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.Space(SPACE_8); return; } QUI.BeginVertical(WIDTH_420); { for (int i = 0; i < sceneLoader.energyBars.Count; i++) { QUI.BeginHorizontal(WIDTH_420); { QUI.Space(-4); QUI.Label(" " + i.ToString(), 22); QUI.ObjectField(sceneLoader.energyBars[i], typeof(EnergyBar), true, WIDTH_420 - 18 - 18 - 13); QUI.BeginVertical(18); { QUI.Space(-1); if (QUI.ButtonMinus()) { Undo.RecordObject(sceneLoader, "Removed Energy Bar"); sceneLoader.energyBars.RemoveAt(i); } } QUI.EndVertical(); } QUI.EndHorizontal(); } QUI.BeginHorizontal(WIDTH_420); { QUI.Space(WIDTH_420 - 23); QUI.BeginVertical(18); { QUI.Space(-1); if (QUI.ButtonPlus()) { Undo.RecordObject(sceneLoader, "Added Energy Bar"); sceneLoader.energyBars.Add(null); } } QUI.EndVertical(); QUI.Space(2); } QUI.EndHorizontal(); } QUI.EndVertical(); QUI.Space(SPACE_8); RestoreColors(); #endif }
void DrawButtonNameOptions() { if (!triggerOnButtonClick.boolValue && !triggerOnButtonDoubleClick.boolValue && !triggerOnButtonLongClick.boolValue) { return; } gameEvent.stringValue = ""; DrawTopButtons(); SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Listen for", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 58); if (triggerOnButtonClick.boolValue) { QUI.PropertyField(triggerOnButtonClick, 12); QUI.Label("button click", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 68); } else if (triggerOnButtonDoubleClick.boolValue) { QUI.PropertyField(triggerOnButtonDoubleClick, 12); QUI.Label("double click", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 70); } else if (triggerOnButtonLongClick.boolValue) { QUI.PropertyField(triggerOnButtonLongClick, 12); QUI.Label("long click", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 64); } QUI.Space(SPACE_8); QUI.BeginChangeCheck(); { QUI.PropertyField(dispatchAll, 12); } if (QUI.EndChangeCheck()) { if (triggerOnGameEvent.boolValue) { gameEvent.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : ""; } else if (triggerOnButtonClick.boolValue || triggerOnButtonDoubleClick.boolValue || triggerOnButtonLongClick.boolValue) { buttonName.stringValue = dispatchAll.boolValue ? DUI.DISPATCH_ALL : DUI.DEFAULT_BUTTON_NAME; if (dispatchAll.boolValue) { buttonCategory.stringValue = DUI.DEFAULT_CATEGORY_NAME; } else { buttonCategory.stringValue = DUI.DEFAULT_CATEGORY_NAME; buttonName.stringValue = DUI.DEFAULT_BUTTON_NAME; ValiateUIButtonNameAndCategory(); } } } QUI.Label("dispatch all", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), 142); } QUI.EndHorizontal(); if (dispatchAll.boolValue) { gameEvent.stringValue = ""; return; } DrawButtonCategory(); DrawButtonName(); RestoreColors(); }
void InitDefineSymbols() { defineSymbolsNewPreset = new AnimBool(false, Repaint); selectedBuildTargetGroup = QUtils.GetActiveBuildTargetGroup(); previouslySelectedBuildTargetGroup = selectedBuildTargetGroup; selectedBuildTargetGroupIsTheActivePlatform = new AnimBool(selectedBuildTargetGroup == QUtils.GetActiveBuildTargetGroup(), Repaint); if (symbols == null) { symbols = new List <string>(); } else { symbols.Clear(); } symbols = QUtils.GetScriptingDefineSymbolsForGroup(selectedBuildTargetGroup); if (presetSymbols == null) { presetSymbols = new List <string>(); } else { presetSymbols.Clear(); } presetSymbols.AddRange(symbols); presetSymbolsReordableList = new ReorderableList(presetSymbols, typeof(string), true, false, false, false) { showDefaultBackground = false, drawElementBackgroundCallback = (rect, index, active, focused) => { } }; presetSymbolsReordableList.drawElementCallback = (rect, index, active, focused) => { if (index == presetSymbolsReordableList.list.Count) { return; } float width = WindowSettings.CurrentPageContentWidth / 2; int dragBumbWidth = 0; int buttonWidth = 16; int textFieldWidth = (int)width - 20 - buttonWidth - 2 - buttonWidth; rect.x += dragBumbWidth; QUI.SetGUIBackgroundColor(EditorGUIUtility.isProSkin ? QColors.Green.Color : QColors.GreenLight.Color); presetSymbolsReordableList.list[index] = EditorGUI.TextField(new Rect(rect.x, rect.y, textFieldWidth, EditorGUIUtility.singleLineHeight), (string)presetSymbolsReordableList.list[index]); QUI.ResetColors(); rect.x += textFieldWidth; rect.x += 2; rect.y -= 1; if (QUI.ButtonMinus(rect)) { if (index == 0 && presetSymbolsReordableList.list.Count == 1) //is this the last list entry? { presetSymbolsReordableList.list[index] = ""; //yes --> add an empty entry } else { presetSymbolsReordableList.list.Remove(presetSymbolsReordableList.list[index]); //no --> remove the entry } } rect.x += buttonWidth; rect.x += 2; if (QUI.ButtonPlus(rect)) { presetSymbolsReordableList.list.Insert(index, ""); //add a new empty entry } }; selectedPresetName = DEFAULT_PRESET_NAME; loadedPresetName = selectedPresetName; RefreshPresetNames(); }
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(); }
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 DrawUIElementsDatabase() { QUI.DrawTexture(DUIResources.headerUIElementsDatabase.texture, 552, 64); float sectionWidth = PAGE_WIDTH - SIDE_BAR_SHADOW_WIDTH * 2; QUI.BeginHorizontal(sectionWidth); { #region New Category if (!NewCategoryAnimBool.value) { if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonNewCategory), 100 * (1 - SearchPatternAnimBool.faded), 20)) { NewCategoryName = ""; NewCategoryAnimBool.target = true; SearchPatternAnimBool.target = false; foreach (string category in UIElementsDatabaseAnimBool.Keys) { UIElementsDatabaseAnimBool[category].target = false; } } } else { SearchPatternAnimBool.target = false; QUI.DrawTexture(DUIResources.pageButtonNewCategory.active, 100, 20); QUI.Space(80); SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.GreenLight.Color); NewCategoryName = EditorGUILayout.TextField(NewCategoryName, GUILayout.Width((sectionWidth - 149) * NewCategoryAnimBool.faded)); RestoreColors(); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonOk), 20, 20)) { if (string.IsNullOrEmpty(NewCategoryName)) { EditorUtility.DisplayDialog("Info", "Cannot create an unnamed category. Try again.", "Ok"); } else if (DUI.UIElementCategoryExists(NewCategoryName)) { EditorUtility.DisplayDialog("Info", "A category named '" + NewCategoryName + "' already exists in the database. Try again.", "Ok"); } else { DUI.CreateUIElementsCategory(NewCategoryName); NewCategoryAnimBool.target = false; RefreshUIElementsDatabase(true); } } QUI.Space(1); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonCancel), 20, 20)) { NewCategoryName = ""; NewCategoryAnimBool.target = false; } } #endregion QUI.Space(342 * (1 - NewCategoryAnimBool.faded) * (1 - SearchPatternAnimBool.faded)); #region Search if (!SearchPatternAnimBool.value) { QUI.FlexibleSpace(); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSearch), 100 * (1 - NewCategoryAnimBool.faded), 20)) { SearchPattern = string.Empty; SearchPatternAnimBool.target = true; NewCategoryAnimBool.target = false; foreach (string category in UIElementsDatabaseAnimBool.Keys) { UIElementsDatabaseAnimBool[category].target = true; } } } else { NewCategoryAnimBool.target = false; if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonClearSearch), 100 * SearchPatternAnimBool.faded, 20)) { SearchPattern = string.Empty; SearchPatternAnimBool.target = false; foreach (string category in UIElementsDatabaseAnimBool.Keys) { UIElementsDatabaseAnimBool[category].target = false; } } GUILayout.Space(1); SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.BlueLight.Color); SearchPattern = EditorGUILayout.TextField(SearchPattern, GUILayout.Width((sectionWidth - 210) * SearchPatternAnimBool.faded)); RestoreColors(); QUI.DrawTexture(DUIResources.pageButtonSearch.active, 100, 20); } #endregion } QUI.EndHorizontal(); QUI.Space(16); if (UIElementsDatabaseAnimBool.Keys.Count == 0) { QUI.DrawTexture(DUIResources.pageImageEmptyDatabase.texture, 552, 256); QUI.BeginHorizontal(sectionWidth); { QUI.FlexibleSpace(); QUI.Label("Add a new category to get started...", DUIStyles.GetStyle(DUIStyles.BlackTextStyle.BlackLabelNormalItalic)); QUI.FlexibleSpace(); } QUI.EndHorizontal(); return; } foreach (string category in DUI.UIElementsDatabase.Keys) { QUI.BeginHorizontal(sectionWidth); { #region Button Bar if (ButtonBar(category + (SearchPatternAnimBool.target ? "*" : ""), UIElementsDatabaseAnimBool[category], (sectionWidth - 203 * UIElementsDatabaseAnimBool[category].faded * (1 - SearchPatternAnimBool.faded)))) { UIElementsDatabaseAnimBool[category].target = !UIElementsDatabaseAnimBool[category].target; } QUI.Space(-7); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonSortAtoZ), 100 * UIElementsDatabaseAnimBool[category].faded * (1 - SearchPatternAnimBool.faded), 20)) { DUI.UIElementsDatabase[category].RemoveEmpty(); DUI.UIElementsDatabase[category].Sort(); } QUI.Space(1); if (QUI.Button(DUIStyles.GetStyle(DUIStyles.ControlPanel.PageButtonDelete), 100 * UIElementsDatabaseAnimBool[category].faded * (1 - SearchPatternAnimBool.faded), 20)) { if (EditorUtility.DisplayDialog("Delete the '" + category + "' category?", "Are you sure you want to proceed?\nOperation cannot be undone!", "Yes", "Cancel")) { DUI.DeleteUIElementsCategory(category); RefreshUIElementsDatabase(true); QUI.EndHorizontal(); break; } } #endregion } QUI.EndHorizontal(); if (!UIElementsDatabaseAnimBool.ContainsKey(category)) { RefreshUIElementsDatabase(true); } else { if (QUI.BeginFadeGroup(UIElementsDatabaseAnimBool[category].faded)) { QUI.BeginChangeCheck(); { if (DUI.UIElementsDatabase[category] == null) { RefreshUIElementsDatabase(); } else { DrawNamesList(DUI.UIElementsDatabase[category].data, PAGE_WIDTH - 200, "Category is empty..."); } } if (QUI.EndChangeCheck()) { if (DUI.UIElementsDatabase[category] == null) { RefreshUIElementsDatabase(); } else { EditorUtility.SetDirty(DUI.UIElementsDatabase[category]); } } QUI.Space(8); } QUI.EndFadeGroup(); } QUI.Space(2); } }
private void DrawOnSpawnEvents() { QUI.Space(SPACE_8); QUI.Box(QStyles.GetBackgroundStyle(Style.BackgroundType.Low, QColors.Color.Purple), WIDTH_420, 40); QUI.Space(-40); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_4); QUI.Label("回调事件", Style.Text.Title, 240, HEIGHT_16); QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_8 + 3); QUI.Toggle(showOnSpawnStarted); QUI.Space(-SPACE_2); tempContent.text = "Started"; QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x); QUI.Space(SPACE_8); QUI.Toggle(showOnSpawnStopped); QUI.Space(-SPACE_2); tempContent.text = "Stopped"; QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x); QUI.Space(SPACE_8); QUI.Toggle(showOnSpawnPaused); QUI.Space(-SPACE_2); tempContent.text = "Paused"; QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x); QUI.Space(SPACE_8); QUI.Toggle(showOnSpawnResumed); QUI.Space(-SPACE_2); tempContent.text = "Resumed"; QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x); QUI.Space(SPACE_8); QUI.Toggle(showOnSpawnFinished); QUI.Space(-SPACE_2); tempContent.text = "Finished"; QUI.Label(tempContent.text, Style.Text.Small, QStyles.CalcSize(tempContent, Style.Text.Small).x); QUI.Space(SPACE_8); QUI.ResetColors(); } QUI.EndHorizontal(); if (showOnSpawnStarted.boolValue || showOnSpawnPaused.boolValue || showOnSpawnFinished.boolValue) { QUI.Space(SPACE_4); } QUI.SetGUIBackgroundColor(AccentColorPurple); animBoolShowOnSpawnStarted.target = showOnSpawnStarted.boolValue; if (QUI.BeginFadeGroup(animBoolShowOnSpawnStarted.faded)) { QUI.PropertyField(OnSpawnStarted, new GUIContent("OnSpawnStarted"), WIDTH_420 - 5); } QUI.EndFadeGroup(); animBoolShowOnSpawnStopped.target = showOnSpawnStopped.boolValue; if (QUI.BeginFadeGroup(animBoolShowOnSpawnStopped.faded)) { QUI.PropertyField(OnSpawnStopped, new GUIContent("OnSpawnStopped"), WIDTH_420 - 5); } QUI.EndFadeGroup(); animBoolShowOnSpawnPaused.target = showOnSpawnPaused.boolValue; if (QUI.BeginFadeGroup(animBoolShowOnSpawnPaused.faded)) { QUI.PropertyField(OnSpawnPaused, new GUIContent("OnSpawnPaused"), WIDTH_420 - 5); } QUI.EndFadeGroup(); animBoolShowOnSpawnResumed.target = showOnSpawnResumed.boolValue; if (QUI.BeginFadeGroup(animBoolShowOnSpawnResumed.faded)) { QUI.PropertyField(OnSpawnResumed, new GUIContent("OnSpawnResumed"), WIDTH_420 - 5); } QUI.EndFadeGroup(); animBoolShowOnSpawnFinished.target = showOnSpawnFinished.boolValue; if (QUI.BeginFadeGroup(animBoolShowOnSpawnFinished.faded)) { QUI.PropertyField(OnSpawnFinished, new GUIContent("OnSpawnfinished"), WIDTH_420 - 5); } QUI.EndFadeGroup(); QUI.ResetColors(); }
void DrawEvents(float width) { if (QUI.GhostBar("Unity Events", IsAnyEventUsed ? QColors.Color.Blue : QColors.Color.Gray, showEvents, width, MiniBarHeight)) { showEvents.target = !showEvents.target; } QUI.BeginHorizontal(width); { QUI.Space(SPACE_8 * showEvents.faded); if (QUI.BeginFadeGroup(showEvents.faded)) { QUI.BeginVertical(width - SPACE_16); { QUI.Space(SPACE_2 * showEvents.faded); QUI.SetGUIBackgroundColor(IsUsingOnDrawerOpened ? QUI.AccentColorBlue : QUI.AccentColorGray); QUI.PropertyField(OnDrawerOpened, new GUIContent() { text = "OnDrawerOpened" }, width - 8); QUI.ResetColors(); QUI.Space(SPACE_2 * showEvents.faded); QUI.SetGUIBackgroundColor(IsUsingOnDrawerClosed ? QUI.AccentColorBlue : QUI.AccentColorGray); QUI.PropertyField(OnDrawerClosed, new GUIContent() { text = "OnDrawerClosed" }, width - 8); QUI.ResetColors(); QUI.Space(SPACE_4 * showEvents.faded); QUI.SetGUIBackgroundColor(IsUsingOnDrawerIsOpening ? QUI.AccentColorBlue : QUI.AccentColorGray); QUI.PropertyField(OnDrawerIsOpening, new GUIContent() { text = "OnDrawerIsOpening" }, width - 8); QUI.ResetColors(); QUI.Space(SPACE_2 * showEvents.faded); QUI.SetGUIBackgroundColor(IsUsingOnDrawerIsClosing ? QUI.AccentColorBlue : QUI.AccentColorGray); QUI.PropertyField(OnDrawerIsClosing, new GUIContent() { text = "OnDrawerIsClosing" }, width - 8); QUI.ResetColors(); QUI.Space(SPACE_4 * showEvents.faded); QUI.SetGUIBackgroundColor(IsUsingOnDrawerBeginDrag ? QUI.AccentColorBlue : QUI.AccentColorGray); QUI.PropertyField(OnDrawerBeginDrag, new GUIContent() { text = "OnDrawerBeginDrag" }, width - 8); QUI.ResetColors(); QUI.Space(SPACE_2 * showEvents.faded); QUI.SetGUIBackgroundColor(IsUsingOnDrawerEndDrag ? QUI.AccentColorBlue : QUI.AccentColorGray); QUI.PropertyField(OnDrawerEndDrag, new GUIContent() { text = "OnDrawerEndDrag" }, width - 8); QUI.ResetColors(); QUI.Space(SPACE_8 * showEvents.faded); } QUI.EndVertical(); QUI.ResetColors(); } QUI.EndFadeGroup(); } QUI.EndHorizontal(); }
void DrawTrigger2D() { QUI.SetGUIBackgroundColor(accentColorPurple); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Despawn After", Style.Text.Normal, 86); QUI.BeginChangeCheck(); QUI.PropertyField(despawnAfter, 100); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnAfter = (PoolyDespawner.DespawnAfter)despawnAfter.enumValueIndex; } } } QUI.FlexibleSpace(); if (!orDespawnAfterTime.boolValue) { QUI.BeginChangeCheck(); QUI.Toggle(orDespawnAfterTime); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.orDespawnAfterTime = orDespawnAfterTime.boolValue; } } } QUI.Label("Or Despawn After Time", Style.Text.Normal, 126); } else { QUI.BeginChangeCheck(); QUI.Toggle(orDespawnAfterTime); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.orDespawnAfterTime = orDespawnAfterTime.boolValue; } } } QUI.Label("Or Despawn After", Style.Text.Normal, 106); QUI.BeginChangeCheck(); QUI.PropertyField(duration, 40); if (duration.floatValue <= 0) { duration.floatValue = 0; } if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.duration = duration.floatValue; } } } QUI.Label("seconds", Style.Text.Normal, 50); } } QUI.EndHorizontal(); QUI.ResetColors(); infoMessage["duration.floatValue"].show.target = duration.floatValue <= 0 && orDespawnAfterTime.boolValue; DrawInfoMessage("duration.floatValue", WIDTH_420); QUI.SetGUIBackgroundColor(accentColorPurple); QUI.BeginHorizontal(WIDTH_420); { QUI.Label("Despawn OnTrigger2D", Style.Text.Normal, 130); QUI.Space(SPACE_8); QUI.BeginChangeCheck(); QUI.Toggle(despawnOnTriggerEnter2D); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnOnTriggerEnter2D = despawnOnTriggerEnter2D.boolValue; } } } QUI.Label("Enter2D", Style.Text.Normal, 50); QUI.Space(SPACE_8); QUI.BeginChangeCheck(); QUI.Toggle(despawnOnTriggerStay2D); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnOnTriggerStay2D = despawnOnTriggerStay2D.boolValue; } } } QUI.Label("Stay2D", Style.Text.Normal, 42); QUI.Space(SPACE_8); QUI.BeginChangeCheck(); QUI.Toggle(despawnOnTriggerExit2D); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.despawnOnTriggerExit2D = despawnOnTriggerExit2D.boolValue; } } } QUI.Label("Exit2D", Style.Text.Normal, 40); QUI.FlexibleSpace(); } QUI.EndHorizontal(); QUI.Space(SPACE_4); QUI.BeginHorizontal(WIDTH_420); { QUI.PropertyField(onlyWithTag, 12); QUI.Label("Trigger Only By Tag", Style.Text.Normal, 114); QUI.BeginChangeCheck(); targetTag.stringValue = EditorGUILayout.TagField(targetTag.stringValue); if (QUI.EndChangeCheck()) { if (serializedObject.isEditingMultipleObjects) { Undo.RecordObjects(targets, "Multiple Edit"); for (int i = 0; i < targets.Length; i++) { PoolyDespawner despawner = (PoolyDespawner)targets[i]; despawner.targetTag = targetTag.stringValue; } } } QUI.Space(SPACE_4); } QUI.EndHorizontal(); QUI.ResetColors(); }
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 DrawCustomGameEvents() { QUI.DrawTexture(DUIResources.barCustomGameEvents.texture, WIDTH_420, 18); //DrawInfoMessage("ComponentInfo", WIDTH_420); SaveColors(); QUI.SetGUIBackgroundColor(DUIColors.PurpleLight.Color); QUI.Space(SPACE_2); QUI.Label("LoadLevel Async", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_420); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("by name", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(command_LoadSceneAsync_SceneName, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { command_LoadSceneAsync_SceneName.stringValue = SceneLoader.DEFAULT_LOAD_SCENE_ASYNC_SCENE_NAME; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("by build index", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(command_LoadSceneAsync_SceneBuildIndex, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { command_LoadSceneAsync_SceneBuildIndex.stringValue = SceneLoader.DEFAULT_LOAD_SCENE_ASYNC_SCENE_BUILD_INDEX; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.Space(SPACE_8); QUI.Label("LoadLevel Additive Async", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_420); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("by name", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(command_LoadSceneAdditiveAsync_SceneName, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { command_LoadSceneAdditiveAsync_SceneName.stringValue = SceneLoader.DEFAULT_LOAD_SCENE_ADDITIVE_ASYNC_SCENE_NAME; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("by build index", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(command_LoadSceneAdditiveAsync_SceneBuildIndex, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { command_LoadSceneAdditiveAsync_SceneBuildIndex.stringValue = SceneLoader.DEFAULT_LOAD_SCENE_ADDITIVE_ASYNC_SCENE_BUILD_INDEX; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.Space(SPACE_8); QUI.Label("Unload Scene", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_420); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("by name", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(command_UnloadScene_SceneName, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { command_UnloadScene_SceneName.stringValue = SceneLoader.DEFAULT_UNLOAD_SCENE_SCENE_NAME; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("by build index", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(command_UnloadScene_SceneBuildIndex, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { command_UnloadScene_SceneBuildIndex.stringValue = SceneLoader.DEFAULT_UNLOAD_SCENE_SCENE_BUILD_INDEX; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.Space(SPACE_8); QUI.Label("Load / Unload Level", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_420); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("load level", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(command_LoadLevel, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { command_LoadLevel.stringValue = SceneLoader.DEFAULT_LOAD_LEVEL; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("unload level", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(command_UnloadLevel, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { command_UnloadLevel.stringValue = SceneLoader.DEFAULT_UNLOAD_LEVEL; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.Space(SPACE_2); QUI.Label("Level Scene Name (naming convention)", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_420); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("scene name", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(levelSceneName, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { levelSceneName.stringValue = SceneLoader.DEFAULT_LEVEL_SCENE_NAME; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.Space(SPACE_8); QUI.Label("Game Event sent after a scene was loaded", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelNormal), WIDTH_420); QUI.BeginHorizontal(WIDTH_420); { QUI.Space(SPACE_16); QUI.Label("game event", DUIStyles.GetStyle(DUIStyles.TextStyle.LabelSmall), 90); QUI.PropertyField(levelLoadedGameEvent, 280); QUI.BeginVertical(22); { QUI.Space(-1); if (QUI.ButtonReset()) { levelLoadedGameEvent.stringValue = SceneLoader.DEFAULT_LEVEL_LOADED; } } QUI.EndVertical(); } QUI.EndHorizontal(); QUI.Space(SPACE_4); }