Beispiel #1
0
  private UIManager() {
    mStartUI = new StartScreen();

    mIntroductionUI = new IntroductionUI();
    mIntroductionUI.setListener(
        new IntroductionListener() {

          @Override
          public void introductionFinish() {
            // TODO Auto-generated method stub
            mLoadingUI.startLoading();
            mCurScreenUI = mLoadingUI;
          }
        });

    mLoadingUI = new LoadingScreenUI();
    mLoadingUI.setListener(
        new LoadingUIListener() {

          @Override
          public void loadingFinish() {
            mCurScreenUI = mGameUI;
            Driver.getInstance(Driver.class).ignoreNextUpdate();
          }
        });

    mGameUI = new GameScreen();

    mCurScreenUI = mStartUI;
    Settings.backgroundColor = Settings.gameNormalGroundColor.cpy();

    listenToDriver();

    InputMgr.getInstance(InputMgr.class)
        .addListener(
            new InputMgrListenerBaseImpl() {

              @Override
              public boolean touchDown(float screenX, float screenY, int pointer, int button) {
                boolean bProcessed = mCurScreenUI.touchDown(screenX, screenY, pointer, button);
                if (bProcessed) {
                  InputMgr.getInstance(InputMgr.class).cancelTouchDown();
                  VoicePlayer.getInstance(VoicePlayer.class).playSound("click.mp3");
                }
                return bProcessed;
              }

              @Override
              public boolean touchUp(float screenX, float screenY, int pointer, int button) {
                return mCurScreenUI.touchUp(screenX, screenY, pointer, button);
              }

              @Override
              public void touchDragged(
                  float screenX, float screenY, float deltaX, float deltaY, int pointer) {
                mCurScreenUI.touchDragged(screenX, screenY, deltaX, deltaY, pointer);
              }
            });
  }
Beispiel #2
0
 public void returnToStartUI() {
   mCurScreenUI = mStartUI;
   mGameUI.clear();
   mIntroductionUI.reset();
 }
Beispiel #3
0
 public void startGame() {
   mCurScreenUI = mIntroductionUI;
   mIntroductionUI.startShow();
 }