Skip to content

Commit

Permalink
Pause/Lobby fix mouse handling logic
Browse files Browse the repository at this point in the history
  • Loading branch information
manups4e committed Sep 30, 2024
1 parent 074ef7a commit 08bdbec
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public int CurrentSelection
get { return Items.Count == 0 ? 0 : Pagination.CurrentMenuIndex; }
set
{
if (value == CurrentSelection) return;
if (value == Pagination.CurrentMenuIndex) return;
if (value < 0)
{
Pagination.CurrentMenuIndex = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public int CurrentSelection
get { return Items.Count == 0 ? 0 : Pagination.CurrentMenuIndex; }
set
{
if (value == CurrentSelection) return;
if (value == Pagination.CurrentMenuIndex) return;
API.ClearPedInPauseMenu();
if (value < 0)
{
Expand Down Expand Up @@ -268,9 +268,9 @@ public int CurrentSelection
{
lobby._pause._lobby.CallFunction("SET_PLAYERS_SELECTION", Pagination.GetScaleformIndex(Pagination.CurrentMenuIndex));
lobby._pause._lobby.CallFunction("SET_PLAYERS_QTTY", CurrentSelection + 1, Items.Count);
Items[CurrentSelection].Selected = true;
if (lobby.listCol[0].Type == "players" || (lobby.listCol.Any(x => x.Type == "players") && Items.Count > 0 && Items[0].KeepPanelVisible))
if (lobby.listCol[lobby.FocusLevel].Type == "players")
{
Items[CurrentSelection].Selected = true;
if (Items[CurrentSelection].ClonePed != null)
Items[CurrentSelection].CreateClonedPed();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ internal void _itemCreation(int page, int pageIndex, bool before, bool isOverflo
AddTextEntry($"menu_lobby_desc_{menuIndex}", item.Description);
BeginScaleformMovieMethod(lobby._pause._lobby.Handle, "ADD_LEFT_ITEM");
PushScaleformMovieFunctionParameterBool(before);
PushScaleformMovieFunctionParameterInt(menuIndex);
PushScaleformMovieFunctionParameterInt(scaleformIndex);
PushScaleformMovieFunctionParameterInt(item._itemId);
PushScaleformMovieMethodParameterString(item._formatLeftLabel);
if (item.DescriptionHash != 0 && string.IsNullOrWhiteSpace(item.Description))
Expand Down Expand Up @@ -195,7 +195,7 @@ internal void _itemCreation(int page, int pageIndex, bool before, bool isOverflo
AddTextEntry($"menu_pause_playerTab[{pause.Index}]_desc_{menuIndex}", item.Description);
BeginScaleformMovieMethod(pause._pause._pause.Handle, "ADD_PLAYERS_TAB_SETTINGS_ITEM");
PushScaleformMovieFunctionParameterBool(before);
PushScaleformMovieFunctionParameterInt(menuIndex);
PushScaleformMovieFunctionParameterInt(scaleformIndex);
PushScaleformMovieFunctionParameterInt(item._itemId);
PushScaleformMovieMethodParameterString(item._formatLeftLabel);
if (item.DescriptionHash != 0 && string.IsNullOrWhiteSpace(item.Description))
Expand Down Expand Up @@ -415,7 +415,7 @@ public int CurrentSelection
get { return Items.Count == 0 ? 0 : Pagination.CurrentMenuIndex; }
set
{
if (value == CurrentSelection)
if (value == Pagination.CurrentMenuIndex)
{
if (Parent != null && Parent.Visible)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public int CurrentSelection
get { return Items.Count == 0 ? 0 : Pagination.CurrentMenuIndex; }
set
{
if (value == CurrentSelection) return;
if (value == Pagination.CurrentMenuIndex) return;
if (value < 0)
{
Pagination.CurrentMenuIndex = 0;
Expand Down
36 changes: 17 additions & 19 deletions ScaleformUI_Csharp/Menus/Pause Menus/LobbyMenu/MainView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -520,27 +520,28 @@ public override async void ProcessMouse()
{
int foc = FocusLevel;
int curSel = 0;
if (_newStyle)
switch (listCol[foc].Type)
{
switch (listCol[foc].Type)
{
case "settings":
curSel = SettingsColumn.CurrentSelection;
case "settings":
curSel = SettingsColumn.CurrentSelection;
if (_newStyle)
SettingsColumn.Items[SettingsColumn.CurrentSelection].Selected = false;
break;
case "players":
curSel = PlayersColumn.CurrentSelection;
break;
case "players":
curSel = PlayersColumn.CurrentSelection;
if (_newStyle)
PlayersColumn.Items[PlayersColumn.CurrentSelection].Selected = false;
break;
case "missions":
curSel = MissionsColumn.CurrentSelection;
break;
case "missions":
curSel = MissionsColumn.CurrentSelection;
if (_newStyle)
MissionsColumn.Items[MissionsColumn.CurrentSelection].Selected = false;
break;
case "store":
curSel = StoreColumn.CurrentSelection;
break;
case "store":
curSel = StoreColumn.CurrentSelection;
if (_newStyle)
StoreColumn.Items[StoreColumn.CurrentSelection].Selected = false;
break;
}
break;
}
updateFocus(context, true);
int index = listCol[FocusLevel].Pagination.GetMenuIndexFromScaleformIndex(itemId);
Expand Down Expand Up @@ -675,9 +676,6 @@ public override async void ProcessControls()

public async void Select()
{
string result = await _pause._lobby.CallFunctionReturnValueString("SET_INPUT_EVENT", 16);

int[] split = result.Split(',').Select(int.Parse).ToArray();
switch (listCol[FocusLevel].Type)
{
case "settings":
Expand Down
42 changes: 24 additions & 18 deletions ScaleformUI_Csharp/Menus/Pause Menus/PauseMenu/TabView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1718,8 +1718,13 @@ public override async void ProcessMouse()
FocusLevel = 1;
if (Tabs[Index] is PlayerListTab tab)
{
if (tab.PlayersColumn.Items[tab.PlayersColumn.CurrentSelection].ClonePed != null)
tab.PlayersColumn.Items[tab.PlayersColumn.CurrentSelection].CreateClonedPed();
if (tab.listCol.Any(x => x.Type == "players"))
{
if (tab.PlayersColumn.Items[tab.PlayersColumn.CurrentSelection].ClonePed != null)
tab.PlayersColumn.Items[tab.PlayersColumn.CurrentSelection].CreateClonedPed();
else
ClearPedInPauseMenu();
}
else
ClearPedInPauseMenu();
}
Expand Down Expand Up @@ -1845,27 +1850,28 @@ public override async void ProcessMouse()
{
int foc = tab.Focus;
int curSel = 0;
if (tab._newStyle)
switch (tab.listCol[foc].Type)
{
switch (tab.listCol[foc].Type)
{
case "settings":
curSel = tab.SettingsColumn.CurrentSelection;
case "settings":
curSel = tab.SettingsColumn.CurrentSelection;
if (tab._newStyle)
tab.SettingsColumn.Items[tab.SettingsColumn.CurrentSelection].Selected = false;
break;
case "players":
curSel = tab.PlayersColumn.CurrentSelection;
break;
case "players":
curSel = tab.PlayersColumn.CurrentSelection;
if (tab._newStyle)
tab.PlayersColumn.Items[tab.PlayersColumn.CurrentSelection].Selected = false;
break;
case "missions":
curSel = tab.MissionsColumn.CurrentSelection;
break;
case "missions":
curSel = tab.MissionsColumn.CurrentSelection;
if (tab._newStyle)
tab.MissionsColumn.Items[tab.MissionsColumn.CurrentSelection].Selected = false;
break;
case "store":
curSel = tab.StoreColumn.CurrentSelection;
break;
case "store":
curSel = tab.StoreColumn.CurrentSelection;
if (tab._newStyle)
tab.StoreColumn.Items[tab.StoreColumn.CurrentSelection].Selected = false;
break;
}
break;
}
tab.updateFocus(context, true);
int index = tab.listCol[tab.Focus].Pagination.GetMenuIndexFromScaleformIndex(itemId);
Expand Down

0 comments on commit 08bdbec

Please sign in to comment.