Skip to content

Commit

Permalink
game status - position and colors
Browse files Browse the repository at this point in the history
  • Loading branch information
digao-dalpiaz committed Sep 28, 2020
1 parent 3e26867 commit 1f014be
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 46 deletions.
69 changes: 33 additions & 36 deletions UFrmGame.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ object FrmGame: TFrmGame
Left = 0
Top = 295
Width = 265
Height = 108
Height = 87
Align = alClient
BevelOuter = bvNone
TabOrder = 2
ExplicitHeight = 108
object LbChat: TLabel
Left = 0
Top = 0
Expand All @@ -69,7 +70,7 @@ object FrmGame: TFrmGame
Left = 0
Top = 13
Width = 265
Height = 74
Height = 53
TabStop = False
Align = alClient
Font.Charset = ANSI_CHARSET
Expand All @@ -83,10 +84,11 @@ object FrmGame: TFrmGame
TabOrder = 0
StyleElements = [seClient, seBorder]
Zoom = 100
ExplicitHeight = 25
end
object EdChatMsg: TEdit
Left = 0
Top = 87
Top = 66
Width = 265
Height = 21
Align = alBottom
Expand All @@ -98,6 +100,7 @@ object FrmGame: TFrmGame
ParentFont = False
TabOrder = 1
OnKeyPress = EdChatMsgKeyPress
ExplicitTop = 87
end
end
object LPlayers: TListBox
Expand Down Expand Up @@ -133,7 +136,7 @@ object FrmGame: TFrmGame
end
object BoxOperations: TPanel
Left = 0
Top = 403
Top = 382
Width = 265
Height = 41
Align = alBottom
Expand Down Expand Up @@ -362,6 +365,18 @@ object FrmGame: TFrmGame
OnClick = BtnRestartClick
end
end
object BoxStatus: TPanel
Left = 0
Top = 423
Width = 265
Height = 21
Align = alBottom
BevelKind = bkFlat
BevelOuter = bvNone
TabOrder = 4
StyleElements = [seFont, seBorder]
ExplicitTop = 430
end
end
object BoxGrid: TPanel
Left = 0
Expand All @@ -372,46 +387,28 @@ object FrmGame: TFrmGame
BevelOuter = bvNone
BorderWidth = 2
TabOrder = 0
object LbPosition: TLabel
Left = 2
Top = 2
Width = 618
Height = 13
Align = alTop
AutoSize = False
ExplicitLeft = 0
ExplicitTop = 0
end
object SB: TScrollBox
Left = 2
Top = 17
Top = 15
Width = 618
Height = 425
Height = 427
HorzScrollBar.Tracking = True
VertScrollBar.Tracking = True
Align = alClient
BorderStyle = bsNone
TabOrder = 1
ExplicitTop = 15
ExplicitHeight = 427
end
object BoxTopOfGrid: TPanel
Left = 2
Top = 2
Width = 618
Height = 15
Align = alTop
BevelOuter = bvNone
TabOrder = 0
object LbPosition: TLabel
Left = 0
Top = 0
Width = 217
Height = 15
Align = alLeft
AutoSize = False
end
object LbStatus: TLabel
Left = 217
Top = 0
Width = 217
Height = 15
Align = alLeft
Alignment = taCenter
AutoSize = False
Transparent = False
ExplicitLeft = 296
end
ExplicitTop = 17
ExplicitHeight = 425
end
end
object IL: TImageList
Expand Down
21 changes: 11 additions & 10 deletions UFrmGame.pas
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ TFrmGame = class(TForm)
BtnRestart: TBitBtn;
BoxGrid: TPanel;
SB: TScrollBox;
BoxTopOfGrid: TPanel;
LbPosition: TLabel;
LbStatus: TLabel;
BoxStatus: TPanel;
procedure EdChatMsgKeyPress(Sender: TObject; var Key: Char);
procedure BtnStartGameClick(Sender: TObject);
procedure LPlayersDrawItem(Control: TWinControl; Index: Integer;
Expand Down Expand Up @@ -124,10 +123,8 @@ procedure TFrmGame.SetStatus(NewStatus: TGameStatus);

procedure SetStatusLabel(const LangIdentSufix: string; Color: TColor);
begin
LbStatus.Caption := Lang.Get('GAME_STATUS_'+LangIdentSufix);
LbStatus.Color := Color;

LbStatus.Visible := True;
BoxStatus.Caption := Lang.Get('GAME_STATUS_'+LangIdentSufix);
BoxStatus.Color := Color;
end;

begin
Expand All @@ -144,14 +141,18 @@ procedure TFrmGame.SetStatus(NewStatus: TGameStatus);
BtnRestart.Visible := (Status = gsGameOver) and pubModeServer;

case Status of
gsUnknown: LbStatus.Visible := False;
gsUnknown:
begin
BoxStatus.Caption := string.Empty;
BoxStatus.Color := clBtnFace;
end;
gsPreparing: SetStatusLabel('PREPARING', clPurple);
gsPlaying: SetStatusLabel('PLAYING', clBlack);
gsMyTurn: SetStatusLabel('MYTURN', clGreen);
gsWaitValid: SetStatusLabel('WAITVALID', clWebIvory);
gsWaitValid: SetStatusLabel('WAITVALID', clWebBrown);
gsAgreement: SetStatusLabel('AGREEMENT', clBlue);
gsPaused: SetStatusLabel('PAUSED', clMaroon);
gsGameOver: SetStatusLabel('GAMEOVER', clRed);
gsPaused: SetStatusLabel('PAUSED', $005B5B5B);
gsGameOver: SetStatusLabel('GAMEOVER', $002C075C);
else raise Exception.Create('Internal: Unsupported status');
end;
end;
Expand Down

0 comments on commit 1f014be

Please sign in to comment.