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

◆ DoubleClick()

void Icon::DoubleClick ( Widget w,
int x,
int y,
int button )
inlineprotected

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

160 {
161 if (button == MouseState.LEFT && !g_Game.IsLeftCtrlDown())
162 {
163 PlayerBase controlledPlayer = PlayerBase.Cast(GetGame().GetPlayer());
164 if (controlledPlayer.GetInventory().HasInventoryReservation(m_Obj, null) || controlledPlayer.GetInventory().IsInventoryLocked() || controlledPlayer.IsItemsToDelete())
165 return;
166
167 ItemPreviewWidget targetIpw = ItemPreviewWidget.Cast(w.FindAnyWidget("Render"));
168 if (!targetIpw)
169 {
170 string name = w.GetName();
171 name.Replace("PanelWidget", "Render");
172 targetIpw = ItemPreviewWidget.Cast(w.FindAnyWidget(name));
173 }
174
175 if (!targetIpw)
176 targetIpw = ItemPreviewWidget.Cast(w);
177
178 EntityAI targetEntity = targetIpw.GetItem();
179 if (targetIpw)
180 {
181 if (!targetEntity.GetInventory().CanRemoveEntity())
182 return;
183
184 if (m_HandsIcon)
185 {
186 if (controlledPlayer.GetHumanInventory().CanRemoveEntityInHands())
187 controlledPlayer.PredictiveMoveItemFromHandsToInventory();
188
190
191 return;
192 }
193
194 EntityAI entityInHands = controlledPlayer.GetHumanInventory().GetEntityInHands();
195 EntityAI entityRootParent = targetEntity.GetHierarchyRoot();
196
197 if (controlledPlayer.GetInventory().HasEntityInInventory(targetEntity) && controlledPlayer.GetHumanInventory().CanAddEntityInHands(targetEntity))
198 {
199 controlledPlayer.PredictiveTakeEntityToHands(targetEntity);
200 }
201 else if (entityInHands && entityRootParent == controlledPlayer)
202 {
203 InventoryLocation targetItemLocation = new InventoryLocation();
204 InventoryLocation handsItemLocation = new InventoryLocation();
205 entityInHands.GetInventory().GetCurrentInventoryLocation(handsItemLocation);
206 int index = controlledPlayer.GetHumanInventory().FindUserReservedLocationIndex(entityInHands);
207 if (index >= 0)
208 controlledPlayer.GetHumanInventory().GetUserReservedLocation(index, targetItemLocation);
209
210 if (controlledPlayer.GetInventory().CanForceSwapEntitiesEx(targetEntity, targetItemLocation, entityInHands, handsItemLocation))
211 {
212 controlledPlayer.PredictiveForceSwapEntities(targetEntity, entityInHands, targetItemLocation);
213 }
214 else if (controlledPlayer.GetInventory().CanSwapEntitiesEx(targetEntity, entityInHands ))
215 {
216 controlledPlayer.PredictiveSwapEntities(targetEntity, entityInHands);
217 }
218 else
219 {
220 controlledPlayer.GetInventory().FindFreeLocationFor(targetEntity, FindInventoryLocationType.ANY, targetItemLocation);
221 if (targetItemLocation.IsValid() && controlledPlayer.GetInventory().LocationCanAddEntity(targetItemLocation))
222 SplitItemUtils.TakeOrSplitToInventoryLocation(controlledPlayer, targetItemLocation);
223 }
224 }
225 else
226 {
227 bool found = false;
228 if (targetEntity.GetInventory().CanRemoveEntity())
229 {
230 InventoryLocation i2 = new InventoryLocation();
231 found = controlledPlayer.GetInventory().FindFreeLocationFor(targetEntity, FindInventoryLocationType.ANY, i2);
232 if (found)
233 {
234 if (i2.GetType() == FindInventoryLocationType.ATTACHMENT)
235 {
236 if (i2.GetParent() != controlledPlayer)
237 found = false;
238 }
239 }
240 }
241
242 if (found)
243 {
244 if (controlledPlayer.GetHumanInventory().CanAddEntityToInventory(targetEntity))
245 controlledPlayer.PredictiveTakeEntityToInventory(FindInventoryLocationType.ANY, targetEntity);
246 }
247 else
248 {
249 if (controlledPlayer.GetHumanInventory().CanAddEntityInHands(targetEntity))
250 controlledPlayer.PredictiveTakeEntityToHands(targetEntity);
251 }
252 }
253
255 }
256 }
257 }
class LogManager EntityAI
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
DayZGame g_Game
Определения DayZGame.c:3868
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
PlayerBase GetPlayer()
Определения ModifierBase.c:51
bool m_HandsIcon
Определения Icon.c:17
EntityAI m_Obj
Определения Icon.c:15
void RefreshQuickbar()
Определения Icon.c:149
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetType()
returns type of InventoryLocation
proto native EntityAI GetItem()
proto native CGame GetGame()
MouseState
Определения EnSystem.c:311

Перекрестные ссылки g_Game, GetGame(), ItemPreviewWidget::GetItem(), InventoryLocation::GetParent(), GetPlayer(), InventoryLocation::GetType(), InventoryLocation::IsValid(), m_HandsIcon, m_Obj, name, RefreshQuickbar(), SplitItemUtils::TakeOrSplitToInventoryLocation(), x и y.