close Warning: Can't synchronize with repository "(default)" (No changeset 184 in the repository). Look in the Trac log for more information.

Ignore:
Timestamp:
Feb 9, 2018, 10:06:13 AM (6 years ago)
Author:
chronos
Message:
  • Added: Popup menu action Spectate in Players stats window.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormPlayersStats.pas

    r181 r182  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   UGame;
     9  Menus, ActnList, UGame;
    1010
    1111type
     
    1414
    1515  TFormPlayersStats = class(TForm)
     16    ASpectate: TAction;
     17    ActionList1: TActionList;
    1618    ListView1: TListView;
     19    MenuItem1: TMenuItem;
     20    PopupMenu1: TPopupMenu;
     21    procedure ASpectateExecute(Sender: TObject);
    1722    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    1823    procedure FormShow(Sender: TObject);
     
    4348  with TPlayer(Players[Item.Index]) do begin
    4449    Item.Caption := Name;
     50    Item.Data := Players[Item.Index];
     51    Item.SubItems.Add(PlayerModeText[Mode]);
    4552    Item.SubItems.Add(IntToStr(TotalCells));
    4653    Item.SubItems.Add(IntToStr(TotalDiscovered));
     
    6370end;
    6471
     72procedure TFormPlayersStats.ASpectateExecute(Sender: TObject);
     73begin
     74  if Assigned(ListView1.Selected) then
     75    Core.Spectate(TPlayer(ListView1.Selected.Data));
     76end;
     77
    6578procedure TFormPlayersStats.ReloadList;
    6679begin
Note: See TracChangeset for help on using the changeset viewer.