GamerSK

video stop

Mar 22nd, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 2.63 KB | None | 0 0
  1. //https://mega.nz/#F!vMcFVaJB!3QnNcYNNkSYF1kuH9-EbTw
  2.  
  3.  
  4. unit Unit1;
  5.  
  6. {$mode objfpc}{$H+}
  7.  
  8. interface
  9.  
  10. uses
  11.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
  12.   ExtCtrls, StdCtrls, Spin;
  13.  
  14. type
  15.  
  16.   { TForm1 }
  17.  
  18.   TForm1 = class(TForm)
  19.     Button1: TButton;
  20.     Button2: TButton;
  21.     Button3: TButton;
  22.     Label1: TLabel;
  23.     Label2: TLabel;
  24.     Label3: TLabel;
  25.     Label4: TLabel;
  26.     Label5: TLabel;
  27.     Label6: TLabel;
  28.     Label7: TLabel;
  29.     ProgressBar: TProgressBar;
  30.     suma: TSpinEdit;
  31.     Timer1: TTimer;
  32.     procedure Button1Click(Sender: TObject);
  33.     procedure Button2Click(Sender: TObject);
  34.     procedure Button3Click(Sender: TObject);
  35.     procedure FormCreate(Sender: TObject);
  36.     procedure Timer1Timer(Sender: TObject);
  37.   private
  38.     { private declarations }
  39.   public
  40.     { public declarations }
  41.   end;
  42.  
  43. var
  44.   Form1: TForm1;
  45.   body,a,b,c:integer;
  46.   stop:byte;
  47.   isStop:boolean;
  48.  
  49. implementation
  50.  
  51. {$R *.lfm}
  52.  
  53. { TForm1 }
  54.  
  55. procedure TForm1.Timer1Timer(Sender: TObject);
  56. begin
  57.   ProgressBar.Position:=ProgressBar.Position+2;
  58.   label5.Caption:=inttostr(ProgressBar.Position)+'%';
  59.   if ProgressBar.Position>=100 then
  60.     begin
  61.       Timer1.Enabled:=false;
  62.       if body > 0 then showmessage('Získal si '+inttostr(body)+' bodov')
  63.         else showmessage('Nezískal si žiadne body!');
  64.       label7.Caption:='Vyhrál si sumu: '+inttostr(suma.Value*body)+'€';
  65.     end;
  66.   a:=1+random(6); b:=1+random(6); c:=1+random(6);
  67.   label1.Caption:=inttostr(a);
  68.   label2.Caption:=inttostr(b);
  69.   label3.Caption:=inttostr(c);
  70. end;
  71.  
  72. procedure TForm1.Button1Click(Sender: TObject);
  73. begin
  74.   Timer1.Enabled:=true;
  75.   suma.ReadOnly:=true;
  76.   isStop:=false;
  77. end;
  78.  
  79. procedure TForm1.Button2Click(Sender: TObject);
  80. begin
  81.   Timer1.Enabled:=false;
  82.   if (isStop = false) then
  83.     begin
  84.       isStop:=true;
  85.       if (a=b) or (a=c) or (b=c) then body:=body+10;
  86.       if (a=b) and (b=c) then body:=body+100;
  87.       label4.Caption:=inttostr(body);
  88.     end;
  89.   if stop = 2 then
  90.     begin
  91.       if body > 0 then showmessage('Získal si '+inttostr(body)+' bodov')
  92.         else showmessage('Nezískal si žiadne body!');
  93.       label7.Caption:='Vyhrál si sumu: '+inttostr(suma.Value*body)+'€';
  94.       Button1.Enabled:=false;
  95.     end
  96.       else inc(stop);
  97. end;
  98.  
  99. procedure TForm1.Button3Click(Sender: TObject);
  100. begin
  101.   body:=0;
  102.   label4.Caption:='0';
  103.   ProgressBar.Position:=0;
  104.   label5.Caption:='0%';
  105.   stop:=0;
  106.   Button1.Enabled:=true;
  107. end;
  108.  
  109. procedure TForm1.FormCreate(Sender: TObject);
  110. begin
  111.   body:=0;
  112.   ProgressBar.Position:=0;
  113.   label5.Caption:='0%';
  114.   label4.Caption:='0';
  115. end;
  116.  
  117. end.
Advertisement
Add Comment
Please, Sign In to add comment