Messages

Messages are how you send in-game messages to players. There are probably a million different ways that you can send messages to players. Maybe a newsfeed, pop-up, inbox, etc. Each could be a little different and have different/rules/configurability needs.

In UserWise we give you the ability to create Message Frameworks or Message Types to add whatever customization you need. So you start with the base Message:

Then you can choose a message type to add the additional fields:

In the SDK, these message types will come out as a message_type field just like you used external_event_type in Events to handle the additional fields and logic.

In UserWise’s SDK we give you three Message Events you can listen to:

public event EventHandler OnLoaded

  • This event is triggered when the UserWise SDK has finished loading and the response from UserWise has returned. This will include both messages that are currently available and upcoming for this player.

    • Typically this is not used unless you have some logic where say four of the same message_type will be returned for the player and you need to randomly choose which version of the message to give the player.

public event EventHandler OnActive

  • This event is triggered for each Message once it has loaded and is now active. For example, if the UserWise SDK returned an upcoming Message starts in 5 minutes, it would not call OnActive until 5 minutes has passed and that event should now be active (e.g. a new liveops is starting and we want to pop-up and notify players so they can jump righ tin).

    • Typically when this is called you’ll switch on the message_type and handle it with some appropriate logic to turn this on. E.g. here is your newsfeed message for this player and here is an inbox message

public event EventHandler OnInactive

  • Very similar to above this method triggers when a Message is no longer active - e.g. this pop-up message should no longer be available for this player.

Setting up Message Event Listeners

In our initial setup script we can add this in

MessagesModule messagesModule = this.userwise.MessagesModule; messagesModule.OnLoaded += MessageEventHandler.OnLoaded; messagesModule.OnActive += MessageEventHandler.OnActive; messagesModule.OnInactive += MessageEventHandler.OnInactive;

You can see an example of this here.

Powered by UserWise