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


Java DragAndDrop.Payload方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Payload方法的典型用法代码示例。如果您正苦于以下问题:Java DragAndDrop.Payload方法的具体用法?Java DragAndDrop.Payload怎么用?Java DragAndDrop.Payload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop的用法示例。


在下文中一共展示了DragAndDrop.Payload方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: builder

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
static DragAndDrop.Source builder(final Actor actor){
   return new DragAndDrop.Source(actor) {
        @Override
        public DragAndDrop.Payload dragStart(InputEvent event, float x, float y, int pointer) {
            DragAndDrop.Payload payload = new DragAndDrop.Payload();

            payload.setDragActor(new Label(actor.getName(), VisUI.getSkin()));

            final Label validLabel = new Label(actor.getName(), VisUI.getSkin());
            validLabel.setColor(Color.BLUE);
            payload.setValidDragActor(validLabel);

            final Label invalidLabel = new Label(actor.getName(), VisUI.getSkin());
            invalidLabel.setColor(Color.RED);
            payload.setInvalidDragActor(invalidLabel);
            return payload;
        }
    };
}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:20,代码来源:ActorsWindow.java

示例2: dragStart

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
    public DragAndDrop.Payload dragStart(InputEvent event, float x, float y, int pointer) {


//        if(sourceSlot.isEmpty())return payload;
        TowerObject tower = (TowerObject) sourceSlot.getLast();
        DragAndDrop.Payload payload = super.dragStart(event, x, y, pointer);
        if (payload == null)return null;

        Level.getMap().setBuild(true, tower, payload);   //start drawing build grid

        Image i = ((Image)payload.getValidDragActor());//nullPointer
        Image inv = ((Image)payload.getDragActor());
        TextureRegionDrawable t = new TextureRegionDrawable(new TextureRegion(tower.getPrototype().getTowerTexture()));
        i.setDrawable(t);
        inv.setDrawable(t);
        dragAndDrop.setDragActorPosition(-i.getWidth()/2, i.getHeight()/2);
        return payload;
    }
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:20,代码来源:LevelShopSource.java

示例3: 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

示例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: drag

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public boolean drag(DragAndDrop.Source source, DragAndDrop.Payload payload, float x, float y, int pointer) {
   // Image i = ((Image)payload.getDragActor());
    //dragAndDrop.setDragActorPosition(-i.getWidth()/2, i.getHeight()/2);//not optimized

    //TextureRegionDrawable t = new TextureRegionDrawable(new TextureRegion(AssetLoader.rockTower));
    //i.setDrawable(t);
    //Level.getMap().setRangeTower(payload.getDragActor().getX(), payload.getDragActor().getY());
    return true;
}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:11,代码来源:TileTarget.java

示例6: drag

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public boolean drag(DragAndDrop.Source source, DragAndDrop.Payload payload, float x, float y, int pointer) {
    Slot payloadSlot = (Slot) payload.getObject();
    // if (targetSlot.getPrototype() == payloadSlot.getPrototype() ||
    // targetSlot.getPrototype() == null) {
    getActor().setColor(Color.WHITE);
    return true;
    // } else {
    // getActor().setColor(Color.DARK_GRAY);
    // return false;
    // }
}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:13,代码来源:SellTarget.java

示例7: 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

示例8: setBuild

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
public void setBuild(boolean build, TowerObject rangeTower, DragAndDrop.Payload payload) {//
    isBuild = build;
    this.rangeTower = rangeTower;
    this.payload = payload;
}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:6,代码来源:Map.java

示例9: reset

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public void reset(DragAndDrop.Source source, DragAndDrop.Payload payload) {
    getActor().setColor(Color.GREEN);
}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:5,代码来源:SellTarget.java

示例10: drag

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public boolean drag(DragAndDrop.Source source, DragAndDrop.Payload payload, float x, float y, int pointer) {
    getActor().setColor(Color.WHITE);
    return true;
}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:6,代码来源:GemGradeTarget.java

示例11: drop

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public void drop(DragAndDrop.Source source, DragAndDrop.Payload payload, float x, float y, int pointer) {

}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:5,代码来源:TileTarget.java

示例12: reset

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public void reset(DragAndDrop.Source source, DragAndDrop.Payload payload) {

}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:5,代码来源:TileTarget.java

示例13: drop

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public void drop(DragAndDrop.Source source, DragAndDrop.Payload payload, float x, float y, int pointer) {



}
 
开发者ID:mrDarkHouse,项目名称:GDefence,代码行数:7,代码来源:SellTarget.java


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