unit MainUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, IniFiles;
type
TForm1 =
class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Edit1: TEdit;
GroupBox3: TGroupBox;
Edit2: TEdit;
GroupBox4: TGroupBox;
Button1: TButton;
Button2: TButton;
Image1: TImage;
GroupBox5: TGroupBox;
Edit3: TEdit;
Button3: TButton;
Edit4: TEdit;
GroupBox6: TGroupBox;
GroupBox7: TGroupBox;
Panel1: TPanel;
Panel2: TPanel;
Button4: TButton;
Panel3: TPanel;
Panel4: TPanel;
Button5: TButton;
Panel5: TPanel;
Panel6: TPanel;
Panel7: TPanel;
GroupBox8: TGroupBox;
Button6: TButton;
Panel8: TPanel;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Panel9: TPanel;
Panel10: TPanel;
Button12: TButton;
GroupBox9: TGroupBox;
Feld1: TPanel;
Feld2: TPanel;
Feld3: TPanel;
Feld4: TPanel;
Feld5: TPanel;
Feld6: TPanel;
Feld7: TPanel;
Feld8: TPanel;
Feld9: TPanel;
Feld10: TPanel;
Feld11: TPanel;
Feld12: TPanel;
Feld13: TPanel;
Feld14: TPanel;
Feld15: TPanel;
Feld16: TPanel;
Feld17: TPanel;
Feld18: TPanel;
Feld21: TPanel;
Feld26: TPanel;
Feld22: TPanel;
Feld28: TPanel;
Feld23: TPanel;
Feld24: TPanel;
Feld27: TPanel;
Feld19: TPanel;
Feld30: TPanel;
Feld25: TPanel;
Feld29: TPanel;
Feld20: TPanel;
GeldTimer: TTimer;
GroupBox11: TGroupBox;
Panel13: TPanel;
Panel14: TPanel;
Button13: TButton;
MaxTimer: TTimer;
Label1: TLabel;
Panel11: TPanel;
Label2: TLabel;
Panel12: TPanel;
Panel15: TPanel;
GroupBox10: TGroupBox;
Label3: TLabel;
Label4: TLabel;
ComboBox1: TComboBox;
Button15: TButton;
Button14: TButton;
Panel16: TPanel;
Panel17: TPanel;
Panel18: TPanel;
Panel19: TPanel;
Panel20: TPanel;
Panel21: TPanel;
Panel22: TPanel;
Button16: TButton;
Button17: TButton;
Button18: TButton;
procedure Button16Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure MaxTimerTimer(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure GeldTimerTimer(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Save: TIniFile;
Felder, getreide, arbeiter, get: double;
raps, zuckerrueben, kartoffeln: double;
mais, geld: Double;
implementation
{$R *.dfm}
procedure TForm1.Button3Click(Sender: TObject);
begin
try
if (Edit1.Text <> '
')
and (Edit2.Text <> '
')
and (Edit3.Text <> '
')
then
begin
Save := TIniFile.Create(Edit3.Text+'
.ini');
Save.WriteString ('
Profileinstellungen','
Spielername',Edit1.Text);
Save.WriteString ('
Profileinstellungen','
Bauernhofname',Edit2.Text);
Save.WriteString ('
Profileinstellungen','
Profilname',Edit3.Text);
Save.WriteInteger ('
Profileinstellungen','
Bildnummer',strtoint(Edit4.Text));
showmessage ('
Profil konnte erfolgreich angelegt werden!');
end
else
showmessage ('
Sie haben nicht alle Felder ausgefüllt!');
except
showmessage ('
Profil konnte nicht angelegt werden!');
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var num: Integer;
begin
num := strtoint(Edit4.Text);
if num <> 1
then
begin
num := num - 1;
Edit4.Text := inttostr (num);
end
else
showmessage('
Es muss ein Bild ausgewählt werden!');
end;
procedure TForm1.Button1Click(Sender: TObject);
var num: Integer;
begin
num := strtoint(Edit4.Text);
if num <> 5
then
begin
num := num + 1;
Edit4.Text := inttostr (num);
end
else
showmessage('
Es muss ein Bild ausgewählt werden!');
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if Felder = 0
then
Felder := Felder +1;
if arbeiter = 0
then
arbeiter := arbeiter + 1;
get := 1;
if FileExists('
C:\WINDOWS\LT-BbLog.ini')
then
begin
Groupbox1.Visible := false;
GroupBox2.BringToFront;
Form1.Height := 361;
Form1.Width := 673;
end
else
begin
GroupBox1.BringToFront;
GroupBox2.SendToBack;
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if Geld > 1499
then
begin
if Felder <> 30
then
begin
Felder := Felder +1;
Geld := Geld - 1500;
Panel7.Caption := floattostr(Geld) + '
€';
Panel2.Caption := floattostr (Felder);
if get = 1
then
Label2.Caption := floattostr(Felder * 400) + '
kg'
else
Label2.Caption := floattostr(Felder * 500) + '
kg';
case Felder
of
2: Feld2.Color := clGreen;
3: Feld3.Color := clGreen;
4: Feld4.Color := clGreen;
5: Feld5.Color := clGreen;
6: Feld6.Color := clGreen;
7: Feld7.Color := clGreen;
8: Feld8.Color := clGreen;
9: Feld9.Color := clGreen;
10: Feld10.Color := clGreen;
11: Feld11.Color := clGreen;
12: Feld12.Color := clGreen;
13: Feld13.Color := clGreen;
14: Feld14.Color := clGreen;
15: Feld15.Color := clGreen;
16: Feld16.Color := clGreen;
17: Feld17.Color := clGreen;
18: Feld18.Color := clGreen;
19: Feld19.Color := clGreen;
20: Feld20.Color := clGreen;
21: Feld21.Color := clGreen;
22: Feld22.Color := clGreen;
23: Feld23.Color := clGreen;
24: Feld24.Color := clGreen;
25: Feld25.Color := clGreen;
26: Feld26.Color := clGreen;
27: Feld27.Color := clGreen;
28: Feld28.Color := clGreen;
29: Feld29.Color := clGreen;
30: Feld30.Color := clGreen;
end;
end
else
showmessage ('
Sie besitzen alle Felder in ihrer Umgebung!');
end
else
showmessage ('
Sie besitzen nicht genug Geld!');
end;
procedure TForm1.GeldTimerTimer(Sender: TObject);
begin
if get = 1
then
begin
if getreide < 40000
then
begin
getreide := getreide + Felder * 400;
Panel14.Caption := floattostr(getreide) + '
kg';
end;
end;
if get = 2
then
begin
if mais < 40000
then
begin
mais := mais + Felder * 150;
Panel12.Caption := floattostr(mais) + '
kg';
end;
end;
if get = 3
then
begin
if raps < 40000
then
begin
raps := raps + Felder * 500;
Panel18.Caption := floattostr(raps) + '
kg';
end;
end;
if get = 4
then
begin
if zuckerrueben < 40000
then
begin
zuckerrueben := zuckerrueben + Felder * 200;
Panel20.Caption := floattostr(zuckerrueben) + '
kg';
end;
end;
if get = 5
then
begin
if kartoffeln < 40000
then
begin
kartoffeln := kartoffeln + kartoffeln * 300;
Panel22.Caption := floattostr(kartoffeln) + '
kg';
end;
end;
if get = 6
then
begin
if mais < 40000
then
begin
mais := mais + Felder * 1000;
Panel12.Caption := floattostr(mais) + '
kg';
end;
end;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
GroupBox11.BringToFront;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Groupbox7.BringToFront;
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
{if Getreide > 9 then
begin
Getreide := Getreide - 10;
Geld := Geld + 5;
Panel14.Caption := inttostr(Getreide) + ' kg';
Panel7.Caption := inttostr(Geld) + ' €';
end
else
showmessage('Sie besitzen nicht genung Getreide!'); }
Geld := Geld + Getreide * 5;
Getreide := 0;
Panel14.Caption := floattostr(Getreide) + '
kg';
Panel7.Caption := floattostr(Geld) + '
€';
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button5Click(Sender: TObject);
var Sparen: double;
begin
if arbeiter <> 10
then
begin
if Geld > 99
then
begin
Geld := geld - 100;
sparen := arbeiter * 100;
arbeiter := arbeiter + 1;
GeldTimer.Interval := 10000 - sparen;
Panel4.Caption := floattostr(arbeiter);
Panel7.Caption := floattostr(geld) + '
€';
end
else
showmessage('
Sie besitzen nicht genung Geld!');
end
else
showmessage('
Sie besitzen schon 10 Arbeiter!');
end;
procedure TForm1.MaxTimerTimer(Sender: TObject);
begin
if getreide > 40000
then
begin
getreide := 40000;
Panel14.Caption := floattostr(getreide) + '
kg';
end;
if mais > 40000
then
begin
mais := 40000;
Panel12.Caption := floattostr(mais) + '
kg';
end;
if get = 1
then
Label2.Caption := floattostr(Felder * 400) + '
kg'
else
Label2.Caption := floattostr(Felder * 150) + '
kg';
end;
procedure TForm1.Button15Click(Sender: TObject);
begin
if Combobox1.Text = '
Getreide'
then
begin
get := 1;
Panel16.Caption := '
Gerade: Getreide';
end
else if Combobox1.Text = '
Mais'
then
begin
get := 2;
Panel16.Caption := '
Gerade: Mais';
end
else if Combobox1.Text = '
Raps'
then
begin
get := 3;
Panel16.Caption := '
Gerade: Raps';
end
else if Combobox1.Text = '
Zuckerrüben'
then
begin
get := 4;
Panel16.Caption := '
Gerade: Zuckerrüben';
end
else if Combobox1.Text = '
Kartoffeln'
then
begin
get := 5;
Panel16.Caption := '
Gerade: Kartoffeln';
end
else if Combobox1.Text = '
Trüffel'
then
begin
get := 6;
Panel16.Caption := '
Gerade: Trüffel';
end
else
showmessage('
Fehler: Sie müssen ein Sorte auswählen!');
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
Geld := Geld + mais * 0.8;
mais := 0;
Panel12.Caption := floattostr(mais) + '
kg';
Panel7.Caption := floattostr(Geld) + '
€';
end;
procedure TForm1.Button16Click(Sender: TObject);
begin
Geld := raps * 5;
raps := 0;
Panel18.Caption := floattostr(raps) + '
kg';
Panel7.Caption := floattostr(Geld) + '
€';
end;
end.