This post covers the new notifications that we have implemented into Exile. The following is mainly targeted to add-on authors of Exile.
In the current implementation of Exile (and Arma), there are many different ways of informing the player about something. May it be information, a warning, an event - you probably know them all. There are hints, silent hints, dynamic text, notifications, task messages, system chat messages and so on. Our goal here was to offer a way of informing the user about something in a unified way. The result is what we call the toaster. Yes, toaster.
You have probably seen the notifications we had at the bottom right of the screen. These and the respective CfgNotifications are now removed completely! If you have been using these, please switch over the our new system. It is very similar to what we have had before, but it looks so much better.
Basically, it is a structured text that can be defined on the fly or as a template in a config. Instead of using symbolic icons, we are using classic mood colors. The color can be defined by you, but we offer three template colors for you. Blue for informative messages, red for warnings or errors and green for success messages.
A single toast is about 60px in height. If you pass a text to it that is smaller, it will center the text vertically within the toast. If your text is larger than that, it will dynamically scale the toast to cover all of your text.
By default, we offer two types of toasts as a template. "Title only" template that, well, just have a one-line message. "Title and Text" toasts can be seen in the video. They offer a title and a small description for that. The title is always a bit brighter to catch the users eye faster. It also supports images. Check out our trader toasts. We use the pop tab icon there.
You can trigger a toast from the client or from the server. Please find some examples here:
#define TOAST_COLOR_RED [0.780, 0.149, 0.318, 1] #define TOAST_COLOR_RED_CONFIG {0.780, 0.149, 0.318, 1} #define TOAST_COLOR_BLUE [0.247, 0.831, 0.988, 1] #define TOAST_COLOR_BLUE_CONFIG {0.247, 0.831, 0.988, 1} #define TOAST_COLOR_GREEN [0.627, 0.874, 0.231, 1] #define TOAST_COLOR_GREEN_CONFIG {0.627, 0.874, 0.231, 1} class CfgExileToasts { /////////////////////////////////////////////////////////////////////////// // INFO /////////////////////////////////////////////////////////////////////////// class InfoEmpty { template = "%1"; color[] = TOAST_COLOR_BLUE_CONFIG; }; class InfoTitleOnly { template = "<t size='22' font='PuristaMedium'>%1</t>"; color[] = TOAST_COLOR_BLUE_CONFIG; }; class InfoTitleAndText { template = "<t size='22' font='PuristaMedium'>%1</t><br/><t color='#ff979ba1' size='19' font='PuristaLight'>%2</t>"; color[] = TOAST_COLOR_BLUE_CONFIG; }; /////////////////////////////////////////////////////////////////////////// // SUCCESS /////////////////////////////////////////////////////////////////////////// class SuccessEmpty { template = "%1"; color[] = TOAST_COLOR_GREEN_CONFIG; }; class SuccessTitleOnly { template = "<t size='22' font='PuristaMedium'>%1</t>"; color[] = TOAST_COLOR_GREEN_CONFIG; }; class SuccessTitleAndText { template = "<t size='22' font='PuristaMedium'>%1</t><br/><t color='#ff979ba1' size='19' font='PuristaLight'>%2</t>"; color[] = TOAST_COLOR_GREEN_CONFIG; }; /////////////////////////////////////////////////////////////////////////// // ERROR /////////////////////////////////////////////////////////////////////////// class ErrorEmpty { template = "%1"; color[] = TOAST_COLOR_RED_CONFIG; }; class ErrorTitleOnly { template = "<t size='22' font='PuristaMedium'>%1</t>"; color[] = TOAST_COLOR_RED_CONFIG; }; class ErrorTitleAndText { template = "<t size='22' font='PuristaMedium'>%1</t><br/><t color='#ff979ba1' size='19' font='PuristaLight'>%2</t>"; color[] = TOAST_COLOR_RED_CONFIG; }; };
Code examples:
/////////////////////////////////////////////////////////////////////////// // CLIENT /////////////////////////////////////////////////////////////////////////// ["InfoTitleAndText", ["Snap Mode", "Look at the object you want to snap to, press SPACE to lock on it and then move your object next to a snap point. Press SPACE again to place the object."]] call ExileClient_gui_toaster_addTemplateToast; ["SuccessTitleAndText", ["Placed safe!", "The PIN has been set to 0000."]] call ExileClient_gui_toaster_addTemplateToast; ["ErrorTitleAndText", ["Failed to repair!", _exception]] call ExileClient_gui_toaster_addTemplateToast; ["ErrorTitleAndText", ["Construction aborted!", "You cannot build during a combat."]] call ExileClient_gui_toaster_addTemplateToast; ["ErrorTitleOnly", ["Your knife broke!"]] call ExileClient_gui_toaster_addTemplateToast; ["SuccessTitleAndText", ["Family registered!", format ["-%1<img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='24'/>", _registrationFee]]] call ExileClient_gui_toaster_addTemplateToast; ["<t size='22' font='PuristaMedium'>Hello, World!</t>", [1, 0, 0, 1]] call ExileClient_gui_toaster_addToast; /////////////////////////////////////////////////////////////////////////// // SERVER /////////////////////////////////////////////////////////////////////////// [_sessionID, "toastRequest", ["ErrorTitleAndText", ["Failed to add lock!", _exception]]] call ExileServer_system_network_send_to; [_sessionID, "toastRequest", ["SuccessTitleOnly", ["Supply box installed!"]]] call ExileServer_system_network_send_to; ["toastRequest", ["InfoTitleAndText", ["Supply drop incoming!", "A Heart for Inmates is going to drop a supply crate in about ten minutes. Check your map for the location."]]] call ExileServer_system_network_send_broadcast;
You you want to discuss the technical implementation of the new toasts, please do so over here:
- 13
Recommended Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now