/** * BOSS滑块 * * @author zuowhat 2013-11-25 * @since 1.0 */ private Rectangle getScensSlider() { bossPics = new AnimatedButtonSprite[ResourceManager.mxdBoss_TTRArray.length]; Sprite[] bossBlackBG = new Sprite[bossPics.length]; // Sprite[] bossInfo = new Sprite[bossPics.length]; float themeRWidth = mCameraWidth * bossPics.length; themeRInitX = themeRWidth / 2f; Rectangle themeR = new Rectangle( themeRWidth / 2f, mCameraHeight / 2f, themeRWidth, mCameraHeight * (2f / 3f), mVertexBufferObjectManager); themeR.setAlpha(0f); int themeSceneOneBossTotal = BangYouScreenActivity.getIntFromSharedPreferences(DataConstant.SHARED_PREFS_THEME_MXD); for (int i = 0; i < ResourceManager.mxdBoss_TTRArray.length; i++) { if (i < themeSceneOneBossTotal) { if (isKO) { if (i != (mCurrentBoss - 1)) { // KO标志 Sprite s = new Sprite(0f, 0f, ResourceManager.ko, mVertexBufferObjectManager); EntityUtil.setSize("width", 1f / 4f, s); s.setPosition((i + 1f / 2f) * mCameraWidth, themeR.getHeight() / 2f); themeR.attachChild(s); } else { // KO动画 Sprite s = new Sprite(0f, 0f, ResourceManager.ko, mVertexBufferObjectManager); EntityUtil.setSize("width", 1f / 4f, s); s.setPosition((i + 1f / 2f) * mCameraWidth, themeR.getHeight() / 2f); themeR.attachChild(s); ScaleAtModifier highestPicScale = new ScaleAtModifier(0.5f, 25f, 1f, 0.5f, 0.5f); // 实体缩放 FadeInModifier highestPicFadeIn = new FadeInModifier(0.5f); // 在0.5秒内改变透明度由0f变为1f ParallelEntityModifier highestPicParalle = new ParallelEntityModifier( new IEntityModifierListener() { @Override public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) { SFXManager.getInstance().playSound("t_ko"); } @Override public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) { // TODO Auto-generated method stub } }, highestPicScale, highestPicFadeIn); // 同时执行修饰符 s.registerEntityModifier(highestPicParalle); } } else { // KO标志 Sprite s = new Sprite(0f, 0f, ResourceManager.ko, mVertexBufferObjectManager); EntityUtil.setSize("width", 1f / 4f, s); s.setPosition((i + 1f / 2f) * mCameraWidth, themeR.getHeight() / 2f); themeR.attachChild(s); } } if (ResourceManager.mxdBoss_TTRArray[i] != null) { // BOSS动画 bossPics[i] = new AnimatedButtonSprite( 0f, 0f, ResourceManager.mxdBoss_TTRArray[i], mVertexBufferObjectManager); EntityUtil.setSize("height", 1f / 2f, bossPics[i]); // BOSS简介 // bossInfo[i] = new Sprite(0f, 0f,ResourceManager.mxdBoss_InfoTRArray[i], // mVertexBufferObjectManager); // EntityUtil.setSize("height", 1f/2f, bossInfo[i]); if (i == 0) { bossPics[i].setPosition(mCameraWidth / 4f, themeR.getHeight() / 2f); // bossInfo[i].setPosition(3f*mCameraWidth/4f, themeR.getHeight()/2f); } if (i == 7) { long[] frameDur = new long[2]; Arrays.fill(frameDur, 300); bossPics[i].animate(frameDur, 0, 1, true); } else { bossPics[i].animate(100, true); } bossPics[i].setOnClickListenerABS( new OnClickListenerABS() { @Override public void onClick( AnimatedButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) { SFXManager.getInstance().playSound("a_click"); SFXManager.getInstance().stopMusic(); SceneManager.getInstance() .showScene( new GameLevel( DataConstant.getMXDBoss(mCurrentBoss), DataConstant.getPlayerModel())); } }); // BOSS图片和简介的位置 if (i > 0) { bossPics[i].setPosition(mCameraWidth + bossPics[i - 1].getX(), themeR.getHeight() / 2f); // bossInfo[i].setPosition(mCameraWidth+bossInfo[i-1].getX(), themeR.getHeight()/2f); } themeR.attachChild(bossPics[i]); registerTouchArea(bossPics[i]); // themeR.attachChild(bossInfo[i]); } else { bossBlackBG[i] = new Sprite( 0f, 0f, ResourceManager.bossBlackBG.getTextureRegion(i), mVertexBufferObjectManager); EntityUtil.setSize("height", 1f / 2f, bossBlackBG[i]); bossBlackBG[i].setPosition(mCameraWidth * (i + 1f / 4f), themeR.getHeight() / 2f); switch (i) { case 0: break; case 1: break; } themeR.attachChild(bossBlackBG[i]); } } return themeR; }
private void init(KeyListenScene pBaseScene) { // 共通ウィンドウを作成 CommonWindowRectangle comonWindowRectangle = new CommonWindowRectangle( 0, 0, pBaseScene.getWindowWidth(), pBaseScene.getWindowHeight(), Color.BLACK, 0.8f, pBaseScene); attachChild(comonWindowRectangle); // タイトル float titleY = 12; Font titleFont = pBaseScene.createFont(Typeface.DEFAULT_BOLD, 30, Color.WHITE); Text titleText = new Text( 10, 10, titleFont, "〜 経験値振り分け 〜", pBaseScene.getBaseActivity().getVertexBufferObjectManager()); pBaseScene.placeToCenterX(titleText, titleY); attachChild(titleText); float titleLineY = titleText.getY() + titleText.getHeight() + 4; Line line = new Line( 10, titleLineY, pBaseScene.getWindowWidth() - 16, titleLineY, pBaseScene.getBaseActivity().getVertexBufferObjectManager()); line.setLineWidth(1); line.setColor(Color.WHITE); line.setAlpha(1.0f); attachChild(line); TextLogic textLogic = new TextLogic(); Font defaultFont = pBaseScene.createFont(Typeface.SANS_SERIF, 16, Color.WHITE); Font paramFont = pBaseScene.createFont(Typeface.DEFAULT, 16, Color.YELLOW); // Font upParamFont = pBaseScene.createFont(Typeface.DEFAULT, 16, Color.BLUE); // Expの表示 float expY = titleLineY + 4; Rectangle totalExpTextRect = textLogic.createTextRectangle( "所持経験値:", defaultFont, "100 Exp", paramFont, pBaseScene.getBaseActivity().getVertexBufferObjectManager()); attachChild(totalExpTextRect); Rectangle afterExpTextRect = textLogic.createTextRectangle( "振り分け後経験値:", defaultFont, "0 Exp", paramFont, pBaseScene.getBaseActivity().getVertexBufferObjectManager()); attachChild(afterExpTextRect); totalExpTextRect.setPosition( pBaseScene.getWindowWidth() / 2 - (totalExpTextRect.getX() + totalExpTextRect.getWidth() + 50 + afterExpTextRect.getWidth()) / 2, expY); afterExpTextRect.setPosition( totalExpTextRect.getX() + totalExpTextRect.getWidth() + 50, totalExpTextRect.getY()); float expLineY = totalExpTextRect.getY() + totalExpTextRect.getHeight() + 4; Line expLine = new Line( 10, expLineY, pBaseScene.getWindowWidth() - 16, expLineY, pBaseScene.getBaseActivity().getVertexBufferObjectManager()); expLine.setLineWidth(1); expLine.setColor(Color.WHITE); expLine.setAlpha(1.0f); attachChild(expLine); // プレイヤー情報 float playerX = 12; float playerY = expLineY + 12; ActorPlayerLogic actorPlayerLogic = new ActorPlayerLogic(); ActorPlayerDto actorPlayerDto = actorPlayerLogic.createActorPlayerDto(pBaseScene, 1); PlayerStatusRectangle playerStatusRectangle = new PlayerStatusRectangle( pBaseScene, defaultFont, actorPlayerDto, ActorSpriteUtil.getFaceFileName(actorPlayerDto.getImageResId()), playerX, playerY); playerStatusRectangle.show(PlayerStatusRectangleType.MINI_STATUS); attachChild(playerStatusRectangle); }