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

Add MainMenu Controller support #2055

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

Jannify
Copy link
Member

@Jannify Jannify commented Jun 24, 2023

  • Make server list controller friendly
  • Add delete confirmation for server list
  • Make server add window in SN based UI
  • Make server add window controller friendly
  • Make server join window controller friendly
  • Make server password window controller friendly
  • Add loading and (error-)message window

From Clement:

  • Unable to scroll with the mousewheel through the server listview when it, I need to hover or focus it with a click on the scrollbar to be able to use the mousewheel scroll
  • No visual hint that the server has been successfully added to the list using Add Server menu
  • No warning before clicking on delete on a serve rentry, which is a bit frustrating when using it accidentaly
  • Didn't look if there's a timeout in our code but in the Loading screen might need a Cancel button if it can be a long process
  • When joining a reachable server, there's no preview of the color we're choosing that we used to have
  • Unable to use tab to switch between entry in server create menu
  • Maybe we could add some margin in the server listview between items. The first item is overflowing a bit on the top, you can see if you force the scroll to offset the listview
  • Add server button looks like a server entry which could be confusing, maybe we could slightly restyle it or move it elsewhere
  • Unable to connect to server text, ip could be centered

grafik

Partial-Completes #1653
Closes #1816

Copy link

@Drakonkinst Drakonkinst left a comment

Choose a reason for hiding this comment

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

Hi! I'm new here, but I've been reading PRs to get an idea of how this mod is developed. Feel free to take my advice with a grain of salt.

Nitrox.Assets.Subnautica/LanguageFiles/en.json Outdated Show resolved Hide resolved
@tornac1234 tornac1234 added the Area: input Related to game input device handling and key mapping label Dec 23, 2023
@tornac1234
Copy link
Collaborator

Do we want this in for 1.8 ?

@Jannify Jannify marked this pull request as ready for review March 19, 2024 23:48
Copy link
Collaborator

@tornac1234 tornac1234 left a comment

Choose a reason for hiding this comment

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

Currently when we click on a server (to join it) and click on another menu (e.g. Play, Multiplayer) while connecting to the server (first step which is notably long when trying to connect to a server that is not started) there's a loading panel appearing which ends up opening an "unable to connect" panel when failing. But this will still open even if we opened another menu in the meantime. For example if we open options while connecting to a server, when we get the fail message, the menu will try to switch to the multiplayer panel but fail and will leave an empty screen.
A fix for this would to cut connection when exiting the loading tab while connecting to a server.

Also I had some issues while selecting the color picker for some reason, some times it work pretty well, but some times it didn't.

Nitrox.Assets.Subnautica/LanguageFiles/en.json Outdated Show resolved Hide resolved
NitroxClient/GameLogic/Settings/NitroxSettingsManager.cs Outdated Show resolved Hide resolved
NitroxModel/Core/NitroxServiceLocator.cs Show resolved Hide resolved
@Jannify Jannify force-pushed the controllerSupport branch 2 times, most recently from 8306604 to 4a037fe Compare May 10, 2024 19:17
@dartasen
Copy link
Member

dartasen commented May 11, 2024

UI looks better overall

Legend :

  • 🔴 Very frustrating
  • 🟠 frustrating
  • 🟢 Idea

Few suggestions about the UX, leaving that here I don't know how painful is it to do with the code-behind unity API :

  • 🔴Unable to scroll with the mousewheel through the server listview when it, I need to hover or focus it with a click on the scrollbar to be able to use the mousewheel scroll
  • 🟢 No visual hint that the server has been successfully added to the list using Add Server menu =>
    • Maybe a Log.InGame would do the trick if a proper UI is hard to implement
    • Either add the server at the top of the list or scroll to the entry when it has been added
  • 🔴 No warning before clicking on delete on a serve rentry, which is a bit frustrating when using it accidentaly =>
    • A warning popup would do the trick
  • 🟠 Didn't look if there's a timeout in our code but in the Loading screen might need a Cancel button if it can be a long process
  • 🟠When joining a reachable server, there's no preview of the color we're choosing that we used to have =>
    • Maybe coloring the player name text can be enough if adding back the color rectangle could break the UI
  • 🟠 Unable to use tab to switch between entry in server create menu

About the UI :

  • 🟢 Maybe we could add some margin in the server listview between items =>
    • The first item is overflowing a bit on the top, you can see if you force the scroll to offset the listview
  • 🟢 Add server button looks like a server entry which could be confusing, maybe we could slightly restyle it or move it elsewhere
  • 🟢 Unable to connect to server text, ip could be centered

@Measurity Measurity added this to the 1.8 milestone Aug 9, 2024
@dartasen dartasen mentioned this pull request Aug 21, 2024
@Jannify Jannify force-pushed the controllerSupport branch 3 times, most recently from c06b6b3 to 7af82d0 Compare October 29, 2024 22:08
@Jannify
Copy link
Member Author

Jannify commented Oct 30, 2024

  • Didn't look if there's a timeout in our code but in the Loading screen might need a Cancel button if it can be a long process

It's tightly coupled to multiplayerSession.ConnectAsync(serverIp, serverPort). So if this call fails, LiteNetLib gets a response or the timeout elapses it will switch to another screen.

@dartasen
Copy link
Member

dartasen commented Nov 9, 2024

The improvements you made looks great so far !

Noticed few minors things bugs :

  • Seems like the red delete color is only applied to freshly created server entry, it does not apply to existing one
    image
  • Sometimes when a button loose focus, it's text will stuck with a black color, reproductible when navigating back&forth multiple time. (Happens to all button on the multiplayer UI, not just that one)
    image

Noticed few bugs with some translations, but that's not up to that PR, i'll do the fix on weblate.

@dartasen
Copy link
Member

dartasen commented Nov 17, 2024

Would add those edits to improve the look & feel :
MainMenuJoinServerPanel:64

playerNameInputField.textComponent.fontSizeMin = 20;
playerNameInputField.textComponent.fontSize = 20;
playerNameInputField.textComponent.fontSizeMax = 22;

MainMenuJoinServerPanel:77

colorPicker.onColorChange.AddListener((data) => playerNameInputField.textComponent.color = data.color);

Found a crash (doesn't seem to be the case on master) :

  • Open Launcher
  • Start Game (wait for full launch)
  • Start Server
  • Server will show a SocketException (LAN Broadcast server trying to bind to a used port)
  • Game should crash

Stack trace :

0x00007FFF78BDEC34 (UnityPlayer) UnityMain
0x000001D7F9719E0A (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Mesh:Internal_Create (UnityEngine.Mesh)
0x000001D7F9719D5B (Mono JIT Code) UnityEngine.Mesh:.ctor ()
0x000001D7F9719913 (Mono JIT Code) TMPro.TextMeshProUGUI:Awake ()
0x000001D7838C0FD0 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007FFF77E8E290 (mono-2.0-bdwgc) mono_get_runtime_build_info
0x00007FFF77E12AC2 (mono-2.0-bdwgc) mono_perfcounters_init
0x00007FFF77E1BB1F (mono-2.0-bdwgc) mono_runtime_invoke
0x00007FFF78DABCFD (UnityPlayer) UnityMain
0x000001D7F9746B66 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Object:Internal_CloneSingleWithParent (UnityEngine.Object,UnityEngine.Transform,bool)
0x000001D7F974699B (Mono JIT Code) UnityEngine.Object:Instantiate (UnityEngine.Object,UnityEngine.Transform,bool)
0x000001D7F974688B (Mono JIT Code) UnityEngine.Object:Instantiate<T_REF> (T_REF,UnityEngine.Transform,bool)
0x000001D8010082AB (Mono JIT Code) NitroxClient.MonoBehaviours.Gui.MainMenu.ServersList.MainMenuServerListPanel:CreateServerButton (string,string,int,bool)
0x000001D80107D47B (Mono JIT Code) NitroxClient.MonoBehaviours.Gui.MainMenu.ServersList.MainMenuServerListPanel:<FindLANServersAsync>g__AddButton|37_0 (System.Net.IPEndPoint)
0x000001D80107D314 (Mono JIT Code) NitroxClient.Communication.LANBroadcastClient:OnServerFound (System.Net.IPEndPoint)
0x000001D8010611F3 (Mono JIT Code) NitroxClient.Communication.LANBroadcastClient:<SearchInternalAsync>g__ReceivedResponse|9_0 (System.Net.IPEndPoint,LiteNetLib.NetPacketReader,LiteNetLib.UnconnectedMessageType)
0x000001D80106103E (Mono JIT Code) LiteNetLib.EventBasedNetListener:LiteNetLib.INetEventListener.OnNetworkReceiveUnconnected (System.Net.IPEndPoint,LiteNetLib.NetPacketReader,LiteNetLib.UnconnectedMessageType)
0x000001D801060BC6 (Mono JIT Code) LiteNetLib.NetManager:ProcessEvent (LiteNetLib.NetEvent)
0x000001D801030963 (Mono JIT Code) LiteNetLib.NetManager:PollEvents ()
0x000001D801030083 (Mono JIT Code) NitroxClient.Communication.LANBroadcastClient/<>c__DisplayClass9_0/<<SearchInternalAsync>b__2>d:MoveNext ()

@dartasen
Copy link
Member

Works fine (apart from the crash)

Copy link
Collaborator

@Measurity Measurity left a comment

Choose a reason for hiding this comment

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

Minor things, otherwise LGTM CW

{
if (!instance)
{
Log.Error("Tried to use ShowLoading() while MainMenuJoinServerNotificationPanel was not ready");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should use nameof when referring to code symbols.

Log.ErrorSensitive("Unable to contact the remote server at: {ip}:{port}", serverIp, serverPort);
string msg = $"{Language.main.Get("Nitrox_UnableToConnect")} {serverIp}:{serverPort}";

if (serverIp.Equals("127.0.0.1"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should check for ipv6 too

public static async Task StartMultiplayerClientAsync(IPAddress ip, int port)
{
    // ...
    if (ip.IsLocalhost())
    // ...
}

public bool OnButtonDown(GameInput.Button button)
{
if (button != GameInput.Button.UICancel)
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use brackets for if statement or move return false after the if on same line.

{
if (t is { IsFaulted: true, Exception: { } ex })
{
Log.Warn($"Failed to execute FindLANServersAsync: {ex.GetFirstNonAggregateMessage()}");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use nameof when referencing code symbols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: input Related to game input device handling and key mapping
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add controller support for in-game UI Steam features (like Controller mapping) won't load with direct start
6 participants