SA-MP/exgui/ServerProperties.pas

88 lines
1.9 KiB
ObjectPascal
Raw Normal View History

2023-11-07 17:10:47 +08:00
unit ServerProperties;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Menus;
2023-11-07 17:10:47 +08:00
type
2023-11-07 23:44:02 +08:00
TfmServerProperties = class(TForm)
2023-12-02 20:35:55 +08:00
lbAddressLab: TLabel;
lbPlayersLab: TLabel;
lbPingLab: TLabel;
lbModeLab: TLabel;
lbMapLab: TLabel;
lbMap: TLabel;
lbMode: TLabel;
lbPing: TLabel;
lbPlayers: TLabel;
edAddress: TEdit;
lbHostName: TLabel;
lbServerPassword: TLabel;
lbRconPassword: TLabel;
edServerPassword: TEdit;
edRconPassword: TEdit;
bnSave: TButton;
bnCancel: TButton;
bnConnect: TButton;
pmCopy: TPopupMenu;
piCopy: TMenuItem;
2023-12-02 19:57:04 +08:00
procedure bnSaveClick(Sender: TObject);
procedure bnCancelClick(Sender: TObject);
procedure bnConnectClick(Sender: TObject);
procedure pmCopyPopup(Sender: TObject);
procedure piCopyClick(Sender: TObject);
2023-11-07 17:10:47 +08:00
private
{ Private declarations }
public
{ Public declarations }
end;
var
2023-11-07 23:44:02 +08:00
fmServerProperties: TfmServerProperties;
2023-11-07 17:10:47 +08:00
implementation
uses Main;
2023-11-07 17:10:47 +08:00
{$R *.dfm}
2023-12-02 19:57:04 +08:00
procedure TfmServerProperties.bnSaveClick(Sender: TObject);
var
Idx: Integer;
2023-12-02 19:57:04 +08:00
begin
Idx:= StrToInt(fmMain.lbServers.Items.Strings[fmMain.lbServers.ItemIndex]);
Servers[Idx].ServerPassword:= edServerPassword.Text;
Servers[Idx].RconPassword:= edRconPassword.Text;
Close;
2023-12-02 19:57:04 +08:00
end;
procedure TfmServerProperties.bnCancelClick(Sender: TObject);
begin
Close;
2023-12-02 19:57:04 +08:00
end;
procedure TfmServerProperties.bnConnectClick(Sender: TObject);
var
Idx: Integer;
2023-12-02 19:57:04 +08:00
begin
Idx:= StrToInt(fmMain.lbServers.Items.Strings[fmMain.lbServers.ItemIndex]);
Servers[Idx].ServerPassword:= edServerPassword.Text;
Servers[Idx].RconPassword:= edRconPassword.Text;
fmMain.ConnectClick(fmMain);
Close;
2023-12-02 19:57:04 +08:00
end;
procedure TfmServerProperties.pmCopyPopup(Sender: TObject);
begin
piCopy.Enabled:= edAddress.Text <> '- - -';
2023-12-02 19:57:04 +08:00
end;
procedure TfmServerProperties.piCopyClick(Sender: TObject);
begin
fmMain.SetClipBoardStr(edAddress.Text);
2023-12-02 19:57:04 +08:00
end;
2023-11-07 17:10:47 +08:00
end.