3 protected float m_SquareSize;
4 protected int m_DefaultSort;
6 protected Widget m_MovePanel;
7 protected Widget m_PanelWidget;
8 protected Widget m_DragRender;
9 protected ButtonWidget m_MoveUp;
10 protected ButtonWidget m_MoveDown;
12 protected bool m_IsInLocalEquipment;
16 m_MovePanel = GetMainWidget().FindAnyWidget(
"MovePanel" );
17 m_PanelWidget = GetMainWidget().FindAnyWidget(
"PanelWidget" );
18 m_DragRender = GetMainWidget().FindAnyWidget(
"Drag_Render" );
19 m_MoveUp = ButtonWidget.Cast( GetMainWidget().
FindAnyWidget(
"MoveUp" ) );
20 m_MoveDown = ButtonWidget.Cast( GetMainWidget().
FindAnyWidget(
"MoveDown" ) );
25 WidgetEventHandler.GetInstance().RegisterOnMouseLeave( m_MoveDown,
this,
"MouseLeave" );
27 WidgetEventHandler.GetInstance().RegisterOnDrag( GetMainWidget() ,
this,
"OnDragHeader" );
28 WidgetEventHandler.GetInstance().RegisterOnDrop( GetMainWidget() ,
this,
"OnDropHeader" );
30 WidgetEventHandler.GetInstance().RegisterOnMouseEnter( GetMainWidget(),
this,
"MouseEnter" );
31 WidgetEventHandler.GetInstance().RegisterOnMouseLeave( GetMainWidget(),
this,
"MouseLeave" );
34 GetMainWidget().GetScreenSize( temp, m_SquareSize );
36 m_DefaultColor = m_PanelWidget.GetColor();
37 m_DefaultFontSize = 20;
49 override void SetLayoutName()
54 override void SetName(
string name )
58 m_HeaderText.SetText(
name );
59 m_HeaderText.Update();
62 m_HeaderText.GetScreenSize(
x,
y );
63 m_PanelWidget.SetSize( 1,
y +
InventoryMenu.GetHeightMultiplied( 10 ) );
66 void OnDragHeader(
Widget w,
int x,
int y )
69 if( parent && GetMainWidget() &&
m_Entity )
73 m_DefaultSort = GetRootWidget().GetSort();
74 item_preview_drag.GetParent().GetParent().GetParent().GetParent().GetParent().GetParent().GetParent().GetParent().AddChild( GetRootWidget() );
77 item_preview_drag.SetItem(
m_Entity );
78 item_preview_drag.SetView(
m_Entity.GetViewIndex() );
83 parent.HideContent(
true );
85 m_PanelWidget.Show(
false );
86 if( item_preview_drag )
87 item_preview_drag.Show(
true );
91 if( item_preview_drag )
93 m_Entity.GetOnItemFlipped().Insert( UpdateFlip );
94 if(
m_Entity.GetInventory().GetFlipCargo() )
96 item_preview_drag.SetSize( hh * m_SquareSize, ww * m_SquareSize );
100 item_preview_drag.SetSize( ww * m_SquareSize, hh * m_SquareSize );
106 void UpdateFlip(
bool flipped )
115 item_preview_drag.SetSize( hh * m_SquareSize, ww * m_SquareSize );
119 item_preview_drag.SetSize( ww * m_SquareSize, hh * m_SquareSize );
124 void OnDropHeader(
Widget w )
127 parent.GetMainWidget().AddChild( GetRootWidget() );
128 GetRootWidget().SetSort( 0 );
133 if( item_preview_drag )
135 item_preview_drag.SetItem(
null );
139 m_PanelWidget.Show(
true );
140 m_DragRender.Show(
false );
142 parent.ShowContent(
true );
151 bool MouseEnter(
Widget w,
int x,
int y)
155 #ifdef PLATFORM_CONSOLE
156 m_MovePanel.Show(
GetGame().
GetInput().IsEnabledMouseAndKeyboardEvenOnServer() );
158 m_MovePanel.Show(
true );
167 if( enter_w != m_MoveUp && enter_w != m_MoveDown && enter_w != m_CollapseButton )
169 if( m_IsInLocalEquipment )
171 m_MovePanel.Show(
false );
178 override void SetActive(
bool active )
180 super.SetActive( active );
183 m_PanelWidget.SetColor(
ARGBF( 1, 1, 0, 0 ) );
187 m_PanelWidget.SetColor( m_DefaultColor );