Changeset 183 for trunk/Forms
- Timestamp:
- Feb 9, 2018, 10:33:18 AM (7 years ago)
- Location:
- trunk/Forms
- Files:
-
- 4 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; -
trunk/Forms/UFormNew.pas
r179 r183 319 319 procedure TFormNew.APlayerModifyExecute(Sender: TObject); 320 320 begin 321 if Assigned(ListViewPlayers.Selected) then begin 322 FormPlayer.Load(TPlayer(ListViewPlayers.Selected.Data)); 323 if FormPlayer.ShowModal = mrOk then begin 324 FormPlayer.Save(TPlayer(ListViewPlayers.Selected.Data)); 325 ReloadView; 321 FormPlayer := TFormPlayer.Create(nil); 322 try 323 if Assigned(ListViewPlayers.Selected) then begin 324 FormPlayer.Load(TPlayer(ListViewPlayers.Selected.Data)); 325 if FormPlayer.ShowModal = mrOk then begin 326 FormPlayer.Save(TPlayer(ListViewPlayers.Selected.Data)); 327 ReloadView; 328 end; 326 329 end; 330 finally 331 FormPlayer.Free; 327 332 end; 328 333 end; -
trunk/Forms/UFormPlayer.lfm
r134 r183 9 9 Constraints.MinHeight = 344 10 10 Constraints.MinWidth = 522 11 DesignTimePPI = 120 12 OnClose = FormClose 11 13 OnShow = FormShow 12 14 Position = poMainFormCenter 13 LCLVersion = '1. 6.4.0'15 LCLVersion = '1.8.0.6' 14 16 object Label1: TLabel 15 17 Left = 24 16 Height = 2 418 Height = 20 17 19 Top = 27 18 Width = 5620 Width = 43 19 21 Caption = 'Name:' 20 22 ParentColor = False … … 22 24 object EditName: TEdit 23 25 Left = 168 24 Height = 3426 Height = 28 25 27 Top = 27 26 28 Width = 339 … … 51 53 object ComboBoxMode: TComboBox 52 54 Left = 168 53 Height = 3455 Height = 28 54 56 Top = 72 55 57 Width = 339 56 58 Anchors = [akTop, akLeft, akRight] 57 ItemHeight = 059 ItemHeight = 20 58 60 ItemIndex = 0 59 61 Items.Strings = ( … … 68 70 object Label2: TLabel 69 71 Left = 24 70 Height = 2 472 Height = 20 71 73 Top = 72 72 Width = 5374 Width = 42 73 75 Caption = 'Mode:' 74 76 ParentColor = False … … 76 78 object Label3: TLabel 77 79 Left = 24 78 Height = 2 480 Height = 20 79 81 Top = 128 80 Width = 5082 Width = 39 81 83 Caption = 'Color:' 82 84 ParentColor = False … … 84 86 object ColorBox1: TColorBox 85 87 Left = 168 86 Height = 3888 Height = 26 87 89 Top = 120 88 90 Width = 339 … … 94 96 object Label4: TLabel 95 97 Left = 24 96 Height = 2 498 Height = 20 97 99 Top = 168 98 Width = 98100 Width = 74 99 101 Caption = 'Agressivity:' 100 102 ParentColor = False … … 102 104 object ComboBoxAgressivity: TComboBox 103 105 Left = 168 104 Height = 34106 Height = 28 105 107 Top = 168 106 108 Width = 339 107 109 Anchors = [akTop, akLeft, akRight] 108 ItemHeight = 0110 ItemHeight = 20 109 111 Items.Strings = ( 110 112 'Low' … … 118 120 object CheckBoxDefensive: TCheckBox 119 121 Left = 24 120 Height = 2 8122 Height = 24 121 123 Top = 208 122 Width = 107124 Width = 89 123 125 Caption = 'Defensive' 124 126 TabOrder = 6 … … 126 128 object Label5: TLabel 127 129 Left = 24 128 Height = 2 4130 Height = 20 129 131 Top = 248 130 Width = 94132 Width = 69 131 133 Caption = 'Start units:' 132 134 ParentColor = False … … 134 136 object SpinEditStartUnits: TSpinEdit 135 137 Left = 224 136 Height = 34138 Height = 28 137 139 Top = 240 138 140 Width = 112 -
trunk/Forms/UFormPlayer.pas
r134 r183 28 28 SpinEditStartUnits: TSpinEdit; 29 29 procedure ComboBoxModeChange(Sender: TObject); 30 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 30 31 procedure FormShow(Sender: TObject); 31 32 private … … 45 46 {$R *.lfm} 46 47 48 uses 49 UCore; 50 47 51 resourcestring 48 52 SHuman = 'Human'; … … 59 63 end; 60 64 65 procedure TFormPlayer.FormClose(Sender: TObject; var CloseAction: TCloseAction); 66 begin 67 Core.PersistentForm.Save(Self); 68 end; 69 61 70 procedure TFormPlayer.FormShow(Sender: TObject); 62 71 begin 72 Core.PersistentForm.Load(Self); 73 Translate; 63 74 UpdateInterface; 64 75 end; … … 68 79 LastIndex: Integer; 69 80 begin 81 Core.CoolTranslator1.TranslateComponentRecursive(Self); 70 82 with ComboBoxMode do begin 71 83 LastIndex := ItemIndex;
Note:
See TracChangeset
for help on using the changeset viewer.