You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-18Lines changed: 23 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,9 +37,9 @@ For proxies the recommended setup is to create one game object per screen and pe
37
37
***Timestep below Popup (number)** - Timestep to set on screen proxy when it is below a popup. This is useful when pausing animations and gameplay while a popup is open.
38
38
***Screen Keeps Input Focus When Below Popup (boolean)** - Check this if the screen should keep input focus when it is below a popup.
39
39
***Others Keep Input Focus When Below Screen (boolean)** - Check this if other screens should keep input focus when below this screen.
40
-
***Transition Url (url)** - Optional URL to post messages to when the screen is about to be shown/hidden. Use this to trigger a transition (see the section on [transitions](#transitions)).
41
-
***Focus Url (url)** - Optional URL to post messages to when the screen gains or loses focus (see the section on [screen focus](#screen-focus-gainloss)).
42
-
***Receiver Url (url)** - Optional URL to post messages to using `monarch.post()`.
40
+
***Transition Url (url)** - **DEPRECATED**Optional URL to post messages to when the screen is about to be shown/hidden. Use this to trigger a transition (see the section on [transitions](#transitions)).
41
+
***Focus Url (url)** - **DEPRECATED**Optional URL to post messages to when the screen gains or loses focus (see the section on [screen focus](#screen-focus-gainloss)).
42
+
***Receiver Url (url)** - **DEPRECATED**Optional URL to post messages to using `monarch.post()`.
43
43
***Preload (boolean)** - Check this if the screen should be preloaded and kept loaded at all times. For a collection proxy it means that it will be async loaded but not enabled at all times while not visible. This can also temporarily be achieved through the `monarch.preload()` function.
44
44
45
45

@@ -53,8 +53,8 @@ For factories the recommended setup is to create one game object per screen and
53
53
***Popup on Popup (boolean)** - Check this if the screen is a [popup](#popups) and it can be shown on top of other popups.
54
54
***Screen Keeps Input Focus When Below Popup (boolean)** - Check this if the screen should keep input focus when it is below a popup.
55
55
***Others Keep Input Focus When Below Screen (boolean)** - Check this if other screens should keep input focus when below this screen.
56
-
***Transition Id (hash)** - Optional id of the game object to send a message to when the screen is about to be shown/hidden. Use this to trigger a transition (see the section on [transitions](#transitions)).
57
-
***Focus Id (hash)** - Optional id of the game object to send a message to when the screen gains or loses focus (see the section on [screen focus](#screen-focus-gainloss)).
56
+
***Transition Id (hash)** - **DEPRECATED**Optional id of the game object to send a message to when the screen is about to be shown/hidden. Use this to trigger a transition (see the section on [transitions](#transitions)).
57
+
***Focus Id (hash)** - **DEPRECATED**Optional id of the game object to send a message to when the screen gains or loses focus (see the section on [screen focus](#screen-focus-gainloss)).
58
58
***Preload (boolean)** - Check this if the screen should be preloaded and kept loaded at all times. For a collection factory this means that its resources will be dynamically loaded at all times. This can also temporarily be achieved through the `monarch.preload()` function.
59
59
60
60

@@ -161,17 +161,29 @@ You can add optional transitions when navigating between screens. This is [descr
161
161
162
162
163
163
## Screen focus gain/loss
164
-
Monarch will send focus gain and focus loss messages if a `Focus Url` (proxy) or `Focus Id` (collectionfactory) was provided when the screen was created. The focus gained message will contain the id of the previous screen and the focus loss message will contain the id of the next screen. Example:
164
+
Monarch will send focus gain and focus loss messages if a focus change listener has been set using `monarch.on_focus_change(screen_id, fn)`
165
165
166
+
DEPRECATED: ~~Monarch will send focus gain and focus loss messages if a `Focus Url` (proxy) or `Focus Id` (collectionfactory) was provided when the screen was created.~~
167
+
168
+
The focus gained message will contain the id of the previous screen and the focus loss message will contain the id of the next screen. Example:
@@ -180,10 +192,3 @@ Both the `monarch.show()` and `monarch.back()` functions take an optional callba
180
192
181
193
## Monarch API
182
194
The full [Monarch API is documented here](/README_API.md).
183
-
184
-
185
-
## Monarch FAQ
186
-
187
-
**Q**: Why am I getting `ERROR GAMEOBJECT: The collection 'default' could not be created since there is already a socket with the same name`?
188
-
189
-
**A**: Each collection that you use must be given a unique id. In this case you have more than one collection loaded with the id `default`. Select the root of each collection in the Outline panel and change the Name field in the properties panel from the default value of `default`.
Copy file name to clipboardExpand all lines: README_API.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,6 +189,32 @@ Post a message to a visible screen. If the screen is created through a collectio
189
189
*`error` (string|nil) - Error message if unable to send message
190
190
191
191
192
+
## monarch.on_transition(screen_id, fn)
193
+
Set a function to be called when a screen should transition in our out. The function will receive (message_id, message, sender) with `message_id` being one of the transition constants.
194
+
IMPORTANT! You must call `monarch.on_message(message_id, message, sender)` from the same script as this function was called.
195
+
196
+
**PARAMETERS**
197
+
*`screen_id` (string|hash) - Id of the screen
198
+
*`fn` (function) - The function to call when a transition should start
199
+
200
+
201
+
## monarch.on_focus_change(screen_id, fn)
202
+
Set a function to be called when a screen gains or loses focus. The function will receive (message_id, message, sender) with `message_id` being one of the focus change constants.
203
+
IMPORTANT! You must call `monarch.on_message(message_id, message, sender)` from the same script as this function was called.
204
+
205
+
**PARAMETERS**
206
+
*`screen_id` (string|hash) - Id of the screen
207
+
*`fn` (function) - The function to call screen focus changes
208
+
209
+
210
+
## monarch.on_post(screen_id, fn)
211
+
Set a function to be called when `msg.post()` is called on a specific screen. IMPORTANT! You must call `monarch.on_message(message_id, message, sender)` from the same script as this function was called.
212
+
213
+
**PARAMETERS**
214
+
*`screen_id` (string|hash) - Id of the screen
215
+
*`fn` (function) - The function to call when the screen receives a message using `msg.post`
216
+
217
+
192
218
## monarch.debug()
193
219
Enable verbose logging of the internals of Monarch.
Copy file name to clipboardExpand all lines: README_TRANSITIONS.md
+14-5Lines changed: 14 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,7 @@
1
1
# Transitions
2
-
You can add optional transitions when navigating between screens. The default behavior is that screen navigation is instant but if you have defined a transition for a screen Monarch will wait until the transition is completed before proceeding. The `Transition Url` (proxy) or `Transition Id` (collectionfactory) property described above should be the URL/Id to a script with an `on_message` handlers for the following messages:
2
+
You can add optional transitions when navigating between screens. The default behavior is that screen navigation is instant but if you have defined a transition for a screen Monarch will wait until the transition is completed before proceeding.
3
+
4
+
Transitions are configured through the `monarch.on_transition(screen_id, fn)` function. The function defines for which screen to configure transitions and sets a function to be called when a transition should be started. This function must accept (message_id, message, sender) as arguments, with `message_id` defining which type of transition to start:
3
5
4
6
*`transition_show_in` (constant defined as `monarch.TRANSITION.SHOW_IN`)
5
7
*`transition_show_out` (constant defined as `monarch.TRANSITION.SHOW_OUT`)
@@ -8,6 +10,11 @@ You can add optional transitions when navigating between screens. The default be
8
10
9
11
When a transition is completed it is up to the developer to send a `transition_done` (constant `monarch.TRANSITION.DONE`) message back to the sender to indicate that the transition is completed and that Monarch can continue the navigation sequence.
10
12
13
+
## Transition URL
14
+
This property is deprecated and will be removed in a future version of Monarch.
15
+
16
+
~~It is also possible to configure transitions through the `Transition Url` (proxy) or `Transition Id` (collectionfactory) property. This property must be the URL/Id to a script with an `on_message` handlers for the transition messages mentioned above.~~
17
+
11
18
12
19
## Predefined transitions
13
20
Monarch comes with a system for setting up transitions easily in a gui_script using the `monarch.transitions.gui` module. Example:
@@ -20,15 +27,17 @@ function init(self)
20
27
-- create transitions for the node 'root'
21
28
-- the node will slide in/out from left and right with
The transition message sent to the Transition Url specified in the screen configuration contains additional information about the transition. For the `transition_show_in` and `transition_back_out` messages the message contains the previous screen id:
123
+
The transition message sent transition listener script contains additional information about the transition. For the `transition_show_in` and `transition_back_out` messages the message contains the previous screen id:
0 commit comments