Changeset 183 for trunk/Forms/UFormClient.pas
- Timestamp:
- Feb 9, 2018, 10:33:18 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormClient.pas
r180 r183 76 76 procedure SetClient(AValue: TClient); 77 77 procedure DoClientChange(Sender: TObject); 78 procedure DoOnMove(CellFrom, CellTo: TCell; var CountOnce, 79 CountRepeat: Integer; Update: Boolean; var Confirm: Boolean); 78 80 public 79 81 property Client: TClient read FClient write SetClient; … … 90 92 91 93 uses 92 UCore ;94 UCore, UFormMove; 93 95 94 96 resourcestring … … 98 100 99 101 { TFormClient } 102 103 procedure TFormClient.DoOnMove(CellFrom, CellTo: TCell; var CountOnce, 104 CountRepeat: Integer; Update: Boolean; var Confirm: Boolean); 105 var 106 I: Integer; 107 FormMove: TFormMove; 108 begin 109 FormMove := TFormMove.Create(nil); 110 try 111 if Update then FormMove.SpinEditOnce.MaxValue := CellFrom.GetAvialPower + CountOnce 112 else FormMove.SpinEditOnce.MaxValue := CellFrom.GetAvialPower; 113 FormMove.SpinEditOnce.Value := CountOnce; 114 FormMove.TrackBarOnce.Max := FormMove.SpinEditOnce.MaxValue; 115 FormMove.TrackBarOnce.Position := FormMove.SpinEditOnce.Value; 116 FormMove.SpinEditRepeat.MaxValue := Client.Game.Map.MaxPower; 117 FormMove.SpinEditRepeat.Value := CountRepeat; 118 FormMove.TrackBarRepeat.Max := FormMove.SpinEditRepeat.MaxValue; 119 FormMove.TrackBarRepeat.Position := FormMove.SpinEditRepeat.Value; 120 FormMove.DefendCount := CellTo.Power; 121 // Attack count from other surrounding cells without current move if already exists 122 FormMove.AttackCount := 0; 123 for I := 0 to CellTo.MovesTo.Count - 1 do 124 if TUnitMove(CellTo.MovesTo[I]).CellFrom <> CellFrom then 125 FormMove.AttackCount := FormMove.AttackCount + TUnitMove(CellTo.MovesTo[I]).CountOnce; 126 FormMove.ShowWinProbability := CellTo.Player <> CellFrom.Player; 127 128 if FormMove.ShowModal = mrOk then begin 129 CountOnce := FormMove.SpinEditOnce.Value; 130 CountRepeat := FormMove.SpinEditRepeat.Value; 131 Confirm := True; 132 end else Confirm := False; 133 finally 134 FormMove.Free; 135 end; 136 end; 100 137 101 138 procedure TFormClient.PaintBox1Paint(Sender: TObject); … … 165 202 begin 166 203 if FClient = AValue then Exit; 204 if Assigned(FClient) then FClient.Form := nil; 167 205 FClient := AValue; 168 if Assigned(FClient) then 206 if Assigned(FClient) then begin 207 FClient.Form := Self; 169 208 FClient.OnChange := DoClientChange; 209 FClient.OnMove := DoOnMove; 210 end; 170 211 Redraw; 171 212 end; … … 298 339 procedure TFormClient.FormDestroy(Sender: TObject); 299 340 begin 341 Client := nil; 300 342 TempBitmap.Free; 301 343 end;
Note:
See TracChangeset
for help on using the changeset viewer.