Difference between revisions of "Notification"

From wiki
Jump to: navigation, search
(Initial commit.)
 
(Reorder Configs. Add additional property. Changed Default value statements.)
Line 58: Line 58:
  
  
== "icon" ==
+
== "allowMultiple" ==
'''Valid options (String): <code>A string which contains the path to the an image.</code>'''
+
'''Valid options (Bool): <code>Either True or False</code>'''
  
'''Default Value:''' Can be omitted. Will not show an icon if omitted.
+
'''Default Value:''' If not specified, will default to False.
  
  
This is the image shown alongside the text to help contextualise the notification.
+
This determines whether or not the notification will allow multiple copies of itself to show. Useful for notifications that might get spammed. (Like trying to sleep in a bed or buying something you can't buy.
  
  
Line 88: Line 88:
 
'''Valid options (Int): <code>An int which contains the time in milliseconds.</code>'''
 
'''Valid options (Int): <code>An int which contains the time in milliseconds.</code>'''
  
'''Default Value:''' Can be omitted. Will show notification for 3 seconds if omitted.
+
'''Default Value:''' If not specified, will default to 3 seconds. (3000 milliseconds)
  
  
Line 94: Line 94:
  
  
== "translationCode" ==
+
== "icon" ==
'''Valid options (String): <code>A string which should not conflict with any other translation string</code>'''
+
'''Valid options (String): <code>A string which contains the path to the an image.</code>'''
  
'''Default Value:''' Can be omitted. Will not show an text if omitted.
+
'''Default Value:''' If not specified, will not show an icon along with the achievement.
  
  
This is the code to the translation, that is the text, that should be shown on the notification.
+
This is the image shown alongside the text to help contextualise the notification.
 +
 
 +
 
 +
== "soundEffect" ==
 +
'''Valid options (String): <code>A string which points to a [[Sound]] code.</code>'''
 +
 
 +
'''Default Value:''' If not specified, will not play a sound along with the achievement.
 +
 
 +
 
 +
This is the sound effect that the notification can play when it appears.
  
  
Line 106: Line 115:
 
'''Valid options (Bool): <code>Either True or False</code>'''
 
'''Valid options (Bool): <code>Either True or False</code>'''
  
'''Default Value:''' Can be omitted. Will be False if omitted.
+
'''Default Value:''' If not specified, will default to False.
  
  
Line 112: Line 121:
  
  
== "allowMultiple" ==
+
== "textAreaWidth" ==
'''Valid options (Bool): <code>Either True or False</code>'''
+
'''Valid options (Float): <code>A positive decimal number</code>'''
  
'''Default Value:''' Can be omitted. Will be False if omitted.
+
'''Default Value:''' No default value is specified. Always need to provide your own.
  
  
This determines whether or not the notification will allow multiple copies of itself to show. Useful for notifications that might get spammed. (Like trying to sleep in a bed or buying something you can't buy.
+
This is how wide the text box on the achievement will be. Most achievements will be 160 pixels wide, but some achievements may be larger than this in order to fit more text.
  
  
== "soundEffect" ==
+
== "translationCode" ==
'''Valid options (String): <code>A string which points to a [[Sound]] code.</code>'''
+
'''Valid options (String): <code>A string which should not conflict with any other translation string</code>'''
  
'''Default Value:''' Can be omitted. Will not play a sound if omitted.
+
'''Default Value:''' If not specified, will not show text alongside the notification
  
This is the sound effect that the notification can play when it appears.
+
 
 +
This is the code to the translation, that is the text, that should be shown on the notification.

Revision as of 06:34, 8 August 2017

In Staxel, *.notification files are used to specify everything about notifications. These notifications are those small boxes that appear when something happens.

  • The size and look of the box
  • Sounds played, how long it stays up.
  • Whether multiple can be shown, and what translation code should they look for.

These notifications are often used alongside lines of code which change what the translation line is supposed to show.

Creating a *.notification file

Notifications actually don't use any other files, except Sound files, listed on this wiki. In essence a notification can be easily made, without the need to look up many other pages on this wiki. A full file might look like;

{
  "kind" : "staxel.notifications.general",
  "box" : "staxel/notifications/NotificationBox.png",
  "boxDimensions" : { "x" : 244.0, "y" : 82.5 },
  "displayTime" : 3000,
  "icon" : "",
  "translationCode" : "",
  "sticky" : false,
  "allowMultiple" : false,
  "soundEffect" : ""
}

Though if you want to simply copy the rest of the notifications in staxel, only the following would be needed;

{
  "__inherits" : "staxel/notifications/GeneralNotification.config",
  "code" : "staxel.notifications.AchievementUnlocked",
  "translationCode" : "achievements.achievementUnlocked",
  "icon" : "staxel/notifications/icons/AchievementIcon.png"
}

The code and icon properties should be fairly self explanatory. The translation code, however, leads to a line that you can use to Translate the line. You'll need to provide a language file in order to provide what text will actually shown. With all that you have a notification that can be displayed, and it will also show text as long as you have made a translation file for that.


Config Options

"code"

Valid options (String): A unique string which notification this object is.

Default Value: No default value is specified. Always need to provide your own.


A string containing the code of the notification the blob will be referring to.


"kind"

Valid options (String): A string representing what kind of notification this is.

Default Value: No default value is specified. Always need to provide your own.


A string that is used by Staxel to provide the correct information. Currently only two kinds are used; "staxel.notifications.general" the normal notification and "staxel.notifications.itemReceived" which is a notification for collecting items. In most cases the general kind is sufficient.


"allowMultiple"

Valid options (Bool): Either True or False

Default Value: If not specified, will default to False.


This determines whether or not the notification will allow multiple copies of itself to show. Useful for notifications that might get spammed. (Like trying to sleep in a bed or buying something you can't buy.


"box"

Valid options (String): A string which contains the path to the an image.

Default Value: No default value is specified. Always need to provide your own.


This is the image of the box shown underneath the text and image.


"boxDimensions"

Valid options (Vector 2): { "x" : 0.0, "y" : 0.0}

Default Value: No default value is specified. Always need to provide your own.


This specifies how large the box should be. This should be roughly the same size as the image used in the box property, but does not need to be.


"displayTime"

Valid options (Int): An int which contains the time in milliseconds.

Default Value: If not specified, will default to 3 seconds. (3000 milliseconds)


This is how long the notification will show for.


"icon"

Valid options (String): A string which contains the path to the an image.

Default Value: If not specified, will not show an icon along with the achievement.


This is the image shown alongside the text to help contextualise the notification.


"soundEffect"

Valid options (String): A string which points to a Sound code.

Default Value: If not specified, will not play a sound along with the achievement.


This is the sound effect that the notification can play when it appears.


"sticky"

Valid options (Bool): Either True or False

Default Value: If not specified, will default to False.


This determines whether or not the notification will stay up unless it is told to be hidden, probably via code.


"textAreaWidth"

Valid options (Float): A positive decimal number

Default Value: No default value is specified. Always need to provide your own.


This is how wide the text box on the achievement will be. Most achievements will be 160 pixels wide, but some achievements may be larger than this in order to fit more text.


"translationCode"

Valid options (String): A string which should not conflict with any other translation string

Default Value: If not specified, will not show text alongside the notification


This is the code to the translation, that is the text, that should be shown on the notification.