コード例 #1
0
  protected void destroyApp(boolean unconditional) {
    final String METHOD_NAME = "GameMidlet::destroyApp";
    try {
      PreLogUtil.put(AllGameStatisticsFactory.getInstance().toString(), this, METHOD_NAME);
      // LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, METHOD_NAME));

      GameAdState gameAdState = GameAdStateFactory.getInstance().getCurrentInstance();

      gameAdState.getAdvertisements().stopAll();

      if (!this.isDestroyed()) {
        this.stopGameCanvasRunnableInterface();
        this.setGameCanvasRunnableInterface(null);
        // if(!AppletUtil.isAppletLoader(this))
        // {
        this.mediaShutdown();
        // }
      } else {
        LogUtil.put(
            LogFactory.getInstance(
                "Midlet Managment Error: Midlet Should Only Be Destroyed Once", this, METHOD_NAME));
      }

      super.destroyApp(true);

      // LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().END, this, METHOD_NAME));
      PreLogUtil.put(CommonStrings.getInstance().END, this, METHOD_NAME);
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, METHOD_NAME, e));
    }
    LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().END, this, METHOD_NAME));
    PreLogUtil.put(CommonStrings.getInstance().END, this, METHOD_NAME);
  }
コード例 #2
0
  protected void unPauseApp() {
    this.unPauseAppBackground(true);

    GameAdState gameAdState = GameAdStateFactory.getInstance().getCurrentInstance();

    gameAdState.getAdvertisements().startAll();
  }
コード例 #3
0
  protected void startApp() {
    try {
      GameAdState gameAdState = GameAdStateFactory.getInstance().getCurrentInstance();

      gameAdState.getAdvertisements().startAll();

      final String START_APP = "startApp";

      LogUtil.put(LogFactory.getInstance(CommonStrings.getInstance().START, this, START_APP));
      // PreLogUtil.put(CommonStrings.getInstance().START, this, START_APP);

      GameCanvasRunnableInterface gameCanvasRunnableInterface =
          this.allbinaryGameCanvasRunnableInterface;

      // If the first time/null then start demo or unpausing
      // thus start up only occurs one time ever otherwise this is just unpause
      if (gameCanvasRunnableInterface == null) {
        gameMidletStateFactory.setCurrentGameState(GameState.NO_GAME_STATE);
        this.setDemo();
      } else {
        LogUtil.put(
            LogFactory.getInstance("GameCanvasRunnableInterface is available", this, START_APP));

        // Starting midlet after a previous start means that we only unpause the
        // GameCanvasRunnableInterface if it is currently displayed
        if (gameCanvasRunnableInterface == this.getCurrentDisplayable()) {
          this.unPauseAppBackground(false);
        } else {
          LogUtil.put(
              LogFactory.getInstance(
                  "GameCanvasRunnableInterface is not current displayable", this, START_APP));
        }
      }
    } catch (Exception e) {
      LogUtil.put(
          LogFactory.getInstance(CommonStrings.getInstance().EXCEPTION, this, "startApp", e));
      destroyApp(false);
      // TWB - Only remove from context when multiple midlets share the same emulator
      notifyDestroyed();
    }
  }