/
bedroom.dart
201 lines (198 loc) · 8.29 KB
/
bedroom.dart
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import 'dart:math';
import 'package:escape_game_kit/escape_game_kit.dart';
import 'package:escape_game_kit_example/game/objects/clover_key.dart';
import 'package:escape_game_kit_example/game/objects/mouth_key.dart';
import 'package:escape_game_kit_example/game/padlocks/bruteforce_padlock.dart';
import 'package:escape_game_kit_example/game/padlocks/computer_padlock.dart';
import 'package:escape_game_kit_example/widgets/object_found_dialog_content.dart';
/// The bedroom.
class BedroomRoom extends Room {
/// The room id.
static const String roomId = 'bedroom';
/// Creates a new [BedroomRoom] instance.
BedroomRoom()
: super(
id: roomId,
onFirstVisit: (escapeGame) {
escapeGame.showDialog(const EscapeGameDialog(content: "<em>Shit, what has just happened ?<br>And above all, where are we !?</em>"));
return const ActionResult.success();
},
interactables: [
Interactable(
id: 'mirror',
renderSettings: const InteractableRenderSettings(
top: 130,
left: 280,
height: 80,
width: 60,
),
onHover: (escapeGame) => const ActionResult.success(object: InteractableTooltip(text: 'A big mirror.')),
),
Interactable(
id: 'top-drawers',
renderSettings: const InteractableRenderSettings(
top: 290,
left: 250,
height: 30,
width: 70,
),
onHover: (escapeGame) => const ActionResult.success(object: InteractableTooltip(text: "There's nothing in the first two draws.")),
),
PickableObject(
object: const MouthKey(),
renderSettings: const InteractableRenderSettings(
top: 320,
left: 250,
height: 15,
width: 70,
),
padlock: BruteforcePadlock(),
onPickedUp: (escapeGame) {
escapeGame.showDialog(const EscapeGameDialog(
title: 'Object found !',
content: ObjectFoundDialogContent(
asset: MouthKey.asset,
message: '<em>You just found a <strong>mouth shaped key</strong> !</em>',
),
));
return const ActionResult.success();
},
removedTooltip: const InteractableTooltip(text: "You've found a key in this draw."),
),
Interactable(
id: 'wardrobe',
renderSettings: const InteractableRenderSettings(
top: 143,
left: 100,
height: 217,
width: 100,
),
onHover: (escapeGame) => const ActionResult.success(object: InteractableTooltip(text: 'This is just a wardrobe.')),
),
Interactable(
id: 'window',
renderSettings: const InteractableRenderSettings(
top: 134,
left: 424,
height: 213,
width: 122,
),
onHover: (escapeGame) => const ActionResult.success(object: InteractableTooltip(text: 'It\'s still dark outside.')),
),
Clue.dialog(
id: 'bed-chest',
renderSettings: const InteractableRenderSettings(
top: 279,
left: 636,
height: 78,
width: 288,
),
keyId: EightKey.objectId,
clueDialog: const EscapeGameDialog(
title: 'Hint on the password',
content:
"<em>You have unlocked this chest using the eight shaped key... And there is a message !</em><br><br>Rabbits and chickens are in the garden. We don't know how many there are, but we can count 20 paws and 6 heads.<br><br><strong>The second digit of the computer password is the rabbit count.</strong>",
),
noKeyDialog: const EscapeGameDialog(
title: 'Locked chest',
content: '<em>There seems to be a chest under this bed, but it has been locked with a key, and you don\'t have it...</em>',
),
),
Clue.dialog(
id: 'lamp',
renderSettings: const InteractableRenderSettings(
top: 230,
left: 288,
height: 44,
width: 38,
),
clueDialog: const EscapeGameDialog(
title: 'Hint on a padlock',
content:
"<em>There seems to be a hint behind this lamp !</em><br><br>I was always forgetting the code of the chest padlock that is hidden in the flower pot in the living room... But now no more worries !<br>To unlock it, we just need to input the number of possible 3-digit code combinations !",
),
),
Interactable(
id: 'candles',
renderSettings: const InteractableRenderSettings(
top: 218,
left: 247,
height: 55,
width: 31,
),
onHover: (escapeGame) => const ActionResult.success(object: InteractableTooltip(text: 'Some candles are lighting up the room.')),
),
Door(
id: 'desk-door',
renderSettings: InteractableRenderSettings(
asset: 'assets/interactables/arrow.svg',
top: 200,
left: 20,
height: 80,
width: 80,
rotationAngle: -pi / 2 - 0.2,
hoverAnimation: InteractableAnimation(type: InteractableAnimationType.pulse),
),
onTap: (escapeGame) {
if (!escapeGame.inventory.hasObjectId(MouthKey.objectId)) {
escapeGame.showDialog(const EscapeGameDialog(
title: 'Door locked',
content: "<em>Damn, the desk door is locked, and you don't have the key !</em>",
));
return const ActionResult.failed();
}
return const ActionResult.success();
},
onHover: (escapeGame) => const ActionResult.success(object: InteractableTooltip(text: 'Go to the desk')),
roomId: 'desk',
),
Door(
id: 'living-room-door',
renderSettings: InteractableRenderSettings(
asset: 'assets/interactables/arrow.svg',
top: 200,
right: 20,
height: 80,
width: 80,
rotationAngle: pi / 2 + 0.2,
hoverAnimation: InteractableAnimation(type: InteractableAnimationType.pulse),
),
onTap: (escapeGame) {
if (!escapeGame.inventory.hasObjectId(MouthKey.objectId)) {
escapeGame.showDialog(const EscapeGameDialog(
title: 'Door locked',
content: "<em>Damn, the living room door is locked, and you don't have the key !</em>",
));
return const ActionResult.failed();
}
return const ActionResult.success();
},
onHover: (escapeGame) => const ActionResult.success(object: InteractableTooltip(text: 'Go to the living room')),
roomId: 'living-room',
),
Door(
id: 'computer',
renderSettings: const InteractableRenderSettings(
top: 225,
left: 410,
height: 60,
width: 60,
),
roomId: 'bedroom-final',
padlock: PadlockSequence(
padlocks: [
CredentialsPadlock(
username: 'htam',
password: '146',
caseSensitive: false,
title: 'Login',
unlockMessage: 'Oh no, we need to login !',
failedToUnlockMessage: 'Cannot login... There must be an error somewhere.',
),
ComputerPadlock(),
],
),
),
],
);
}