Esempio n. 1
0
  @Given("^'(\\w+)' has a Start script$")
  public void object_has_start_script(String object) {
    programWaitLockPermits -= 1;
    Project project = ProjectManager.getInstance().getCurrentProject();
    Sprite sprite = Util.findSprite(project, object);
    StartScript script = new StartScript(sprite);

    script.addBrick(
        new CallbackBrick(
            sprite,
            new CallbackBrick.BrickCallback() {
              @Override
              public void onCallback() {
                synchronized (programStartWaitLock) {
                  if (!programHasStarted) {
                    programHasStarted = true;
                    programStartWaitLock.notify();
                  }
                }
              }
            }));

    sprite.addScript(script);
    Cucumber.put(Cucumber.KEY_CURRENT_SCRIPT, script);
  }
Esempio n. 2
0
  @Given("^'(\\w+)' has a When '(\\w+)' script$")
  public void object_has_a_when_script(String object, String message) {
    programWaitLockPermits -= 1;
    Project project = ProjectManager.getInstance().getCurrentProject();
    Sprite sprite = Util.findSprite(project, object);
    BroadcastScript script = new BroadcastScript(sprite, message);

    sprite.addScript(script);
    Cucumber.put(Cucumber.KEY_CURRENT_SCRIPT, script);
  }
Esempio n. 3
0
 private void addScriptEndCallbacks() {
   Project project = ProjectManager.getInstance().getCurrentProject();
   for (Sprite sprite : project.getSpriteList()) {
     for (int i = 0; i < sprite.getNumberOfScripts(); i++) {
       sprite
           .getScript(i)
           .addBrick(
               new CallbackBrick(
                   sprite,
                   new CallbackBrick.BrickCallback() {
                     @Override
                     public void onCallback() {
                       programWaitLock.release();
                     }
                   }));
     }
   }
 }