Changeset 95


Ignore:
Timestamp:
Sep 28, 2022, 12:23:17 AM (2 years ago)
Author:
chronos
Message:
  • Added: Show dialog about new train every start of new week.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r94 r95  
    244244  CopyImage(Engine.ImageLocomotive.Bitmap, FormImages.ImageLocomotive.Picture.Bitmap);
    245245  CopyImage(Engine.ImageLocomotive.BitmapDisabled, FormImages.ImageLocomotive.Picture.Bitmap, True);
     246  CopyImage(Engine.ImageNewTrain.Bitmap, FormImages.ImageLocomotive.Picture.Bitmap);
     247  CopyImage(Engine.ImageNewTrain.BitmapDisabled, FormImages.ImageLocomotive.Picture.Bitmap, True);
    246248  CopyImage(Engine.ImageCarriage.Bitmap, FormImages.ImageCarriage.Picture.Bitmap);
    247249  CopyImage(Engine.ImageCarriage.BitmapDisabled, FormImages.ImageCarriage.Picture.Bitmap, True);
     
    259261    BitmapInvert(Engine.ImageLocomotive.Bitmap);
    260262    BitmapInvert(Engine.ImageLocomotive.BitmapDisabled);
     263    BitmapInvert(Engine.ImageNewTrain.Bitmap);
     264    BitmapInvert(Engine.ImageNewTrain.BitmapDisabled);
    261265    BitmapInvert(Engine.ImageCarriage.Bitmap);
    262266    BitmapInvert(Engine.ImageCarriage.BitmapDisabled);
  • trunk/Languages/BigMetro.cs.po

    r94 r95  
    2525msgstr "Big Metro"
    2626
     27#: uengine.sautomatic
     28msgctxt "uengine.sautomatic"
     29msgid "Automatic"
     30msgstr "Automaticky"
     31
     32#: uengine.sback
     33msgctxt "uengine.sback"
     34msgid "Back"
     35msgstr "Zpět"
     36
     37#: uengine.sbigmetro
     38msgctxt "uengine.sbigmetro"
     39msgid "Big Metro"
     40msgstr "Big Metro"
     41
     42#: uengine.scontinue
     43msgctxt "uengine.scontinue"
     44msgid "Continue"
     45msgstr "Pokračovat"
     46
     47#: uengine.sczech
     48msgctxt "uengine.sczech"
     49msgid "Czech"
     50msgstr "Čeština"
     51
     52#: uengine.sdarkmode
     53msgctxt "uengine.sdarkmode"
     54msgid "Dark mode"
     55msgstr "Temný režim"
     56
    2757#: uengine.sday
    2858msgid "Day"
    2959msgstr "Den"
     60
     61#: uengine.senglish
     62msgctxt "uengine.senglish"
     63msgid "English"
     64msgstr "Angličtina"
     65
     66#: uengine.sexit
     67msgctxt "uengine.sexit"
     68msgid "Exit"
     69msgstr "Odejít"
     70
     71#: uengine.sfullscreen
     72msgctxt "uengine.sfullscreen"
     73msgid "Full screen"
     74msgstr "Celá obrazovka"
    3075
    3176#: uengine.sgameover
     
    4287msgstr "%d cestujících cestovalo ve vašem metru během %d dnů."
    4388
     89#: uengine.slanguage
     90msgctxt "uengine.slanguage"
     91msgid "Language"
     92msgstr "Jazyk"
     93
    4494#: uengine.slondon
    4595msgid "London"
     
    4999msgid "New high score!"
    50100msgstr "Nové vysoké skóre!"
     101
     102#: uengine.snewtrain
     103msgid "You get a new train for your metro"
     104msgstr "Získáváš nový vlak pro tvé metro"
    51105
    52106#: uengine.snewyork
     
    63117msgstr "Dřívější vysoké skóre bylo %d cestujících v %d dnech."
    64118
     119#: uengine.soptions
     120msgctxt "uengine.soptions"
     121msgid "Options"
     122msgstr "Volby"
     123
    65124#: uengine.sparis
    66125msgid "Paris"
    67126msgstr "Paříž"
    68127
     128#: uengine.splay
     129msgctxt "uengine.splay"
     130msgid "Play"
     131msgstr "Hrát"
     132
    69133#: uengine.sprague
    70134msgid "Prague"
    71135msgstr "Praha"
    72136
     137#: uengine.srestart
     138msgctxt "uengine.srestart"
     139msgid "Try again"
     140msgstr "Zkusit znovu"
     141
    73142#: uengine.sstationnotdefined
    74143msgid "Station have to be defined"
     
    83152msgstr "Tokyo"
    84153
     154#: uengine.strain
     155msgid "Train"
     156msgstr "Vlak"
     157
     158#: uengine.sweek
     159msgid "week"
     160msgstr "týden"
     161
    85162#: uformmain.sfridayshort
    86163msgid "FRI"
     
    112189
    113190#: umenu.sautomatic
     191msgctxt "umenu.sautomatic"
    114192msgid "Automatic"
    115193msgstr "Automaticky"
    116194
    117195#: umenu.sback
     196msgctxt "umenu.sback"
    118197msgid "Back"
    119198msgstr "Zpět"
     
    125204
    126205#: umenu.scontinue
     206msgctxt "umenu.scontinue"
    127207msgid "Continue"
    128208msgstr "Pokračovat"
    129209
    130210#: umenu.sczech
     211msgctxt "umenu.sczech"
    131212msgid "Czech"
    132213msgstr "Čeština"
    133214
    134215#: umenu.sdarkmode
     216msgctxt "umenu.sdarkmode"
    135217msgid "Dark mode"
    136218msgstr "Temný režim"
    137219
    138220#: umenu.senglish
     221msgctxt "umenu.senglish"
    139222msgid "English"
    140223msgstr "Angličtina"
     
    146229
    147230#: umenu.sfullscreen
     231msgctxt "umenu.sfullscreen"
    148232msgid "Full screen"
    149233msgstr "Celá obrazovka"
    150234
    151235#: umenu.slanguage
     236msgctxt "umenu.slanguage"
    152237msgid "Language"
    153238msgstr "Jazyk"
     
    164249
    165250#: umenu.srestart
     251msgctxt "umenu.srestart"
    166252msgid "Try again"
    167253msgstr "Zkusit znovu"
  • trunk/Languages/BigMetro.de.po

    r94 r95  
    2525msgstr "Big Metro"
    2626
     27#: uengine.sautomatic
     28#, fuzzy
     29msgctxt "uengine.sautomatic"
     30msgid "Automatic"
     31msgstr "Automatisch"
     32
     33#: uengine.sback
     34#, fuzzy
     35msgctxt "uengine.sback"
     36msgid "Back"
     37msgstr "Zurück"
     38
     39#: uengine.sbigmetro
     40#, fuzzy
     41msgctxt "uengine.sbigmetro"
     42msgid "Big Metro"
     43msgstr "Big Metro"
     44
     45#: uengine.scontinue
     46#, fuzzy
     47msgctxt "uengine.scontinue"
     48msgid "Continue"
     49msgstr "Fortsetzen"
     50
     51#: uengine.sczech
     52#, fuzzy
     53msgctxt "uengine.sczech"
     54msgid "Czech"
     55msgstr "Tschechisch"
     56
     57#: uengine.sdarkmode
     58#, fuzzy
     59msgctxt "uengine.sdarkmode"
     60msgid "Dark mode"
     61msgstr "Darm mode"
     62
    2763#: uengine.sday
    2864msgid "Day"
    2965msgstr "Tag"
     66
     67#: uengine.senglish
     68#, fuzzy
     69msgctxt "uengine.senglish"
     70msgid "English"
     71msgstr "Englisch"
     72
     73#: uengine.sexit
     74#, fuzzy
     75msgctxt "uengine.sexit"
     76msgid "Exit"
     77msgstr "Beenden"
     78
     79#: uengine.sfullscreen
     80#, fuzzy
     81msgctxt "uengine.sfullscreen"
     82msgid "Full screen"
     83msgstr "Vollbild"
    3084
    3185#: uengine.sgameover
     
    4296msgstr "%d Passagiere fuhren mit deiner Metro über %d Tage."
    4397
     98#: uengine.slanguage
     99#, fuzzy
     100msgctxt "uengine.slanguage"
     101msgid "Language"
     102msgstr "Sprache"
     103
    44104#: uengine.slondon
    45105msgid "London"
     
    49109msgid "New high score!"
    50110msgstr "Neuer Highscore!"
     111
     112#: uengine.snewtrain
     113msgid "You get a new train for your metro"
     114msgstr ""
    51115
    52116#: uengine.snewyork
     
    63127msgstr "Der alte Highscore war %d passager in %d Tagen."
    64128
     129#: uengine.soptions
     130#, fuzzy
     131msgctxt "uengine.soptions"
     132msgid "Options"
     133msgstr "Optionen"
     134
    65135#: uengine.sparis
    66136msgid "Paris"
    67137msgstr ""
    68138
     139#: uengine.splay
     140#, fuzzy
     141msgctxt "uengine.splay"
     142msgid "Play"
     143msgstr "Play"
     144
    69145#: uengine.sprague
    70146msgid "Prague"
    71147msgstr ""
    72148
     149#: uengine.srestart
     150#, fuzzy
     151msgctxt "uengine.srestart"
     152msgid "Try again"
     153msgstr "Neustart"
     154
    73155#: uengine.sstationnotdefined
    74156msgid "Station have to be defined"
     
    83165msgstr ""
    84166
     167#: uengine.strain
     168msgid "Train"
     169msgstr ""
     170
     171#: uengine.sweek
     172msgid "week"
     173msgstr ""
     174
    85175#: uformmain.sfridayshort
    86176msgid "FRI"
     
    112202
    113203#: umenu.sautomatic
     204msgctxt "umenu.sautomatic"
    114205msgid "Automatic"
    115206msgstr "Automatisch"
    116207
    117208#: umenu.sback
     209msgctxt "umenu.sback"
    118210msgid "Back"
    119211msgstr "Zurück"
     
    125217
    126218#: umenu.scontinue
     219msgctxt "umenu.scontinue"
    127220msgid "Continue"
    128221msgstr "Fortsetzen"
    129222
    130223#: umenu.sczech
     224msgctxt "umenu.sczech"
    131225msgid "Czech"
    132226msgstr "Tschechisch"
    133227
    134228#: umenu.sdarkmode
     229msgctxt "umenu.sdarkmode"
    135230msgid "Dark mode"
    136231msgstr "Darm mode"
    137232
    138233#: umenu.senglish
     234msgctxt "umenu.senglish"
    139235msgid "English"
    140236msgstr "Englisch"
     
    146242
    147243#: umenu.sfullscreen
     244msgctxt "umenu.sfullscreen"
    148245msgid "Full screen"
    149246msgstr "Vollbild"
    150247
    151248#: umenu.slanguage
     249msgctxt "umenu.slanguage"
    152250msgid "Language"
    153251msgstr "Sprache"
     
    164262
    165263#: umenu.srestart
     264msgctxt "umenu.srestart"
    166265msgid "Try again"
    167266msgstr "Neustart"
  • trunk/Languages/BigMetro.fr.po

    r94 r95  
    2525msgstr "Big Metro"
    2626
     27#: uengine.sautomatic
     28#, fuzzy
     29msgctxt "uengine.sautomatic"
     30msgid "Automatic"
     31msgstr "Automatique"
     32
     33#: uengine.sback
     34#, fuzzy
     35msgctxt "uengine.sback"
     36msgid "Back"
     37msgstr "Retour"
     38
     39#: uengine.sbigmetro
     40#, fuzzy
     41msgctxt "uengine.sbigmetro"
     42msgid "Big Metro"
     43msgstr "Big Metro"
     44
     45#: uengine.scontinue
     46#, fuzzy
     47msgctxt "uengine.scontinue"
     48msgid "Continue"
     49msgstr "Continuer"
     50
     51#: uengine.sczech
     52#, fuzzy
     53msgctxt "uengine.sczech"
     54msgid "Czech"
     55msgstr "Tchèque"
     56
     57#: uengine.sdarkmode
     58#, fuzzy
     59msgctxt "uengine.sdarkmode"
     60msgid "Dark mode"
     61msgstr "Mode sombre"
     62
    2763#: uengine.sday
    2864msgid "Day"
    2965msgstr "Jour"
     66
     67#: uengine.senglish
     68#, fuzzy
     69msgctxt "uengine.senglish"
     70msgid "English"
     71msgstr "Anglais"
     72
     73#: uengine.sexit
     74#, fuzzy
     75msgctxt "uengine.sexit"
     76msgid "Exit"
     77msgstr "Sortie"
     78
     79#: uengine.sfullscreen
     80#, fuzzy
     81msgctxt "uengine.sfullscreen"
     82msgid "Full screen"
     83msgstr "Plein écran"
    3084
    3185#: uengine.sgameover
     
    4296msgstr "%d passagers ont pris votre métro pendant %d jours."
    4397
     98#: uengine.slanguage
     99#, fuzzy
     100msgctxt "uengine.slanguage"
     101msgid "Language"
     102msgstr "Langue"
     103
    44104#: uengine.slondon
    45105msgid "London"
     
    49109msgid "New high score!"
    50110msgstr "Nouveau highscore!"
     111
     112#: uengine.snewtrain
     113msgid "You get a new train for your metro"
     114msgstr ""
    51115
    52116#: uengine.snewyork
     
    63127msgstr "Le vieux highscore était %d passagers pendant %d jours."
    64128
     129#: uengine.soptions
     130#, fuzzy
     131msgctxt "uengine.soptions"
     132msgid "Options"
     133msgstr "Options"
     134
    65135#: uengine.sparis
    66136msgid "Paris"
    67137msgstr ""
    68138
     139#: uengine.splay
     140#, fuzzy
     141msgctxt "uengine.splay"
     142msgid "Play"
     143msgstr "Jouer"
     144
    69145#: uengine.sprague
    70146msgid "Prague"
    71147msgstr ""
    72148
     149#: uengine.srestart
     150#, fuzzy
     151msgctxt "uengine.srestart"
     152msgid "Try again"
     153msgstr "Redémarrer"
     154
    73155#: uengine.sstationnotdefined
    74156msgid "Station have to be defined"
     
    83165msgstr ""
    84166
     167#: uengine.strain
     168msgid "Train"
     169msgstr ""
     170
     171#: uengine.sweek
     172msgid "week"
     173msgstr ""
     174
    85175#: uformmain.sfridayshort
    86176msgid "FRI"
     
    112202
    113203#: umenu.sautomatic
     204msgctxt "umenu.sautomatic"
    114205msgid "Automatic"
    115206msgstr "Automatique"
    116207
    117208#: umenu.sback
     209msgctxt "umenu.sback"
    118210msgid "Back"
    119211msgstr "Retour"
     
    125217
    126218#: umenu.scontinue
     219msgctxt "umenu.scontinue"
    127220msgid "Continue"
    128221msgstr "Continuer"
    129222
    130223#: umenu.sczech
     224msgctxt "umenu.sczech"
    131225msgid "Czech"
    132226msgstr "Tchèque"
    133227
    134228#: umenu.sdarkmode
     229msgctxt "umenu.sdarkmode"
    135230msgid "Dark mode"
    136231msgstr "Mode sombre"
    137232
    138233#: umenu.senglish
     234msgctxt "umenu.senglish"
    139235msgid "English"
    140236msgstr "Anglais"
     
    146242
    147243#: umenu.sfullscreen
     244msgctxt "umenu.sfullscreen"
    148245msgid "Full screen"
    149246msgstr "Plein écran"
    150247
    151248#: umenu.slanguage
     249msgctxt "umenu.slanguage"
    152250msgid "Language"
    153251msgstr "Langue"
     
    164262
    165263#: umenu.srestart
     264msgctxt "umenu.srestart"
    166265msgid "Try again"
    167266msgstr "Redémarrer"
  • trunk/Languages/BigMetro.pot

    r94 r95  
    1515msgstr ""
    1616
     17#: uengine.sautomatic
     18msgctxt "uengine.sautomatic"
     19msgid "Automatic"
     20msgstr ""
     21
     22#: uengine.sback
     23msgctxt "uengine.sback"
     24msgid "Back"
     25msgstr ""
     26
     27#: uengine.sbigmetro
     28msgctxt "uengine.sbigmetro"
     29msgid "Big Metro"
     30msgstr ""
     31
     32#: uengine.scontinue
     33msgctxt "uengine.scontinue"
     34msgid "Continue"
     35msgstr ""
     36
     37#: uengine.sczech
     38msgctxt "uengine.sczech"
     39msgid "Czech"
     40msgstr ""
     41
     42#: uengine.sdarkmode
     43msgctxt "uengine.sdarkmode"
     44msgid "Dark mode"
     45msgstr ""
     46
    1747#: uengine.sday
    1848msgid "Day"
     49msgstr ""
     50
     51#: uengine.senglish
     52msgctxt "uengine.senglish"
     53msgid "English"
     54msgstr ""
     55
     56#: uengine.sexit
     57msgctxt "uengine.sexit"
     58msgid "Exit"
     59msgstr ""
     60
     61#: uengine.sfullscreen
     62msgctxt "uengine.sfullscreen"
     63msgid "Full screen"
    1964msgstr ""
    2065
     
    3277msgstr ""
    3378
     79#: uengine.slanguage
     80msgctxt "uengine.slanguage"
     81msgid "Language"
     82msgstr ""
     83
    3484#: uengine.slondon
    3585msgid "London"
     
    3888#: uengine.snewhighscore
    3989msgid "New high score!"
     90msgstr ""
     91
     92#: uengine.snewtrain
     93msgid "You get a new train for your metro"
    4094msgstr ""
    4195
     
    53107msgstr ""
    54108
     109#: uengine.soptions
     110msgctxt "uengine.soptions"
     111msgid "Options"
     112msgstr ""
     113
    55114#: uengine.sparis
    56115msgid "Paris"
    57116msgstr ""
    58117
     118#: uengine.splay
     119msgctxt "uengine.splay"
     120msgid "Play"
     121msgstr ""
     122
    59123#: uengine.sprague
    60124msgid "Prague"
    61125msgstr ""
    62126
     127#: uengine.srestart
     128msgctxt "uengine.srestart"
     129msgid "Try again"
     130msgstr ""
     131
    63132#: uengine.sstationnotdefined
    64133msgid "Station have to be defined"
     
    73142msgstr ""
    74143
     144#: uengine.strain
     145msgid "Train"
     146msgstr ""
     147
     148#: uengine.sweek
     149msgid "week"
     150msgstr ""
     151
    75152#: uformmain.sfridayshort
    76153msgid "FRI"
     
    102179
    103180#: umenu.sautomatic
     181msgctxt "umenu.sautomatic"
    104182msgid "Automatic"
    105183msgstr ""
    106184
    107185#: umenu.sback
     186msgctxt "umenu.sback"
    108187msgid "Back"
    109188msgstr ""
     
    115194
    116195#: umenu.scontinue
     196msgctxt "umenu.scontinue"
    117197msgid "Continue"
    118198msgstr ""
    119199
    120200#: umenu.sczech
     201msgctxt "umenu.sczech"
    121202msgid "Czech"
    122203msgstr ""
    123204
    124205#: umenu.sdarkmode
     206msgctxt "umenu.sdarkmode"
    125207msgid "Dark mode"
    126208msgstr ""
    127209
    128210#: umenu.senglish
     211msgctxt "umenu.senglish"
    129212msgid "English"
    130213msgstr ""
    131214
    132215#: umenu.sexit
     216msgctxt "umenu.sexit"
    133217msgid "Exit"
    134218msgstr ""
    135219
    136220#: umenu.sfullscreen
     221msgctxt "umenu.sfullscreen"
    137222msgid "Full screen"
    138223msgstr ""
    139224
    140225#: umenu.slanguage
     226msgctxt "umenu.slanguage"
    141227msgid "Language"
    142228msgstr ""
    143229
    144230#: umenu.soptions
     231msgctxt "umenu.soptions"
    145232msgid "Options"
    146233msgstr ""
    147234
    148235#: umenu.splay
     236msgctxt "umenu.splay"
    149237msgid "Play"
    150238msgstr ""
    151239
    152240#: umenu.srestart
     241msgctxt "umenu.srestart"
    153242msgid "Try again"
    154243msgstr ""
  • trunk/UColors.pas

    r90 r95  
    1212  TColors = record
    1313    Background: TColor;
     14    Background2: TColor;
    1415    Text: TColor;
    1516    ShapeBackground: TColor;
     
    2930  if DarkMode then begin
    3031    Background := $2f3020;
     32    Background2 := $4f5040;
    3133    Text := clWhite;
    3234    ShapeBackground := clBlack;
     
    3638  end else begin
    3739    Background := $eff0e0;
     40    Background2 := $cfd0c0;
    3841    Text := clBlack;
    3942    ShapeBackground := clWhite;
  • trunk/UControls.pas

    r86 r95  
    1818    Bounds: TRect;
    1919    Canvas: TCanvas;
     20    procedure MouseUp(Position: TPoint);
    2021    constructor Create; virtual;
    2122    procedure Paint; virtual;
    2223    property Enabled: Boolean read FEnabled write SetEnabled;
    2324    property OnClick: TNotifyEvent read FOnClick write FOnClick;
     25  end;
     26
     27  { TLabel }
     28
     29  TLabel = class(TControl)
     30    Text: string;
     31    procedure Paint; override;
    2432  end;
    2533
     
    4452implementation
    4553
     54{ TLabel }
     55
     56procedure TLabel.Paint;
     57begin
     58  if Assigned(Canvas) then
     59  with Canvas do begin
     60    TextOut(Bounds.Left, Bounds.Top, Text);
     61  end;
     62end;
     63
    4664{ TButton }
    4765
     
    5876  FEnabled := AValue;
    5977  if Assigned(Canvas) then Paint;
     78end;
     79
     80procedure TControl.MouseUp(Position: TPoint);
     81begin
     82  if Bounds.Contains(Position) then
     83  if Assigned(FOnClick) then FOnClick(Self);
    6084end;
    6185
  • trunk/UEngine.pas

    r94 r95  
    77uses
    88  {$IFDEF DARWIN}MacOSAll, CocoaAll, CocoaUtils,{$ENDIF}
    9   Classes, SysUtils, Graphics, Controls, ExtCtrls, Math, DateUtils, URegistry,
    10   UMetaCanvas, Generics.Collections, Generics.Defaults, UMenu, UControls,
    11   UMetroPassenger, UColors, UView, URiver, UTrack, UCity, UGeometric;
     9  Classes, SysUtils, Graphics, Controls, ExtCtrls, Math, DateUtils, Types,
     10  URegistry, UMetaCanvas, Generics.Collections, Generics.Defaults, UMenu,
     11  UControls, UMetroPassenger, UColors, UView, URiver, UTrack, UCity, UGeometric;
    1212
    1313type
     
    148148  end;
    149149
    150   TGameState = (gsNotStarted, gsRunning, gsPaused, gsGameOver, gsMenu);
     150  TGameState = (gsNotStarted, gsRunning, gsPaused, gsGameOver, gsMenu, gsNewWeek);
    151151
    152152  { TEngine }
     
    187187    procedure DrawTrains(Canvas: TCanvas);
    188188    procedure DrawGameOver(Canvas: TCanvas; CanvasSize: TPoint);
    189     procedure DrawNewTrain(Canvas: TCanvas; CanvasSize: TPoint);
     189    procedure DrawNewWeek(Canvas: TCanvas; CanvasSize: TPoint);
    190190    procedure DrawStationPassengerOverload(Canvas: TCanvas);
    191191    procedure DrawLines(Canvas: TCanvas);
     
    210210    procedure ButtonPause(Sender: TObject);
    211211    procedure ButtonFastForward(Sender: TObject);
     212    procedure ButtonNewTrain(Sender: TObject);
    212213    procedure ButtonBackClick(Sender: TObject);
    213214    procedure DarkModeChanged(Sender: TObject);
     
    217218    procedure InitCities;
    218219  public
     220    Week: Integer;
    219221    Colors: TColors;
    220222    Passengers: TMetroPassengers;
     
    241243    ImageFastForward: TImage;
    242244    ImageCarriage: TImage;
     245    ImageNewTrain: TImage;
    243246    HighestServedPassengerCount: Integer;
    244247    HighestServedDaysCount: Integer;
     
    320323  SNoOldStationToConnectNew = 'No old line station to connect new station';
    321324  SStationWithoutMapStation = 'Station have to have MapStation';
     325  SNewTrain = 'You get a new train for your metro';
     326  SWeek = 'week';
     327  STrain = 'Train';
     328  SPlay = 'Play';
     329  SOptions = 'Options';
     330  SExit = 'Exit';
     331  SBigMetro = 'Big Metro';
     332  SDarkMode = 'Dark mode';
     333  SLanguage = 'Language';
     334  SCzech = 'Czech';
     335  SEnglish = 'English';
     336  SBack = 'Back';
     337  SAutomatic = 'Automatic';
     338  SFullScreen = 'Full screen';
     339  SContinue = 'Continue';
     340  SRestart = 'Try again';
    322341
    323342  // Cities
     
    16661685end;
    16671686
     1687procedure TEngine.ButtonNewTrain(Sender: TObject);
     1688begin
     1689  Trains.AddNew;
     1690  if Random < 0.2 then Carriages.AddNew;
     1691  State := gsRunning;
     1692  Redraw;
     1693end;
     1694
    16681695procedure TEngine.MenuItemGameContinue(Sender: TObject);
    16691696begin
     
    18321859  I: Integer;
    18331860  Y: Integer;
     1861  IsDay: Boolean;
    18341862const
    18351863  ClockSize = 20;
    18361864begin
    1837   if (Time / OneHour > 6) and (Time / OneHour < 18) then begin
     1865  IsDay := (((Time / OneHour) mod 24) > 6) and (((Time / OneHour) mod 24) < 18);
     1866  if IsDay then begin
    18381867    Canvas.Brush.Style := bsSolid;
    18391868    Canvas.Brush.Color := Colors.Background;
     
    18501879  Canvas.Brush.Style := bsClear;
    18511880
    1852   if (Time / OneHour > 6) and (Time / OneHour < 18) then begin
     1881  if IsDay then begin
    18531882    Canvas.Pen.Color := Colors.Text;
    18541883  end else begin
     
    18991928procedure TEngine.DrawTrains(Canvas: TCanvas);
    19001929var
    1901   I: Integer;
    19021930  P: Integer;
    19031931  Pos: TPoint;
     
    19782006    Brush.Color := Self.Colors.Background;
    19792007
    1980     Y := 100;
     2008    Y := ScaleY(100, 96);
    19812009    Font.Size := 40;
    19822010    TextOut((CanvasSize.X - TextWidth(SGameOver)) div 2, Y, SGameOver);
     
    19912019    Y := Y + Round(TextHeight(SGameOverStatistic) * 1.1);
    19922020
    1993     Y := Y + 16;
     2021    Y := Y + ScaleY(16, 96);
    19942022
    19952023    // Calculate new highest score
     
    20102038end;
    20112039
    2012 procedure TEngine.DrawNewTrain(Canvas: TCanvas; CanvasSize: TPoint);
    2013 begin
    2014 
     2040procedure TEngine.DrawNewWeek(Canvas: TCanvas; CanvasSize: TPoint);
     2041var
     2042  Text: string;
     2043  TextSize: TSize;
     2044  Y: Integer;
     2045  X: Integer;
     2046const
     2047  ImageZoom = 4;
     2048begin
     2049  with Canvas do begin
     2050    Pen.Color := Self.Colors.Text;
     2051    Pen.Style := psSolid;
     2052    Pen.Width := ScaleX(2, 96);
     2053    Brush.Color := Self.Colors.Background2;
     2054    Brush.Style := bsSolid;
     2055    Rectangle(Bounds(CanvasSize.X div 4, CanvasSize.Y div 4, CanvasSize.X div 2, CanvasSize.Y div 2));
     2056    Pen.Style := psClear;
     2057    X := CanvasSize.X div 4 + ScaleX(10, 96);
     2058    Y := CanvasSize.Y div 4 + ScaleX(10, 96);
     2059
     2060    Text := IntToStr(Week) + '. ' + SWeek;
     2061    Font.Size := 30;
     2062    Font.Color := Self.Colors.Text;
     2063    TextSize := TextExtent(Text);
     2064    TextOut(X, Y, Text);
     2065    Y := Y + Round(1.1 * TextSize.Height);
     2066
     2067    Text := SNewTrain;
     2068    Font.Size := 14;
     2069    Font.Color := Self.Colors.Text;
     2070    TextSize := TextExtent(Text);
     2071    TextOut(X, Y, Text);
     2072    Y := Y + Round(1.1 * TextSize.Height);
     2073
     2074    ImageNewTrain.Canvas := Canvas;
     2075    ImageNewTrain.Bounds := Bounds((CanvasSize.X - ImageLocomotive.Bitmap.Width * ImageZoom) div 2,
     2076      (CanvasSize.Y - ImageLocomotive.Bitmap.Height * ImageZoom) div 2,
     2077      ImageLocomotive.Bitmap.Width * ImageZoom,
     2078      ImageLocomotive.Bitmap.Height * ImageZoom);
     2079    ImageNewTrain.Paint;
     2080
     2081    Y := (CanvasSize.Y - ImageLocomotive.Bitmap.Height * ImageZoom) div 2 +
     2082      Round(ImageLocomotive.Bitmap.Height * ImageZoom * 1.1);
     2083
     2084    Text := STrain;
     2085    Font.Size := 20;
     2086    Font.Color := Self.Colors.Text;
     2087    TextSize := TextExtent(Text);
     2088    TextOut((CanvasSize.X - TextSize.Width) div 2, Y, Text);
     2089  end;
    20152090end;
    20162091
     
    22802355    Redraw; // Redraw on every tick because engine time is changed so clock should be redrawn
    22812356
    2282   // Add new trains
    2283   if (Time - LastNewWeekTime) > NewTrainPeriod then begin
    2284     LastNewWeekTime := Time;
    2285     Trains.AddNew;
    2286     if Random < 0.2 then Carriages.AddNew;
    2287     // TODO: Show notification screen with confirmation
    2288     Redraw;
    2289   end;
    2290 
    2291   // Add new shape
    2292   if (Time - LastNewShapeTime) > NewShapePeriod then begin
    2293     LastNewShapeTime := Time;
    2294     if ShapeCount <= Integer(High(TStationShape)) then Inc(ShapeCount);
    2295     Redraw;
    2296   end;
    2297 
    2298   // Add new stations
    2299   if (Time - LastNewStationTime) > NewStationPeriod then begin
    2300     LastNewStationTime := Time;
    2301     Stations.AddNew;
    2302     ResizeView;
    2303     Redraw;
    2304   end;
    2305 
    2306   // Add new passengers
    2307   if (Time - LastNewPassengerTime) > NewPassengerPeriod then begin
    2308     LastNewPassengerTime := Time;
     2357    // Add new trains
     2358    if (Time - LastNewWeekTime) > NewTrainPeriod then begin
     2359      LastNewWeekTime := Time;
     2360      Inc(Week);
     2361      State := gsNewWeek;
     2362      Redraw;
     2363    end;
     2364
     2365    // Add new shape
     2366    if (Time - LastNewShapeTime) > NewShapePeriod then begin
     2367      LastNewShapeTime := Time;
     2368      if ShapeCount <= Integer(High(TStationShape)) then Inc(ShapeCount);
     2369      Redraw;
     2370    end;
     2371
     2372    // Add new stations
     2373    if (Time - LastNewStationTime) > NewStationPeriod then begin
     2374      LastNewStationTime := Time;
     2375      Stations.AddNew;
     2376      ResizeView;
     2377      Redraw;
     2378    end;
     2379
     2380    // Add new passengers
     2381    if (Time - LastNewPassengerTime) > NewPassengerPeriod then begin
     2382      LastNewPassengerTime := Time;
     2383      for MapStation in Stations do
     2384      with MapStation do
     2385      if Random < NewPassengerProbability then begin
     2386        Passenger := Self.Passengers.AddNew;
     2387        Passenger.Shape := TStationShape(Random(Integer(ShapeCount)));
     2388        Passengers.Add(Passenger);
     2389
     2390        // Passenger is not allowed to have same shape
     2391        while (Passenger.Shape = Shape) or
     2392        not (Passenger.Shape in GetExistStationShapes) do
     2393          Passenger.Shape := TStationShape((Integer(Passenger.Shape) + 1) mod Integer(ShapeCount));
     2394        Redraw;
     2395      end;
     2396    end;
     2397
     2398    // Check station passenger overload state
    23092399    for MapStation in Stations do
    2310     with MapStation do
    2311     if Random < NewPassengerProbability then begin
    2312       Passenger := Self.Passengers.AddNew;
    2313       Passenger.Shape := TStationShape(Random(Integer(ShapeCount)));
    2314       Passengers.Add(Passenger);
    2315 
    2316       // Passenger is not allowed to have same shape
    2317       while (Passenger.Shape = Shape) or
    2318       not (Passenger.Shape in GetExistStationShapes) do
    2319         Passenger.Shape := TStationShape((Integer(Passenger.Shape) + 1) mod Integer(ShapeCount));
    2320       Redraw;
    2321     end;
    2322   end;
    2323 
    2324   // Check station passenger overload state
    2325   for MapStation in Stations do
    2326   with MapStation do begin
    2327     if Passengers.Count > MaxWaitingPassengers then begin
    2328       OverloadDuration := OverloadDuration + (FTime - FLastTime);
    2329       if OverloadDuration > MaxPassengersOveloadTime then
    2330         OverloadDuration := MaxPassengersOveloadTime;
    2331       if OverloadDuration < MaxPassengersOveloadTime then Redraw;
    2332     end;
    2333     if Passengers.Count <= MaxWaitingPassengers then begin
    2334       if OverloadDuration > 0 then Redraw;
    2335       OverloadDuration := OverloadDuration - (FTime - FLastTime);
    2336       if OverloadDuration < 0 then begin
    2337         OverloadDuration := 0;
    2338       end;
    2339     end;
    2340   end;
    2341 
    2342   TrainMovement;
    2343 
    2344   // Game over
    2345   for MapStation in Stations do
    2346   with MapStation do begin
    2347     if OverloadDuration >= MaxPassengersOveloadTime then begin
    2348       State := gsGameOver;
    2349       Redraw;
    2350     end;
    2351   end;
    2352 
     2400    with MapStation do begin
     2401      if Passengers.Count > MaxWaitingPassengers then begin
     2402        OverloadDuration := OverloadDuration + (FTime - FLastTime);
     2403        if OverloadDuration > MaxPassengersOveloadTime then
     2404          OverloadDuration := MaxPassengersOveloadTime;
     2405        if OverloadDuration < MaxPassengersOveloadTime then Redraw;
     2406      end;
     2407      if Passengers.Count <= MaxWaitingPassengers then begin
     2408        if OverloadDuration > 0 then Redraw;
     2409        OverloadDuration := OverloadDuration - (FTime - FLastTime);
     2410        if OverloadDuration < 0 then begin
     2411          OverloadDuration := 0;
     2412        end;
     2413      end;
     2414    end;
     2415
     2416    TrainMovement;
     2417
     2418    // Game over
     2419    for MapStation in Stations do
     2420    with MapStation do begin
     2421      if OverloadDuration >= MaxPassengersOveloadTime then begin
     2422        State := gsGameOver;
     2423        Redraw;
     2424      end;
     2425    end;
    23532426  end;
    23542427  LastTickTime := Now;
     
    24252498      Menu.MouseUp(Button, Position);
    24262499      Redraw;
    2427     end else begin
    2428       // Back button
    2429       if ButtonBack.Bounds.Contains(Position) then begin
    2430         if Assigned(ButtonBack.OnClick) then
    2431           ButtonBack.OnClick(ButtonBack);
    2432       end;
    2433 
    2434       // Pause button
    2435       if ImagePause.Bounds.Contains(Position) then begin
    2436         if Assigned(ImagePause.OnClick) then
    2437           ImagePause.OnClick(ImagePause);
    2438       end;
    2439 
    2440       // Play button
    2441       if ImagePlay.Bounds.Contains(Position) then begin
    2442         if Assigned(ImagePlay.OnClick) then
    2443           ImagePlay.OnClick(ImagePlay);
    2444       end;
    2445 
    2446       // Fast forward button
    2447       if ImageFastForward.Bounds.Contains(Position) then begin
    2448         if Assigned(ImageFastForward.OnClick) then
    2449           ImageFastForward.OnClick(ImageFastForward);
    2450       end;
     2500    end else
     2501    if State = gsNewWeek then begin
     2502      ImageNewTrain.MouseUp(Position);
     2503    end
     2504    else
     2505    if State = gsRunning then begin
     2506      ButtonBack.MouseUp(Position);
     2507      ImagePause.MouseUp(Position);
     2508      ImagePlay.MouseUp(Position);
     2509      ImageFastForward.MouseUp(Position);
    24512510
    24522511      // Place selected train if focused track
     
    26082667  KeyF3 = 114;
    26092668  KeyF4 = 115;
     2669  KeyF5 = 116;
    26102670begin
    26112671  if Key = KeyEsc then begin
     
    26352695      Redraw;
    26362696    end;
     2697  end else
     2698  if Key = KeyF5 then begin
     2699    if State = gsRunning then begin
     2700      State := gsNewWeek;
     2701      Redraw;
     2702    end;
    26372703  end;
    26382704  {$ENDIF}
     
    26472713procedure TEngine.Clear;
    26482714begin
     2715  Week := 0;
    26492716  Trains.Clear;
    26502717  Passengers.Clear;
     
    26732740  end;
    26742741
    2675   for I := 0 to 8 do begin
     2742  for I := 0 to 2 do begin
    26762743    Lines.AddNew;
    26772744    NewTrain := TMetroTrain.Create;
     
    27542821  ImageFastForward := TImage.Create;
    27552822  ImageFastForward.OnClick := ButtonFastForward;
     2823  ImageNewTrain := TImage.Create;
     2824  ImageNewTrain.OnClick := ButtonNewTrain;
    27562825  //if FileExists(ImagePassengerName) then
    27572826  //  ImagePassenger.Picture.LoadFromFile(ImagePassengerName);
     
    27702839  FreeAndNil(Trains);
    27712840  FreeAndNil(Carriages);
     2841  FreeAndNil(ImageNewTrain);
    27722842  FreeAndNil(ImagePlay);
    27732843  FreeAndNil(ImageFastForward);
     
    28092879  MetaCanvas.DrawTo(Canvas);
    28102880
    2811   if State <> gsMenu then begin
    2812     DrawGameControls(Canvas, CanvasSize);
    2813   end;
    2814 
    28152881  // Game over
    28162882  if State = gsGameOver then
     
    28202886  if State = gsMenu then begin
    28212887    Menu.Paint(Canvas, CanvasSize);
     2888  end else
     2889  if State = gsNewWeek then begin
     2890    DrawNewWeek(Canvas, CanvasSize);
     2891  end else
     2892  if State in [gsRunning, gsPaused] then begin
     2893    DrawGameControls(Canvas, CanvasSize);
    28222894  end;
    28232895
  • trunk/UMenu.pas

    r86 r95  
    7878    property OnExit: TNotifyEvent read FOnExit write FOnExit;
    7979  end;
    80 
    81 resourcestring
    82   SPlay = 'Play';
    83   SOptions = 'Options';
    84   SExit = 'Exit';
    85   SBigMetro = 'Big Metro';
    86   SDarkMode = 'Dark mode';
    87   SLanguage = 'Language';
    88   SCzech = 'Czech';
    89   SEnglish = 'English';
    90   SBack = 'Back';
    91   SAutomatic = 'Automatic';
    92   SFullScreen = 'Full screen';
    93   SContinue = 'Continue';
    94   SRestart = 'Try again';
    9580
    9681
Note: See TracChangeset for help on using the changeset viewer.