Exemplo n.º 1
0
  private void initRadarPanel() {
    final WidgetList<RadarCFG.MarkerCheck> markers =
        new WidgetList<RadarCFG.MarkerCheck>(new Coord(200, 16), 20) {
          @Override
          protected void itemclick(RadarCFG.MarkerCheck item, int button) {
            if (button == 1) {
              item.set(!item.a);
            }
          }
        };
    markers.canselect = false;
    radar.add(markers, 225, 0);

    WidgetList<RadarCFG.GroupCheck> groups =
        radar.add(
            new WidgetList<RadarCFG.GroupCheck>(new Coord(200, 16), 20) {
              @Override
              public void selected(RadarCFG.GroupCheck item) {
                markers.clear(true);
                for (RadarCFG.MarkerCFG marker : item.group.markerCFGs) {
                  markers.additem(new RadarCFG.MarkerCheck(marker));
                }
              }
            });
    for (RadarCFG.Group group : RadarCFG.groups) {
      groups.additem(new RadarCFG.GroupCheck(group)).hitbox = true;
    }

    radar.add(
        new Button(60, "Save") {
          @Override
          public void click() {
            RadarCFG.save();
          }
        },
        183,
        groups.sz.y + 10);

    radar.pack();
    radar.add(new PButton(200, "Back", 27, main), radar.sz.x / 2 - 100, radar.sz.y + 35);
    radar.pack();
  }
Exemplo n.º 2
0
  private void initShortcutsPanel() {
    WidgetList<KeyBinder.ShortcutWidget> list =
        shortcuts.add(
            new WidgetList<KeyBinder.ShortcutWidget>(new Coord(300, 24), 16) {
              @Override
              public boolean mousedown(Coord c0, int button) {
                boolean result = super.mousedown(c0, button);
                KeyBinder.ShortcutWidget item = itemat(c0);
                if (item != null) {
                  c0 = c0.add(0, sb.val * itemsz.y);
                  item.mousedown(c0.sub(item.parentpos(this)), button);
                }
                return result;
              }

              @Override
              public Object tooltip(Coord c0, Widget prev) {
                KeyBinder.ShortcutWidget item = itemat(c0);
                if (item != null) {
                  c0 = c0.add(0, sb.val * itemsz.y);
                  return item.tooltip(c0, prev);
                }
                return super.tooltip(c, prev);
              }
            });
    list.canselect = false;
    KeyBinder.makeWidgets(
            () -> {
              for (int i = 0; i < list.listitems(); i++) {
                list.listitem(i).update();
              }
              return null;
            })
        .forEach(list::additem);
    shortcuts.pack();
    shortcuts.add(
        new PButton(200, "Back", 27, main), shortcuts.sz.x / 2 - 100, shortcuts.sz.y + 35);
    shortcuts.pack();
  }