DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ UpdateQuickbarItemCard() [2/2]

void UIScriptedMenu::UpdateQuickbarItemCard ( RadialQuickbarItem quickbar_item)
inlineprotected

См. определение в файле RadialQuickbarMenu.c строка 414

415 {
416 Widget item_card_widget = quickbar_item.GetRadialItemCard();
417
418 //get content panels
419 Widget item_details = item_card_widget.FindAnyWidget( "ItemDetails" );
420 TextWidget item_title = TextWidget.Cast( item_card_widget.FindAnyWidget( "ItemTitle" ) );
421
422 //set text
423 TextWidget text_widget = TextWidget.Cast( item_card_widget.FindAnyWidget( TEXT_ITEM_NAME ) );
424 EntityAI item = quickbar_item.GetItem();
425
426 Widget quantity_panel = item_card_widget.FindAnyWidget( "QuantityPanel" );
427 if ( item )
428 {
429 //item text
430 text_widget.SetText( quickbar_item.GetItem().GetDisplayName() );
431
432 //item preview
433 ItemPreviewWidget item_preview = ItemPreviewWidget.Cast( item_card_widget.FindAnyWidget( "ItemPreview" ) );
434 item_preview.SetItem( item );
435 item_preview.SetView( item.GetViewIndex() );
436 item_preview.SetModelOrientation( Vector( 0,0,0 ) );
437
438 //item quantity
439 Widget quantity_stack = quantity_panel.FindAnyWidget( "QuantityStackPanel" );
440 ProgressBarWidget quantity_bar = ProgressBarWidget.Cast( quantity_panel.FindAnyWidget( "QuantityBar" ) );
441 int has_quantity = QuantityConversions.HasItemQuantity( item );
442 //calculate and set quantity
443 if ( has_quantity == QUANTITY_HIDDEN )
444 {
445 quantity_panel.Show( false );
446 }
447 else if ( has_quantity == QUANTITY_COUNT )
448 {
449 //hide bar
450 quantity_bar.Show( false );
451
452 //show stack
453 TextWidget quantity_text = TextWidget.Cast( quantity_stack.FindAnyWidget( "Quantity" ) );
454 quantity_text.SetText( QuantityConversions.GetItemQuantityText( item ) );
455 quantity_stack.Show( true );
456 }
457 else if ( has_quantity == QUANTITY_PROGRESS )
458 {
459 //hide stack
460 quantity_stack.Show( false );
461
462 //show bar
463 float progress_max = quantity_bar.GetMax();
464 int max = item.ConfigGetInt( "varQuantityMax" );
465 int count = item.ConfigGetInt( "count" );
466 float quantity = QuantityConversions.GetItemQuantity( ItemBase.Cast( item ) );
467
468 if ( count > 0 )
469 {
470 max = count;
471 }
472 if ( max > 0 )
473 {
474
475 float value = Math.Round( ( quantity / max ) * 100 );
476 quantity_bar.SetCurrent( value );
477 }
478
479 quantity_bar.Show( true );
480 }
481
482 //display content panels
483 item_details.Show( true );
484 item_title.Show( false );
485 }
486 else if ( quickbar_item.GetCategorySwitchID() != -1 )
487 {
488 item_title.SetText( quickbar_item.GetItemName() );
489
490 item_details.Show( false );
491 item_title.Show( true );
492 }
493 else
494 {
495 item_title.SetText( "#container_empty" );
496
497 //display content panels
498 item_details.Show( false );
499 item_title.Show( true );
500 }
501 }
class LogManager EntityAI
class GP5GasMask extends MaskBase ItemBase
proto native void SetView(int viewIndex)
proto native void SetItem(EntityAI object)
proto native void SetModelOrientation(vector vOrientation)
const string TEXT_ITEM_NAME
Определения RadialQuickbarMenu.c:97
const int QUANTITY_PROGRESS
Определения constants.c:516
const int QUANTITY_COUNT
Определения constants.c:515
const int QUANTITY_HIDDEN
Определения constants.c:514
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
WorkspaceWidget Widget
Defined in code.

Перекрестные ссылки QuantityConversions::GetItemQuantity(), QuantityConversions::GetItemQuantityText(), QuantityConversions::HasItemQuantity(), QUANTITY_COUNT, QUANTITY_HIDDEN, QUANTITY_PROGRESS, RadialQuickbarItem(), Math::Round(), ItemPreviewWidget::SetItem(), ItemPreviewWidget::SetModelOrientation(), ItemPreviewWidget::SetView(), TEXT_ITEM_NAME и Vector().