当前位置: 首页>>代码示例>>Java>>正文


Java DragAndDrop.Target方法代码示例

本文整理汇总了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;
                }
            }
        }
    }
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:21,代码来源:LevelShopSource.java

示例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());
    }
}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:8,代码来源:GemGradeSource.java

示例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
        }
    }
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:15,代码来源:BuySlotSource.java

示例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){
        //
    }*/
}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:32,代码来源:SellSlotSource.java

示例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) {

		}
	};
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:14,代码来源:DefaultDragAndDropTarget.java

示例6: getDropTarget

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public DragAndDrop.Target getDropTarget () {
	return dummyTarget;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:5,代码来源:DefaultDragAndDropTarget.java


注:本文中的com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Target方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。