@Override public void dragStop(InputEvent event, float x, float y, int pointer, Payload payload, Target target) { Slot payloadSlot = (Slot) payload.getObject(); if (target != null) { Slot targetSlot = ((SlotActor) target.getActor()).getSlot(); sourceSlot.copy(targetSlot.isEmpty(), targetSlot.getTask()); targetSlot.copy(payloadSlot.isEmpty(), payloadSlot.getTask()); if(targetSlot.hasPosition()) { dialog.setTask(targetSlot.getTask()); dialog.show(AppMain.calendarScreen.getStage()); } } else { sourceSlot.copy(payloadSlot.isEmpty(), payloadSlot.getTask()); } }
@Override public void dragStop(InputEvent event, float x, float y, int pointer, Payload payload, Target target) { Slot payloadSlot = (Slot) payload.getObject(); if (target != null) { Slot targetSlot = ((SlotActor) target.getActor()).getSlot(); if (targetSlot.getItem() == payloadSlot.getItem() || targetSlot.getItem() == null) { targetSlot.add(payloadSlot.getItem(), payloadSlot.getAmount()); } else { Item targetType = targetSlot.getItem(); int targetAmount = targetSlot.getAmount(); targetSlot.take(targetAmount); targetSlot.add(payloadSlot.getItem(), payloadSlot.getAmount()); sourceSlot.add(targetType, targetAmount); } } else { sourceSlot.add(payloadSlot.getItem(), payloadSlot.getAmount()); } }
@Override public void dragStop(InputEvent event, float x, float y, int pointer, Payload payload, Target target) { //Slot payloadSlot = (Slot) payload.getObject(); if (target == null) { ifNullTarget(); } else if(target instanceof SlotTarget){ ifSlotTarget(target); } /*else {// other targets System.out.println("else"); ifNullTarget(); }*/ }
protected void ifSlotTarget(Target target){ Slot targetSlot = ((SlotActor) target.getActor()).getSlot(); boolean sameType = false; for (Class<? extends GameObject> i : targetSlot.getType()){ if(TowerObject.isMatches(i, payloadSlot.getLast().getClass())){ sameType = true; } } if(/*targetSlot.getType() != payloadSlot.getType() && targetSlot.getType().getSuperclass() != payloadSlot.getType() && payloadSlot.getType().getSuperclass() != targetSlot.getType()*/!sameType) {//recipe extends detail ifNullTarget(); return; }//new engine lol if (targetSlot.matches(payloadSlot) || targetSlot.isEmpty()){ // targetSlot.add(payloadSlot.takeAll()); int toMove = targetSlot.getMaxItems() - targetSlot.getAmount();//if < 0 error with maxItems if(toMove == 0) {//cant swap with low possible number slots ifNullTarget(); return; } if(payloadSlot.getAmount() <= toMove) { targetSlot.add(payloadSlot.takeAll()); } else { targetSlot.add(payloadSlot.take(toMove)); sourceSlot.add(payloadSlot.takeAll()); } } else{//swap slot items Array<? extends GameObject> tmp = targetSlot.takeAll(); targetSlot.add(payloadSlot.takeAll()); sourceSlot.add(tmp); } }
@Override public void dragStop (InputEvent event, float x, float y, int pointer, Payload payload, Target target) { if( target == null ){ sourceSlot.add(payload.getDragActor()); } }
@Override public Target getDropTarget () { return dropTarget; }
public void addTarget (Target target) { targets.add(target); }
public void removeTarget (Target target) { targets.removeValue(target, true); }
public void addTarget(Target target) { drag.addTarget(target); }
public void removeTarget(Target target) { drag.removeTarget(target); }
Target getDropTarget ();