Update and FixedUpdate¶
This pages talks about the Update and FixedUpdate Unity events of MainManager.
Update¶
MainManager.Update is the main global update method of the game. It only does anything if basicload is true (LoadEverything completed).
Here is a summary of the tasks it handles in order:
- Handles dialogue mode SetText updates when not in a
promptoritemlist:- Handles the
blinkerrendering whenwaitinputis true - Enables
isholdingskipwhen input 5 (cancel) is held (check the text advance system documentation to learn more) - Handles passing to the next textbox (or going forward when backtracking) when input 4 (confirm) or 5 (cancel) is pressed
- Handles initiating a backtrack if input 6 (switch) is pressed
- Handles stopping
isholdingskipwhen input 5 (cancel) is no longer held
- Handles the
- Handles different types of prompts (check the prompt, numberprompt and letterprompt documentations for the details, this only summarises what happens):
- On all prompts:
- The
blinkeris disabled - PlayScrollSound called when up/down inputs are processed
- Both
keyholdare reset to 0.0 when no longer holding any directional inputs
- The
- On a regular prompt:
optiondecrements on an up input (with wrap around tomaxoption- 1 when going negative) and increments on a down input (with wrap around to 0 when going tomaxoption)- On a 4 input (confirm), the confirmation is handled with a
Confirmsound, settinglistcancelledto false, settingpromptpickandlastpromptto the confirmedoption, turning off thepromptflag and resetting the backtracking lines. This also turns any currentskiptextand applies aninputcooldownof 5.0 frames - If
listcancelisn't negative (this prompt supports cancellation) and input 5 (cancel) is pressed, it is handled with aCancelsound, settingpromptpickandlastprompttolistcanceland turning off thepromptflag. This also turns any currentskiptextand applies aninputcooldownof 10.0 frames
- On a numberprompt:
optionis set to 0 on an up input and tomaxoption- 1 on a down input. Either inputs causes flagvar 5 to be set to the input id- When input 8 (pause) is pressed,
optionis set tomaxoption- 1 optiondecrements on a left input (with wrap around tomaxoption- 1 when going negative) and increments on a right input (with wrap around to 0 when going tomaxoption). Either inputs causes flagvar 5 to be set to the input id and PlayScrollSound to be called- On a 4 input (confirm), the same handling is done than a regular prompt except that
promptpickis set to 0 and there are further handling depending on theoptionconfirmed: anything less than 10 appends the number to flagstring 0,option10 either commits the flagstring toflagvar[listtype]or cancels it if it's empty andoption11 removes 1 character from the flagstring when it's not empty. On a confirm or cancel,promptpointersis set to one element beinglistcancelorlistredirectfor cancelling or confirming respectively. A PayBuzzer happens when attempting to erase a number when the flagstring is empty - On a 5 input (cancel), the same handling is done than a regular prompt except that
promptpickis set to 0,promptpointersis set tolistcancel, theinputcooldownis 15.0 frames instead and the backtracking is reset
- On a letterprompt:
optionis decreased by flagvar 1 on an up input (clamped from 0) and it is increased by flagvar 1 on a down input (clamped tomaxoption- 1). Either inputs causes flagvar 5 to be set to the input id- When input 8 (pause) is pressed,
optionis set tomaxoption- 1 - When input 6 (switch) is pressed, the letterprompt is changed to the next one with ChangeLetterPrompt(-1)
- The same handling of left/right inputs happens than a numberprompt, but with the variation that
optionis wrapped to the leftmost of the current row by increasing it by flagvar 1 if left was pressed andoptionis wrapped on the rightmost of the current row by decreasing it by flagvar 1 if right was pressed - Any directional input processed above gets its changes to
optionrepeated if the currentoptionpoints to a blank space as stored by flagvar 5.optiongets clamped from 0 tomaxoption- 1 and flagvar 5 gets reset to -1 after - On a 4 input (confirm), the same handling is done than a regular prompt except that
promptpickis set to 0 and there are further handling depending on theoptionconfirmed: anything less thanmaxoption- 3 appends the selected character toflagstring[listtype](with Koeran handling if needed),optionofmaxoption- 3 removes a character in the flagstring (with Koeran handling if needed),optionofmaxoption- 2 appends ato the flagstring andoptionofmaxoption- 1 commits the flagstring toflagvar[listtype]and setspromptpointersto one element beinglistredirect. A PayBuzzer happens when attempting to erase a character when the flagstring is empty, when attempting to add a character while its length is 10, when attempting to add a space while in the middle of Building a Korean character or when attempting to confirm when the flagstring is empty (cancelling isn't supported on a letterprompt) - On a 5 input (cancel), either the last entered part of the current Korean character is undone or a character is removed from
flagstring[listtype](PlayBuzzer is called instead if the flagstring was empty)
- On all prompts:
- Handles specifics about cooking under specific conditions where
sounds[5]andsounds[6]have their pitch set to 2.5, Time.TimeScale set to 2.5 andnoskipset to true. Here are the list of required conditions for that to happen:- flagvar 3 is 5353 (only set to this value by the cooking event when the chef is about to cook)
- The game is
inevent - The message lock is released
noskipis false (meaning the logic hasn't run yet)lasteventis 3 (cooking event)skiptextis trueinputcooldownexpired- Either a 4 (confirm) input or 5 (cancel) input gets held
- Handles various itemlist related naviguation (check the different listtype documentations for the details, this only summarises what happens):
- If
listsellis true,showmoneyis set to 10.0 so the berry counter HUD is shown cursorgets locally positioned relative tolistcursorso it visually points at the current item. There are slight variations for the language listtype and any quests listtype- Up/down inputs gets processed with an UpdateList call (true for up, false for down, 1 skip and without nosound) followed by a ShowItemList with the current ItemList parameters to refresh
itemlistifoptionchanged as a result of the UpdateList call. NOTE: This doesn't use the overloads that supports the wrap around feature - Left/Right inputs gets processed the same way than up/down, but the UpdateList calls are repeated for
listammounttimes before the ShowItemList call (it doesn't use the overloads that supports this already with the skip parameter). However, for a quests listtype, these inputs processing completely changes because it needs to cycle the current tab:- PlaySound(
PageFlip) called - ResetList called
listtypeis decremented for a left input (with wrap arround to 16 if it gets lower than 14) or incremented for a right input (with wrap aroundf to 14 if it gets higher than 16)- UpdateQuestBoard called which rerenders the now changed tab
- ShowItemList called to reflect the new listtype with showdescription and without sell
- PlaySound(
- If no directional inputs are pressed both
keyholdare reset to 0.0 - When pressing input 7 (show HUD) on an ItemList that supports
multiselect, theoptionis added (if allowed) or removed frommultiselect(withBadgeEquiporBadgeDequipsound) followed bylistYset to -1 with a ShowItemList call using the currentitemlistparameters to refresh the list if the changes tomultiselectwas allowed (PlayBuzzer call if it wasn't). Here are the conditions to supportmultiselect(one of them needs to be true):listsellis truelisttypeis items listtype while flags 349 is true (this is a items storage deposit process). In this condition, it is forbidden to add tomultiselectwhen it already contains enough to fill upmaxstorageif it was confirmedlisttypeis storage items listtype (assumed to be a withdrawal process). In this condition, it is forbidden to add tomultiselectwhen it already contains enough to fill upmaxitemsif it was confirmed
- When pressing input 4 (confirm), the following happens:
- PlaySound(
Confirm, 10) called listcancelledset to falselastpromptset tooption- If
savelastlistis enabled, it is set to false whileoverridedlistis set to the return of a SaveList - There are specific confirmation handling for most of the listtypes, check the listtype documentation for the details on each of them
- PlaySound(
- When pressing input 5 (cancel), the following happens (except for a language listtype which cannot be cancelled):
multiselectis reset to a new list- PlaySound(
Cancel, 10) called listcancelledset to trueinputcooldownset for 15.0 framesskiptextreset to false- On a quests listtype, CloseQuestBoard is called and SaveCameraPosition(false) is called to restore the save camera position (check the quest board system to learn more)
- If the above didn't apply and the game is in a
battle, CancelList is called on thebattle - If neither of the above cases applied,
listredirectis set tolistcancel - DestroyList called to tear down the current
itemlist
- If
- Calls GetJoystick
FixedUpdate¶
MainManager.FixedUpdate is much simpler in comparision.
If basicload is true (LoadEverything ran to completion), the following happens:
- RefreshCamera is called
- LoopMusic is called