Changeset 447 for trunk/LocalPlayer/Rates.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Rates.pas
r442 r447 46 46 procedure TRatesDlg.OffscreenPaint; 47 47 var 48 p, x, y, current, max, i: integer;49 s, s1: string;48 P, X, Y, current, Max, I: Integer; 49 S, s1: string; 50 50 begin 51 51 if (OffscreenUser <> nil) and (OffscreenUser <> self) then … … 64 64 BtnFrame(Offscreen.Canvas, CloseBtn.BoundsRect, MainTexture); 65 65 Offscreen.Canvas.Font.Assign(UniFont[ftCaption]); 66 s:= Phrases.Lookup('TITLE_RATES');66 S := Phrases.Lookup('TITLE_RATES'); 67 67 RisedTextOut(Offscreen.Canvas, 68 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s)) div 2 - 1, 7, s);69 70 if MyRO.Wonder[woLiberty].EffectiveOwner = me then71 s:= Phrases.Lookup('NORATES')72 else 73 s:= Phrases.Lookup('RATES');68 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, S)) div 2 - 1, 7, S); 69 70 if MyRO.Wonder[woLiberty].EffectiveOwner = Me then 71 S := Phrases.Lookup('NORATES') 72 else 73 S := Phrases.Lookup('RATES'); 74 74 Offscreen.Canvas.Font.Assign(UniFont[ftNormal]); 75 p := pos('\', s);76 if p= 0 then77 RisedTextOut(Offscreen.Canvas, (ClientWidth - BiColorTextWidth(Canvas, s))78 div 2, 114, s)79 else 80 begin 81 s1 := copy(s, 1, p- 1);75 P := Pos('\', S); 76 if P = 0 then 77 RisedTextOut(Offscreen.Canvas, (ClientWidth - BiColorTextWidth(Canvas, S)) 78 div 2, 114, S) 79 else 80 begin 81 s1 := Copy(S, 1, P - 1); 82 82 RisedTextOut(Offscreen.Canvas, 83 83 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s1)) div 2, 84 84 114 - MessageLineSpacing div 2, s1); 85 s1 := copy(s, p+ 1, 255);85 s1 := Copy(S, P + 1, 255); 86 86 RisedTextOut(Offscreen.Canvas, 87 87 (ClientWidth - BiColorTextWidth(Offscreen.Canvas, s1)) div 2, … … 90 90 Offscreen.Canvas.Font.Assign(UniFont[ftSmall]); 91 91 92 if MyRO.Wonder[woLiberty].EffectiveOwner = me then92 if MyRO.Wonder[woLiberty].EffectiveOwner = Me then 93 93 begin 94 94 GlowFrame(Offscreen, ClientWidth div 2 - xSizeBig div 2, 52, xSizeBig, 95 ySizeBig, Tribe[ me].Color);95 ySizeBig, Tribe[Me].Color); 96 96 BitBltCanvas(Offscreen.Canvas, ClientWidth div 2 - xSizeBig div 2, 52, 97 97 xSizeBig, ySizeBig, BigImp.Canvas, (woLiberty mod 7) * xSizeBig, … … 102 102 // ImageOp_CBC(Offscreen,Templates,260,40,145,112,36,36,$404000,$8B8BEB); 103 103 104 s:= Phrases.Lookup('SCIENCE');105 RisedTextOut(Offscreen.Canvas, 106 16 + 120 - BiColorTextWidth(Offscreen.Canvas, s), 44, s);107 s:= Format('%d%%', [100 - MyRO.TaxRate - MyRO.LuxRate]);108 RisedTextOut(Offscreen.Canvas, 109 16 + 120 - BiColorTextWidth(Offscreen.Canvas, s), 60, s);104 S := Phrases.Lookup('SCIENCE'); 105 RisedTextOut(Offscreen.Canvas, 106 16 + 120 - BiColorTextWidth(Offscreen.Canvas, S), 44, S); 107 S := Format('%d%%', [100 - MyRO.TaxRate - MyRO.LuxRate]); 108 RisedTextOut(Offscreen.Canvas, 109 16 + 120 - BiColorTextWidth(Offscreen.Canvas, S), 60, S); 110 110 // PaintProgressBar(Offscreen.Canvas,2,16,81,(100-MyRO.LuxRate-MyRO.TaxRate)*120 div 100,0,120,MainTexture); 111 111 112 112 // reverse progress bar for science 113 x:= 16;114 y:= 81;113 X := 16; 114 Y := 81; 115 115 current := (100 - MyRO.LuxRate - MyRO.TaxRate) * 120 div 100; 116 max := 120;117 Frame(Offscreen.Canvas, x - 1, y - 1, x + max, y+ 7, $000000, $000000);118 RFrame(Offscreen.Canvas, x - 2, y - 2, x + max + 1, y+ 8,116 Max := 120; 117 Frame(Offscreen.Canvas, X - 1, Y - 1, X + Max, Y + 7, $000000, $000000); 118 RFrame(Offscreen.Canvas, X - 2, Y - 2, X + Max + 1, Y + 8, 119 119 MainTexture.ColorBevelShade, MainTexture.ColorBevelLight); 120 120 with Offscreen.Canvas do 121 121 begin 122 for i:= 0 to current div 8 - 1 do123 BitBltCanvas(Offscreen.Canvas, x + max - 8 - i * 8, y, 8, 7,122 for I := 0 to current div 8 - 1 do 123 BitBltCanvas(Offscreen.Canvas, X + Max - 8 - I * 8, Y, 8, 7, 124 124 HGrSystem.Data.Canvas, 104, 9 + 8 * 2); 125 BitBltCanvas(Offscreen.Canvas, x + max - current, y, current - 8 * (current div 8), 7,125 BitBltCanvas(Offscreen.Canvas, X + Max - current, Y, current - 8 * (current div 8), 7, 126 126 HGrSystem.Data.Canvas, 104, 9 + 8 * 2); 127 127 Brush.Color := $000000; 128 FillRect(Rect( x, y, x + max - current, y+ 7));128 FillRect(Rect(X, Y, X + Max - current, Y + 7)); 129 129 Brush.Style := bsClear; 130 130 end; 131 131 132 132 RisedTextOut(Offscreen.Canvas, 16 + 160, 44, Phrases.Lookup('LUX')); 133 s:= Format('%d%%', [MyRO.LuxRate]);134 RisedTextOut(Offscreen.Canvas, 135 16 + 160 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 60, s);133 S := Format('%d%%', [MyRO.LuxRate]); 134 RisedTextOut(Offscreen.Canvas, 135 16 + 160 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 60, S); 136 136 PaintProgressBar(Offscreen.Canvas, 5, 16 + 160, 81, 137 137 MyRO.LuxRate * 120 div 100, 0, 120, MainTexture); … … 144 144 MainTexture.ColorBevelLight); 145 145 RisedTextOut(Offscreen.Canvas, 16 + 80, 164, Phrases.Lookup('TAXRATE')); 146 s:= Format('%d%%', [MyRO.TaxRate]);146 S := Format('%d%%', [MyRO.TaxRate]); 147 147 RisedTextOut(Offscreen.Canvas, 148 16 + 80 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 180, s);148 16 + 80 { +120-BiColorTextWidth(Offscreen.Canvas,s) } , 180, S); 149 149 PaintProgressBar(Offscreen.Canvas, 0, 16 + 80, 201, 150 150 MyRO.TaxRate * 120 div 100, 0, 120, MainTexture); … … 164 164 begin 165 165 Caption := Phrases.Lookup('TITLE_RATES'); 166 if MyRO.Wonder[woLiberty].EffectiveOwner = me then167 begin 168 ScienceBtn.Visible := false;169 LuxBtn.Visible := false;166 if MyRO.Wonder[woLiberty].EffectiveOwner = Me then 167 begin 168 ScienceBtn.Visible := False; 169 LuxBtn.Visible := False; 170 170 end 171 171 else 172 172 begin 173 ScienceBtn.Visible := true;174 LuxBtn.Visible := true;173 ScienceBtn.Visible := True; 174 LuxBtn.Visible := True; 175 175 end; 176 176 OffscreenPaint; … … 184 184 procedure TRatesDlg.TaxLuxBtnClick(Sender: TObject); 185 185 var 186 NewTax, NewLux: integer;186 NewTax, NewLux: Integer; 187 187 begin 188 188 NewTax := MyRO.TaxRate div 10; … … 191 191 begin 192 192 if NewTax < 10 then 193 inc(NewTax);193 Inc(NewTax); 194 194 if NewTax + NewLux > 10 then 195 dec(NewLux);195 Dec(NewLux); 196 196 end 197 197 else if (Sender = TaxDownBtn) and (NewTax > 0) then 198 dec(NewTax)198 Dec(NewTax) 199 199 else if (Sender = ScienceBtn) and (NewLux > 0) then 200 dec(NewLux)200 Dec(NewLux) 201 201 else if (Sender = LuxBtn) and (NewLux + NewTax < 100) then 202 inc(NewLux);203 if Server(sSetRates, me, NewTax + NewLux shl 4, nil^) <> eNotChanged then202 Inc(NewLux); 203 if Server(sSetRates, Me, NewTax + NewLux shl 4, nil^) <> eNotChanged then 204 204 begin 205 205 CityOptimizer_BeginOfTurn; 206 206 SmartUpdateContent; 207 MainScreen.UpdateViews( true);207 MainScreen.UpdateViews(True); 208 208 end; 209 209 end;
Note:
See TracChangeset
for help on using the changeset viewer.