Java 类com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Target 实例源码

项目:Terminkalender    文件:SlotSource.java   
@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());
    }
}
项目:libgdx-utils    文件:SlotSource.java   
@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());
    }
}
项目:GDefence    文件:SlotSource.java   
@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();
    }*/
}
项目:GDefence    文件:SlotSource.java   
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);
        }
    }
项目:Inspiration    文件:InventorySlotSource.java   
@Override
public void dragStop (InputEvent event, float x, float y, int pointer, Payload payload, Target target) {
    if( target == null ){
        sourceSlot.add(payload.getDragActor());
    }
}
项目:vis-editor    文件:SceneTab.java   
@Override
public Target getDropTarget () {
    return dropTarget;
}
项目:vis-editor    文件:VisDragAndDrop.java   
public void addTarget (Target target) {
    targets.add(target);
}
项目:vis-editor    文件:VisDragAndDrop.java   
public void removeTarget (Target target) {
    targets.removeValue(target, true);
}
项目:ead    文件:DraggableScrollPane.java   
public void addTarget(Target target) {
    drag.addTarget(target);
}
项目:ead    文件:DraggableScrollPane.java   
public void removeTarget(Target target) {
    drag.removeTarget(target);
}
项目:vis-editor    文件:DragAndDropTarget.java   
Target getDropTarget ();