本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source类的典型用法代码示例。如果您正苦于以下问题:Java Source类的具体用法?Java Source怎么用?Java Source使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Source类属于com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop包,在下文中一共展示了Source类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addSquad
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
public void addSquad (final Entity squad, final int index) {
final SquadCommandCard squadCard = new SquadCommandCard(squad, index, skin);
Source source = new Source(squadCard) {
@Override
public Payload dragStart (InputEvent event, float x, float y, int pointer) {
Payload payload = new Payload();
// payload.setDragActor(new Label("Test", skin));
SquadCommandCard card = new SquadCommandCard(squad, index, skin);
payload.setDragActor(card);
// payload.setDragActor(squadTable);
return payload;
}
};
dragAndDrop.addSource(source);
cardSlots.get(index).setCard(squadCard);
}
示例2: drag
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public boolean drag(Source source, 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;
// }
}
示例3: drop
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public void drop(Source source, Payload payload, float x, float y, int pointer) {
InventoryItem sourceActor = (InventoryItem) payload.getDragActor();
InventoryItem targetActor = _targetSlot.getTopInventoryItem();
InventorySlot sourceSlot = ((InventorySlotSource)source).getSourceSlot();
if( sourceActor == null ) {
return;
}
//First, does the slot accept the source item type?
if( !_targetSlot.doesAcceptItemUseType(sourceActor.getItemUseType())) {
//Put item back where it came from, slot doesn't accept item
sourceSlot.add(sourceActor);
return;
}
if( !_targetSlot.hasItem() ){
_targetSlot.add(sourceActor);
}else{
//If the same item and stackable, add
if( sourceActor.isSameItemType(targetActor) && sourceActor.isStackable()){
_targetSlot.add(sourceActor);
}else{
//If they aren't the same items or the items aren't stackable, then swap
InventorySlot.swapSlots(sourceSlot, _targetSlot, sourceActor);
}
}
}
示例4: drag
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public boolean drag(Source source, Payload payload, float x, float y, int pointer) {
Slot payloadSlot = (Slot) payload.getObject();
// if (targetSlot.getItem() == payloadSlot.getItem() ||
// targetSlot.getItem() == null) {
getActor().setColor(Color.WHITE);
return true;
// } else {
// getActor().setColor(Color.DARK_GRAY);
// return false;
// }
}
示例5: addAtlasSource
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
private void addAtlasSource (AtlasItem item) {
dragAndDrop.addSource(new Source(item) {
@Override
public Payload dragStart (InputEvent event, float x, float y, int pointer) {
return createTexturePayload(item.getRegion(), item.getAtlasAsset());
}
});
}
示例6: clear
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
/** Removes all targets and sources. */
public void clear () {
targets.clear();
for (Entry<Source, DragListener> entry : sourceListeners.entries())
entry.key.getActor().removeCaptureListener(entry.value);
sourceListeners.clear();
}
示例7: createDropSource
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public Source createDropSource (VisDragAndDrop dragAndDrop, FileItem item) {
String relativePath = fileAccess.relativizeToAssetsFolder(item.getFile());
FileHandle dataFile = item.getFile().parent().child(".vis").child("data.json");
if (dataFile.exists() == false) return null;
SpriterAssetData data = spriterDataIO.loadData(dataFile);
return new VisDropSource(dragAndDrop, item).defaultView("New Spriter Animation \n (drop on scene to add)").setPayload(new SpriterAsset(relativePath, data.imageScale));
}
示例8: createDropSource
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public Source createDropSource (VisDragAndDrop dragAndDrop, FileItem item) {
FileHandle atlasFile = FileUtils.sibling(item.getFile(), "atlas");
FileHandle skeletonFile = item.getFile();
String atlasPath = fileAccess.relativizeToAssetsFolder(atlasFile);
String skeletonPath = fileAccess.relativizeToAssetsFolder(skeletonFile);
SpineAssetDescriptor asset = new SpineAssetDescriptor(atlasPath, skeletonPath, 1);
return new VisDropSource(dragAndDrop, item).defaultView("New Spine Animation \n (drop on scene to add)").setPayload(asset);
}
示例9: drop
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public void drop(Source source, Payload payload, float x, float y, int pointer) {
}
示例10: reset
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public void reset(Source source, Payload payload) {
getActor().setColor(Color.LIGHT_GRAY);
}
示例11: drag
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public boolean drag(Source source, Payload payload, float x, float y, int pointer) {
return true;
}
示例12: reset
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public void reset(Source source, Payload payload) {
}
示例13: drag
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public boolean drag(Source source, Payload payload, float x, float y, int pointer) {
return true;
}
示例14: drop
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public void drop(Source source, Payload payload, float x, float y, int pointer) {}
示例15: reset
import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public void reset(Source source, Payload payload) {}