- Timestamp:
- Feb 9, 2018, 10:33:18 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 9 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; -
trunk/Languages/xtactics.cs.po
r182 r183 475 475 476 476 #: tformnew.tabsheetmode.caption 477 msgctxt "tformnew.tabsheetmode.caption" 477 478 msgid "Mode" 478 479 msgstr "Režim" … … 536 537 537 538 #: tformplayersstats.listview1.columns[1].caption 539 msgctxt "tformplayersstats.listview1.columns[1].caption" 538 540 msgid "Mode" 539 541 msgstr "Režim" … … 700 702 701 703 #: uformhelp.scontent 702 msgid "xTactics is a risk based strategic game. Main focus of the game is to offer player various possibilities to configure game conditions. Map for game is generated randomly for each play. Game is multiplayer so single player can play with other human opponents or with many computer opponents.\n" 704 msgid "" 705 "xTactics is a risk based strategic game. Main focus of the game is to offer player various possibilities to configure game conditions. Map for game is generated randomly for each play. Game is multiplayer so single player can play with other human opponents or with many computer opponents.\n" 703 706 "\n" 704 707 "Each cell has defined number of units which can be instructed to attack enemy or neutral adjacent cells. Units can also defend against enemy attach from adjacent cells. You can move units inside your territory. \n" … … 706 709 "\n" 707 710 "Resolution of attack of units is determined by rule similar to one which is used in Risk game. Battle consist of several fights. Each fight attacker can use up to 3 units and defender up to 2 units. Number of units for each side determine number of dices. Both sides roll their dices and order them in descending order. Each side takes one dice with highest value. One who has dice with higher value wins. In case of tie, defender wins. Loser lose its unit and another pair of dices is evaluated. This process is calculated automatically and for each planned attack win probability is displayed.\n" 708 ""709 msgstr"xTactics je strategická hra založena na hře Risk. Hlavní zaměření hry je nabídnout hráči různé možnosti k nastavení podmínek hry. Mapa hry je generována náhodně pro každou hru. Hra je pro více hráčů takže jeden hráč může hrát s dalšími lidskými protivníky nebo s mnoha počítačovými protivníky.\n"711 msgstr "" 712 "xTactics je strategická hra založena na hře Risk. Hlavní zaměření hry je nabídnout hráči různé možnosti k nastavení podmínek hry. Mapa hry je generována náhodně pro každou hru. Hra je pro více hráčů takže jeden hráč může hrát s dalšími lidskými protivníky nebo s mnoha počítačovými protivníky.\n" 710 713 "\n" 711 714 "Každá buňka má určitý počet jednotek, které mohou být použity k útoku na přilehlé nepřátelské nebo neutrální buňky. Jednotky se mohou bránit proti nepřátelském útoku z přilehlých buněk. Můžete přesouvat jednotky uvnitř území.\n" … … 713 716 "\n" 714 717 "Vyhodnocení útoku jednotek je určen pravidlem podobným tomu, které je použito u hry Risk. Bitva se skládá z několika bojů. Každá boj útočník může použít do 3 jednotek a obránce do 2 jednotek. Počet jednotek pro každou stranu určuje počet kostek. Obě strany házejí jejich kostkami a seřadí je v sestupném pořadí. Každá strana bere jednu kostku s nejvyšší hodnotou. Ten, který má kostku s vyšší hodnotou vyhrává. V případě remízy, vyhrává obránce. Prohrávající ztrácí své jednotky a další pár kostek je vyhodnocen. Tento proces je vypočítáván automaticky a pro každý plánovaný útok je zobrazena odhadovaná pravděpodobnost.\n" 715 ""716 718 717 719 #: uformmain.sturn -
trunk/Languages/xtactics.po
r182 r183 460 460 461 461 #: tformnew.tabsheetmode.caption 462 msgctxt "tformnew.tabsheetmode.caption" 462 463 msgid "Mode" 463 464 msgstr "" … … 521 522 522 523 #: tformplayersstats.listview1.columns[1].caption 524 msgctxt "tformplayersstats.listview1.columns[1].caption" 523 525 msgid "Mode" 524 526 msgstr "" -
trunk/UCore.pas
r182 r183 67 67 procedure DoPlayerChange(Sender: TObject); 68 68 procedure DoMoveUpdated(UnitMove: TUnitMove); 69 procedure DoOnMove(CellFrom, CellTo: TCell; var CountOnce,70 CountRepeat: Integer; Update: Boolean; var Confirm: Boolean);71 69 procedure DoOnWin(Player: TPlayer); 72 70 procedure Delay(Time: Integer); … … 106 104 107 105 uses 108 UFormMove, UFormMain, UFormNew, UFormSettings, UFormAbout, UFormPlayer,106 UFormMove, UFormMain, UFormNew, UFormSettings, UFormAbout, 109 107 UFormHelp, UFormCharts, UFormUnitMoves, UFormPlayersStats; 110 108 … … 123 121 124 122 { TCore } 125 126 procedure TCore.DoOnMove(CellFrom, CellTo: TCell; var CountOnce,127 CountRepeat: Integer; Update: Boolean; var Confirm: Boolean);128 var129 I: Integer;130 begin131 if Update then FormMove.SpinEditOnce.MaxValue := CellFrom.GetAvialPower + CountOnce132 else FormMove.SpinEditOnce.MaxValue := CellFrom.GetAvialPower;133 FormMove.SpinEditOnce.Value := CountOnce;134 FormMove.TrackBarOnce.Max := FormMove.SpinEditOnce.MaxValue;135 FormMove.TrackBarOnce.Position := FormMove.SpinEditOnce.Value;136 FormMove.SpinEditRepeat.MaxValue := Game.Map.MaxPower;137 FormMove.SpinEditRepeat.Value := CountRepeat;138 FormMove.TrackBarRepeat.Max := FormMove.SpinEditRepeat.MaxValue;139 FormMove.TrackBarRepeat.Position := FormMove.SpinEditRepeat.Value;140 FormMove.DefendCount := CellTo.Power;141 // Attack count from other surrounding cells without current move if already exists142 FormMove.AttackCount := 0;143 for I := 0 to CellTo.MovesTo.Count - 1 do144 if TUnitMove(CellTo.MovesTo[I]).CellFrom <> CellFrom then145 FormMove.AttackCount := FormMove.AttackCount + TUnitMove(CellTo.MovesTo[I]).CountOnce;146 FormMove.ShowWinProbability := CellTo.Player <> CellFrom.Player;147 148 if FormMove.ShowModal = mrOk then begin149 CountOnce := FormMove.SpinEditOnce.Value;150 CountRepeat := FormMove.SpinEditRepeat.Value;151 Confirm := True;152 end else Confirm := False;153 end;154 123 155 124 procedure TCore.DoOnWin(Player: TPlayer); … … 401 370 begin 402 371 UGame.InitStrings; 403 FormPlayer.Translate;404 372 end; 405 373 … … 408 376 Server := TServer.Create; 409 377 Game := TGame.Create; 410 Game.OnMove := DoOnMove;411 378 Game.OnMoveUpdated := DoMoveUpdated; 412 379 Game.OnWin := DoOnWin; … … 485 452 Form.AZoomAll.Execute; 486 453 Form.Show; 454 FormClients.Add(Form); 487 455 end; 488 456 -
trunk/UGame.pas
r180 r183 415 415 end; 416 416 417 TMoveEvent = procedure(CellFrom, CellTo: TCell; var CountOnce, CountRepeat: Integer; 418 Update: Boolean; var Confirm: Boolean) of object; 419 417 420 { TClient } 418 421 419 422 TClient = class 420 423 private 424 FForm: TForm; 421 425 FGame: TGame; 422 426 FControlPlayer: TPlayer; 423 427 FOnChange: TNotifyEvent; 424 428 FOnReceive: TReceiveEvent; 429 FOnMove: TMoveEvent; 425 430 procedure SetControlPlayer(AValue: TPlayer); 431 procedure SetForm(AValue: TForm); 426 432 procedure SetGame(AValue: TGame); 427 433 procedure DoChange; 428 434 public 429 Form: TForm;430 435 Name: string; 431 436 View: TView; … … 436 441 property ControlPlayer: TPlayer read FControlPlayer write SetControlPlayer; 437 442 property Game: TGame read FGame write SetGame; 443 property Form: TForm read FForm write SetForm; 444 property OnMove: TMoveEvent read FOnMove write FOnMove; 438 445 property OnReceive: TReceiveEvent read FOnReceive write FOnReceive; 439 446 property OnChange: TNotifyEvent read FOnChange write FOnChange; … … 450 457 { TGame } 451 458 452 TMoveEvent = procedure(CellFrom, CellTo: TCell; var CountOnce, CountRepeat: Integer;453 Update: Boolean; var Confirm: Boolean) of object;454 459 TMoveUpdatedEvent = procedure(UnitMove: TUnitMove) of object; 455 460 … … 464 469 private 465 470 FMapType: TMapType; 466 FOnMove: TMoveEvent;467 471 FOnMoveUpdated: TMoveUpdatedEvent; 468 472 FOnNewTurn: TNotifyEvent; … … 519 523 property MapType: TMapType read FMapType write SetMapType; 520 524 published 521 property OnMove: TMoveEvent read FOnMove write FOnMove;522 525 property OnMoveUpdated: TMoveUpdatedEvent read FOnMoveUpdated write FOnMoveUpdated; 523 526 property OnWin: TWinEvent read FOnWin write FOnWin; … … 697 700 if Assigned(FControlPlayer) then 698 701 FControlPlayer.FClient := Self; 702 end; 703 704 procedure TClient.SetForm(AValue: TForm); 705 begin 706 if FForm = AValue then Exit; 707 FForm := AValue; 699 708 end; 700 709 … … 2921 2930 CountRepeat := Result.CountRepeat; 2922 2931 if (Mode = pmHuman) and Confirmation and 2923 Assigned(Game.FOnMove) then Game.FOnMove(CellFrom, CellTo, CountOnce, CountRepeat, True, Confirm); 2932 Assigned(Client) and Assigned(Client.FOnMove) then 2933 Client.FOnMove(CellFrom, CellTo, CountOnce, CountRepeat, True, Confirm); 2924 2934 end else begin 2925 2935 CountOnce := Power; 2926 2936 CountRepeat := 0; 2927 2937 if (Mode = pmHuman) and Confirmation and 2928 Assigned(Game.FOnMove) then Game.FOnMove(CellFrom, CellTo, CountOnce, CountRepeat, False, Confirm); 2938 Assigned(Client) and Assigned(Client.FOnMove) then 2939 Client.FOnMove(CellFrom, CellTo, CountOnce, CountRepeat, False, Confirm); 2929 2940 end; 2930 2941 if Confirm then begin -
trunk/xtactics.lpr
r181 r183 33 33 Application.CreateForm(TCore, Core); 34 34 Application.CreateForm(TFormMain, FormMain); 35 Application.CreateForm(TFormMove, FormMove);36 Application.CreateForm(TFormPlayer, FormPlayer);37 35 Application.Run; 38 36 end.
Note:
See TracChangeset
for help on using the changeset viewer.