public ResultScene(Camera mCamera) {
    super(mCamera);
    activity = BaseActivity.getSharedInstance();
    setBackgroundEnabled(false);
    GameScene scene = (GameScene) activity.mCurrentScene;
    float accureay = 1 - (float) scene.missCount / scene.bulletCount;
    if (Float.isNaN(accureay)) accureay = 0;
    accureay *= 100;
    Text result =
        new Text(
            0,
            0,
            activity.mFont,
            activity.getString(R.string.accuracy) + ": " + String.format("%.2f", accureay) + "%",
            BaseActivity.getSharedInstance().getVertexBufferObjectManager());

    final int x = (int) (mCamera.getWidth() / 2 - result.getWidth() / 2);
    final int y = (int) (mCamera.getHeight() / 2 - result.getHeight() / 2);

    done = false;
    result.setPosition(x, mCamera.getHeight() + result.getHeight());
    MoveYModifier mod =
        new MoveYModifier(5, result.getY(), y) {
          @Override
          protected void onModifierFinished(IEntity pItem) {
            done = true;
          }
        };
    attachChild(result);
    result.registerEntityModifier(mod);
    setOnSceneTouchListener(this);
  }
Exemplo n.º 2
0
 public BookInfoDialog(BaseActivity activity, Collection<String> items) {
   super(activity);
   mCoolReader = activity;
   setTitle(mCoolReader.getString(R.string.dlg_book_info));
   fillMap();
   mInflater = LayoutInflater.from(getContext());
   View view = mInflater.inflate(R.layout.book_info_dialog, null);
   TableLayout table = (TableLayout) view.findViewById(R.id.table);
   for (String item : items) {
     addItem(table, item);
   }
   setView(view);
 }