DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
CargoContainer.c
См. документацию.
1//cargo grid wrapper
3{
4 protected const int ROWS_NUMBER_XBOX = 5;
5
6 protected CargoBase m_Cargo;
7 protected int m_CargoIndex = -1;
8
9 protected int m_FocusedItemPosition = -1;
11 protected ref array<ref Icon> m_Icons;
14
15 protected float m_IconSize;
16 protected float m_SpaceSize;
17
18 protected bool m_IsAttachment;
20 protected TextWidget m_AlternateFalseHeaderTextWidget; //to be set and updated along with the main one
24#ifndef PLATFORM_CONSOLE
25 protected ref SizeToChild m_Resizer1;
26#endif
27 protected ref SizeToChild m_Resizer2;
28 protected ref Timer m_ResizeTimer;
29
30 protected int m_AttachmentSlotID = -1;
31
32 void CargoContainer( LayoutHolder parent, bool is_attachment = false )
33 {
34 m_IsAttachment = is_attachment;
39
40 m_CargoContainer = m_RootWidget.FindAnyWidget( "grid_background" );
41 m_ItemsContainer = m_RootWidget.FindAnyWidget( "grid_overlay" );
42 m_CargoHeader = m_RootWidget.FindAnyWidget( "grid_container_header_spacer" );
43#ifndef PLATFORM_CONSOLE
44 m_RootWidget.GetScript( m_Resizer1 );
45#endif
46 m_RootWidget.FindAnyWidget( "grid_container" ).GetScript( m_Resizer2 );
47 m_CargoHeader.Show( is_attachment );
48 m_FalseHeaderTextWidget = TextWidget.Cast(m_CargoHeader.FindAnyWidget( "TextWidget0" ));
49
50 m_MainWidget = m_CargoContainer;
52 }
53
55 {
56 if ( m_Entity )
57 {
58 m_Entity.GetOnItemAddedIntoCargo().Remove( AddedToCargo );
59 m_Entity.GetOnItemRemovedFromCargo().Remove( RemovedFromCargo );
60 m_Entity.GetOnItemMovedInCargo().Remove( MovedInCargo );
61 m_Entity.GetOnSetLock().Remove( SetLock );
62 m_Entity.GetOnReleaseLock().Remove( ReleaseLock );
63 }
64 }
65
66 int GetCargoIndex() { return m_CargoIndex; }
67
68 void AddedToCargoEx( EntityAI item, bool refresh = true )
69 {
71 item.GetInventory().GetCurrentInventoryLocation( il );
72 int x = il.GetCol();
73 int y = il.GetRow();
74
75 if ( m_ShowedItemPositions.Contains( item ) )
76 {
78 InitIconEx( item_pos.param1, item, x, y, refresh );
79 item_pos.param2 = x;
80 item_pos.param3 = y;
81 }
82 else
83 {
84 ref Icon icon = new Icon( this, false );
85 m_Icons.Insert( icon );
86 InitIconEx( icon, item, x, y, refresh );
87 m_ShowedItemPositions.Insert( item, new Param3<ref Icon, int, int>( icon, x, y ) );
88 }
89
90 if (refresh)
92
93 #ifdef PLATFORM_CONSOLE
94 for ( int i = 0; i < m_Cargo.GetItemCount(); i++ )
95 {
96 EntityAI item2 = m_Cargo.GetItem( i );
98 if ( data )
99 {
100 data.param1.SetCargoPos( i );
101 data.param1.SetPos();
102 }
103 }
104
106
107 if (refresh)
108 Refresh();
109 #endif
110 }
111
113 {
114 AddedToCargoEx( item );
115 }
116
118 {
120 if( data )
121 {
122 m_Icons.RemoveItem( data.param1 );
123 m_ShowedItemPositions.Remove( item );
124 }
125
127
128 #ifdef PLATFORM_CONSOLE
129 for( int i = 0; i < m_Cargo.GetItemCount(); i++ )
130 {
131 EntityAI item2 = m_Cargo.GetItem( i );
132 data = m_ShowedItemPositions.Get( item2 );
133 if( data && data.param1 )
134 {
135 data.param1.SetCargoPos( i );
136 data.param1.SetPos();
137 }
138 }
139
141
142 Refresh();
143 #endif
144 }
145
147 {
149 item.GetInventory().GetCurrentInventoryLocation( il );
150
151 int x = il.GetCol();
152 #ifdef PLATFORM_CONSOLE
153 int y = il.GetRow() - 1;
154 #else
155 int y = il.GetRow();
156 #endif
157 if( m_ShowedItemPositions.Contains( item ) )
158 {
160 if( data.param1 )
161 {
162 if( data.param2 != x || data.param3 != y )
163 {
164 data.param2 = x;
165 data.param3 = y;
166 #ifdef PLATFORM_CONSOLE
167 data.param1.SetCargoPos( data.param3 );
168 #endif
169 #ifdef PLATFORM_WINDOWS
170 data.param1.SetPosX( data.param2 );
171 data.param1.SetPosY( data.param3 );
172 #endif
173 }
174 data.param1.UpdateInterval();
175 }
176 }
178 }
179
180 void SetLock( EntityAI item )
181 {
182 #ifndef PLATFORM_CONSOLE
183 if( GetGame().GetPlayer() )
184 {
186 int index = GetGame().GetPlayer().GetHumanInventory().FindUserReservedLocationIndex( item );
187 if( index >= 0 )
188 {
189 GetGame().GetPlayer().GetHumanInventory().GetUserReservedLocation( index, il );
190
191 ref Icon icon = new Icon( this, false );
192 m_Icons.Insert( icon );
193 icon.InitLock( m_Entity, item, il.GetCol(), il.GetRow(), il.GetFlip() );
194 m_ShowedLockPositions.Insert( item, new Param3<ref Icon, int, int>( icon, 1, 1 ) );
195 item.GetOnReleaseLock().Insert( ReleaseLock );
196 }
197 }
198 #endif
199 }
200
202 {
203 #ifndef PLATFORM_CONSOLE
204 if( m_ShowedLockPositions.Contains( item ) )
205 {
206 Icon ic = m_ShowedLockPositions.Get( item ).param1;
207 m_Icons.RemoveItem( ic );
208 m_ShowedLockPositions.Remove( item );
209 item.GetOnReleaseLock().Remove( ReleaseLock );
210 }
211 #endif
212 }
213
214 override void SetLayoutName()
215 {
216 #ifdef PLATFORM_CONSOLE
218 #else
219 switch( InventoryMenu.GetWidthType() )
220 {
221 case ScreenWidthType.NARROW:
222 {
224 break;
225 }
226 case ScreenWidthType.MEDIUM:
227 {
229 break;
230 }
231 case ScreenWidthType.WIDE:
232 {
234 break;
235 }
236 }
237 #endif
238
239 }
240
241 void SetEntity( EntityAI item, int cargo_index = 0, bool immedUpdate = true )
242 {
243 if ( item )
244 {
245 m_Entity = item;
246 m_Cargo = item.GetInventory().GetCargoFromIndex(cargo_index);
247 m_CargoIndex = cargo_index;
248
249 m_Entity.GetOnItemAddedIntoCargo().Insert( AddedToCargo );
250 m_Entity.GetOnItemRemovedFromCargo().Insert( RemovedFromCargo );
251 m_Entity.GetOnItemMovedInCargo().Insert( MovedInCargo );
252 m_Entity.GetOnSetLock().Insert( SetLock );
253 m_Entity.GetOnReleaseLock().Insert( ReleaseLock );
254
255 if (immedUpdate)
257
259 m_MainWidget = m_ItemsContainer;
260
261 if ( m_Cargo )
262 {
263 int i;
264 int prev_count = m_ShowedItemPositions.Count();
265
266 //START - Add new item Icons
267 for ( i = 0; i < m_Cargo.GetItemCount(); i++ )
268 {
269 EntityAI cargo_item = m_Cargo.GetItem( i );
270 if ( cargo_item )
271 {
272 AddedToCargoEx( cargo_item, immedUpdate );
273 }
274 }
275
276 #ifdef PLATFORM_CONSOLE
277 if (immedUpdate)
278 Refresh();
279 #endif
280 }
281 }
282 }
283
285 {
286 return m_Entity;
287 }
288
290 {
291 Widget header;
292 string name = m_Entity.GetDisplayName();
293 name.ToUpper();
294
295 if ( m_Entity.CanDisplayCargo() && m_Entity.GetInventory().GetCargoFromIndex(m_CargoIndex) )
296 {
297 name = name + " (" + GetCargoCapacity().ToString() + "/" + GetMaxCargoCapacity() + ")";
299 {
301 float x, y;
303 m_FalseHeaderTextWidget.GetScreenSize( x, y );
304 m_CargoHeader.FindAnyWidget( "grid_container_header" ).SetSize( 1, y + InventoryMenu.GetHeightMultiplied( 10 ) );
305 m_CargoHeader.Update();
306
308 {
310 }
311 return;
312 }
313 }
314
315 if ( Container.Cast( GetParent() ) && Container.Cast( GetParent() ).GetHeader() )
317 }
318
320 {
321 m_Rows.Clear();
322 m_ShowedItemPositions.Clear();
323
324 ref CargoContainerRow row;
325
326 #ifdef PLATFORM_CONSOLE
327 int cargo_height = 1;
328 #else
329 int cargo_height = m_Entity.GetInventory().GetCargoFromIndex(m_CargoIndex).GetHeight();
330 #endif
331
332 for ( int j = 0; j < cargo_height; j++ )
333 {
334 row = new CargoContainerRow( this );
335
336 row.SetNumber( j );
337 row.SetEntity( m_Entity );
338
339 #ifdef PLATFORM_WINDOWS
340 #ifndef PLATFORM_CONSOLE
341 row.SetWidth( m_Entity.GetInventory().GetCargoFromIndex(m_CargoIndex).GetWidth(), false );
342 #endif
343 #endif
344
345 row.GetRootWidget().SetSort( j, false );
346 m_Rows.Insert( row );
347 }
348
349 float y;
350 row.GetRootWidget().FindAnyWidget( "Icon0" ).GetScreenSize( y, m_IconSize );
351 #ifdef PLATFORM_WINDOWS
352 #ifndef PLATFORM_CONSOLE
353 row.GetRootWidget().FindAnyWidget( "Spacer0" ).GetScreenSize( m_SpaceSize, y );
354 #endif
355 #endif
356
357 m_Resizer2.ResizeParentToChild();
358#ifndef PLATFORM_CONSOLE
359 m_Resizer1.ResizeParentToChild();
360#endif
361 }
362
364 {
365#ifndef PLATFORM_CONSOLE
366 m_Resizer1.ResizeParentToChild();
367#else
368 m_Resizer2.ResizeParentToChild();
369#endif
370 }
371
373 {
374 return m_IconSize;
375 }
376
378 {
379 return m_SpaceSize;
380 }
381
383 {
384 #ifdef PLATFORM_CONSOLE
385 #ifndef PLATFORM_WINDOWS
386 return CargoList.Cast( m_Cargo ).GetTotalWeight( null );
387 #endif
388 #endif
389 int total_size = 0;
390 for ( int i = 0; i < m_Cargo.GetItemCount(); ++i )
391 {
392 int x, y;
393 m_Cargo.GetItemSize( i, x, y );
394 total_size += x * y;
395 }
396 return total_size;
397 }
398
400 {
401 #ifdef PLATFORM_CONSOLE
402 #ifndef PLATFORM_WINDOWS
403 return CargoList.Cast( m_Cargo ).GetMaxWeight();
404 #endif
405 #endif
406 return m_Cargo.GetWidth() * m_Cargo.GetHeight();
407 }
408
410 {
411 if ( item && m_ShowedItemPositions.Contains( item ) )
412 {
414 return data.param1;
415 }
416 return null;
417 }
418
419 Icon GetIcon( int index )
420 {
421 if ( m_Cargo == null )
422 {
423 return null;
424 }
425
426 if ( index >= 0 && m_Cargo.GetItemCount() > index )
427 return GetIcon( m_Cargo.GetItem( index ) );
428 return null;
429 }
430
432 {
434 }
435
436 override float GetFocusedContainerHeight( bool contents = false )
437 {
438 float x, y;
439 if( contents && GetFocusedIcon() )
440 GetFocusedIcon().GetRootWidget().GetScreenSize( x, y );
441 else
442 GetRootWidget().GetScreenSize( x, y );
443 return y;
444 }
445
446 override float GetFocusedContainerYPos( bool contents = false )
447 {
448 float x, y;
449 if( contents && GetFocusedIcon() )
450 GetFocusedIcon().GetRootWidget().GetPos( x, y );
451 else
452 GetRootWidget().GetPos( x, y );
453 return y;
454 }
455
456 override float GetFocusedContainerYScreenPos( bool contents = false )
457 {
458 float x, y;
459 if( contents && GetFocusedIcon() )
460 GetFocusedIcon().GetRootWidget().GetScreenPos( x, y );
461 else
462 GetRootWidget().GetScreenPos( x, y );
463 return y;
464 }
465
467 {
468 if( m_IsActive )
469 {
470 if( m_FocusedItemPosition >= m_Icons.Count() )
471 m_FocusedItemPosition = m_Icons.Count() - 1;
473 if( icon && !icon.IsActive() )
474 {
475 icon.SetActive( true );
476 Inventory.GetInstance().UpdateConsoleToolbar();
477 }
478 }
479 }
480
481 void UpdateRowVisibility(int count)
482 {
483 int i;
484 int rows = Math.Max(1, Math.Ceil((count + 1) / ROWS_NUMBER_XBOX));
485 if (m_Cargo)
486 {
488 if (rows > maxRows) // limit amout of cargo rows depending on max cargo capacity
489 rows = maxRows;
490 }
491 else
492 {
493 if (m_Entity)
494 Error(string.Format("%1::UpdateRowVisibility - CargoBase is NULL for entity %2 at position %3", ToString(), m_Entity.GetType(), m_Entity.GetPosition()));
495 }
496
497 int diff = rows - m_Rows.Count();
498 if(diff < 0)
499 {
500 for(i = m_Rows.Count() - 1; i >= rows; i--)
501 {
502 m_Rows.Remove(i);
503 }
504 }
505 else if(diff > 0)
506 {
507 m_MainWidget = m_CargoContainer;
508 for(i = m_Rows.Count(); i < rows; i++)
509 {
510 ref CargoContainerRow row = new CargoContainerRow(this);
511
512 row.SetNumber(i);
513 row.SetEntity(m_Entity);
514 row.GetRootWidget().SetSort(i);
515 m_Rows.Insert(row);
516 }
517 m_MainWidget = m_ItemsContainer;
518 }
519
520 m_Resizer2.ResizeParentToChild();
521 #ifndef PLATFORM_CONSOLE
522 m_Resizer1.ResizeParentToChild();
523 #endif
524 }
525
526 override void Refresh()
527 {
528 #ifdef PLATFORM_CONSOLE
529 if ( !m_ResizeTimer )
530 m_ResizeTimer = new Timer();
531 if ( m_ResizeTimer.IsRunning() )
532 m_ResizeTimer.Stop();
533 m_ResizeTimer.Run( 0.05, this, "RefreshImpl" );
534 #endif
535 }
536
538 {
541 }
542
543 override void UpdateInterval()
544 {
546 {
547 if( data.param1 )
548 {
549 data.param1.UpdateInterval();
550 }
551 }
552 }
553
554 Icon InitIconEx( Icon icon, EntityAI item, int pos_x, int pos_y, bool refresh = true )
555 {
556 #ifdef PLATFORM_CONSOLE
557 icon.SetSize( 1, 1 );
558 #ifdef PLATFORM_WINDOWS
559 pos_y = pos_y * 5 + pos_x;
560 #endif
561 icon.SetCargoPos( pos_y );
562 icon.SetPosY( pos_y );
563 icon.SetPosEx( refresh );
564 #else
565 int size_x, size_y;
566 GetGame().GetInventoryItemSize( InventoryItem.Cast( item ), size_x, size_y );
567
568 if ( item.GetInventory().GetFlipCargo() )
569 icon.SetSize( size_y, size_x );
570 else
571 icon.SetSize( size_x, size_y );
572
573 icon.SetPosX( pos_x );
574 icon.SetPosY( pos_y );
575 icon.SetPosEx( refresh );
576 #endif
577 icon.InitEx( item, refresh );
578 return icon;
579 }
580
581 Icon InitIcon( Icon icon, EntityAI item, int pos_x, int pos_y )
582 {
583 return InitIconEx( icon, item, pos_x, pos_y );
584 }
585
586 bool HasItem( EntityAI item )
587 {
588 return m_ShowedItemPositions.Contains( item );
589 }
590
592 {
593 if (CanDrop())
594 {
595 Man player = GetGame().GetPlayer();
596 if( GetFocusedIcon() )
597 {
598 ItemBase item = ItemBase.Cast( GetFocusedIcon().GetObject() );
599 if( item && player.CanDropEntity( item ) )
600 {
601 if( item.GetTargetQuantityMax() < item.GetQuantity() )
602 item.SplitIntoStackMaxClient( null, -1 );
603 else
604 player.PhysicalPredictiveDropItem( item );
605 return true;
606 }
607 }
608 }
609 return false;
610 }
611
612 override void SetDefaultFocus( bool while_micromanagment_mode = false )
613 {
614 super.SetDefaultFocus(while_micromanagment_mode);
615
616 Unfocus();
619 }
620
621 override void SetLastFocus()
622 {
624 }
625
626 override void Unfocus()
627 {
628 Icon icon = GetFocusedIcon();
629 if ( icon )
630 {
631 icon.SetActive( false );
632 }
633 }
634
635 override void UnfocusAll()
636 {
637 if( m_Icons )
638 {
639 foreach( Icon icon : m_Icons )
640 {
641 icon.SetActive( false );
642 }
643 }
645 }
646
647 override void SetNextActive()
648 {
649 Unfocus();
650 int focused_row = m_FocusedItemPosition / ROWS_NUMBER_XBOX;
651 int max_row = ( m_Icons.Count() - 1) / ROWS_NUMBER_XBOX;
652
653 if ( max_row > focused_row )
654 {
656 if ( m_FocusedItemPosition >= m_Icons.Count() )
657 {
658 m_FocusedItemPosition = m_Icons.Count() - 1;
659 }
661 }
662 else
663 {
664 SetActive(false);
665 }
666 }
667
668 override void SetPreviousActive( bool force = false )
669 {
670 Unfocus();
671 int focused_row = m_FocusedItemPosition / ROWS_NUMBER_XBOX;
672
673 if ( focused_row > 0 )
674 {
677 }
678 else
679 {
680 SetActive(false);
681 }
682 }
683
684
685 override void SetNextRightActive()
686 {
687 if ( m_Icons.Count() > 0)
688 {
689 Unfocus();
690 int focused_row = m_FocusedItemPosition / ROWS_NUMBER_XBOX;
691 int row_min = focused_row * ROWS_NUMBER_XBOX;
692 int row_max = row_min + ROWS_NUMBER_XBOX - 1;
693
694 if ( row_max >= m_Icons.Count() )
695 {
696 row_max = m_Icons.Count() - 1;
697 }
698
700 if( m_FocusedItemPosition > row_max )
701 {
702 m_FocusedItemPosition = row_min;
703 }
704
706 }
707 }
708
709 override void SetNextLeftActive()
710 {
711 if ( m_Icons.Count() > 0)
712 {
713 Unfocus();
714 int focused_row = m_FocusedItemPosition / ROWS_NUMBER_XBOX;
715 int row_min = focused_row * ROWS_NUMBER_XBOX;
716 int row_max = row_min + ROWS_NUMBER_XBOX - 1;
717
718 if ( row_max >= m_Icons.Count() )
719 {
720 row_max = m_Icons.Count() - 1;
721 }
722
724 if( m_FocusedItemPosition < row_min )
725 {
726 m_FocusedItemPosition = row_max;
727 }
728
730 }
731 }
732
734 {
735 Icon icon = GetFocusedIcon();
736 if( icon )
737 {
738 return EntityAI.Cast( icon.GetObject() );
739 }
740
741 return null;
742 }
743
744 override void SetLastActive()
745 {
746 super.SetLastActive();
747 if( GetFocusedIcon() )
748 {
749 GetFocusedIcon().SetActive( false );
750 }
751
752 int focusedIconCount = m_Icons.Count();
753 int columCount = m_Icons.Count() / ROWS_NUMBER_XBOX;
754 if (focusedIconCount > ROWS_NUMBER_XBOX)
755 {
756 int iconMax = columCount * ROWS_NUMBER_XBOX;
757 int diff = focusedIconCount - iconMax;
758 if (diff == 0)
759 diff = ROWS_NUMBER_XBOX;
760 m_FocusedItemPosition = focusedIconCount - diff;
761 }
762 else
763 {
765 }
767 }
768
769 override void SetActive( bool active )
770 {
771 super.SetActive( active );
773 }
774
775 override bool IsItemActive()
776 {
777 if( GetFocusedIcon() )
778 {
779 ItemBase item = ItemBase.Cast( GetFocusedIcon().GetObject() );
780 return ( item != null );
781 }
782 return false;
783 }
784
786 {
787 if( GetFocusedIcon() )
788 {
789 ItemBase item = ItemBase.Cast( GetFocusedIcon().GetObject() );
790 return ( !IsEmpty() && QuantityConversions.HasItemQuantity( item ) && item.CanBeSplit() );
791 }
792 return false;
793 }
794
795 override bool IsEmpty()
796 {
797 return m_Icons.Count() == 0;
798 }
799
800 int GetRecipeCount( bool recipe_anywhere, ItemBase entity1, ItemBase entity2, PlayerBase player )
801 {
802 PluginRecipesManager recipes_manager = PluginRecipesManager.Cast( GetPlugin( PluginRecipesManager ) );
803 return recipes_manager.GetValidRecipes( entity1, entity2, null, player );
804 }
805
806 override bool CanCombineAmmo()
807 {
808 if( GetFocusedIcon() )
809 {
811
812 ItemBase entity = ItemBase.Cast( GetFocusedIcon().GetObject() );
813 ItemBase item_in_hands = ItemBase.Cast( GetGame().GetPlayer().GetHumanInventory().GetEntityInHands() );
814
815 return ( amc.CanPerformActionFromInventory( item_in_hands, entity ) || amc.CanSetActionFromInventory( item_in_hands, entity ) );
816 }
817 return false;
818 }
819
820 override bool TransferItem()
821 {
822 if (CanTakeToInventory())
823 {
824 if (GetFocusedIcon())
825 {
826 EntityAI entity = EntityAI.Cast( GetFocusedIcon().GetObject() );
827 if (entity)
828 {
829 GetGame().GetPlayer().PredictiveTakeEntityToInventory( FindInventoryLocationType.CARGO, entity );
830 return true;
831 }
832 }
833 }
834 return false;
835 }
836
837 override bool SelectItem()
838 {
839 Icon focused_item = GetFocusedIcon();
840 if (focused_item)
841 {
842 ItemBase item = ItemBase.Cast(focused_item.GetObject());
843 if (item && item.IsTakeable() && item.CanPutIntoHands(null))
844 {
845 ItemManager.GetInstance().SetSelectedItemEx(item, this, focused_item);
846 return true;
847 }
848 }
849 return false;
850 }
851
852 override bool Select()
853 {
854 EntityAI focused_item = GetFocusedItem();
856 DayZPlayer player = GetGame().GetPlayer();
857
858
859 if( focused_item != selected_item )
860 {
861 if( selected_item )
862 {
863 if( selected_item.GetInventory().CanRemoveEntity() && m_Entity )
864 {
865 bool can_add = m_Entity.GetInventory().CanAddEntityInCargo( selected_item, selected_item.GetInventory().GetFlipCargo());
866 bool in_cargo = !player.GetInventory().HasEntityInInventory( selected_item ) || !m_Entity.GetInventory().HasEntityInCargo( selected_item );
867 if( can_add && in_cargo )
868 {
869 player.PredictiveTakeEntityToTargetCargo( m_Entity, selected_item );
871 if( selected_cont2 )
872 {
873 selected_cont2.SetActive( false );
874 }
875
876 SetActive( true );
878 return true;
879 }
880 else
881 {
883 if( selected_cont )
884 {
885 selected_cont.SetActive( false );
886 }
887
888 SetActive( true );
889 SetDefaultFocus( true );
890 }
891 }
892 }
893 else if ( focused_item && focused_item.GetInventory().CanRemoveEntity() )
894 {
895 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
896 if( item_in_hands )
897 {
898 if( GameInventory.CanSwapEntitiesEx( item_in_hands, focused_item ) )
899 {
900 player.PredictiveSwapEntities( item_in_hands, focused_item );
901 return true;
902 }
903 }
904 else
905 {
906 if( player.GetHumanInventory().CanAddEntityInHands( focused_item ) )
907 {
908 player.PredictiveTakeEntityToHands( focused_item );
909 return true;
910 }
911 }
912 }
913 }
914 return false;
915 }
916
917 override bool Combine()
918 {
919 if (CanCombine())
920 {
921 if (GetFocusedIcon())
922 {
923 Icon icon = GetFocusedIcon();
924 if( icon )
925 {
926 EntityAI item_in_hands = GetGame().GetPlayer().GetHumanInventory().GetEntityInHands();
927 EntityAI prev_item = EntityAI.Cast( icon.GetObject() );
928 if( item_in_hands && prev_item )
929 {
930 return icon.CombineItems( item_in_hands, prev_item );
931 }
932 }
933 }
934 }
935 return false;
936 }
937
938 void ShowFalseCargoHeader(bool show)
939 {
940 m_CargoHeader.Show(show);
941 }
942
944 {
947 if (update)
948 {
950 }
951 }
952
953 void SetAttachmentSlotID(int slotID)
954 {
955 m_AttachmentSlotID = slotID;
956 }
957
959 {
960 return m_AttachmentSlotID;
961 }
962
964 {
965 return m_Icons.Count();
966 }
967}
void Inventory(LayoutHolder parent)
Определения Inventory.c:74
EntityAI m_Entity
Определения ActionDebug.c:11
Object GetObject()
Определения ActionTargets.c:122
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
map
Определения ControlsXboxNew.c:4
void GetActionManager()
Определения CrossHairSelector.c:132
proto string ToString()
Icon x
Icon y
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
ScreenWidthType
Определения InventoryMenu.c:2
void InventoryMenu()
Определения InventoryMenu.c:20
bool m_IsActive
Определения ModifierBase.c:19
PlayerBase GetPlayer()
Определения ModifierBase.c:51
string GetIcon()
Определения NotificationSystem.c:45
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
ref Widget m_RootWidget[MAX_SIMULTANIOUS_PLAYERS]
Определения PluginRemotePlayerDebugClient.c:14
void SetActive()
Определения TrapBase.c:414
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1040
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
Определения ActionManagerClient.c:1138
proto void GetInventoryItemSize(InventoryItem item, out int width, out int height)
proto native DayZPlayer GetPlayer()
represents base for cargo storage for entities
Определения Cargo.c:7
Widget m_ItemsContainer
Определения CargoContainer.c:23
override void SetLastFocus()
Определения CargoContainer.c:621
ref SizeToChild m_Resizer2
Определения CargoContainer.c:27
void ~CargoContainer()
Определения CargoContainer.c:54
Widget m_CargoHeader
Определения CargoContainer.c:21
float GetIconSize()
Определения CargoContainer.c:372
override void SetActive(bool active)
Определения CargoContainer.c:769
void SetAttachmentSlotID(int slotID)
Определения CargoContainer.c:953
Icon GetFocusedIcon()
Определения CargoContainer.c:431
float GetSpaceSize()
Определения CargoContainer.c:377
override bool Combine()
Определения CargoContainer.c:917
void MovedInCargo(EntityAI item)
Определения CargoContainer.c:146
TextWidget m_FalseHeaderTextWidget
Определения CargoContainer.c:19
override void SetNextActive()
Определения CargoContainer.c:647
void UpdateSize()
Определения CargoContainer.c:363
override void SetLayoutName()
Определения CargoContainer.c:214
override void Unfocus()
Определения CargoContainer.c:626
void SetLock(EntityAI item)
Определения CargoContainer.c:180
override EntityAI GetFocusedItem()
Определения CargoContainer.c:733
int GetIconsCount()
Определения CargoContainer.c:963
int GetCargoIndex()
Определения CargoContainer.c:66
void ShowFalseCargoHeader(bool show)
Определения CargoContainer.c:938
int GetAttachmentSlotID()
Определения CargoContainer.c:958
override bool Select()
Определения CargoContainer.c:852
ref Timer m_ResizeTimer
Определения CargoContainer.c:28
ref array< ref Icon > m_Icons
Определения CargoContainer.c:11
override float GetFocusedContainerYPos(bool contents=false)
Определения CargoContainer.c:446
int GetMaxCargoCapacity()
Определения CargoContainer.c:399
void UpdateSelection()
Определения CargoContainer.c:466
ref SizeToChild m_Resizer1
Определения CargoContainer.c:25
override void UnfocusAll()
Определения CargoContainer.c:635
Widget m_CargoContainer
Определения CargoContainer.c:22
override float GetFocusedContainerHeight(bool contents=false)
Определения CargoContainer.c:436
override bool IsItemActive()
Определения CargoContainer.c:775
const int ROWS_NUMBER_XBOX
Определения CargoContainer.c:4
int m_CargoIndex
Определения CargoContainer.c:7
int GetCargoCapacity()
Определения CargoContainer.c:382
void SetEntity(EntityAI item, int cargo_index=0, bool immedUpdate=true)
Определения CargoContainer.c:241
void AddedToCargoEx(EntityAI item, bool refresh=true)
Определения CargoContainer.c:68
override bool SelectItem()
Определения CargoContainer.c:837
override bool TransferItemToVicinity()
Определения CargoContainer.c:591
override bool TransferItem()
Определения CargoContainer.c:820
Icon InitIcon(Icon icon, EntityAI item, int pos_x, int pos_y)
Определения CargoContainer.c:581
int m_FocusedItemPosition
Определения CargoContainer.c:9
bool HasItem(EntityAI item)
Определения CargoContainer.c:586
EntityAI GetEntity()
Определения CargoContainer.c:284
override void SetPreviousActive(bool force=false)
Определения CargoContainer.c:668
override Header GetHeader()
Определения ClosableContainer.c:62
override float GetFocusedContainerYScreenPos(bool contents=false)
Определения CargoContainer.c:456
void RemovedFromCargo(EntityAI item)
Определения CargoContainer.c:117
void AddedToCargo(EntityAI item)
Определения CargoContainer.c:112
override void SetDefaultFocus(bool while_micromanagment_mode=false)
Определения CargoContainer.c:612
void UpdateRowVisibility(int count)
Определения CargoContainer.c:481
float m_SpaceSize
Определения CargoContainer.c:16
float m_IconSize
Определения CargoContainer.c:15
override bool IsItemWithQuantityActive()
Определения CargoContainer.c:785
void SetAlternateFalseTextHeaderWidget(TextWidget w)
Определения CargoContainer.c:943
override void SetNextLeftActive()
Определения CargoContainer.c:709
ref map< EntityAI, ref Param3< ref Icon, int, int > > m_ShowedItemPositions
Определения CargoContainer.c:12
ref map< EntityAI, ref Param3< ref Icon, int, int > > m_ShowedLockPositions
Определения CargoContainer.c:13
CargoBase m_Cargo
Определения CargoContainer.c:6
override bool CanCombineAmmo()
Определения CargoContainer.c:806
bool m_IsAttachment
Определения CargoContainer.c:18
override void SetLastActive()
Определения CargoContainer.c:744
int m_AttachmentSlotID
Определения CargoContainer.c:30
Icon GetIcon(EntityAI item)
Определения CargoContainer.c:409
Icon GetIcon(int index)
Определения CargoContainer.c:419
override bool IsEmpty()
Определения CargoContainer.c:795
void ReleaseLock(EntityAI item)
Определения CargoContainer.c:201
void RefreshImpl()
Определения CargoContainer.c:537
override void Refresh()
Определения CargoContainer.c:526
TextWidget m_AlternateFalseHeaderTextWidget
Определения CargoContainer.c:20
override void SetNextRightActive()
Определения CargoContainer.c:685
void CargoContainer(LayoutHolder parent, bool is_attachment=false)
Определения CargoContainer.c:32
void UpdateHeaderText()
Определения CargoContainer.c:289
int GetRecipeCount(bool recipe_anywhere, ItemBase entity1, ItemBase entity2, PlayerBase player)
Определения CargoContainer.c:800
Icon InitIconEx(Icon icon, EntityAI item, int pos_x, int pos_y, bool refresh=true)
Определения CargoContainer.c:554
void InitGridHeight()
Определения CargoContainer.c:319
ref array< ref CargoContainerRow > m_Rows
Определения CargoContainer.c:10
override void UpdateInterval()
Определения CargoContainer.c:543
Определения CargoContainer.c:3
Определения Building.c:6
static bool CanSwapEntitiesEx(notnull EntityAI item1, notnull EntityAI item2)
Определения Inventory.c:628
script counterpart to engine's class Inventory
Определения Inventory.c:79
void SetName(string name)
Определения Header.c:33
void SetPosX(int x)
Определения Icon.c:1646
void SetCargoPos(int x)
Определения Icon.c:1084
void SetPosEx(bool refresh=true)
Определения Icon.c:1686
bool CombineItems(EntityAI entity1, EntityAI entity2)
Определения Icon.c:731
void SetPosY(int y)
Определения Icon.c:1651
override void SetActive(bool active)
Определения Icon.c:103
void SetSize(int x, int y)
Определения Icon.c:1067
Object GetObject()
Определения Icon.c:1266
void InitEx(EntityAI obj, bool refresh=true)
Определения Icon.c:1447
Определения Icon.c:2
Определения ItemBase.c:15
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native bool GetFlip()
returns flip status of cargo
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanPutIntoHands(EntityAI parent)
Определения GardenBase.c:275
override bool IsTakeable()
Определения BaseBuildingBase.c:988
override bool CanBeSplit()
Определения Rag.c:34
Определения InventoryItem.c:731
void SetSelectedItemEx(EntityAI selected_item, Container selected_container, LayoutHolder selected_icon)
Определения ItemManager.c:113
Container GetSelectedContainer()
Определения ItemManager.c:90
EntityAI GetSelectedItem()
Определения ItemManager.c:85
static ItemManager GetInstance()
Определения ItemManager.c:282
Определения ItemManager.c:2
Определения Container.c:2
Определения EnMath.c:7
Определения EntityAI.c:95
Определения PlayerBaseClient.c:2
static int HasItemQuantity(notnull EntityAI item)
Определения QuantityConversions.c:143
Определения EnWidgets.c:220
Определения DayZPlayerImplement.c:63
Определения EnWidgets.c:190
const string CargoContainerXbox
Определения WidgetLayoutName.c:21
const string CargoContainerWide
Определения WidgetLayoutName.c:20
const string CargoContainerNarrow
Определения WidgetLayoutName.c:18
const string CargoContainerMedium
Определения WidgetLayoutName.c:19
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto float Ceil(float f)
Returns ceil of value.
proto native Widget GetParent()
Get parent of the Effect.
Определения Effect.c:407