Changeset 349 for branches/highdpi/LocalPlayer/Enhance.pas
- Timestamp:
- Apr 6, 2021, 8:11:02 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Enhance.pas
r303 r349 7 7 UDpiControls, ScreenTools, BaseWin, Protocol, ClientTools, Term, LCLIntf, LCLType, 8 8 9 SysUtils, Classes, Graphics, Controls, Forms, 9 SysUtils, Classes, Graphics, Controls, Forms, IsoEngine, 10 10 ButtonB, ButtonC, Menus; 11 11 … … 28 28 Popup: TDpiPopupMenu; 29 29 procedure FormCreate(Sender: TObject); 30 procedure FormDestroy(Sender: TObject); 30 31 procedure FormPaint(Sender: TObject); 31 32 procedure FormShow(Sender: TObject); … … 35 36 procedure JobClick(Sender: TObject); 36 37 procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); 38 private 39 NoMap: TIsoMap; 37 40 public 38 41 procedure ShowNewContent(NewMode: integer; TerrType: integer = -1); … … 45 48 EnhanceDlg: TEnhanceDlg; 46 49 50 47 51 implementation 48 52 49 uses Help; 53 uses 54 Help, UKeyBindings; 50 55 51 56 {$R *.lfm} … … 57 62 begin 58 63 inherited; 64 NoMap := TIsoMap.Create; 59 65 CaptionRight := CloseBtn.Left; 60 66 CaptionLeft := ToggleBtn.Left + ToggleBtn.Width; … … 85 91 end; 86 92 93 procedure TEnhanceDlg.FormDestroy(Sender: TObject); 94 begin 95 FreeAndNil(NoMap); 96 end; 97 87 98 procedure TEnhanceDlg.FormPaint(Sender: TObject); 88 99 var … … 97 108 if Controls[i] is TButtonC then 98 109 DpiBitCanvas(Canvas, Controls[i].Left + 2, Controls[i].Top - 11, 8, 8, 99 GrExt[HGrSystem].Data.Canvas, 121 + Controls[i].Tag mod 7 * 9,110 HGrSystem.Data.Canvas, 121 + Controls[i].Tag mod 7 * 9, 100 111 1 + Controls[i].Tag div 7 * 9); 101 112 end; … … 129 140 while (EndStage < 5) and (MyData.EnhancementJobs[Page, EndStage] <> jNone) do 130 141 inc(EndStage); 131 x := InnerWidth div 2 - xxt - (xxt + 3) * EndStage; 142 with NoMap do 143 x := InnerWidth div 2 - xxt - (xxt + 3) * EndStage; 132 144 133 145 TerrType := Page; … … 185 197 end; 186 198 187 if TerrType < fForest then 188 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 189 1 + TerrType * (xxt * 2 + 1), 1 + yyt) 190 else 191 begin 192 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 193 1 + 2 * (xxt * 2 + 1), 1 + yyt + 2 * (yyt * 3 + 1)); 194 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 195 1 + 7 * (xxt * 2 + 1), 1 + yyt + 2 * (2 + TerrType - fForest) * 196 (yyt * 3 + 1)); 197 end; 198 if TileImp and fTerImp = tiFarm then 199 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 200 1 + (xxt * 2 + 1), 1 + yyt + 12 * (yyt * 3 + 1)) 201 else if TileImp and fTerImp = tiIrrigation then 202 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1, 203 1 + yyt + 12 * (yyt * 3 + 1)); 204 if TileImp and fRR <> 0 then 205 begin 206 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 207 1 + 6 * (xxt * 2 + 1), 1 + yyt + 10 * (yyt * 3 + 1)); 208 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 209 1 + 2 * (xxt * 2 + 1), 1 + yyt + 10 * (yyt * 3 + 1)); 210 end 211 else if TileImp and fRoad <> 0 then 212 begin 213 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 214 1 + 6 * (xxt * 2 + 1), 1 + yyt + 9 * (yyt * 3 + 1)); 215 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 216 1 + 2 * (xxt * 2 + 1), 1 + yyt + 9 * (yyt * 3 + 1)); 217 end; 218 if TileImp and fTerImp = tiMine then 219 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 220 1 + 2 * (xxt * 2 + 1), 1 + yyt + 12 * (yyt * 3 + 1)); 221 inc(x, xxt * 2 + 6) 199 with NoMap do begin 200 if TerrType < fForest then 201 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 202 1 + TerrType * (xxt * 2 + 1), 1 + yyt) 203 else 204 begin 205 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 206 1 + 2 * (xxt * 2 + 1), 1 + yyt + 2 * (yyt * 3 + 1)); 207 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 208 1 + 7 * (xxt * 2 + 1), 1 + yyt + 2 * (2 + TerrType - fForest) * 209 (yyt * 3 + 1)); 210 end; 211 if TileImp and fTerImp = tiFarm then 212 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 213 1 + (xxt * 2 + 1), 1 + yyt + 12 * (yyt * 3 + 1)) 214 else if TileImp and fTerImp = tiIrrigation then 215 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 1, 216 1 + yyt + 12 * (yyt * 3 + 1)); 217 if TileImp and fRR <> 0 then 218 begin 219 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 220 1 + 6 * (xxt * 2 + 1), 1 + yyt + 10 * (yyt * 3 + 1)); 221 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 222 1 + 2 * (xxt * 2 + 1), 1 + yyt + 10 * (yyt * 3 + 1)); 223 end 224 else if TileImp and fRoad <> 0 then 225 begin 226 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 227 1 + 6 * (xxt * 2 + 1), 1 + yyt + 9 * (yyt * 3 + 1)); 228 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 229 1 + 2 * (xxt * 2 + 1), 1 + yyt + 9 * (yyt * 3 + 1)); 230 end; 231 if TileImp and fTerImp = tiMine then 232 Sprite(offscreen, HGrTerrain, x, 64 - yyt, xxt * 2, yyt * 2, 233 1 + 2 * (xxt * 2 + 1), 1 + yyt + 12 * (yyt * 3 + 1)); 234 inc(x, xxt * 2 + 6); 235 end; 222 236 end; 223 237 … … 289 303 procedure TEnhanceDlg.CloseBtnClick(Sender: TObject); 290 304 begin 291 Close 305 Close; 292 306 end; 293 307 … … 304 318 begin 305 319 Page := TComponent(Sender).Tag; 306 SmartUpdateContent 320 SmartUpdateContent; 307 321 end; 308 322 … … 324 338 move(MyData.EnhancementJobs[Page, stage + 1], 325 339 MyData.EnhancementJobs[Page, stage], 4 - stage); 326 MyData.EnhancementJobs[Page, 4] := jNone 340 MyData.EnhancementJobs[Page, 4] := jNone; 327 341 end 328 342 else … … 351 365 begin 352 366 MyData.EnhancementJobs[Page, stage] := jRoad; 353 inc(stage) 367 inc(stage); 354 368 end; 355 369 if (NewJob = jFarm) and not(jIrr in Done) then 356 370 begin 357 371 MyData.EnhancementJobs[Page, stage] := jIrr; 358 inc(stage) 359 end; 360 MyData.EnhancementJobs[Page, stage] := NewJob 361 end; 362 SmartUpdateContent 372 inc(stage); 373 end; 374 MyData.EnhancementJobs[Page, stage] := NewJob; 375 end; 376 SmartUpdateContent; 363 377 end; 364 378 365 379 procedure TEnhanceDlg.FormKeyDown(Sender: TObject; var Key: Word; 366 380 Shift: TShiftState); 367 begin 368 if Key = VK_F1 then 381 var 382 ShortCut: TShortCut; 383 begin 384 ShortCut := KeyToShortCut(Key, Shift); 385 if BHelp.Test(ShortCut) then 369 386 HelpDlg.ShowNewContent(FWindowMode or wmPersistent, hkText, 370 387 HelpDlg.TextIndex('MACRO'))
Note:
See TracChangeset
for help on using the changeset viewer.