本文整理汇总了Java中org.andengine.entity.scene.menu.MenuScene类的典型用法代码示例。如果您正苦于以下问题:Java MenuScene类的具体用法?Java MenuScene怎么用?Java MenuScene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuScene类属于org.andengine.entity.scene.menu包,在下文中一共展示了MenuScene类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMenuItemX
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
protected float getMenuItemX(final MenuScene pMenuScene, final int pIndex) {
final float menuSceneWidth = pMenuScene.getWidth();
final IMenuItem menuItem = pMenuScene.getMenuItem(pIndex);
final float menuItemWidth = menuItem.getWidth();
/* Determine horizontal position. */
final float x;
switch (this.mHorizontalAlign) {
case LEFT:
x = menuItemWidth * 0.5f;
break;
case CENTER:
x = menuSceneWidth * 0.5f;
break;
case RIGHT:
x = menuSceneWidth - (menuItemWidth * 0.5f);
break;
default:
throw new IllegalArgumentException("Unexpected " + HorizontalAlign.class.getSimpleName() + " with value: '" + this.mHorizontalAlign + "'.");
}
return x + this.mOffsetX;
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:25,代码来源:MenuSceneAnimator.java
示例2: getFromX
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
protected float getFromX(final MenuScene pMenuScene, final IMenuItem pMenuItem, final float pX) {
switch (this.mDirection) {
case UP:
case DOWN:
return pX;
case DOWN_LEFT:
case UP_LEFT:
case LEFT:
return pMenuScene.getWidth() + (pMenuItem.getWidth() * 0.5f);
case DOWN_RIGHT:
case UP_RIGHT:
case RIGHT:
return -(pMenuItem.getWidth() * 0.5f);
default:
throw new IllegalArgumentException();
}
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:18,代码来源:SlideMenuSceneAnimator.java
示例3: getFromY
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
protected float getFromY(final MenuScene pMenuScene, final IMenuItem pMenuItem, final float pY) {
switch (this.mDirection) {
case DOWN_LEFT:
case DOWN:
case DOWN_RIGHT:
return pMenuScene.getHeight() + (pMenuItem.getHeight() * 0.5f);
case LEFT:
case RIGHT:
return pY;
case UP_LEFT:
case UP:
case UP_RIGHT:
return -(pMenuItem.getHeight() * 0.5f);
default:
throw new IllegalArgumentException();
}
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:18,代码来源:SlideMenuSceneAnimator.java
示例4: onMenuItemClicked
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
@Override
public boolean onMenuItemClicked(MenuScene pMenuScene, IMenuItem pMenuItem, float pMenuItemLocalX, float pMenuItemLocalY) {
int id = pMenuItem.getID();
Logger.log(TAG, "Menu item clicked");
for (int menuId : mLevels) {
if (id == menuId) {
Logger.log(TAG, "Selected level " + menuId);
AbstractGameActivity activity = getActivity();
if (activity != null) {
Logger.log(TAG, "Creating game scene");
SceneManager sceneManager = activity.getSceneManager();
sceneManager.uploadScene(SceneType.GAME_SCENE);
GameScene gameScene = (GameScene) sceneManager.getScene(SceneType.GAME_SCENE);
gameScene.setLevel(menuId);
gameScene.populateScene();
activity.getEngine().setScene(gameScene);
return true;
}
return false;
}
}
return false;
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:25,代码来源:GameMenuScene.java
示例5: initMenuPause
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
private void initMenuPause() {
pauseScene = new MenuScene(gameCamera, this);
final ITextureRegion textureNext = getTexture(ResMan.MENU_NEXT);
final ITextureRegion textureReset = getTexture(ResMan.MENU_RESET);
final ITextureRegion textureQuit = getTexture(ResMan.MENU_QUIT);
nextPauseMenuItem = new SpriteMenuItem(OPTION_NEXT, textureNext, getVBOM());
nextPauseMenuItem.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
nextPauseMenuItem.setVisible(false);
pauseScene.addMenuItem(nextPauseMenuItem);
final SpriteMenuItem resetMenuItem = new SpriteMenuItem(OPTION_RESET, textureReset, getVBOM());
resetMenuItem.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
pauseScene.addMenuItem(resetMenuItem);
final SpriteMenuItem quitMenuItem = new SpriteMenuItem(OPTION_QUIT, textureQuit, getVBOM());
quitMenuItem.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
pauseScene.addMenuItem(quitMenuItem);
pauseScene.buildAnimations();
pauseScene.setBackgroundEnabled(false);
pauseScene.setOnMenuItemClickListener(this);
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:24,代码来源:AbstractGameActivity.java
示例6: initMenuWin
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
private void initMenuWin() {
winScene = new MenuScene(gameCamera, this);
final ITextureRegion textureNext = getTexture(ResMan.MENU_NEXT);
final ITextureRegion textureReset = getTexture(ResMan.MENU_RESET);
final ITextureRegion textureQuit = getTexture(ResMan.MENU_QUIT);
nextWinMenuItem = new SpriteMenuItem(OPTION_NEXT, textureNext, getVBOM());
nextWinMenuItem.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
nextWinMenuItem.setVisible(false);
winScene.addMenuItem(nextWinMenuItem);
final SpriteMenuItem resetMenuItem = new SpriteMenuItem(OPTION_RESET, textureReset, getVBOM());
resetMenuItem.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
winScene.addMenuItem(resetMenuItem);
final SpriteMenuItem quitMenuItem = new SpriteMenuItem(OPTION_QUIT, textureQuit, getVBOM());
quitMenuItem.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
winScene.addMenuItem(quitMenuItem);
winScene.buildAnimations();
winScene.setBackgroundEnabled(false);
winScene.setOnMenuItemClickListener(this);
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:24,代码来源:AbstractGameActivity.java
示例7: createMenuChildScene
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
private void createMenuChildScene()
{
menuChildScene = new MenuScene(camera);
menuChildScene.setPosition(0, 0);
final IMenuItem playMenuItem = new ScaleMenuItemDecorator(new SpriteMenuItem(MENU_PLAY, resourcesManager.play_region, vbom), 1.2f, 1);
final IMenuItem optionsMenuItem = new ScaleMenuItemDecorator(new SpriteMenuItem(MENU_OPTIONS, resourcesManager.options_region, vbom), 1.2f, 1);
menuChildScene.addMenuItem(playMenuItem);
menuChildScene.addMenuItem(optionsMenuItem);
menuChildScene.buildAnimations();
menuChildScene.setBackgroundEnabled(false);
playMenuItem.setPosition(playMenuItem.getX(), playMenuItem.getY()- 40);
optionsMenuItem.setPosition(optionsMenuItem.getX(), optionsMenuItem.getY() - 90);
menuChildScene.setOnMenuItemClickListener(this);
setChildScene(menuChildScene);
}
开发者ID:LHBDev,项目名称:MoonMiner,代码行数:22,代码来源:MainMenuScene.java
示例8: buildMenuSceneAnimations
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
@Override
public void buildMenuSceneAnimations(final MenuScene pMenuScene) {
this.updateOverallHeight(pMenuScene);
final int menuItemCount = pMenuScene.getMenuItemCount();
for (int i = 0; i < menuItemCount; i++) {
final IMenuItem menuItem = pMenuScene.getMenuItem(i);
final float x = this.getMenuItemX(pMenuScene, i);
final float y = this.getMenuItemY(pMenuScene, i);
this.onMenuItemPositionBuilt(pMenuScene, i, menuItem, x, y);
}
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:15,代码来源:MenuSceneAnimator.java
示例9: resetMenuSceneAnimations
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
@Override
public void resetMenuSceneAnimations(final MenuScene pMenuScene) {
final int menuItemCount = pMenuScene.getMenuItemCount();
for (int i = 0; i < menuItemCount; i++) {
final IMenuItem menuItem = pMenuScene.getMenuItem(i);
final float x = this.getMenuItemX(pMenuScene, i);
final float y = this.getMenuItemY(pMenuScene, i);
this.onMenuItemPositionReset(pMenuScene, i, menuItem, x, y);
}
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:13,代码来源:MenuSceneAnimator.java
示例10: getMenuItemY
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
protected float getMenuItemY(final MenuScene pMenuScene, final int pIndex) {
final float menuSceneHeight = pMenuScene.getHeight();
final IMenuItem menuItem = pMenuScene.getMenuItem(pIndex);
/* Prepare vertical position. */
float baseY;
switch (this.mVerticalAlign) {
case TOP:
baseY = menuSceneHeight;
break;
case CENTER:
baseY = (0.5f * menuSceneHeight) + (this.mOverallHeight * 0.5f);
break;
case BOTTOM:
baseY = this.mOverallHeight;
break;
default:
throw new IllegalArgumentException("Unexpected " + VerticalAlign.class.getSimpleName() + " with value: '" + this.mVerticalAlign + "'.");
}
final float menuItemHeight = menuItem.getHeight();
/* Determine vertical position. */
final float y = baseY - (menuItemHeight * 0.5f) - (pIndex * (menuItemHeight + this.mMenuItemSpacing));
return y + this.mOffsetY;
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:29,代码来源:MenuSceneAnimator.java
示例11: updateOverallHeight
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
private void updateOverallHeight(final MenuScene pMenuScene) {
final int menuItemCount = pMenuScene.getMenuItemCount();
float overallHeight = 0;
for (int i = menuItemCount - 1; i >= 0; i--) {
final IMenuItem menuItem = pMenuScene.getMenuItem(i);
overallHeight += menuItem.getHeight();
}
this.mOverallHeight = overallHeight + ((menuItemCount - 1) * this.mMenuItemSpacing);
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:12,代码来源:MenuSceneAnimator.java
示例12: onMenuItemPositionBuilt
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
@Override
protected void onMenuItemPositionBuilt(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
final float fromX = getFromX(pMenuScene, pMenuItem, pX);
final float fromY = getFromY(pMenuScene, pMenuItem, pY);
pMenuItem.setPosition(fromX, fromY);
final MoveModifier moveModifier = new MoveModifier(SlideMenuSceneAnimator.DURATION, fromX, fromY, pX, pY, this.mEaseFunction);
moveModifier.setAutoUnregisterWhenFinished(false);
pMenuItem.registerEntityModifier(moveModifier);
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:12,代码来源:SlideMenuSceneAnimator.java
示例13: onMenuItemPositionReset
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
@Override
protected void onMenuItemPositionReset(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
final float fromX = getFromX(pMenuScene, pMenuItem, pX);
final float fromY = getFromY(pMenuScene, pMenuItem, pY);
pMenuItem.setPosition(fromX, fromY);
pMenuItem.resetEntityModifiers();
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:10,代码来源:SlideMenuSceneAnimator.java
示例14: onMenuItemPositionBuilt
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
@Override
protected void onMenuItemPositionBuilt(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
pMenuItem.setPosition(pX, pY);
final AlphaModifier alphaModifier = new AlphaModifier(AlphaMenuSceneAnimator.DURATION, AlphaMenuSceneAnimator.ALPHA_FROM, AlphaMenuSceneAnimator.ALPHA_TO, this.mEaseFunction);
alphaModifier.setAutoUnregisterWhenFinished(false);
pMenuItem.registerEntityModifier(alphaModifier);
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:9,代码来源:AlphaMenuSceneAnimator.java
示例15: onMenuItemPositionReset
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
@Override
protected void onMenuItemPositionReset(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
pMenuItem.setPosition(pX, pY);
pMenuItem.resetEntityModifiers();
pMenuItem.setAlpha(AlphaMenuSceneAnimator.ALPHA_FROM);
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:8,代码来源:AlphaMenuSceneAnimator.java
示例16: createMenuChildScene
import org.andengine.entity.scene.menu.MenuScene; //导入依赖的package包/类
private void createMenuChildScene() {
Logger.log(TAG, "creating menu items");
AbstractGameActivity activity = getActivity();
if (activity == null) {
return;
}
ResourcesManager manager = activity.getResourcesManager();
mMenuScene = new MenuScene(activity.getEngine().getCamera());
mMenuScene.setPosition(activity.getCameraWidth() / 2, activity.getCameraHeight() / 2);
TextureRegion[] levelRegionS = {
TextureRegionFactory.extractFromTexture(manager.getTexture("gfx/level1.png")),
TextureRegionFactory.extractFromTexture(manager.getTexture("gfx/level2.png")),
TextureRegionFactory.extractFromTexture(manager.getTexture("gfx/level3.png")),
};
IMenuItem[] menuItems = {
new SpriteMenuItem(mLevels[0], levelRegionS[0], manager.getVertexBufferObjectManager()),
new SpriteMenuItem(mLevels[1], levelRegionS[1], manager.getVertexBufferObjectManager()),
new SpriteMenuItem(mLevels[2], levelRegionS[2], manager.getVertexBufferObjectManager()),
};
for (IMenuItem menuItem : menuItems) {
mMenuScene.addMenuItem(menuItem);
}
int width = activity.getCameraWidth() / 2;
int height = activity.getCameraHeight() / 2;
menuItems[0].setPosition(-width + 100, height - 100);
menuItems[1].setPosition(-width + 300, height - 100);
menuItems[2].setPosition(-width + 500, height - 100);
mMenuScene.buildAnimations();
mMenuScene.setBackgroundEnabled(false);
mMenuScene.setOnMenuItemClickListener(this);
setChildScene(mMenuScene);
}
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:39,代码来源:GameMenuScene.java
注:本文中的org.andengine.entity.scene.menu.MenuScene类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论