Line 273: |
Line 273: |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | // TODO: Examples with choices | + | // TODO: More examples with choices |
| | | |
| + | To utilise options, you are better off using createQuestionDialogue. |
| + | |
| + | <syntaxhighlight lang="c#"> |
| + | private void SampleClick() |
| + | { |
| + | // List of choices to give the farmer. |
| + | List<Response> choices = new List<Response>() |
| + | { |
| + | new Response("dialogue_id1","Choice 1" ), |
| + | new Response("dialogue_id2", "Choice 2"), |
| + | new Response("dialogue_id3", "Choice 3"), |
| + | new Response("dialogue_id4", "Choice 4") |
| + | }; |
| + | |
| + | // And here we case it to pop up on the farmer's screen. When the farmer has picked a choice, it sends that information to the method below (DialogueSet |
| + | Game1.currentLocation.createQuestionDialogue($"What is the question?", choices.ToArray(), new GameLocation.afterQuestionBehavior(DialogueSet)); |
| + | } |
| + | |
| + | public void DialogueSet(Farmer who, string dialogue_id) |
| + | { |
| + | // Here you get which option was picked as dialogue_id. |
| + | Game1.addHUDMessage(new HUDMessage($"Farmer {who} chose option {dialogue_id}")); |
| + | |
| + | } |
| + | </syntaxhighlight> |
| | | |
| ==Mail== | | ==Mail== |