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

◆ RefreshItemVariables()

void ScriptedWidgetEventHandler::RefreshItemVariables ( InventoryItem item,
vector data,
bool show_quantity,
bool show_temperature )
inlineprivate

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

585 {
586 int index = Math.Round(data[0]);
587 Widget bck = GetItemBackground(index);
588 Widget item_w;
589
590 if ( bck )
591 {
592 item_w = bck.FindAnyWidget("GridItem");
593 if ( item_w )
594 {
595 int has_quantity = m_Controller.HasItemQuantity( item );
596 Widget quantity_panel = bck.FindAnyWidget("QuantityPanel");
597 TextWidget item_quantity = TextWidget.Cast( bck.FindAnyWidget("Quantity") );
598 ProgressBarWidget quantity_progress = ProgressBarWidget.Cast( bck.FindAnyWidget("QuantityBar") );
599 Widget quantity_stack = bck.FindAnyWidget("QuantityStackPanel");
600 if ( has_quantity == QUANTITY_HIDDEN )
601 {
602 quantity_panel.Show( false );
603 }
604 else
605 {
606 quantity_panel.Show( true );
607 if ( has_quantity == QUANTITY_COUNT )
608 {
609 item_quantity.SetText( m_Controller.GetItemQuantityText( item ) );
610 quantity_stack.Show( true );
611 quantity_progress.Show( false );
612 }
613 else if ( has_quantity == QUANTITY_PROGRESS )
614 {
615 float progress_max = quantity_progress.GetMax();
616 int max = m_Controller.GetItemQuantityMax( item );
617 int count = m_Controller.GetItemCount( item );
618 float quantity = m_Controller.GetItemQuantity( item );
619 if ( count > 0 )
620 {
621 max = count;
622 }
623 if ( max > 0 )
624 {
625
626 float value = Math.Round( ( quantity / max ) * 100 );
627 quantity_progress.SetCurrent( value );
628 }
629 quantity_stack.Show( false );
630 quantity_progress.Show( true );
631 }
632 }
633
634 if ( show_temperature )
635 {
636 if ( item && item.IsInherited( InventoryItem ) )
637 {
638 int color = m_Controller.GetItemColor( this, item); // !!!!!
639 if ( color )
640 {
641 item_w.SetColor( color );
642 }
643 }
644 }
645 }
646 }
647 }
InventoryGridController m_Controller
Определения InventoryGrid.c:51
Widget GetItemBackground(int index)
Определения InventoryGrid.c:347
const int QUANTITY_PROGRESS
Определения constants.c:516
const int QUANTITY_COUNT
Определения constants.c:515
const int QUANTITY_HIDDEN
Определения constants.c:514
WorkspaceWidget Widget
Defined in code.

Перекрестные ссылки GetItemBackground(), m_Controller, QUANTITY_COUNT, QUANTITY_HIDDEN, QUANTITY_PROGRESS и Math::Round().

Используется в AddItem(), RefreshQuickbarItemVariables(), ResetItem(), SetItem(), UpdateItems(), UpdateQuantityItems() и UpdateTemperatureItems().