Ticket Details - UQcsse3200/2024-studio-3 GitHub Wiki
Introduction
The ticket details is where information of the current order being considered by the player is stored. It keeps track of three details of each ticket:
- The order number
- The recipe name
- The meal and ingredients image with processing icons.
- The time left on the order
The ticket details will be retrieved from the Station Serving Component once a submission has been made. Further details of this can be seen here.
Here is an image below of a list of tickets. In this example, it is the last ticket, Order 1, would be getting saved in TicketDetails.
To go into more detail of the format of values being saved, take the following example:
currentOrderNumber = "1"
currentMeal = "acaiBowl"
currentTimeLeft = "24"
Usage
The following statements will add a fresh docket on screen:
entity.getEvents().trigger("createOrder","recipeName");
Dockets can also be added by using triggers for specific recipe dockets
ServiceLocator.getEntityService().getEvents().trigger("createAcaiDocket");
ServiceLocator.getEntityService().getEvents().trigger("createSaladDocket");
ServiceLocator.getEntityService().getEvents().trigger("createFruitSaladDocket");
ServiceLocator.getEntityService().getEvents().trigger("createSteakDocket");
ServiceLocator.getEntityService().getEvents().trigger("createBananaDocket");
Examples of create docket usage:
receipe name is as per core/assets/configs/recipe.json
// acaiBowl :
`entity.getEvents().trigger("createOrder","acaiBowl");`
// steakMeal :
`entity.getEvents().trigger("createOrder","steakMeal");`
// salad :
`entity.getEvents().trigger("createOrder","salad");`
For type safety, use RecipeNameEnums
when passing the recipe name argument:
// acaiBowl :
`entity.getEvents().trigger("createOrder", RecipeNameEnums.ACAI_BOWL.getRecipeName());`
// steakMeal :
`entity.getEvents().trigger("createOrder", RecipeNameEnums.STEAK_MEAL.getRecipeName());`
// salad :
`entity.getEvents().trigger("createOrder", RecipeNameEnums.SALAD.getRecipeName());`
Calling the events - as previously outlined - will create a fresh docket and automatically position it. The docket automatically handles updating its position when another docket is either removed from or added to the screen.