From 1f014be4079fb2ad881d33ec9a836c321437c7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Depin=C3=A9=20Dalpiaz?= Date: Mon, 28 Sep 2020 19:21:28 -0300 Subject: [PATCH] game status - position and colors --- UFrmGame.dfm | 69 +++++++++++++++++++++++++--------------------------- UFrmGame.pas | 21 ++++++++-------- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/UFrmGame.dfm b/UFrmGame.dfm index 2354c17..3f237e2 100644 --- a/UFrmGame.dfm +++ b/UFrmGame.dfm @@ -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 @@ -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 @@ -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 @@ -98,6 +100,7 @@ object FrmGame: TFrmGame ParentFont = False TabOrder = 1 OnKeyPress = EdChatMsgKeyPress + ExplicitTop = 87 end end object LPlayers: TListBox @@ -133,7 +136,7 @@ object FrmGame: TFrmGame end object BoxOperations: TPanel Left = 0 - Top = 403 + Top = 382 Width = 265 Height = 41 Align = alBottom @@ -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 @@ -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 diff --git a/UFrmGame.pas b/UFrmGame.pas index 91f7a05..65ad52b 100644 --- a/UFrmGame.pas +++ b/UFrmGame.pas @@ -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; @@ -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 @@ -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;