@@ -1284,8 +1284,8 @@ internal async void Draw()
12841284 }
12851285#endif
12861286
1287- #if FIVEM
12881287 #region draw counter + pre-counter text
1288+ #if FIVEM
12891289 string counterText = $ "{ CounterPreText ?? "" } { CurrentIndex + 1 } / { Size } ";
12901290 if ( ! string . IsNullOrEmpty ( CounterPreText ) || MaxItemsOnScreen < Size )
12911291 {
@@ -1325,9 +1325,26 @@ internal async void Draw()
13251325 {
13261326 MenuItemsYOffset += bgHeight - 1f ;
13271327 }
1328+ #endif
1329+ #if REDM
1330+ if ( Size > 0 )
1331+ {
1332+ float textSize = ( 12f * 27f ) / MenuController . ScreenHeight ;
1333+ Call ( SET_TEXT_SCALE , textSize , textSize ) ;
1334+ Call ( ( CitizenFX . Core . Native . Hash ) 0x50A41AD966910F03 , 135 , 135 , 135 , 255 ) ; // _SET_TEXT_COLOUR / 0x50A41AD966910F03
1335+ Call ( SET_TEXT_CENTRE , true ) ;
1336+ float textMinX = ( headerSize . Key / 2f ) / MenuController . ScreenWidth ;
1337+ float textMaxX = ( Width - 10f ) / MenuController . ScreenWidth ;
1338+ float textY = ( MenuItemsYOffset + 38f * ( MathUtil . Clamp ( Size , 0 , MaxItemsOnScreen ) + 1 ) - 11f ) / MenuController . ScreenHeight ;
1339+ int font = 23 ;
1340+ Call ( ( CitizenFX . Core . Native . Hash ) 0xADA9255D , font ) ;
1341+ //SetTextWrap(textMinX, textMaxX);
1342+
1343+ Call ( _DRAW_TEXT , Call < long > ( _CREATE_VAR_STRING , 10 , "LITERAL_STRING" , $ "{ CurrentIndex + 1 } of { Size } ") , textMinX , textY ) ;
1344+ }
1345+ #endif
13281346
13291347 #endregion
1330- #endif
13311348 }
13321349 #endregion
13331350
@@ -1339,7 +1356,6 @@ internal async void Draw()
13391356 SetScriptGfxAlignParams ( 0f , 0f , 0f , 0f ) ;
13401357#endif
13411358
1342-
13431359 //DrawSprite(MenuController._texture_dict, "gradient_bgd", x, y, width, height, 0f, 255, 255, 255, 255);
13441360#if FIVEM
13451361 float bgHeight = 38f * MathUtil . Clamp ( Size , 0 , MaxItemsOnScreen ) ;
@@ -1351,20 +1367,39 @@ internal async void Draw()
13511367
13521368 ResetScriptGfxAlign ( ) ;
13531369 DrawRect ( x , y , width , height , 0 , 0 , 0 , 180 ) ;
1370+ MenuItemsYOffset += bgHeight - 1f ;
13541371#endif
13551372#if REDM
13561373 //float x = (Position.Key + ((headerSize.Key) / 2f)) / MenuController.ScreenWidth;
13571374 //float y = ((Position.Value + MenuItemsYOffset + ((bgHeight + 1f) / 2f) /) / MenuController.ScreenHeight);
13581375 //float width = (headerSize.Key + 16f) / MenuController.ScreenWidth;
13591376 //float height = (bgHeight + 17f) / MenuController.ScreenHeight;
13601377 float bgHeight = 38f * MathUtil . Clamp ( Size , 0 , MaxItemsOnScreen ) ;
1378+ var currentMenuItem = GetCurrentMenuItem ( ) ;
1379+ float descriptionBoxHeight = 0f ;
1380+ if ( currentMenuItem != null && ! string . IsNullOrEmpty ( currentMenuItem . Description ) )
1381+ {
1382+ int count = ( currentMenuItem . Description . Count ( ( a => { return a == '\n ' ; } ) ) - 1 ) ;
1383+ if ( count < 1 )
1384+ {
1385+ descriptionBoxHeight = 42f ;
1386+ }
1387+ else
1388+ {
1389+ descriptionBoxHeight = ( 38f * count ) + 30f ;
1390+ }
1391+
1392+ bgHeight += descriptionBoxHeight ;
1393+ }
1394+ float actualBgYLocation = ( ( 38f + ( 38f / 2f ) + ( bgHeight / 2f ) ) / MenuController . ScreenHeight ) ;
13611395 float x = ( Position . Key + ( headerSize . Key / 2f ) ) / MenuController . ScreenWidth ;
1362- float y = ( ( Position . Value + MenuItemsYOffset + ( ( bgHeight + 1f - ( headerSize . Value ) ) / 2f ) ) / MenuController . ScreenHeight ) ;
1396+ float y = ( ( Position . Value + MenuItemsYOffset + ( ( bgHeight + 1f - ( headerSize . Value ) ) / 2f ) + 19f ) / MenuController . ScreenHeight ) ;
13631397 float width = headerSize . Key / MenuController . ScreenWidth ;
1364- float height = ( headerSize . Value + bgHeight + 33f ) / MenuController . ScreenHeight ;
1398+ float height = ( headerSize . Value + bgHeight + 33f + 38f ) / MenuController . ScreenHeight ;
13651399 Call ( DRAW_SPRITE , MenuController . _texture_dict , MenuController . _header_texture , x , y , width , height , 0f , 0 , 0 , 0 , 240 ) ;
1400+ Call ( DRAW_SPRITE , MenuController . _texture_dict , MenuController . _header_texture , x , y + actualBgYLocation - ( descriptionBoxHeight / MenuController . ScreenHeight ) , width , 38f / MenuController . ScreenHeight , 0f , 55 , 55 , 55 , 255 ) ;
1401+ MenuItemsYOffset += bgHeight - descriptionBoxHeight - 1f ;
13661402#endif
1367- MenuItemsYOffset += bgHeight - 1f ;
13681403 }
13691404 #endregion
13701405
@@ -1377,9 +1412,10 @@ internal async void Draw()
13771412 }
13781413 }
13791414 #endregion
1415+ float descriptionYOffset = 0f ;
1416+
13801417#if FIVEM
13811418 #region Up Down overflow Indicator
1382- float descriptionYOffset = 0f ;
13831419 if ( Size > 0 )
13841420 {
13851421 if ( Size > MaxItemsOnScreen )
@@ -1450,21 +1486,21 @@ internal async void Draw()
14501486 }
14511487
14521488 #endregion
1453-
1489+ #endif
14541490 #region Draw Description
14551491 if ( Size > 0 )
14561492 {
14571493 var currentMenuItem = GetCurrentMenuItem ( ) ;
14581494 if ( currentMenuItem != null && ! string . IsNullOrEmpty ( currentMenuItem . Description ) )
14591495 {
1460- #region description text
1496+ #region description text
14611497 int font = 0 ;
14621498 float textSize = ( 14f * 27f ) / MenuController . ScreenHeight ;
14631499
1500+ #if FIVEM
14641501 float textMinX = 0f + ( 10f / MenuController . ScreenWidth ) ;
14651502 float textMaxX = Width / MenuController . ScreenWidth - ( 10f / MenuController . ScreenWidth ) ;
14661503 float textY = MenuItemsYOffset / MenuController . ScreenHeight + ( 16f / MenuController . ScreenHeight ) + descriptionYOffset ;
1467-
14681504 SetScriptGfxAlign ( 76 , 84 ) ;
14691505 SetScriptGfxAlignParams ( 0f , 0f , 0f , 0f ) ;
14701506
@@ -1517,11 +1553,25 @@ internal async void Draw()
15171553 }
15181554
15191555 ResetScriptGfxAlign ( ) ;
1556+ #endif
1557+ #if REDM
15201558
1521- #endregion
1559+ Call ( SET_TEXT_SCALE , textSize , textSize ) ;
1560+ Call ( SET_TEXT_CENTRE , true ) ;
1561+ float textMinX = ( headerSize . Key / 2f ) / MenuController . ScreenWidth ;
1562+ float textMaxX = ( Width - 10f ) / MenuController . ScreenWidth ;
1563+ float textY = MenuItemsYOffset / MenuController . ScreenHeight + ( 18f / MenuController . ScreenHeight ) + ( 48f / MenuController . ScreenHeight ) ;
1564+ font = 23 ;
1565+ Call ( ( CitizenFX . Core . Native . Hash ) 0xADA9255D , font ) ;
1566+ Call ( _DRAW_TEXT , Call < long > ( _CREATE_VAR_STRING , 10 , "LITERAL_STRING" , $ "{ currentMenuItem . Description } ") , textMinX , textY ) ;
15221567
1568+ #endif
15231569
1524- #region background
1570+ #endregion
1571+
1572+
1573+ #if FIVEM
1574+ #region background
15251575 float descWidth = Width / MenuController . ScreenWidth ;
15261576 float descHeight = ( textHeight + 0.005f ) * lineCount + ( 8f / MenuController . ScreenHeight ) + ( 2.5f / MenuController . ScreenHeight ) ;
15271577 float descX = ( Position . Key + ( Width / 2f ) ) / MenuController . ScreenWidth ;
@@ -1534,19 +1584,20 @@ internal async void Draw()
15341584 DrawRect ( descX , descY , descWidth , descHeight , 0 , 0 , 0 , 180 ) ;
15351585
15361586 ResetScriptGfxAlign ( ) ;
1537- #endregion
1587+ #endregion
15381588
15391589 descriptionYOffset += descY + ( descHeight / 2f ) - ( 4f / MenuController . ScreenHeight ) ;
1590+ #endif
15401591 }
15411592 else
15421593 {
15431594 descriptionYOffset += MenuItemsYOffset / MenuController . ScreenHeight + ( 2f / MenuController . ScreenHeight ) + descriptionYOffset ;
15441595 }
15451596
15461597 }
1547-
15481598 #endregion
15491599
1600+ #if FIVEM
15501601 #region Draw Weapon Stats
15511602 {
15521603 if ( Size > 0 )
0 commit comments