|
1 |
| -using System; |
2 |
| -using System.Collections.Generic; |
3 |
| -using System.Linq; |
4 |
| -using System.Text; |
5 |
| -using System.Threading.Tasks; |
6 |
| -using CitizenFX.Core; |
| 1 | +using System.Collections.Generic; |
| 2 | +using static CitizenFX.Core.Native.Function; |
7 | 3 | using static CitizenFX.Core.Native.API;
|
8 | 4 |
|
9 | 5 | namespace MenuAPI
|
@@ -68,5 +64,63 @@ internal override void Draw(int indexOffset)
|
68 | 64 |
|
69 | 65 | base.Draw(indexOffset);
|
70 | 66 | }
|
| 67 | + |
| 68 | + internal override void GoRight() |
| 69 | + { |
| 70 | + if (ItemsCount > 0) |
| 71 | + { |
| 72 | + int oldIndex = ListIndex; |
| 73 | + int newIndex = oldIndex; |
| 74 | + if (ListIndex >= ItemsCount - 1) |
| 75 | + { |
| 76 | + newIndex = 0; |
| 77 | + } |
| 78 | + else |
| 79 | + { |
| 80 | + newIndex++; |
| 81 | + } |
| 82 | + ListIndex = newIndex; |
| 83 | + ParentMenu.ListItemIndexChangeEvent(ParentMenu, this, oldIndex, newIndex, Index); |
| 84 | +#if FIVEM |
| 85 | + PlaySoundFrontend(-1, "NAV_LEFT_RIGHT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false); |
| 86 | +#endif |
| 87 | +#if REDM |
| 88 | + // Has invalid parameter types in API. |
| 89 | + Call((CitizenFX.Core.Native.Hash)0xCE5D0FFE83939AF1, -1, "NAV_RIGHT", "HUD_SHOP_SOUNDSET", 1); |
| 90 | +#endif |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + internal override void GoLeft() |
| 95 | + { |
| 96 | + if (ItemsCount > 0) |
| 97 | + { |
| 98 | + int oldIndex = ListIndex; |
| 99 | + int newIndex = oldIndex; |
| 100 | + if (ListIndex < 1) |
| 101 | + { |
| 102 | + newIndex = ItemsCount - 1; |
| 103 | + } |
| 104 | + else |
| 105 | + { |
| 106 | + newIndex--; |
| 107 | + } |
| 108 | + ListIndex = newIndex; |
| 109 | + |
| 110 | + ParentMenu.ListItemIndexChangeEvent(ParentMenu, this, oldIndex, newIndex, Index); |
| 111 | +#if FIVEM |
| 112 | + PlaySoundFrontend(-1, "NAV_LEFT_RIGHT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false); |
| 113 | +#endif |
| 114 | +#if REDM |
| 115 | + // Has invalid parameter types in API. |
| 116 | + Call((CitizenFX.Core.Native.Hash)0xCE5D0FFE83939AF1, -1, "NAV_LEFT", "HUD_SHOP_SOUNDSET", 1); |
| 117 | +#endif |
| 118 | + } |
| 119 | + } |
| 120 | + |
| 121 | + internal override void Select() |
| 122 | + { |
| 123 | + ParentMenu.ListItemSelectEvent(ParentMenu, this, ListIndex, Index); |
| 124 | + } |
71 | 125 | }
|
72 | 126 | }
|
0 commit comments