-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDialogTask.cs
78 lines (65 loc) · 2.32 KB
/
DialogTask.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
namespace TheraWii
{
public class DialogTask : Task
{
private string displayText;
[XmlIgnore]
public GameTextBox textBox;
public string DisplayText
{
get { return displayText; }
set { displayText = value; }
}
public DialogTask()
{
endCondition = new ButtonEndCondition();
}
public DialogTask(DialogTask d)
{
Name = "copy of" + d.Name;
displayText = d.displayText;
endCondition = d.endCondition.returnNew();
}
public override List<WiiType> getRequiredDevices()
{
List<WiiType> wt = endCondition.getRequiredDevices();
return wt;
}
public override void Initialize(
GraphicsDeviceManager g, ContentManager c, SpriteBatch sb,
int screenHeight, int screenWidth, Session s, Vector3 position)
{
base.Initialize(g, c, sb, screenHeight, screenWidth, s, position);
textBox = new GameTextBox();
String buttonText = "";
/* create some space in the text message before printing the end condition critera */
if (endCondition.GetType() == typeof(ButtonEndCondition))
{
buttonText = "\n\nHit the " + ((ButtonEndCondition)endCondition).getButtonText() + " to continue.";
}
else if (endCondition.GetType() == typeof(TimeLimitEndCondition))
{
buttonText = "\n\n\nTherapy will continue in " + ((TimeLimitEndCondition)endCondition).TimeLimit + " seconds.";
}
textBox.Initialize(displayText + buttonText, c, sb, screenHeight, screenWidth);
}
public override void Draw(GameTime gt)
{
textBox.Draw();
}
public override string ToString()
{
return base.ToString() + " (Dialog)";
}
public override System.Windows.Forms.Form GetTaskForm()
{
return new FormDialogTask(this);
}
}
}