@Override
  public void bind(final Nifty nifty, final Screen screen) {
    System.out.println("bind()");
    this.nifty = nifty;

    for (int i = 0; i < 5; i++) {
      for (int j = 0; j < 5; j++) {
        Element e = screen.findElementByName("item" + i + "_" + j);
        DroppableControl drroppableControl = e.getControl(DroppableControl.class);
        drroppableControl.addFilter(this);
      }
    }
  }
Пример #2
0
 public void spawnCitizenWindow(Citizen citizen) {
   String windowId = "updatable-" + NiftyIdCreator.generate();
   CustomControlCreator citizenWindowCreator = new CustomControlCreator(windowId, "CitizenWindow");
   Element citizenWindow = citizenWindowCreator.create(nifty, screen, windows);
   // the controller needs to be set on the panel rather than the control, maybe due to the hidden
   // window-content panel
   // there is something bugged about these ID's
   Element citizenWindowPanel =
       citizenWindow.findElementByName(
           windowId
               + "#CitizenWindow#window-content#CitizenWindow#window-content#CitizenWindowPanel");
   CitizenWindowController controller =
       citizenWindowPanel.getControl(CitizenWindowController.class);
   controller.setCitizen(citizen);
   updatables.put(windowId, controller);
 }