Пример #1
0
  public Project(Context context, String name, boolean landscape) {
    xmlHeader.setProgramName(name);
    xmlHeader.setDescription("");

    if (landscape) {
      ifPortraitSwitchWidthAndHeight();
    } else {
      ifLandscapeSwitchWidthAndHeight();
    }
    if (ScreenValues.SCREEN_HEIGHT == 0 || ScreenValues.SCREEN_WIDTH == 0) {
      Utils.updateScreenWidthAndHeight(context);
    }
    xmlHeader.virtualScreenWidth = ScreenValues.SCREEN_WIDTH;
    xmlHeader.virtualScreenHeight = ScreenValues.SCREEN_HEIGHT;
    setDeviceData(context);

    MessageContainer.clear();

    dataContainer = new DataContainer();

    if (context == null) {
      return;
    }

    Sprite background = new Sprite(context.getString(R.string.background));
    background.look.setZIndex(0);
    addSprite(background);
  }
Пример #2
0
  public void removeUnusedBroadcastMessages() {
    List<String> usedMessages = new ArrayList<String>();
    for (Sprite currentSprite : spriteList) {
      for (int scriptIndex = 0; scriptIndex < currentSprite.getNumberOfScripts(); scriptIndex++) {
        Script currentScript = currentSprite.getScript(scriptIndex);
        if (currentScript instanceof BroadcastMessage) {
          addBroadcastMessage(
              ((BroadcastMessage) currentScript).getBroadcastMessage(), usedMessages);
        }

        for (int brickIndex = 0; brickIndex < currentScript.getBrickList().size(); brickIndex++) {
          Brick currentBrick = currentScript.getBrick(brickIndex);
          if (currentBrick instanceof BroadcastMessage) {
            addBroadcastMessage(
                ((BroadcastMessage) currentBrick).getBroadcastMessage(), usedMessages);
          }
        }
      }
    }
    MessageContainer.removeUnusedMessages(usedMessages);
  }
Пример #3
0
  private List<Brick> setupControlCategoryList(Context context) {
    List<Brick> controlBrickList = new ArrayList<Brick>();
    controlBrickList.add(new WhenStartedBrick(null));
    controlBrickList.add(new WhenBrick(null));
    controlBrickList.add(new WaitBrick(BrickValues.WAIT));

    final String broadcastMessage = MessageContainer.getFirst(context);
    controlBrickList.add(new BroadcastReceiverBrick(broadcastMessage));
    controlBrickList.add(new BroadcastBrick(broadcastMessage));
    controlBrickList.add(new BroadcastWaitBrick(broadcastMessage));

    controlBrickList.add(new NoteBrick(context.getString(R.string.brick_note_default_value)));
    controlBrickList.add(new ForeverBrick());
    controlBrickList.add(new IfLogicBeginBrick(0));
    controlBrickList.add(new RepeatBrick(BrickValues.REPEAT));

    if (SettingsActivity.isPhiroSharedPreferenceEnabled(context)) {
      controlBrickList.add(new PhiroIfLogicBeginBrick());
    }

    return controlBrickList;
  }