本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source方法的典型用法代码示例。如果您正苦于以下问题:Java DragAndDrop.Source方法的具体用法?Java DragAndDrop.Source怎么用?Java DragAndDrop.Source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop
的用法示例。
在下文中一共展示了DragAndDrop.Source方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
};
}
示例2: 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;
}
示例3: 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;
// }
}
示例4: 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) {
}
};
}
示例5: reset
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public void reset(DragAndDrop.Source source, DragAndDrop.Payload payload) {
getActor().setColor(Color.GREEN);
}
示例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) {
getActor().setColor(Color.WHITE);
return true;
}
示例7: 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) {
}
示例8: reset
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop; //导入方法依赖的package包/类
@Override
public void reset(DragAndDrop.Source source, DragAndDrop.Payload payload) {
}
示例9: 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) {
}