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

◆ DoubleClick()

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

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

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

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