417 {
418 Widget item_card_widget = quickbar_item.GetRadialItemCard();
419
420
421 Widget item_details = item_card_widget.FindAnyWidget(
"ItemDetails" );
422 TextWidget item_title = TextWidget.Cast( item_card_widget.FindAnyWidget( "ItemTitle" ) );
423
424
425 TextWidget text_widget = TextWidget.Cast( item_card_widget.FindAnyWidget(
TEXT_ITEM_NAME ) );
426 EntityAI item = quickbar_item.GetItem();
427
428 Widget quantity_panel = item_card_widget.FindAnyWidget(
"QuantityPanel" );
429 if ( item )
430 {
431
432 text_widget.SetText( quickbar_item.GetItem().GetDisplayName() );
433
434
435 ItemPreviewWidget item_preview = ItemPreviewWidget.Cast( item_card_widget.FindAnyWidget( "ItemPreview" ) );
437 item_preview.
SetView( item.GetViewIndex() );
439
440
441 Widget quantity_stack = quantity_panel.FindAnyWidget(
"QuantityStackPanel" );
442 ProgressBarWidget quantity_bar = ProgressBarWidget.Cast( quantity_panel.FindAnyWidget( "QuantityBar" ) );
443 int has_quantity = QuantityConversions.HasItemQuantity( item );
444
446 {
447 quantity_panel.Show( false );
448 }
450 {
451
452 quantity_bar.Show( false );
453
454
455 TextWidget quantity_text = TextWidget.Cast( quantity_stack.FindAnyWidget( "Quantity" ) );
456 quantity_text.SetText( QuantityConversions.GetItemQuantityText( item ) );
457 quantity_stack.Show( true );
458 }
460 {
461
462 quantity_stack.Show( false );
463
464
465 float progress_max = quantity_bar.GetMax();
466 int max = item.ConfigGetInt( "varQuantityMax" );
467 int count = item.ConfigGetInt( "count" );
468 float quantity = QuantityConversions.GetItemQuantity(
ItemBase.Cast( item ) );
469
470 if ( count > 0 )
471 {
472 max = count;
473 }
474 if ( max > 0 )
475 {
476
477 float value = Math.Round( ( quantity / max ) * 100 );
478 quantity_bar.SetCurrent( value );
479 }
480
481 quantity_bar.Show( true );
482 }
483
484
485 item_details.Show( true );
486 item_title.Show( false );
487 }
488 else if ( quickbar_item.GetCategorySwitchID() != -1 )
489 {
490 item_title.SetText( quickbar_item.GetItemName() );
491
492 item_details.Show( false );
493 item_title.Show( true );
494 }
495 else
496 {
497 item_title.SetText( "#container_empty" );
498
499
500 item_details.Show( false );
501 item_title.Show( true );
502 }
503 }
class GP5GasMask extends MaskBase ItemBase
const int QUANTITY_PROGRESS
const int QUANTITY_HIDDEN
proto native vector Vector(float x, float y, float z)
Vector constructor from components.