ItemList State Machine¶
There are several static public fields of MainManager that represents the state of an ItemList. All of them can be accessed externally, but extra care must be given in doing so since it can lead to undefined behaviors. The fields are generally kept around between ShowItemList calls to preserve them between updates and only changed before doing a refresh.
To denote that we are currently in an ItemList, ItemList
gets assigned when the list gets active and it gets set to null when inactive. Additionally, the instance field inlist
is set to true on the list creation and it is supposed to be set to false when it's handled, but due to the inlist issue, this is only guaranteed after a Pickitem command is fully done. This is different than prompt
which tells if we are in a Prompt, NumberPrompt or LetterPrompt and it is managed differently.
All fields are static to MainManager unless specified otherwise.
Parameters of ShowItemList¶
These are sent to the method and they are kept in these fields so that the method will be called the same way during refreshes:
- listtype: The original
type
parameter. It does not take into consideration overrides. Each type specify different methods for generationlistvar
, the SetText input string used for each options and how itslistdescbox
is rendered. listpos
: The originalposition
parameter.listdesc
: The originalshowdescription
parameter.listsell
: The originalsell
parameter.
Configuration¶
These are not sent to ShowItemList, but should be set externally before to configure aspects of the list prompt:
listredirect
: The Dialogue line id when a confirmation is done (see Pickitem for more info)listcancel
: The Dialogue line id to redirect when a cancellation is done (see Pickitem for more info)storeid
: The store id if it's one.- instance.
listammount
: The amount of items shown at once.
Save and restore¶
The list prompt system has the ability to save the browsing information on an ItemList after confirmation (but not cancellation) and to restore them the next time a new ItemList is requested via ShowItemList:
savelastlist
: Tell whether or not to save the browsing info upon confirmation tooverridedlist
. Has to be set externally and gets cleared once the list has been saved.overridedlist
: The browsing info of the last saved list bysavelastlist
. Gets cleared on restore to the next new list call. It containsoption
,listcursor
,listlow
,listmax
andlistoption
.
This is only used in CardGame under normal gameplay.
Options management¶
These are used to track a list prompt's options and selections:
multiselect
: The list of selected items in the ItemListlistcanceled
: Whether the ItemList has been cancelled or notlistvar
: All the available options, depends on listtype- instance.
maxoptions
: The number of available options in the entire list (same use as in a Prompt, NumberPrompt or LetterPrompt). - instance.
option
: The option index in the entire list (same use as in a Prompt, NumberPrompt or LetterPrompt). - instance.
lastPrompt
: Theoption
value on the last confirmed ItemList (same use as in a Prompt, NumberPrompt or LetterPrompt). NOTE: As with the prompts, it is better to useoption
because that only always report the last ItemList option selected regardless if it was confirmed or not which can be checked separately listoption
: The same then option, but only after the ItemList destruction (which is done after a selection has been done).
Scrolling and view¶
These are used to maintain a separation between what the entire list is and what its visible part is located at:
listlow
: Lower boundary of the visible part of the ItemList (this is visually the topmost item visible)listmax
: Upper boundary of the visible part of the ItemList (this is visually the bottomost item visible)listy
: Thelistlow
or -1. This is how the game detects that an ItemList isn't fully scrolled by putting the value to -1 and then tolistlow
after fully scrolling itlistcursor
: The option index of the currently visible part only (from 0 tolistammount
- 1)
User interface¶
These are the actual objects that contains all the UI for the ItemList:
- ItemList: The transform of the current ItemList, also tells if an ItemList is active if it's not null
listdescbox
: The transform of the description box