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

◆ DraggingOverGrid() [1/2]

bool ClosableContainer::DraggingOverGrid ( Widget w,
int x,
int y,
Widget reciever )
inlineprotected

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

245 {
246 if( w == null )
247 {
248 return false;
249 }
250
251 PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
252 if( !player.CanManipulateInventory() )
253 {
254 return false;
255 }
256
257 EntityAI item = GetItemPreviewItem( w );
258
259 if( !item )
260 {
261 return false;
262 }
263
264 if( !item.GetInventory().CanRemoveEntity() )
265 {
266 return false;
267 }
268
269 int color, c_x, c_y;
270
271 #ifdef PLATFORM_CONSOLE
272 int idx = -1;
273 #else
274 int idx = 0;
275 #endif
276
277 CargoBase cargo = m_Entity.GetInventory().GetCargoFromIndex(m_CargoIndex);
278 if( cargo )
279 {
280 c_x = cargo.GetHeight();
281 c_y = cargo.GetWidth();
282 }
283
284 InventoryLocation dst = new InventoryLocation;
285 #ifdef PLATFORM_CONSOLE
286 x = 0;
287 y = cargo.GetItemCount();
288 m_Entity.GetInventory().FindFreeLocationFor( item, FindInventoryLocationType.CARGO, dst );
289 #else
290 dst.SetCargoAuto(cargo, item, x, y, item.GetInventory().GetFlipCargo());
291 #endif
292
293 #ifdef PLATFORM_CONSOLE
294 if( dst.IsValid() && m_Entity.GetInventory().LocationCanAddEntityEx(dst))
295 #else
296 if( m_Entity && c_x > x && c_y > y && m_Entity.GetInventory().LocationCanAddEntityEx(dst))
297 #endif
298 {
299 ItemManager.GetInstance().HideDropzones();
300 if( m_Entity.GetHierarchyRootPlayer() == GetGame().GetPlayer() )
301 {
302 ItemManager.GetInstance().GetRightDropzone().SetAlpha( 1 );
303 }
304 else
305 {
306 ItemManager.GetInstance().GetLeftDropzone().SetAlpha( 1 );
307 }
308 color = ColorManager.GREEN_COLOR;
309 }
310 else
311 {
312 color = ColorManager.RED_COLOR;
313 ItemManager.GetInstance().ShowSourceDropzone( item );
314 }
315
316 if( w.FindAnyWidget("Cursor") )
317 {
318 w.FindAnyWidget("Cursor").SetColor( color );
319 }
320 else
321 {
322 string name = w.GetName();
323 name.Replace( "PanelWidget", "Cursor" );
324 if( w.FindAnyWidget( name ) )
325 {
326 w.FindAnyWidget( name ).SetColor( color );
327 }
328 }
329
330 return true;
331 }
class LogManager EntityAI
EntityAI m_Entity
Определения ActionDebug.c:11
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Icon x
Icon y
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
PlayerBase GetPlayer()
Определения ModifierBase.c:51
proto native int GetItemCount()
proto native int GetWidth()
proto native int GetHeight()
int m_CargoIndex
Определения ContainerWithCargo.c:4
EntityAI GetItemPreviewItem(Widget w)
Определения ContainerWithCargo.c:224
proto native bool IsValid()
verify current set inventory location
proto native void SetCargoAuto(notnull CargoBase cargo, EntityAI e, int row, int col, bool flip)
based on Cargo.IsProxyCargo uses SetProxyCargo or SetCargo respectively
proto native CGame GetGame()

Перекрестные ссылки GetGame(), CargoBase::GetHeight(), ItemManager::GetInstance(), CargoBase::GetItemCount(), GetItemPreviewItem(), ItemManager::GetLeftDropzone(), GetPlayer(), ItemManager::GetRightDropzone(), CargoBase::GetWidth(), ColorManager::GREEN_COLOR, ItemManager::HideDropzones(), InventoryLocation::IsValid(), m_CargoIndex, m_Entity, name, ColorManager::RED_COLOR, InventoryLocation::SetCargoAuto(), ItemManager::ShowSourceDropzone(), x и y.