示例#1
0
  private void init() {
    foreground.addWidget(loaded.getWidget("background").copy());
    transitor.addWidget(loaded.getWidget("background").copy());

    // Build the pages
    for (int i = 0; i < 4; ++i) {
      Widget normal = createCopy();
      TextBox.get(normal.getWidget("title")).setContent(local("tag") + (i + 1));

      for (int j = 0; j < 4; ++j) {
        normal.getWidget("" + j).addComponent(new HintHandler(j));
      }
      normal.addComponent(new ForegroundPage(i));
      add(i, foreground, normal);
    }

    for (int i = 0; i < 4; ++i) {
      Widget back = createCopy();
      TextBox.get(back.getWidget("title")).setContent(local("tag") + (i + 1));

      back.addComponent(new TransitPage(i));
      add(i, transitor, back);
    }

    resetAll();
  }
示例#2
0
  private Widget createMedia(Media media) {
    Widget ret = loaded.getWidget("t_one").copy();
    DrawTexture.get(ret.getWidget("icon")).texture = media.cover;
    TextBox.get(ret.getWidget("title")).content = media.getDisplayName();
    TextBox.get(ret.getWidget("desc")).content = media.getDesc();
    TextBox.get(ret.getWidget("time")).content = media.getLengthStr();

    ret.regEventHandler(
        MouseDownEvent.class,
        (Widget w, MouseDownEvent event) -> {
          if (w.isFocused()) {
            player.startPlay(media);
            gui.postEvent(new UpdateMediaEvent());
          }
        });

    return ret;
  }
示例#3
0
  private void init() {
    pageMain = loaded.getWidget("back").copy();

    List<Media> installedMedias = data.getInstalledMediaList();

    player.updatePlayerMedias(installedMedias);

    {
      Widget area = pageMain.getWidget("area");
      ElementList list = new ElementList();

      for (Media m : installedMedias) {
        list.addWidget(createMedia(m));
      }

      area.addComponent(list);
    }

    EventLoader.load(pageMain, this);
    gui.addWidget(pageMain);

    gui.postEvent(new UpdateMediaEvent());
  }
示例#4
0
 static {
   loaded = CGUIDocLoader.load(new ResourceLocation("academy:guis/preset_edit.xml"));
   template = loaded.getWidget("template");
 }
示例#5
0
 private Widget get(LIGui gui, int i) {
   return gui.getWidget("" + i);
 }