Changeset 182 for trunk/Forms


Ignore:
Timestamp:
Feb 9, 2018, 10:06:13 AM (7 years ago)
Author:
chronos
Message:
  • Added: Popup menu action Spectate in Players stats window.
Location:
trunk/Forms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormPlayersStats.lfm

    r181 r182  
    33  Height = 300
    44  Top = 237
    5   Width = 596
     5  Width = 697
    66  Caption = 'Players stats'
    77  ClientHeight = 300
    8   ClientWidth = 596
     8  ClientWidth = 697
    99  DesignTimePPI = 120
    1010  OnClose = FormClose
     
    1515    Height = 292
    1616    Top = 4
    17     Width = 588
     17    Width = 689
    1818    Align = alClient
    1919    BorderSpacing.Around = 4
     
    2121      item
    2222        Caption = 'Name'
     23        Width = 100
     24      end   
     25      item
     26        Caption = 'Mode'
    2327        Width = 100
    2428      end   
     
    4044      end>
    4145    OwnerData = True
     46    PopupMenu = PopupMenu1
    4247    ReadOnly = True
    4348    RowSelect = True
     
    4651    OnData = ListView1Data
    4752  end
     53  object PopupMenu1: TPopupMenu
     54    left = 143
     55    top = 110
     56    object MenuItem1: TMenuItem
     57      Action = ASpectate
     58    end
     59  end
     60  object ActionList1: TActionList
     61    left = 358
     62    top = 111
     63    object ASpectate: TAction
     64      Caption = 'Spectate'
     65      OnExecute = ASpectateExecute
     66    end
     67  end
    4868end
  • 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.