-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
Do we want this in for 1.8 ? |
a0c0f46
to
9038864
Compare
There was a problem hiding this 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.
NitroxPatcher/Patches/Persistent/SystemsSpawner_SetupSingleton_Patch.cs
Outdated
Show resolved
Hide resolved
NitroxClient/MonoBehaviours/Gui/MainMenu/ServersList/MainMenuServerListPanel.cs
Outdated
Show resolved
Hide resolved
NitroxClient/MonoBehaviours/Gui/MainMenu/ServersList/MainMenuServerListPanel.cs
Outdated
Show resolved
Hide resolved
NitroxClient/MonoBehaviours/Gui/MainMenu/ServerJoin/JoinServerBackend.cs
Outdated
Show resolved
Hide resolved
NitroxClient/MonoBehaviours/Gui/MainMenu/ServerJoin/JoinServerBackend.cs
Outdated
Show resolved
Hide resolved
8306604
to
4a037fe
Compare
UI looks better overall Legend :
Few suggestions about the UX, leaving that here I don't know how painful is it to do with the code-behind unity API :
About the UI :
|
159ce5a
to
499f6e6
Compare
c06b6b3
to
7af82d0
Compare
Also it's now controller friendly
This re-enables controller support
onClick.RemoveAllListeners() doesn't remove all listeners, see https://docs.unity3d.com/ScriptReference/Events.UnityEventBase.RemoveAllListeners.html
…eScope() is called
7af82d0
to
f90d74e
Compare
It's tightly coupled to |
3175938
to
52d7ec2
Compare
Would add those edits to improve the look & feel : playerNameInputField.textComponent.fontSizeMin = 20;
playerNameInputField.textComponent.fontSize = 20;
playerNameInputField.textComponent.fontSizeMax = 22;
colorPicker.onColorChange.AddListener((data) => playerNameInputField.textComponent.color = data.color); Found a crash (doesn't seem to be the case on master) :
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 () |
Works fine (apart from the crash) |
There was a problem hiding this 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"); |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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()}"); |
There was a problem hiding this comment.
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.
From Clement:
Partial-Completes #1653
Closes #1816