Changeset 76 for trunk/UEngine.pas
- Timestamp:
- May 18, 2021, 10:25:20 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UEngine.pas
r73 r76 277 277 private 278 278 FDarkMode: Boolean; 279 FOnDarkModeChange: TNotifyEvent; 279 280 LastMousePos: TPoint; 280 281 LastFocusedStation: TMapStation; … … 292 293 MenuOptions: TMenu; 293 294 MenuGame: TMenu; 294 ButtonBack: TMenuItemButton;295 295 LastState: TGameState; 296 296 function GetServedDaysCount: Integer; … … 345 345 State: TGameState; 346 346 RedrawPending: Boolean; 347 ButtonBack: TMenuItemImage; 347 348 ImagePassenger: TImage; 348 349 ImageLocomotive: TImage; … … 365 366 property DarkMode: Boolean read FDarkMode write SetDarkMode; 366 367 property ServedDaysCount: Integer read GetServedDaysCount; 368 property OnDarkModeChange: TNotifyEvent read FOnDarkModeChange 369 write FOnDarkModeChange; 367 370 end; 368 371 … … 382 385 ImagePassengerName = 'Images/Passenger.png'; 383 386 ImageLocomotiveName = 'Images/Locomotive.png'; 387 ImageLeftArrowName = 'Images/Left arrow.png'; 384 388 TrainPassengerCount = 6; 385 389 StationMinDistance = 100; … … 403 407 404 408 uses 405 UGeometric, UFormMain, ULanguages ;409 UGeometric, UFormMain, ULanguages, UPixelPointer; 406 410 407 411 resourcestring … … 1667 1671 FDarkMode := AValue; 1668 1672 InitColors; 1673 if Assigned(FOnDarkModeChange) then FOnDarkModeChange(Self); 1669 1674 end; 1670 1675 … … 2643 2648 NewIndex: Integer; 2644 2649 begin 2645 if Button = mbLeft then begin 2646 if State <> gsMenu then begin 2650 if (Button = mbLeft) and (State <> gsMenu) then begin 2647 2651 MouseHold := True; 2648 2652 LastFocusedStation := nil; … … 2656 2660 // Select unused train 2657 2661 if (Distance(Position, Point(View.DestRect.Right div 2 - Length(LineColors) div 2 * LineColorsDist - 100, 2658 View.DestRect.Bottom - LineColorsDist)) < 30) and2662 View.DestRect.Bottom - LineColorsDist)) < 30) and 2659 2663 (Trains.GetUnusedCount > 0) then begin 2660 2664 SelectedTrain := Trains.GetUnusedTrain; 2661 2665 Exit; 2666 end; 2667 2668 // New track creation from selected station as start 2669 Station := GetStationOnPos(View.PointDestToSrc(Position)); 2670 if Assigned(Station) then begin 2671 if Assigned(SelectedLine) and (SelectedLine.LineStations.Count = 0) then NewLine := SelectedLine 2672 else NewLine := GetUnusedLine; 2673 if Assigned(NewLine) then begin 2674 NewLine.ConnectStation(Station, nil, nil); 2675 TrackStationDown := NewLine.Track.Points.Last; 2676 TrackStationUp := nil; 2677 LastFocusedStation := Station; 2678 SelectedLine := NewLine; 2679 Exit; 2680 end; 2662 2681 end; 2663 2682 … … 2686 2705 end; 2687 2706 if Assigned(Track) then Track.Free; 2688 2689 // New track creation from selected station as start2690 Station := GetStationOnPos(View.PointDestToSrc(Position));2691 if Assigned(Station) then begin2692 if Assigned(SelectedLine) and (SelectedLine.LineStations.Count = 0) then NewLine := SelectedLine2693 else NewLine := GetUnusedLine;2694 if Assigned(NewLine) then begin2695 NewLine.ConnectStation(Station, nil, nil);2696 TrackStationDown := NewLine.Track.Points.Last;2697 TrackStationUp := nil;2698 LastFocusedStation := Station;2699 end;2700 end;2701 end;2702 2707 end; 2703 2708 end; … … 2787 2792 constructor TEngine.Create; 2788 2793 begin 2789 ButtonBack := TMenuItemButton.Create; 2790 ButtonBack.Text := '🡸'; 2794 ButtonBack := TMenuItemImage.Create; 2791 2795 ButtonBack.OnClick := ButtonBackClick; 2792 2796 ButtonBack.BackgroundColor := clNone; 2797 ButtonBack.Bounds := Bounds(0, 0, ScaleX(80, 96), ScaleY(80, 96)); 2793 2798 MenuMain := TMenu.Create; 2794 2799 MenuOptions := TMenu.Create;
Note:
See TracChangeset
for help on using the changeset viewer.