Rework chat line templates and logic

- Extract chat line templates and logic so they can be reused across widgets
- Make text notification styling entirely template driven (by removing chat color configuration and making color optional for `TextNotification`)
- Add a new TextNotificationsDisplay widget (based on and replacing ChatDisplayWidget)
- Add timestamp support to text notifications
This commit is contained in:
Ivaylo Draganov
2021-06-15 17:32:21 +03:00
committed by Matthias Mailänder
parent 8416dc3f2d
commit 9e92340ea7
20 changed files with 330 additions and 363 deletions

View File

@@ -6,17 +6,22 @@ Container@CHAT_PANEL:
Logic: IngameChatLogic
OpenTeamChatKey: OpenTeamChat
OpenGeneralChatKey: OpenGeneralChat
Templates:
Chat: CHAT_LINE_TEMPLATE
System: SYSTEM_LINE_TEMPLATE
Mission: SYSTEM_LINE_TEMPLATE
Feedback: SYSTEM_LINE_TEMPLATE
Children:
Container@CHAT_OVERLAY:
Width: PARENT_RIGHT - 24
Height: PARENT_BOTTOM - 25
Height: PARENT_BOTTOM - 30
Visible: false
Children:
ChatDisplay@CHAT_DISPLAY:
TextNotificationsDisplay@CHAT_DISPLAY:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
RemoveTime: 250
UseShadow: True
BottomSpacing: 3
Container@CHAT_CHROME:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
@@ -59,20 +64,3 @@ Container@CHAT_PANEL:
TopBottomSpacing: 3
ItemSpacing: 4
Align: Bottom
Children:
Container@CHAT_TEMPLATE:
X: 2
Width: PARENT_RIGHT - 27
Height: 16
Children:
Label@NAME:
X: 3
Width: 50
Height: 16
Shadow: True
Label@TEXT:
X: 12
Width: PARENT_RIGHT - 17
Height: 16
WordWrap: true
Shadow: True

View File

@@ -3,6 +3,11 @@ Container@CHAT_CONTAINER:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM - 20
Logic: IngameChatLogic
Templates:
Chat: CHAT_LINE_TEMPLATE
System: SYSTEM_LINE_TEMPLATE
Mission: SYSTEM_LINE_TEMPLATE
Feedback: SYSTEM_LINE_TEMPLATE
Children:
Container@CHAT_CHROME:
X: 15
@@ -28,20 +33,3 @@ Container@CHAT_CONTAINER:
Height: PARENT_BOTTOM - 30
TopBottomSpacing: 3
ItemSpacing: 2
Children:
Container@CHAT_TEMPLATE:
X: 2
Width: PARENT_RIGHT - 27
Height: 16
Children:
Label@NAME:
X: 3
Width: 50
Height: 16
Shadow: True
Label@TEXT:
X: 12
Width: PARENT_RIGHT - 17
Height: 16
WordWrap: true
Shadow: True

View File

@@ -1,5 +1,10 @@
Container@SERVER_LOBBY:
Logic: LobbyLogic
ChatTemplates:
Chat: CHAT_LINE_TEMPLATE
System: SYSTEM_LINE_TEMPLATE
Mission: SYSTEM_LINE_TEMPLATE
Feedback: SYSTEM_LINE_TEMPLATE
X: (WINDOW_RIGHT - WIDTH) / 2
Y: (WINDOW_BOTTOM - 560) / 2
Width: 900
@@ -99,29 +104,6 @@ Container@SERVER_LOBBY:
Height: PARENT_BOTTOM - 30
TopBottomSpacing: 3
ItemSpacing: 2
Children:
Container@CHAT_TEMPLATE:
Width: PARENT_RIGHT - 27
Height: 16
X: 2
Y: 0
Children:
Label@TIME:
X: 3
Width: 50
Height: 16
Shadow: True
Label@NAME:
X: 45
Width: 50
Height: 16
Shadow: True
Label@TEXT:
X: 55
Width: PARENT_RIGHT - 60
Height: 16
WordWrap: true
Shadow: True
Button@CHAT_MODE:
Y: PARENT_BOTTOM - HEIGHT
Width: 50

View File

@@ -138,6 +138,7 @@ ChromeLayout:
cnc|chrome/assetbrowser.yaml
cnc|chrome/missionbrowser.yaml
cnc|chrome/editor.yaml
common|chrome/text-notifications.yaml
Voices:
cnc|audio/voices.yaml

View File

@@ -6,17 +6,22 @@ Container@CHAT_PANEL:
Logic: IngameChatLogic
OpenTeamChatKey: OpenTeamChat
OpenGeneralChatKey: OpenGeneralChat
Templates:
Chat: CHAT_LINE_TEMPLATE
System: SYSTEM_LINE_TEMPLATE
Mission: SYSTEM_LINE_TEMPLATE
Feedback: SYSTEM_LINE_TEMPLATE
Children:
Container@CHAT_OVERLAY:
Width: PARENT_RIGHT - 24
Height: PARENT_BOTTOM - 25
Height: PARENT_BOTTOM - 30
Visible: false
Children:
ChatDisplay@CHAT_DISPLAY:
TextNotificationsDisplay@CHAT_DISPLAY:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
RemoveTime: 250
UseShadow: True
BottomSpacing: 3
Container@CHAT_CHROME:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
@@ -54,20 +59,3 @@ Container@CHAT_PANEL:
TopBottomSpacing: 3
ItemSpacing: 4
Align: Bottom
Children:
Container@CHAT_TEMPLATE:
X: 2
Width: PARENT_RIGHT - 27
Height: 16
Children:
Label@NAME:
X: 3
Width: 50
Height: 16
Shadow: True
Label@TEXT:
X: 12
Width: PARENT_RIGHT - 17
Height: 16
WordWrap: true
Shadow: True

View File

@@ -3,6 +3,11 @@ Container@CHAT_CONTAINER:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM - 100
Logic: IngameChatLogic
Templates:
Chat: CHAT_LINE_TEMPLATE
System: SYSTEM_LINE_TEMPLATE
Mission: SYSTEM_LINE_TEMPLATE
Feedback: SYSTEM_LINE_TEMPLATE
Children:
Container@CHAT_CHROME:
X: 20
@@ -28,20 +33,3 @@ Container@CHAT_CONTAINER:
Height: PARENT_BOTTOM - 30
TopBottomSpacing: 3
ItemSpacing: 2
Children:
Container@CHAT_TEMPLATE:
X: 2
Width: PARENT_RIGHT - 27
Height: 16
Children:
Label@NAME:
X: 3
Width: 50
Height: 16
Shadow: True
Label@TEXT:
X: 12
Width: PARENT_RIGHT - 17
Height: 16
WordWrap: true
Shadow: True

View File

@@ -1,5 +1,10 @@
Background@SERVER_LOBBY:
Logic: LobbyLogic
ChatTemplates:
Chat: CHAT_LINE_TEMPLATE
System: SYSTEM_LINE_TEMPLATE
Mission: SYSTEM_LINE_TEMPLATE
Feedback: SYSTEM_LINE_TEMPLATE
X: (WINDOW_RIGHT - WIDTH) / 2
Y: (WINDOW_BOTTOM - HEIGHT) / 2
Width: 900
@@ -103,28 +108,6 @@ Background@SERVER_LOBBY:
Height: PARENT_BOTTOM - 30
TopBottomSpacing: 2
ItemSpacing: 2
Children:
Container@CHAT_TEMPLATE:
X: 2
Width: PARENT_RIGHT - 27
Height: 16
Children:
Label@TIME:
X: 3
Width: 50
Height: 16
Shadow: True
Label@NAME:
X: 45
Width: 50
Height: 16
Shadow: True
Label@TEXT:
X: 55
Width: PARENT_RIGHT - 60
Height: 16
WordWrap: true
Shadow: True
Button@CHAT_MODE:
Y: PARENT_BOTTOM - HEIGHT
Width: 50

View File

@@ -0,0 +1,39 @@
Container@CHAT_LINE_TEMPLATE:
Width: PARENT_RIGHT
Height: 16
Children:
Label@TIME:
X: 5
Width: 37
Height: 16
Shadow: True
Label@PREFIX:
X: 5
Height: 16
Shadow: True
Label@TEXT:
X: 5
Height: 16
WordWrap: True
Shadow: True
Container@SYSTEM_LINE_TEMPLATE:
Width: PARENT_RIGHT
Height: 16
Children:
Label@TIME:
X: 5
Width: 37
Height: 16
Shadow: True
Label@PREFIX:
X: 5
Height: 16
Shadow: True
TextColor: FFFF00
Label@TEXT:
X: 5
Height: 16
WordWrap: True
Shadow: True
TextColor: FFFF00

View File

@@ -49,8 +49,6 @@ Metrics:
ChatLineSound: ChatLine
ClickDisabledSound: ClickDisabledSound
ClickSound: ClickSound
ChatMessageColor: FFFFFF
SystemMessageColor: FFFF00
NormalSelectionColor: FFFFFF
AltSelectionColor: 00FFFF
CtrlSelectionColor: FFFF00

View File

@@ -117,6 +117,7 @@ ChromeLayout:
common|chrome/replaybrowser.yaml
common|chrome/gamesave-browser.yaml
common|chrome/gamesave-loading.yaml
common|chrome/text-notifications.yaml
Weapons:
d2k|weapons/debris.yaml

View File

@@ -134,6 +134,7 @@ ChromeLayout:
common|chrome/confirmation-dialogs.yaml
common|chrome/editor.yaml
common|chrome/playerprofile.yaml
common|chrome/text-notifications.yaml
Weapons:
ra|weapons/explosions.yaml

View File

@@ -180,6 +180,7 @@ ChromeLayout:
common|chrome/missionbrowser.yaml
common|chrome/confirmation-dialogs.yaml
common|chrome/editor.yaml
common|chrome/text-notifications.yaml
Voices:
ts|audio/voices.yaml