-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuConfig.pas
137 lines (124 loc) · 3.6 KB
/
uConfig.pas
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
unit uConfig;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, uSelector, FMX.Objects;
type
TConfig = class(TFrame)
Rectangle1: TRectangle;
Rectangle2: TRectangle;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
Image5: TImage;
Image6: TImage;
Image7: TImage;
StartMusic: TSelector;
GameMusic: TSelector;
Airplane: TSelector;
Explosion: TSelector;
Applause: TSelector;
RadarBeep: TSelector;
ButtonClick: TSelector;
BtSair: TImage;
procedure BtSairClick(Sender: TObject);
private
F0 : TBitmap;
F1 : TBitmap;
F2 : TBitmap;
F3 : TBitmap;
F4 : TBitmap;
F5 : TBitmap;
F6 : TBitmap;
F7 : TBitmap;
F8 : TBitmap;
F9 : TBitmap;
F10 : TBitmap;
public
Constructor Create(aOwner : TComponent); Override;
Procedure ShowIn(aControl : TControl);
Procedure HideFrame;
end;
Var
Config : TConfig;
implementation
Uses
FMX.Ani,
uImages,
uMedia;
{$R *.fmx}
{ TFrame1 }
procedure TConfig.BtSairClick(Sender: TObject);
begin
Media.Click2;
HideFrame;
end;
constructor TConfig.Create(aOwner: TComponent);
begin
inherited;
F0 := Images.GetText('0');
F1 := Images.GetText('1');
F2 := Images.GetText('2');
F3 := Images.GetText('3');
F4 := Images.GetText('4');
F5 := Images.GetText('5');
F6 := Images.GetText('6');
F7 := Images.GetText('7');
F8 := Images.GetText('8');
F9 := Images.GetText('9');
F10 := Images.GetText('10');
StartMusic .SetOptions([F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10]);
GameMusic .SetOptions([F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10]);
Airplane .SetOptions([F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10]);
Explosion .SetOptions([F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10]);
Applause .SetOptions([F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10]);
RadarBeep .SetOptions([F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10]);
ButtonClick.SetOptions([F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10]);
F0 .Free;
F1 .Free;
F2 .Free;
F3 .Free;
F4 .Free;
F5 .Free;
F6 .Free;
F7 .Free;
F8 .Free;
F9 .Free;
F10.Free;
end;
procedure TConfig.ShowIn(aControl: TControl);
begin
Parent := aControl;
Width := aControl.Width;
Height := aControl.Height;
Position.X := 0;
Position.Y := aControl.Height+1;
TAnimator.AnimateFloat(Self, 'Position.Y', 0, 0.5, TAnimationType.Out, TInterpolationType.Linear);
StartMusic .ItemIndex := Media.VolumeStartMusic;
GameMusic .ItemIndex := Media.VolumeGameMusic;
Airplane .ItemIndex := Media.VolumeAirplane;
Explosion .ItemIndex := Media.VolumeExplosion;
Applause .ItemIndex := Media.VolumeApplause;
RadarBeep .ItemIndex := Media.VolumeRadarBeep;
ButtonClick.ItemIndex := Media.VolumeButtonClick;
end;
procedure TConfig.HideFrame;
begin
Media.VolumeStartMusic := StartMusic .ItemIndex;
Media.VolumeGameMusic := GameMusic .ItemIndex;
Media.VolumeAirplane := Airplane .ItemIndex;
Media.VolumeExplosion := Explosion .ItemIndex;
Media.VolumeApplause := Applause .ItemIndex;
Media.VolumeRadarBeep := RadarBeep .ItemIndex;
Media.VolumeButtonClick := ButtonClick.ItemIndex;
Media.SaveVolumes;
TAnimator.AnimateFloat(Self, 'Position.Y', (Parent As TControl).Height + Height+1 , 0.5, TAnimationType.In, TInterpolationType.Linear);
TThread.CreateAnonymousThread(
Procedure
Begin
Sleep(510);
TThread.Queue(Nil, Procedure Begin Parent := Nil; End);
End);
end;
end.