Changeset 662
- Timestamp:
- Jul 5, 2025, 9:46:37 AM (7 hours ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/CityScreen.pas
r622 r662 1748 1748 Shift: TShiftState); 1749 1749 begin 1750 if Key = VK_P then begin 1751 if ProdHint then begin 1752 ProdHint := False; 1753 SmartUpdateContent; 1754 end; 1755 ChooseProject; 1756 end else 1757 if Key = VK_RETURN then begin 1758 CloseBtnClick(Self); 1759 end else 1750 1760 if ((Key = VK_UP) or (Key = VK_NUMPAD8)) and (cix >= 0) and 1751 1761 (WindowMode = wmPersistent) then -
trunk/LocalPlayer/Select.pas
r622 r662 6 6 uses 7 7 Protocol, ClientTools, ScreenTools, PVSB, BaseWin, LCLIntf, LCLType, Messages, 8 SysUtils, Classes, ButtonB, ButtonBase, Types, 8 SysUtils, Classes, ButtonB, ButtonBase, Types, Math, 9 9 {$IFDEF DPI}Dpi.Graphics, Dpi.Controls, Dpi.Forms, Dpi.ExtCtrls, Dpi.Menus, 10 10 Dpi.Common, System.UITypes{$ELSE} … … 66 66 MultiPage: Boolean; 67 67 ScienceNationDotBuffer: TBitmap; 68 function GetSelectionIndex: Integer; 68 69 procedure ScrollBarUpdate(Sender: TObject); 69 70 procedure InitLines; 70 procedure Line(ca: TCanvas; L: Integer; NonText, lit: Boolean);71 procedure Line(ca: TCanvas; L: Integer; NonText, Lit: Boolean); 71 72 function RenameModel(mix: Integer): Boolean; 72 73 procedure OnScroll(var Msg: TMessage); message WM_VSCROLL; 73 74 procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE; 75 procedure SetSelectionIndex(Index: Integer); 74 76 public 75 77 Result: Integer; … … 189 191 end; 190 192 191 procedure TListDlg.Line(ca: TCanvas; L: Integer; NonText, lit: Boolean);193 procedure TListDlg.Line(ca: TCanvas; L: Integer; NonText, Lit: Boolean); 192 194 // paint a line 193 195 … … 237 239 238 240 var 239 icon, ofs, X, Y, y0, lix, I, J, TextColor, Available, First, Test,241 Icon, ofs, X, Y, y0, lix, I, J, TextColor, Available, First, Test, 240 242 FutureCount, Growth, TrueFood, TrueProd: Integer; 241 243 CityReport: TCityReportNew; … … 261 263 Y := Y + TitleHeight; 262 264 end; 263 if lit then265 if Lit then 264 266 TextColor := MainTexture.ColorLitText 265 267 else … … 433 435 Y := Y + TitleHeight; 434 436 end; 435 if lit then437 if Lit then 436 438 TextColor := MainTexture.ColorLitText 437 439 else … … 552 554 553 555 if NonText then 554 begin // show tech icon556 begin // show tech Icon 555 557 if lix = adNexus then 556 558 begin … … 604 606 if lix = MyRO.ResearchTech then 605 607 begin 606 Server(sGetTechCost, Me, 0, icon);607 icon := 4 + MyRO.Research * 4 div icon;608 if icon > 4 + 3 then609 icon := 4 + 3608 Server(sGetTechCost, Me, 0, Icon); 609 Icon := 4 + MyRO.Research * 4 div Icon; 610 if Icon > 4 + 3 then 611 Icon := 4 + 3 610 612 end 611 613 else if (lix >= adMilitary) then 612 icon := -1614 Icon := -1 613 615 else if lix in FutureTech then 614 616 begin 615 icon := -1;617 Icon := -1; 616 618 FutureCount := MyRO.Tech[lix]; 617 619 end 618 620 else if MyRO.Tech[lix] = tsSeen then 619 icon := 1621 Icon := 1 620 622 else if MyRO.Tech[lix] >= tsApplicable then 621 icon := 2623 Icon := 2 622 624 else 623 icon := -1625 Icon := -1 624 626 else 625 627 with MyRO.EnemyReport[Column[J]]^ do // enemy science … … 629 631 (Tech[lix] < tsApplicable)) then 630 632 begin 631 icon := 4 + ResearchDone div 25;632 if icon > 4 + 3 then633 icon := 4 + 3;633 Icon := 4 + ResearchDone div 25; 634 if Icon > 4 + 3 then 635 Icon := 4 + 3; 634 636 end 635 637 else if lix = adMilitary then 636 icon := -1638 Icon := -1 637 639 else if lix in FutureTech then 638 640 begin 639 icon := -1;641 Icon := -1; 640 642 FutureCount := Tech[lix] 641 643 end 642 644 else if Tech[lix] >= tsApplicable then 643 icon := 2645 Icon := 2 644 646 else if Tech[lix] = tsSeen then 645 icon := 1647 Icon := 1 646 648 else 647 icon := -1;648 if icon >= 0 then649 Icon := -1; 650 if Icon >= 0 then 649 651 Sprite(Offscreen, HGrSystem, 104 - 33 + 15 + 3 + TechNameSpace + 650 24 * J, y0 + 3, 14, 14, 67 + icon * 15, 85)652 24 * J, y0 + 3, 14, 14, 67 + Icon * 15, 85) 651 653 else if (Kind = kScience) and (FutureCount > 0) then 652 654 begin … … 710 712 Y := Y + TitleHeight; 711 713 end; 712 if lit then714 if Lit then 713 715 TextColor := MainTexture.ColorLitText 714 716 else … … 788 790 (Selected + i0 >= Lines[Layer]) then 789 791 Selected := -2; 790 if Selected <> Sel0 then 791 begin 792 if Selected <> Sel0 then begin 792 793 if Sel0 <> -2 then 793 794 Line(Canvas, Sel0, False, False); … … 1861 1862 end; 1862 1863 1864 function TListDlg.GetSelectionIndex: Integer; 1865 begin 1866 if Selected >= 0 then Result := ScrollBar.Position + Selected 1867 else Result := -1; 1868 end; 1869 1870 procedure TListDlg.SetSelectionIndex(Index: Integer); 1871 var 1872 NewSelected: Integer; 1873 NewScrollBarPos: Integer; 1874 Over: Integer; 1875 Under: Integer; 1876 begin 1877 if Index < 0 then Index := 0; 1878 if Index > Lines[Layer] - 1 then Index := Lines[Layer] - 1; 1879 1880 NewSelected := Index - ScrollBar.Position; 1881 NewScrollBarPos := ScrollBar.Position; 1882 1883 Over := NewSelected - Min(DispLines, Lines[Layer] - NewScrollBarPos); 1884 if Over > 0 then begin 1885 Inc(NewScrollBarPos, Over); 1886 Dec(NewSelected, Over); 1887 end; 1888 1889 Under := -NewSelected; 1890 if Under > 0 then begin 1891 Dec(NewScrollBarPos, Under); 1892 Inc(NewSelected, Under); 1893 end; 1894 1895 if (NewSelected <> Selected) or (NewScrollBarPos <> ScrollBar.Position) then begin 1896 if Selected >= 0 then Line(Canvas, Selected, False, False); 1897 1898 ScrollBar.Position := NewScrollBarPos; 1899 Selected := NewSelected; 1900 1901 Line(Canvas, Selected, False, True); 1902 end; 1903 end; 1904 1863 1905 procedure TListDlg.FormKeyDown(Sender: TObject; var Key: Word; 1864 1906 Shift: TShiftState); 1865 begin 1907 var 1908 LastSelectionIndex: Integer; 1909 begin 1910 if (Key = VK_RIGHT) or (Key = VK_NUMPAD6) then begin 1911 if MultiPage and (Layer < MaxLayer - 1) then begin 1912 LastSelectionIndex := GetSelectionIndex; 1913 Inc(Layer); 1914 if Lines[Layer] = 0 then Inc(Layer); 1915 ScrollBar.Init(Lines[Layer] - 1, DispLines); 1916 SetSelectionIndex(LastSelectionIndex); 1917 SmartUpdateContent; 1918 end; 1919 end else 1920 if (Key = VK_LEFT) or (Key = VK_NUMPAD4) then begin 1921 if MultiPage and (Layer > 0) then begin 1922 LastSelectionIndex := GetSelectionIndex; 1923 Dec(Layer); 1924 if Lines[Layer] = 0 then Dec(Layer); 1925 ScrollBar.Init(Lines[Layer] - 1, DispLines); 1926 SetSelectionIndex(LastSelectionIndex); 1927 SmartUpdateContent; 1928 end; 1929 end else 1930 if (Key = VK_UP) or (Key = VK_NUMPAD8) then begin 1931 SetSelectionIndex(GetSelectionIndex - 1); 1932 end else 1933 if (Key = VK_DOWN) or (Key = VK_NUMPAD2) then begin 1934 SetSelectionIndex(GetSelectionIndex + 1); 1935 end else 1936 if (Key = VK_HOME) or (Key = VK_NUMPAD7) then begin 1937 SetSelectionIndex(0); 1938 end else 1939 if (Key = VK_END) or (Key = VK_NUMPAD1) then begin 1940 SetSelectionIndex(Lines[Layer]); 1941 end else 1942 if (Key = VK_PRIOR) or (Key = VK_NUMPAD9) then begin 1943 SetSelectionIndex(GetSelectionIndex - ScrollBar.PageSize); 1944 end else 1945 if (Key = VK_NEXT) or (Key = VK_NUMPAD3) then begin 1946 SetSelectionIndex(GetSelectionIndex + ScrollBar.PageSize); 1947 end else 1948 if Key = VK_RETURN then begin 1949 PaintBox1MouseDown(Self, TMouseButton.mbLeft, [ssLeft], 0, 0); 1950 end else 1866 1951 if (Key = VK_F2) and (Kind in [kModels, kEModels]) then // my key 1867 1952 // !!! toggle
Note:
See TracChangeset
for help on using the changeset viewer.