Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split chat lines into pools and allow the player to filter them #18905

Merged
merged 2 commits into from
Jul 4, 2021

Conversation

dragunoff
Copy link
Contributor

@dragunoff dragunoff commented Dec 7, 2020

This is #17737 stripped down to the core idea:

  • Split chat lines into pools (e.g. System, Mission, Chat, Notifications, UI Feedback)
  • Allow the player to toggle the display of UI Feedback chat pool

This is the only UI exposed to the player - a checkbox in "Display settings":
Screenshot_20210208_195234
Screenshot_20210208_195512

Display settings

Repeated messages are merged into one and a counter is displayed:
image
In game chat

Closes #16148
Provides the basis for solving #5775, #6400, #6354, #3278 and #12421. These will come in follow-ups.

@anvilvapre
Copy link
Contributor

at the end of a long game i tried to read back at what play time another player left the game. when who said what. i noticed the chat lines did not contain a timestamp. perhaps a separate feature. not important as you may be able to see in replay.

@dragunoff
Copy link
Contributor Author

Needs a rebase but I'll wait for #18948

@dragunoff
Copy link
Contributor Author

Rebased and updated to work with the new settings logic split.

Copy link
Member

@pchote pchote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few code comments below. Ingame, the message deduplication is really nice. I wonder whether we need a tooltip on the checkbox to describe what "UI Feedback" actually covers?

OpenRA.Game/Game.cs Outdated Show resolved Hide resolved
OpenRA.Game/Game.cs Outdated Show resolved Hide resolved
OpenRA.Game/Network/ChatLine.cs Outdated Show resolved Hide resolved
OpenRA.Game/Network/ChatLine.cs Outdated Show resolved Hide resolved
OpenRA.Mods.Common/Widgets/Logic/Ingame/IngameChatLogic.cs Outdated Show resolved Hide resolved
OpenRA.Game/Settings.cs Outdated Show resolved Hide resolved
@dragunoff
Copy link
Contributor Author

A few code comments below. Ingame, the message deduplication is really nice. I wonder whether we need a tooltip on the checkbox to describe what "UI Feedback" actually covers?

Yeah, "UI Feedback" and the pool associated with it is a bit problematic. I had difficulty coming up with a name for that pool. Currently it only includes the "Selected across screen/map" messages and they probably don't belong in the chat at all. There was an idea to move them to a dedicated widget for transient messages (it was discussed in #16355). And perhaps that's a good way to handle them.

@dragunoff
Copy link
Contributor Author

Another thing that may be a problem with the "repeatable" lines that I introduce in this PR is the number appended to the end. Because "Selected across map (3)" is a somewhat ambiguous - does that mean that 3 units were selected or that the message was repeated 3 times? 🤔

@dragunoff
Copy link
Contributor Author

Update: I'm trying to get back to this but I should wait for #19360 (or rebase on top of it) because it moves the chat handling functions out of Game.cs.

@teinarss
Copy link
Contributor

teinarss commented Jun 5, 2021

Needs a rebase now.

@dragunoff
Copy link
Contributor Author

Update:

  • rebased after the merge of Move Text handling to its own class #19436
  • renamed ChatLine to TextNotification to go better with the new TextNotificationManager class
  • applied other changes and fixes from the discussions above

OpenRA.Game/Network/TextNotification.cs Outdated Show resolved Hide resolved
OpenRA.Game/TextNotificationsManager.cs Show resolved Hide resolved
OpenRA.Game/TextNotificationsManager.cs Outdated Show resolved Hide resolved
@dragunoff
Copy link
Contributor Author

Update: Addressed some feedback by @teinarss and shuffled the methods in TextNotificationsManager some more. This has taken many iterations but I feel it's finally coming together 🤞

teinarss
teinarss previously approved these changes Jun 12, 2021
Copy link
Member

@pchote pchote left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple of very minor style nits then good to merge. I'm looking forward to this and #19458.

chatLineToDisplay = new TextNotification(
chatLine.Pool,
chatLine.Prefix,
string.Format("{0} ({1})", chatLine.Text, repetitions + 1),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can now be $"{chatLine.Text} ({repetitions + 1})"

public readonly Color PrefixColor;
public readonly string Prefix;
public readonly string Text;
public readonly Color TextColor;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pedantic nit (feel free to ignore): we list (color, text, text, color) here compared to (text, text, color, color) in the ctor. Could we reorder these fields to either (text, color, text, color) or (text, text, color, color) for consistency?


static void AddTextNotification(TextNotificationPool pool, string prefix, string text, Color? prefixColor = null, Color? textColor = null)
{
var thePrefixColor = prefixColor ?? chatMessageColor;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: we don't use "the" prefixes anywhere else in the code so these stick out as looking a bit odd.
These two lines are quite short and only used once, so how about we just inline them directly below? That would also save us from evaluating them if the pool is not enabled.

- Add a common class for passing around chat lines
- Add wrapper methods for adding chat lines
- Combine repeated chat lines in the display widget
@dragunoff
Copy link
Contributor Author

Update: addressed the nits from pchote

@pchote pchote merged commit 2ea6bfb into OpenRA:bleed Jul 4, 2021
@pchote
Copy link
Member

pchote commented Jul 4, 2021

https://github.com/OpenRA/OpenRA/wiki/Changelog-(bleed)/_compare/3ea046323dd9f25bd71803cad917f09557befb78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removing debug msgs for q and w shortcuts
6 participants