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


Java Source类代码示例

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

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

示例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);
        }
    }

}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:31,代码来源:InventorySlotTarget.java

示例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;
	// }
}
 
开发者ID:PixelScientists,项目名称:libgdx-utils,代码行数:13,代码来源:SlotTarget.java

示例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());
		}
	});
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:9,代码来源:AssetDragAndDrop.java

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

示例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));
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:9,代码来源:SpriterEditorSupport.java

示例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);
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:13,代码来源:SpineEditorSupport.java

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

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

示例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;
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:5,代码来源:InventorySlotTarget.java

示例12: reset

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public void reset(Source source, Payload payload) {
}
 
开发者ID:Mignet,项目名称:Inspiration,代码行数:4,代码来源:InventorySlotTarget.java

示例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;
}
 
开发者ID:javosuher,项目名称:Terminkalender,代码行数:5,代码来源:SlotTarget.java

示例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) {}
 
开发者ID:javosuher,项目名称:Terminkalender,代码行数:3,代码来源:SlotTarget.java

示例15: reset

import com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop.Source; //导入依赖的package包/类
@Override
public void reset(Source source, Payload payload) {}
 
开发者ID:javosuher,项目名称:Terminkalender,代码行数:3,代码来源:SlotTarget.java


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