Simple Notification System
Simple Notification System
Documentation
Documentation
Features
Features
- Display time - determine how long each message will stay on the screen.
- Notifications queue - when a number of displayed messages reach the maximum new notifications will be shown once other disappear.
- Display location - choose where the message should be shown (with 9 premade anchors).
- Play sound - each notification can play a different sound when appears.
- Add image - each notification can have one image added to determine its type.
- Color indicators - set up indicator colors to define message importance.
- Customizable background - use flat color, gradient or custom image as background.
- Transition styles - four premade animations which support messages appearing and disappearing (pop, slide, fade, float).
Implementation
Implementation
Note: Notification Manager component can display messages only in one place. It means if you want to show some messages on the left side of the screen and some different messages in the center of the screen you will need to add two components. Each of them will handle messages displaying separately, they can be customized separately as well.
Add AC_SNS_NotificationManager to player controller blueprint (optionally to player character). This component will handle displaying notifications to player(s). Once the component is added click on it to access its details. Find General Settings category and set up default data:
- WindowPosition - determines which widget container should be used to display messages. Containers can be seen and adjusted in WBP_SNS_NotificationManager.
- MaxNotificationsQueueAmount - determines how many messages can be displayed at once. When the maximum number of displayed notifications is reached new message will be queued and pop up once other disappear.
- DisplayNewestNotificationOnTop - defines if new messages should be displayed at the top of the list. By default, new messages are added to the bottom of the list. (this is a technical option and won't change the order in which queued notifications appear).
- WhenNewNotificationIsAddedPushOtherSlots - defines if new messages should be added to "first" slot then existing ones will be pushed up or down.
Visual settings
Visual settings
You are not limited to single transition animation. You can mix them as you want, you can even use them all at once! In and out animations can be different as well! Important: Messages displayed in the center container are stretched to match viewport resolution so SlideIn and SlideOut effects are disabled for messages in the center container.
Visual settings of displayed notifications can be adjusted in the NotificationManager component. Access its details and navigate to Visual Settings category, settings are divided into few sections. Visual settings are applied to all notifications displayed by specific NotificationManager.
1. Slot filling - background options:
- SlotFillingType - determines how message background should look like - flat color, transparent, gradient, custom image.
- SlotFillingOpacityBoost - Used to adjust opacity for some of the backgrounds - ie. make gradient more or less visible.
- SlotFillingColor - adds a base color to a background image. All backgrounds are white by default so we can use it to easily manipulate them.
2. Transition in - appearing animations options:
- InAnimationTime - how long does it take (in seconds) for a message to appear on the screen. Minimum transition in time equals 0.1s.
- PlayFadeInEffect - should FadeIn animation effect be played when a message appears?
- PlaySlideInEffect - should SlideIn animation effect be played when a message appears?
- SlideInEffectDirection - determines direction of SlideIn animation effect.
- PlayPopInEffect - should PopIn animation effect be played when a message appears?
- PopInEffectAnchors - determines pivot point for PopIn animation effect. ie. UpperLeft means will appear from the upper left part of the slot widget. This option is useful if you want to pop message out from the edge of the screen.
- PlayFloatInEffect - should FloatIn animation effect be played when a message appears?
3. Transition out - disappearing animations options:
- OutAnimationTime - how long does it take (in seconds) for a message to disappear on the screen. Minimum transition in time equals 0.1s.
- PlayFadeOutEffect - should FadeOut animation effect be played when a message disappears?
- PlaySlideOutEffect - should SlideOut animation effect be played when a message disappears?
- SlideOutEffectDirection - determines direction of SlideOut animation effect.
- PlayPopOutEffect - should PopOut animation effect be played when a message disappears?
- PopOutEffectAnchors - determines pivot point for PopOut animation effect. ie. UpperLeft means will disappear to upper left part of the slot widget. This option is useful if you want to hide a message in the direction of the edge of the screen.
- PlayFloatOuteffect - should FloatOut animation effect be played when a message disappears?
4. Slot settings - overall visual options:
- SlotsPadding - determines empty space around message slots (and between them).
- ColorIndicatorsSize - determines the size of the border around the message. Each side of the border is adjusted separately.
- OverrideSlotWidth - set message slot width to constant, so all slots will have the same width. If the message is too long text will be wrapped and slot's height will be adjusted to display message properly. If set to 0 text won't be wrapped and the message will be displayed in a single row. Slot's width will be adjusted to text length, so different messages will have different width.
- OverrideSlotHeight - set message slot height to constant. All slots will have the same height. However, if the message is too long and text needs to be wrapped it will go outside the widget.
- MinSlotWidth - used only when OverrideSlotWidth=0, message slot will still adjust its width to text, however, it won't be shorter that MinSlotWidth.
- MinSlotHeight - used only when OverrideSlotHeight=0. Message height won't be lower than the set value, however, it still will be adjusted to wrapped text.
- ImagePosition - determines where a message image should be shown (if there is any). If set to Hidden images won't be shown even if the message contains it.
5. Font - options related to font:
- FontSize - determines size of the used font.
- FontFamily - determines what font will be used in notifications.
Notifying players
Notifying players
To notify player about an event, send a warning or simple information just execute QueueNewNotification event from NotificationManager. It will show a message instantly or if the list is full, the message will be queued and shown at the nearest opportunity. Each sent message has several options, so they can reflect they purpose:
- MessageText - text that will be displayed to a player.
- IndicatorColor - color fo the indicator (if the indicator is visible).
- Sound - will be played when animation appears.
- Image - will be added next to the text (if the image is not set to hidden).
- CanBeClickedToDismiss - should message disappear when player click on it? If message duration is set to 0 it always will be clickable.
- Duration - how long (in seconds) message will be visible to a player. It is the time between transition in and out animations. If set to 0 message will be persistent and disappear only when clicked.
- OverrideFillingColor - should message background color be overridden with specified one? If not it will use default one assigned in Notification Manager.
- FillingColor - color added to the background when the OverrideFillingColor option is checked.