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


Java IOnSceneTouchListener类代码示例

本文整理汇总了Java中org.andengine.entity.scene.IOnSceneTouchListener的典型用法代码示例。如果您正苦于以下问题:Java IOnSceneTouchListener类的具体用法?Java IOnSceneTouchListener怎么用?Java IOnSceneTouchListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: setManagedHUD

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
public void setManagedHUD(PhoeniciaHUD hud, IOnSceneTouchListener touchListener) {
    if (hud == null) {
        this.clearManagedHUD();
        return;
    }
    if (this.managedHUD != null) {
        this.detachChild(this.managedHUD);
    }
    this.managedHUD = hud;
    Debug.d("Attaching HUD to tour overlay: " + hud);
    this.game.hudManager.setHudLayerVisible(false);
    this.attachChild(this.managedHUD);
    this.managedHUD.setZIndex(this.messageBox.getZIndex() - 1);
    this.sortChildren();

    if (touchListener != null) {
        this.managedHUD.setOnSceneTouchListener(touchListener);
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:20,代码来源:TourOverlay.java

示例2: showGiftRequestCode

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
public void showGiftRequestCode() {
    final GiftStop stop = this;
    this.giftRequest = GiftRequest.newRequest(this.tour.game, this.requestWord, this.tourRequest);
    this.requestHUD = new RequestGiftHUD(this.tour.game, this.giftRequest) {

        @Override
        protected boolean verifyGift() {
            // don't verify anything yet
            return false;
        }
    };
    this.requestHUD.setNumberpadVisible(false);
    this.overlay.setManagedHUD(this.requestHUD, new IOnSceneTouchListener() {
        @Override
        public boolean onSceneTouchEvent(Scene scene, TouchEvent touchEvent) {
            // Capture scene touches
            stop.next();
            return false;
        }
    });
    this.overlay.showMessage(this.getMessage(MSG_REQUESTCODE), TourOverlay.MessageBox.Bottom, true);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:23,代码来源:GiftStop.java

示例3: getOnSceneTouchListener

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
@Override
public IOnSceneTouchListener getOnSceneTouchListener() {
    return new IOnSceneTouchListener() {
        @Override
        public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
            final int action = pSceneTouchEvent.getAction();
            if (action == TouchEvent.ACTION_MOVE || action == TouchEvent.ACTION_DOWN) {
                final Body body = player.getBody();
                float ratio = PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT;
                body.setTransform(body.getPosition().x, pSceneTouchEvent.getY() / ratio, body.getAngle());
                return true;
            }
            return false;
        }
    };
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:17,代码来源:GutGame.java

示例4: setGameScene

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
private void setGameScene() {
    gameScene = new Scene();
    gameScene.setOnAreaTouchTraversalFrontToBack();
    final IOnSceneTouchListener sceneTouchListener = currentGame.getOnSceneTouchListener();
    if (sceneTouchListener != null) {
        gameScene.setOnSceneTouchListener(sceneTouchListener);
    }
    loadPhysics(currentGame);

    for (int i = 0; i < LAYER_COUNT; i++) {
        final Entity layer = new Entity();
        layer.setZIndex(i);
        gameScene.attachChild(layer);
    }

    loadHUD(currentGame);
    loadScene(currentGame);
    mEngine.setScene(gameScene);
    MusicManager.pause();
    music.play();
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:22,代码来源:AbstractGameActivity.java

示例5: showProfOrRunGame

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
private void showProfOrRunGame() {
    final List<GFXAsset> profAssets = currentGame.getProfAssets();
    if (profPosition < profAssets.size()) {
        GFXAsset profAsset = profAssets.get(profPosition);
        DitheredSprite splash = new DitheredSprite(0, 0, currentGame.getWidth(), currentGame.getHeight(),
                getTexture(loadGFXAsset(profAsset)), getVBOM());
        splashScene.setBackground(new SpriteBackground(splash));
        splashScene.setOnSceneTouchListener(new IOnSceneTouchListener() {
            @Override
            public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
                if (pSceneTouchEvent.isActionDown()) {
                    Log.d(TAG, "onSceneTouchEvent - Touched splashScene: screen at position " + profPosition);
                    loadGameAsync(++profPosition, false);
                    return true;
                }
                return false;
            }
        });
    } else {
        splashScene.setBackground(splashBackground);
        Log.d(TAG, "onTimePassed - Finished prof screens, launching game!");
        runCurrentGame();
    }
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:25,代码来源:AbstractGameActivity.java

示例6: LevelModeCompleteScene

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
LevelModeCompleteScene() {

        Text levelCompleteTextShape = new Text((float) (camera.getWidth() * 0.05), (float) (camera.getHeight() * 0.05),
                resourcesManager.levelModeCompleteFont, "Level Mode\nCompleted", vbom);
        levelCompleteTextShape.setScaleCenter(0, 0);
        attachChild(levelCompleteTextShape);

        Sprite cup = new Sprite(0, 0, resourcesManager.levelModeCup, vbom);
        cup.setPosition(camera.getWidth() / 2 - cup.getWidth() / 2, camera.getHeight() * 0.4f);
        attachChild(cup);
        attachChild(new ConfettiParticleSystem(vbom, camera.getWidth()));
        setOnSceneTouchListener(new IOnSceneTouchListener() {

                @Override
                public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {

                    onBackKeyPressed();

                    return false;
                }
            });
    }
 
开发者ID:djschilling,项目名称:sopa,代码行数:23,代码来源:LevelModeCompleteScene.java

示例7: showMarketRequest

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
private void showMarketRequest() {
    this.overlay.focusOn(this.marketBlock);
    this.overlay.clearFocus();
    final GiftStop stop = this;
    this.tourRequest = createMarketRequestForGift();

    this.marketHUD = new MarketHUD(this.tour.game) {

        @Override
        protected void abortSale(RequestItem item, int needed, MarketRequest request) {
            final MarketHUD.MissingItemsDialog dialog = new MissingItemsDialog(450, 300, item, needed, request, PhoeniciaContext.vboManager) {
                @Override
                protected void onGiftClicked() {
                    stop.next();
                }

                @Override
                protected void onReturnClicked() {
                    // Can't go back to the Market HUD
                    GameSounds.play(GameSounds.FAILED);
                }
            };
            this.registerTouchArea(dialog);
            dialog.open(this);
            this.activeDialog = dialog;
        }

        @Override
        public void attemptSale(MarketRequest request) {
            // Can't attempt a sale, wait for the tour to initiate it
            if (stop.currentMessageIndex == MSG_REQUESTINTRO) {
                return;
            } else {
                super.attemptSale(request);
                //stop.next();
            }
        }

        @Override
        protected void declineSale(MarketRequest request) {
            // Can't decline sales during the tour
        }

        @Override
        protected List<MarketRequest> getRequests() {
            // Only present one request
            List<MarketRequest> requests = new ArrayList<MarketRequest>();
            requests.add(tourRequest);
            return requests;
        }

        @Override
        public void finish() {
            return;
        }
    };

    this.overlay.showGuide();
    this.overlay.setManagedHUD(this.marketHUD, new IOnSceneTouchListener() {
        @Override
        public boolean onSceneTouchEvent(Scene scene, TouchEvent touchEvent) {
            // Swallow touch events during the intro message, but allow them in the start message
            Debug.d("Current message: "+stop.currentMessageIndex);
            return stop.currentMessageIndex == MSG_REQUESTINTRO;
        }
    });
    this.marketHUD.populateRequestItems(tourRequest);
    this.overlay.showMessage(this.getMessage(MSG_REQUESTINTRO), TourOverlay.MessageBox.Bottom, true);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:70,代码来源:GiftStop.java

示例8: getOnSceneTouchListener

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
public IOnSceneTouchListener getOnSceneTouchListener() {
    return null;
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:4,代码来源:BaseGame.java

示例9: onCreateScene

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
@Override
protected Scene onCreateScene() {				

	mBackground = new ParallaxBackground(82/255f, 190/255f, 206/255f){

		float prevX = 0;
		float parallaxValueOffset = 0;

		@Override
		public void onUpdate(float pSecondsElapsed) {

			switch(GAME_STATE){

			case STATE_READY:
			case STATE_PLAYING:
				final float cameraCurrentX = mCurrentWorldPosition;//mCamera.getCenterX();

				if (prevX != cameraCurrentX) {

					parallaxValueOffset +=  cameraCurrentX - prevX;
					this.setParallaxValue(parallaxValueOffset);
					prevX = cameraCurrentX;
				}
				break;
			}		

			super.onUpdate(pSecondsElapsed);
		}
	};

	mSceneManager = new SceneManager(this, mResourceManager, mBackground);
	mScene = mSceneManager.createScene();	

	mScene.setOnSceneTouchListener(new IOnSceneTouchListener() {

		@Override
		public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
			if(pSceneTouchEvent.isActionDown()){

				switch(GAME_STATE){

				case STATE_READY:
					startPlaying();
					break;

				case STATE_PLAYING:
					mSceneManager.mBird.flap();
					break;

				case STATE_DEAD:
					//restartGame();
					break;	
				}								
			}
			return false;
		}
	});		
	
	updateScore();

	return mScene;
}
 
开发者ID:deano2390,项目名称:OpenFlappyBird,代码行数:63,代码来源:MainActivity.java

示例10: createController

import org.andengine.entity.scene.IOnSceneTouchListener; //导入依赖的package包/类
private void createController() {
	final float controllerWidthHor = mResourcesManager.mControlLeft_TextureRegion.getWidth();
	final float controllerWidthVer = mResourcesManager.mControlUp_TextureRegion.getWidth();
	final float controllerHeight = mResourcesManager.mControlLeft_TextureRegion.getHeight();

	Controller.left = new Sprite(controllerWidthHor*0.5f, controllerHeight*0.5f, mResourcesManager.mControlLeft_TextureRegion, mVertexManager) {
		public boolean onAreaTouched(TouchEvent touchEvent, float X, float Y) {
			if (touchEvent.isActionDown() || touchEvent.isActionMove()) {
				HumanMoves.unsetTouchDirection(DIRECTION_RIGHT);
				HumanMoves.setTouchDirection(DIRECTION_LEFT);
				Controller.left.setAlpha(CONTROL_ALPHA_PRESSED);
				Controller.right.setAlpha(CONTROL_ALPHA_NORMAL);
			}
			else {
				HumanMoves.unsetTouchDirection(DIRECTION_LEFT);
				Controller.left.setAlpha(CONTROL_ALPHA_NORMAL);
			}
			return true;
		};
	};
	mHUD.registerTouchArea(Controller.left);
	mHUD.attachChild(Controller.left);
	
	Controller.right = new Sprite(controllerWidthHor*1.5f+CONTROL_SPACING, controllerHeight*0.5f, mResourcesManager.mControlRight_TextureRegion, mVertexManager) {
		public boolean onAreaTouched(TouchEvent touchEvent, float X, float Y) {
			if (touchEvent.isActionDown() || touchEvent.isActionMove()) {
				HumanMoves.unsetTouchDirection(DIRECTION_LEFT);
				HumanMoves.setTouchDirection(DIRECTION_RIGHT);
				Controller.right.setAlpha(CONTROL_ALPHA_PRESSED);
				Controller.left.setAlpha(CONTROL_ALPHA_NORMAL);
			}
			else {
				HumanMoves.unsetTouchDirection(DIRECTION_RIGHT);
				Controller.right.setAlpha(CONTROL_ALPHA_NORMAL);
			}
			return true;
		};
	};
	mHUD.registerTouchArea(Controller.right);
	mHUD.attachChild(Controller.right);
	
	Controller.up = new Sprite(GameScreen.CAMERA_WIDTH-controllerWidthVer/2, controllerHeight/2, mResourcesManager.mControlUp_TextureRegion, mVertexManager) {
		public boolean onAreaTouched(TouchEvent touchEvent, float X, float Y) {
			if (touchEvent.isActionDown() || touchEvent.isActionMove()) {
				HumanMoves.setTouchDirection(DIRECTION_UP);
				Controller.up.setAlpha(CONTROL_ALPHA_PRESSED);
			}
			else {
				HumanMoves.unsetTouchDirection(DIRECTION_UP);
				Controller.up.setAlpha(CONTROL_ALPHA_NORMAL);
			}
			return true;
		};
	};
	mHUD.registerTouchArea(Controller.up);
	mHUD.attachChild(Controller.up);
	
	mHUD.setOnSceneTouchListener(new IOnSceneTouchListener() {

		@Override
		public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) {
			HumanMoves.unsetTouchDirection(DIRECTION_LEFT);
			Controller.left.setAlpha(CONTROL_ALPHA_NORMAL);

			HumanMoves.unsetTouchDirection(DIRECTION_RIGHT);
			Controller.right.setAlpha(CONTROL_ALPHA_NORMAL);

			HumanMoves.unsetTouchDirection(DIRECTION_UP);
			Controller.up.setAlpha(CONTROL_ALPHA_NORMAL);

			return false;
		}
		
	});
}
 
开发者ID:delight-im,项目名称:NationSoccer,代码行数:76,代码来源:GameScene.java


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