DiscoverTenerife
Public Member Functions | Private Member Functions | Private Attributes | List of all members
toastMessage Class Reference

class that controls the colored messages that are shown to the user giving him information but they hide after a few seconds. It has a system of queues because if you start several pararell coroutines at the same time of showing the toast message only the last one will be shown, but I solved this problem using the queue system. Each message will wait until its the first one of the queue and there inst any other message showing itself at that moment to show the first one. More...

Inheritance diagram for toastMessage:

Public Member Functions

void makeAnimation (string message, Color32 color, int duration)
 This method puts on the queue the message to be shown. More...
 

Private Member Functions

void Awake ()
 This method is called before the first frame. It calls the show method with false as a parameter and it initialize all the queues and the inProcess_ property as false. More...
 
void Update ()
 This method is called each frame. It checks if the inProcess_ property is false and if the three queues arent empty, if that is the case it calls the showFirstElementOfTheQueue method in other case it just do nothing. More...
 
void showFirstElementOfTheQueue ()
 This method remove the first element of the three queues and start the showMessage coroutine with those elements. More...
 
void show (bool mode)
 This method hides the text and the background image of the toast message if you give it a false, if you give it a true it shows the text and the background image. More...
 
IEnumerator showMessage (string message, Color32 color, int duration)
 This coroutine show the text and the background image with the given color and the given string during the given number of seconds, then it hides the message and the background image. When it starts, it puts the inProcess_ property to true and just before endind it sets the inProcess_ property as false. More...
 

Private Attributes

GameObject text_
 GameObject that contains the text that is shown on the toast message. More...
 
GameObject image_
 GameObject that contains the image that is shown as a background during the message is not hide. You can choose its color. More...
 
bool inProcess_
 true if a toastMessage is shown, false if there isnt any toastMessage being shown. More...
 
List< string > messagesQueue_
 This list stores strings of the messages of the nexts toastMessages that will be shown. More...
 
List< Color32 > colorsQueue_
 This list stores the colors of the nexts toastMessages that will be shown. More...
 
List< int > durationQueue_
 This list stores the duration of the nexts toastMessages that will be shown. More...
 

Detailed Description

class that controls the colored messages that are shown to the user giving him information but they hide after a few seconds. It has a system of queues because if you start several pararell coroutines at the same time of showing the toast message only the last one will be shown, but I solved this problem using the queue system. Each message will wait until its the first one of the queue and there inst any other message showing itself at that moment to show the first one.

Member Function Documentation

◆ Awake()

void toastMessage.Awake ( )
private

This method is called before the first frame. It calls the show method with false as a parameter and it initialize all the queues and the inProcess_ property as false.

◆ makeAnimation()

void toastMessage.makeAnimation ( string  message,
Color32  color,
int  duration 
)

This method puts on the queue the message to be shown.

Parameters
stringmessage that will be shown.
Color32color of the background image.
inttime in seconds that the message will be shown.

◆ show()

void toastMessage.show ( bool  mode)
private

This method hides the text and the background image of the toast message if you give it a false, if you give it a true it shows the text and the background image.

Parameters
booltrue if you want to show the message and the background image.

◆ showFirstElementOfTheQueue()

void toastMessage.showFirstElementOfTheQueue ( )
private

This method remove the first element of the three queues and start the showMessage coroutine with those elements.

◆ showMessage()

IEnumerator toastMessage.showMessage ( string  message,
Color32  color,
int  duration 
)
private

This coroutine show the text and the background image with the given color and the given string during the given number of seconds, then it hides the message and the background image. When it starts, it puts the inProcess_ property to true and just before endind it sets the inProcess_ property as false.

Parameters
stringmessage that will be shown.
Color32color of the background image.
inttime in seconds that the message will be shown.

◆ Update()

void toastMessage.Update ( )
private

This method is called each frame. It checks if the inProcess_ property is false and if the three queues arent empty, if that is the case it calls the showFirstElementOfTheQueue method in other case it just do nothing.

Member Data Documentation

◆ colorsQueue_

List<Color32> toastMessage.colorsQueue_
private

This list stores the colors of the nexts toastMessages that will be shown.

◆ durationQueue_

List<int> toastMessage.durationQueue_
private

This list stores the duration of the nexts toastMessages that will be shown.

◆ image_

GameObject toastMessage.image_
private

GameObject that contains the image that is shown as a background during the message is not hide. You can choose its color.

◆ inProcess_

bool toastMessage.inProcess_
private

true if a toastMessage is shown, false if there isnt any toastMessage being shown.

◆ messagesQueue_

List<string> toastMessage.messagesQueue_
private

This list stores strings of the messages of the nexts toastMessages that will be shown.

◆ text_

GameObject toastMessage.text_
private

GameObject that contains the text that is shown on the toast message.


The documentation for this class was generated from the following file: