本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Target方法的典型用法代码示例。如果您正苦于以下问题:Java DragAndDrop.Target方法的具体用法?Java DragAndDrop.Target怎么用?Java DragAndDrop.Target使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop
的用法示例。
在下文中一共展示了DragAndDrop.Target方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dragStop
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public void dragStop(InputEvent event, float x, float y, int pointer, DragAndDrop.Payload payload, DragAndDrop.Target target) {
Level.getMap().setBuild(false, null, null);// end drawing build grid
super.dragStop(event, x, y, pointer, payload, target);
if (target instanceof TileTarget) {
TowerObject tower = ((TowerObject) payloadSlot.getLast());
if (tower != null) {
// Build
MapTile targetTile = ((MapTileActor) target.getActor()).getMapTile();
if(targetTile.build(tower)) {
// if (amount > 1) {
// sourceSlot.add(item, amount - 1);
// }
}else {
sourceSlot.add(payloadSlot.takeAll());
// return;
}
}
}
}
示例2: ifSlotTarget
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
protected void ifSlotTarget(DragAndDrop.Target target) {
Slot targetSlot = ((SlotActor) target.getActor()).getSlot();
if (targetSlot.matches(payloadSlot) || targetSlot.getPrototype() == null) {
targetSlot.add(payloadSlot.takeAll());
}
}
示例3: ifSlotTarget
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
protected void ifSlotTarget(DragAndDrop.Target target) {
Slot targetSlot = ((SlotActor) target.getActor()).getSlot();
if (!targetSlot.isFull() && (targetSlot.matches(payloadSlot) || targetSlot.getPrototype() == null)) {
Item item = sourceSlot.getPrototype();
if(GDefence.getInstance().user.deleteGold(item.getGlobalCost())){
targetSlot.add(payloadSlot.takeAll());
} else {
// System.out.println("No enough money");
}
} else {
//dont swap items
}
}
示例4: dragStop
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public void dragStop(InputEvent event, float x, float y, int pointer, DragAndDrop.Payload payload, DragAndDrop.Target target) {
if (target instanceof SellTarget) {
Item item = payloadSlot.getPrototype();
int amount = payloadSlot.getAmount();
if (item != null) {
GDefence.getInstance().user.addGold(item.getGlobalCost() * amount);
} else {
GDefence.getInstance().log("SellSlotSource: Item - null");
}
return;
}
super.dragStop(event, x, y, pointer, payload, target);
/*else if(target instanceof GemGradeTarget){
Slot targetSlot = ((SlotActor) target.getActor()).getSlot();
if(targetSlot.isEmpty()){//targetSlot.getPrototype() == null
int noNeed = 0;
if (payloadSlot.getAmount() > 1){
noNeed = payloadSlot.getAmount() - 1;
}
targetSlot.add(payloadSlot.take(1));
if(noNeed > 0) {
sourceSlot.add(payloadSlot.takeAll());//all remaining
}
}
} else if(target instanceof TowerCraftTarget){
//
}*/
}
示例5: DefaultDragAndDropTarget
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
public DefaultDragAndDropTarget () {
dummyTarget = new DragAndDrop.Target(new Actor()) {
@Override
public boolean drag (DragAndDrop.Source source, DragAndDrop.Payload payload, float x, float y, int pointer) {
return false;
}
@Override
public void drop (DragAndDrop.Source source, DragAndDrop.Payload payload, float x, float y, int pointer) {
}
};
}
示例6: getDropTarget
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public DragAndDrop.Target getDropTarget () {
return dummyTarget;
}