示例#1
0
  public static Table setupScrollpane(
      float x,
      float y,
      float paneWidth,
      float paneHeight,
      ScrollPane target,
      Texture scrollButton) {
    ScrollPane.ScrollPaneStyle scrollPaneStyle = new ScrollPane.ScrollPaneStyle();
    scrollPaneStyle.vScrollKnob = new TextureRegionDrawable(new TextureRegion(scrollButton));

    target.setStyle(scrollPaneStyle);
    target.setFadeScrollBars(false);
    target.setOverscroll(false, false);
    target.setFlickScroll(false);

    target.addListener(new GetScrollFocusWhenEntered(target));

    Table scenarioPaneContainer = new Table();
    scenarioPaneContainer.setX(x);
    scenarioPaneContainer.setY(y);
    scenarioPaneContainer.setWidth(paneWidth);
    scenarioPaneContainer.setHeight(paneHeight);
    scenarioPaneContainer.add(target).fill().expand();
    return scenarioPaneContainer;
  }
示例#2
0
  protected CollapsableWindow addBehaviorSelectionWindow(
      String title, List<String> testList, float x, float y) {

    CollapsableWindow window = new CollapsableWindow(title, skin);
    window.row();

    ScrollPane pane = new ScrollPane(testList, skin);
    pane.setFadeScrollBars(false);
    pane.setScrollX(0);
    pane.setScrollY(0);

    window.add(pane);
    window.pack();
    window.pack();
    if (window.getHeight() > stage.getHeight()) {
      window.setHeight(stage.getHeight());
    }
    window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x);
    window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y);
    window.layout();
    window.collapse();
    stage.addActor(window);

    return window;
  }
示例#3
0
 public void act() {
   if (updateScroll > 0) {
     consoleScroll.setScrollPercentX(0);
     consoleScroll.setScrollPercentY(100);
     consoleScroll.updateVisualScroll();
     updateScroll--;
   }
 }
示例#4
0
  public void generateLists(String type) {
    elist.offsetX2 = type.equals("equipment") ? 20 : 0;
    float y = pane.getScrollX();
    Array<Item> sc = elist.getItems();
    sc.clear();
    for (Item e : GameViews.global.items.get(type)) {
      sc.add(e);
    }

    elist.layout();
    for (Cell cell : topbar.getCells()) {
      ((TopBar) cell.getActor()).select(((TopBar) cell.getActor()).name.equals(type));
    }

    pane.setScrollX(y);
  }
示例#5
0
 private void setSP(ScrollPane sp) {
   ScrollPaneStyle aux_st = sp.getStyle();
   TextureRegion bg = new TextureRegion(Textures.scroll_box_bg, 0, 0, 256, 512);
   TextureRegionDrawable bg_d = new TextureRegionDrawable(bg);
   aux_st.background = bg_d;
   aux_st.vScroll = null;
   sp.setStyle(aux_st);
   sp.setHeight(415);
   sp.setWidth(212);
   sp.setSmoothScrolling(true);
   sp.setFadeScrollBars(true);
   sp.setFlickScroll(false);
   sp.setScrollbarsOnTop(true);
   sp.setupFadeScrollBars(2, 1.5f);
 }
    void initialize() {
      skin.getFont("default").getData().markupEnabled = true;

      for (int i = 0; i < 6; i++) trackButtons.add(new TextButton(i + "", skin, "toggle"));

      animationList.getSelection().setRequired(false);

      premultipliedCheckbox.setChecked(true);

      loopCheckbox.setChecked(true);

      scaleSlider.setValue(1);
      scaleSlider.setSnapToValues(new float[] {1, 1.5f, 2, 2.5f, 3, 3.5f}, 0.01f);

      mixSlider.setValue(0.3f);
      mixSlider.setSnapToValues(new float[] {1, 1.5f, 2, 2.5f, 3, 3.5f}, 0.1f);

      speedSlider.setValue(1);
      speedSlider.setSnapToValues(new float[] {0.5f, 0.75f, 1, 1.25f, 1.5f, 2, 2.5f}, 0.1f);

      alphaSlider.setValue(1);
      alphaSlider.setDisabled(true);

      window.setMovable(false);
      window.setResizable(false);
      window.setKeepWithinStage(false);
      window.setX(-3);
      window.setY(-2);

      window.getTitleLabel().setColor(new Color(0.76f, 1, 1, 1));
      window.getTitleTable().add(openButton).space(3);
      window.getTitleTable().add(minimizeButton).width(20);

      skinScroll.setFadeScrollBars(false);

      animationScroll.setFadeScrollBars(false);
    }
示例#7
0
  private void popButtons() {
    VerticalGroup listNoob = new VerticalGroup();
    VerticalGroup listHardcore = new VerticalGroup();
    VerticalGroup listOther = new VerticalGroup();

    int y_init = Gdx.graphics.getHeight() - 100;
    int x_init = 70;

    int counter = 0;

    for (Constants.achiev_types type : Constants.achiev_types.values()) {
      AchievBtn btn = new AchievBtn(type.toString(), StylesManager.skin, type);
      btn.setBounds(x_init, y_init, 150, 35);

      y_init -= 40;
      list.add(btn);

      if (counter < 20) listNoob.addActor(btn);
      else if (counter < 40) listHardcore.addActor(btn);
      else listOther.addActor(btn);

      counter++;
    }

    // add back button
    final TextButton btn = new TextButton("Back", StylesManager.btnGray);
    btn.setBounds(Gdx.graphics.getWidth() / 2 - 75, 20, 150, 35);
    btn.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {

            return true;
          }

          public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            if (x < btn.getWidth() && x > 0 && y < btn.getHeight() && y > 0)
              maingame.setScreen(maingame.questsScreen);
          }
        });
    table.addActor(btn);

    ScrollPane sp1 = new ScrollPane(listNoob, StylesManager.skin);
    ScrollPane sp2 = new ScrollPane(listHardcore, StylesManager.skin);
    ScrollPane sp3 = new ScrollPane(listOther, StylesManager.skin);
    setSP(sp1);
    sp1.setPosition(73, 92);
    table.addActor(sp1);
    setSP(sp2);
    sp2.setPosition(72 + 212, 92);
    table.addActor(sp2);
    setSP(sp3);
    sp3.setPosition(71 + 2 * 212, 92);
    table.addActor(sp3);
  }
示例#8
0
 @Override
 public void create() {
   stage = new Stage(480, 800, false);
   group = new Group();
   group.setSize(256 * 30, 256); // 横向滚动条
   //		group.setSize(256, 512*30);//纵向滚动条
   images = new Image[30];
   int i;
   for (i = 0; i < 30; ++i) {
     images[i] = new Image(new Texture(Gdx.files.internal("data/lengjiao.png")));
     //			images[i] = new Image(new Texture(Gdx.files.internal("data/test1.jpg")));
     images[i].setPosition(i * 256, 0); // 横向滚动条
     //			images[i].setPosition(0, i*512);//纵向滚动条
     group.addActor(images[i]);
   }
   style = new ScrollPaneStyle(); // 初始化一个ScrollPaneStyle
   style.background = null; // 把背景设成null,即这个滚动条不需要背景
   pane = new ScrollPane(group, style);
   pane.setSize(480, 256); // 横向滚动条
   //		pane.setScrollingDisabled(false, true);//设置是否可上下、左右移动..这里设置了横向可移动、纵向不可移动..
   //		pane.setSize(256,800);
   stage.addActor(pane);
   Gdx.input.setInputProcessor(stage);
 }
示例#9
0
  public void setupGUI() {
    stage = new Stage();

    skin = new Skin(Gdx.files.internal("uiskin.json"));
    table = new Table(skin);
    // table.setBounds(0, 0, Gdx.graphics.getWidth(),
    // Gdx.graphics.getHeight());
    // table.setClip(true);

    Gdx.input.setInputProcessor(stage);

    // defaultStyle.over = skin.getDrawable("button.hover");

    TextButton fullScreenButton = new TextButton("Toglle Full Screen", skin, "default");
    fullScreenButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            Config.fullscreen = !Config.fullscreen;
          }
        });

    // fullScreenButton.setFillParent(true);
    TextButton saveSettingsButton = new TextButton("Save settings", skin, "default");
    saveSettingsButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            Config.reload();
            show();
          }
        });
    Container<TextButton> saveSettingContainer = new Container<TextButton>(saveSettingsButton);

    saveSettingContainer.padTop(Value.percentHeight(.6f, table));

    TextButton backButton = new TextButton("Go back", skin, "default");
    backButton.addListener(
        new ClickListener() {
          @Override
          public void clicked(InputEvent event, float x, float y) {
            Screens.setScreen(Screens.MAIN_MENU_SCREEN);
          }
        });

    VerticalGroup buttons1 = new VerticalGroup();
    buttons1.fill();
    buttons1.addActor(fullScreenButton);

    VerticalGroup buttons2 = new VerticalGroup();
    buttons2.fill();
    buttons2.addActor(saveSettingsButton);
    buttons2.addActor(backButton);

    // buttons.setPosition(Gdx.graphics.getWidth()/4,
    // Gdx.graphics.getHeight()/5);

    VerticalGroup resolution = new VerticalGroup();
    ButtonGroup<TextButton> buttonGroup = new ButtonGroup<>();
    buttonGroup.setMaxCheckCount(1);
    resolution.fill();

    transparentSkin = new Skin(new TextureAtlas("select.pack"));
    TextButtonStyle transparent = new TextButtonStyle();
    transparent.checked = transparentSkin.getDrawable("checked");
    transparent.up = transparentSkin.getDrawable("up");
    transparent.font = FontUtil.generateFont(Color.WHITE, 20);

    addResolutions(buttonGroup, transparent);

    for (TextButton b : buttonGroup.getButtons()) {
      resolution.addActor(b);
    }

    resolution.right();

    ScrollPane resolScroll = new ScrollPane(resolution);
    resolScroll.setHeight(700);

    Label fullScreenLabel = new Label("", skin);
    fullScreenLabel.addAction(
        Actions.forever(
            new Action() {
              @Override
              public boolean act(float delta) {
                if (Config.fullscreen) {
                  fullScreenLabel.setColor(Color.GREEN);
                  fullScreenLabel.setText("on");
                } else {
                  fullScreenLabel.setColor(Color.RED);
                  fullScreenLabel.setText("off");
                }
                return true;
              }
            }));

    table.setFillParent(true);
    Table left = new Table();
    left.add(buttons1).spaceBottom(Value.percentHeight(.6f, table));
    left.add(fullScreenLabel).top();
    left.row();
    // left.row();
    left.add(buttons2);
    // table.add(buttons1.left()).left();
    table.add(left).left().padLeft(Value.percentWidth(0.1f, table)).expandX();
    // table.add(fullScreenLabel).top().spaceRight(Value.percentWidth(.5f,
    // table));
    table.add(resolScroll).right().padRight(Value.percentWidth(0.1f, table));

    // table.row();
    // table.add(buttons2).bottom().left();
    // table.center();

    stage.addActor(table);

    if (Config.debug) table.setDebug(true);
  }
示例#10
0
  @Override
  public void create() {
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    texture1 = new Texture(Gdx.files.internal("data/badlogicsmall.jpg"));
    texture2 = new Texture(Gdx.files.internal("data/badlogic.jpg"));
    TextureRegion image = new TextureRegion(texture1);
    TextureRegion imageFlipped = new TextureRegion(image);
    imageFlipped.flip(true, true);
    TextureRegion image2 = new TextureRegion(texture2);
    // stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false, new
    // PolygonSpriteBatch());
    stage = new Stage();
    // stage.setViewport(new ExtendViewport(800, 480));
    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;

    ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
    style.imageUp = new TextureRegionDrawable(image);
    style.imageDown = new TextureRegionDrawable(imageFlipped);
    ImageButton iconButton = new ImageButton(style);

    Button buttonMulti = new TextButton("Multi\nLine\nToggle", skin, "toggle");
    Button imgButton = new Button(new Image(image), skin);
    Button imgToggleButton = new Button(new Image(image), skin, "toggle");

    Label myLabel = new Label("this is some text.", skin);
    myLabel.setWrap(true);

    Table t = new Table();
    t.row();
    t.add(myLabel);

    t.layout();

    CheckBox checkBox = new CheckBox("Check me", skin);
    final Slider slider = new Slider(0, 10, 1, false, skin);
    TextField textfield = new TextField("", skin);
    textfield.setMessageText("Click here!");
    SelectBox dropdown = new SelectBox(skin);
    dropdown.setItems(
        "Android1",
        "Windows1",
        "Linux1",
        "OSX1",
        "Android2",
        "Windows2",
        "Linux2",
        "OSX2",
        "Android3",
        "Windows3",
        "Linux3",
        "OSX3",
        "Android4",
        "Windows4",
        "Linux4",
        "OSX4",
        "Android5",
        "Windows5",
        "Linux5",
        "OSX5",
        "Android6",
        "Windows6",
        "Linux6",
        "OSX6",
        "Android7",
        "Windows7",
        "Linux7",
        "OSX7");
    dropdown.setSelected("Linux6");
    Image imageActor = new Image(image2);
    ScrollPane scrollPane = new ScrollPane(imageActor);
    List list = new List(skin);
    list.setItems(listEntries);
    list.getSelection().setMultiple(true);
    list.getSelection().setRequired(false);
    // list.getSelection().setToggle(true);
    ScrollPane scrollPane2 = new ScrollPane(list, skin);
    scrollPane2.setFlickScroll(false);
    SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false, skin, "default-horizontal");
    fpsLabel = new Label("fps:", skin);

    // configures an example of a TextField in password mode.
    final Label passwordLabel = new Label("Textfield in password mode: ", skin);
    final TextField passwordTextField = new TextField("", skin);
    passwordTextField.setMessageText("password");
    passwordTextField.setPasswordCharacter('*');
    passwordTextField.setPasswordMode(true);

    // window.debug();
    Window window = new Window("Dialog", skin);
    window.getButtonTable().add(new TextButton("X", skin)).height(window.getPadTop());
    window.setPosition(0, 0);
    window.defaults().spaceBottom(10);
    window.row().fill().expandX();
    window.add(iconButton);
    window.add(buttonMulti);
    window.add(imgButton);
    window.add(imgToggleButton);
    window.row();
    window.add(checkBox);
    window.add(slider).minWidth(100).fillX().colspan(3);
    window.row();
    window.add(dropdown);
    window.add(textfield).minWidth(100).expandX().fillX().colspan(3);
    window.row();
    window.add(splitPane).fill().expand().colspan(4).maxHeight(200);
    window.row();
    window.add(passwordLabel).colspan(2);
    window.add(passwordTextField).minWidth(100).expandX().fillX().colspan(2);
    window.row();
    window.add(fpsLabel).colspan(4);
    window.pack();

    // stage.addActor(new Button("Behind Window", skin));
    stage.addActor(window);

    textfield.setTextFieldListener(
        new TextFieldListener() {
          public void keyTyped(TextField textField, char key) {
            if (key == '\n') textField.getOnscreenKeyboard().show(false);
          }
        });

    slider.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            Gdx.app.log("UITest", "slider: " + slider.getValue());
          }
        });

    iconButton.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            new Dialog("Some Dialog", skin, "dialog") {
              protected void result(Object object) {
                System.out.println("Chosen: " + object);
              }
            }.text("Are you enjoying this demo?")
                .button("Yes", true)
                .button("No", false)
                .key(Keys.ENTER, true)
                .key(Keys.ESCAPE, false)
                .show(stage);
          }
        });
  }
示例#11
0
  public void createWindow() {
    Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    TextButton closeButton = new TextButton("", skin, "close-toggle");

    Random random = new Random();

    dialog = new Window("Terminal", skin);
    dialog.setBounds(10 + random.nextInt(50), 100 + random.nextInt(50), 400, 200);
    dialog.setResizable(true);
    dialog.setKeepWithinStage(true);
    dialog
        .getTitleTable()
        .add(closeButton)
        .size(dialog.getPadTop() * 4 / 5, dialog.getPadTop() * 4 / 5)
        .padRight(dialog.getPadRight());
    dialog.left().top();
    dialog.setResizeBorder(5);
    dialog.padRight(0);
    dialog.padBottom(1);

    SimpleDateFormat simpleDateformat = new SimpleDateFormat("E");
    String day = simpleDateformat.format(new Date());
    String month = new SimpleDateFormat("MMM").format(Calendar.getInstance().getTime());
    int date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
    int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
    int min = Calendar.getInstance().get(Calendar.MINUTE);
    int sec = Calendar.getInstance().get(Calendar.SECOND);
    String textTest =
        "Last login: "******" "
            + month
            + " "
            + String.format("%02d", date)
            + " "
            + String.format("%02d", hour)
            + ":"
            + String.format("%02d", min)
            + ":"
            + String.format("%02d", sec);

    cld.textHistory = textTest;
    consoleDialog = new Label(cld.textHistory, skin);
    consoleDialog.setWrap(true);
    consoleDialog.setAlignment(Align.topLeft, Align.topLeft);

    consoleArrow =
        new Label(cld.parser.getInputPrefix(), new LabelStyle(skin.get(LabelStyle.class)));
    consoleField = new TextField("", skin);
    consoleField.setFocusTraversal(false);
    Color colour = Color.ORANGE;
    colour.a = 0.8f;
    consoleField.getStyle().cursor = skin.newDrawable("white", colour);
    consoleField.getStyle().cursor.setMinWidth(10);
    consoleField.setBlinkTime(0.6f);

    Table scrollTable = new Table();
    scrollTable.top();
    scrollTable.add(consoleDialog).colspan(2).growX().fill().left().top();
    scrollTable.row();
    scrollTable.add(consoleArrow).left().top();
    scrollTable.add(consoleField).expand(true, false).fill().left().top();
    scrollTable.padBottom(1);

    consoleScroll = new ScrollPane(scrollTable, skin);
    consoleScroll.setFadeScrollBars(false);
    consoleScroll.setVariableSizeKnobs(true);
    consoleScroll.setFlickScroll(false);
    dialog.add(consoleScroll).fill().expand();
    this.stage.addActor(dialog);

    closeButton.addListener(new CLICloseButtonListener(this, dialog));

    setKeyboardFocus();
  }
示例#12
0
  public void init() {
    add = new ParticleEffect();
    add.load(
        Gdx.files.internal(Setting.GAME_RES_PARTICLE + "addp.p"),
        Gdx.files.internal(Setting.GAME_RES_PARTICLE));
    add.setPosition(835, 111);

    render = new ShapeRenderer();
    render.setAutoShapeType(true);

    stage =
        new Stage(
            new ScalingViewport(
                Scaling.stretch,
                GameUtil.screen_width,
                GameUtil.screen_height,
                new OrthographicCamera()),
            GameMenuView.stage.getBatch());

    $.add(
            new ImageButton(
                Res.getDrawable(Setting.GAME_RES_IMAGE_MENU_GLOBAL + "exit.png"),
                Res.getDrawable(Setting.GAME_RES_IMAGE_MENU_GLOBAL + "exitc.png")))
        .setPosition(960, 550)
        .fadeOut()
        .addAction(Actions.parallel(Actions.fadeIn(0.2f), Actions.moveTo(960, 510, 0.1f)))
        .onClick(
            new Runnable() {
              @Override
              public void run() {
                Music.playSE("snd210");
                GameViews.gameview.stackView.disposes();
              }
            })
        .appendTo(stage);

    $.add(
            new ImageButton(
                Res.getDrawable(Setting.GAME_RES_IMAGE_MENU_GLOBAL + "min.png"),
                Res.getDrawable(Setting.GAME_RES_IMAGE_MENU_GLOBAL + "minc.png")))
        .setPosition(910, 550)
        .fadeOut()
        .addAction(Actions.parallel(Actions.fadeIn(0.2f), Actions.moveTo(910, 510, 0.1f)))
        .onClick(
            new Runnable() {
              @Override
              public void run() {
                GameViews.gameview.stackView.onkeyDown(Keys.ESCAPE);
                Music.playSE("snd210");
              }
            })
        .appendTo(stage);

    Image bg = Res.get(Setting.GAME_RES_IMAGE_MENU_ITEM + "item_bg.png");
    bg.setColor(1, 1, 1, 0);
    bg.setPosition(160, 28);
    bg.addAction(Actions.fadeIn(0.2f));
    stage.addActor(bg);

    ListStyle style = new ListStyle();
    style.font = FontUtil.generateFont(" ".toCharArray()[0], 22);
    style.selection = Res.getDrawable(Setting.GAME_RES_IMAGE_MENU_EQUIP + "equipsel.png");
    style.fontColorSelected = Color.valueOf("f5e70c");
    elist = new com.rpsg.rpg.system.ui.List<Item>(style);
    elist.onClick(
        new Runnable() {
          @Override
          public void run() {
            item = elist.getSelected();
            Music.playSE("snd210");
          }
        });
    elist.layout();
    pane = new ScrollPane(elist);
    pane.getStyle().vScroll = Res.getDrawable(Setting.GAME_RES_IMAGE_MENU_ITEM + "scrollbar.png");
    pane.getStyle().vScrollKnob =
        Res.getDrawable(Setting.GAME_RES_IMAGE_MENU_ITEM + "scrollbarin.png");
    pane.setForceScroll(false, true);
    pane.layout();

    Table table = new Table();
    table.add(pane);
    table.padRight(20);
    table.setPosition(170, 40);
    table.setSize(270, 390);
    table.getCell(pane).width(table.getWidth()).height(table.getHeight() - 20);
    table.setColor(1, 1, 1, 0);
    table.addAction(Actions.fadeIn(0.2f));
    stage.addActor(table);
    topbarSel = Res.get(Setting.GAME_RES_IMAGE_MENU_ITEM + "topsel.png");
    topbar = new Table();
    topbar.setBackground(Res.getDrawable(Setting.GAME_RES_IMAGE_MENU_ITEM + "topbar.png"));
    topbar.setSize(818, 42);
    topbar.setPosition(160, 455);
    int tmpI = 0, offsetX = 135;
    topbar.add(new TopBar("medicine", tmpI++ * offsetX));
    topbar.add(new TopBar("material", tmpI++ * offsetX));
    topbar.add(new TopBar("cooking", tmpI++ * offsetX));
    topbar.add(new TopBar("equipment", tmpI++ * offsetX));
    topbar.add(new TopBar("spellcard", tmpI++ * offsetX));
    topbar.add(new TopBar("important", tmpI++ * offsetX));
    for (Cell cell : topbar.getCells()) {
      cell.padLeft(50).padRight(34).height(40);
      cell.getActor()
          .addListener(
              new InputListener() {
                public boolean touchDown(
                    InputEvent event, float x, float y, int pointer, int button) {
                  Music.playSE("snd210");
                  return true;
                }
              });
    }

    stage.addActor(topbar);

    generateLists("medicine");

    final Actor mask = new Actor();
    mask.setWidth(GameUtil.screen_width);
    mask.setHeight(GameUtil.screen_height);
    mask.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return false;
          }
        });
    stage.addActor(mask);
    scuse = Res.get(Setting.GAME_RES_IMAGE_MENU_SC + "sc_use.png");
    scuse.loaded =
        new Runnable() {
          @Override
          public void run() {
            scuse.setPosition(
                (int) (GameUtil.screen_width / 2 - scuse.getWidth() / 2),
                (int) (GameUtil.screen_height / 2 - scuse.getHeight() / 2));
          }
        };
    sellist = new com.rpsg.rpg.system.ui.List<ListItem>(style);
    sellist.onDBClick(
        new Runnable() {
          @Override
          public void run() {
            sellist.getSelected().run.run();
          }
        });
    can =
        new Runnable() {
          @Override
          public void run() {
            scuse.visible = false;
            sellist.setVisible(false);
            mask.setVisible(false);
            layer = 0;
          }
        };
    sellist.setPosition(368, 240);
    sellist.setSize(254, 100);
    sellist.layout();

    stage.addActor(
        sellist.onClick(
            new Runnable() {
              @Override
              public void run() {
                Music.playSE("snd210");
              }
            }));

    final Actor mask2 = new Actor();
    mask2.setWidth(GameUtil.screen_width);
    mask2.setHeight(GameUtil.screen_height);
    mask2.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            return false;
          }
        });

    elist.onDBClick(
        new Runnable() {
          @Override
          public void run() {
            scuse.visible = true;
            sellist.offsetX2 = 20;
            sellist.getItems().clear();
            if (item.type == Item.TYPE_USEINMAP)
              sellist
                  .getItems()
                  .add(
                      new ListItem("使用")
                          .setUserObject(Res.get(Setting.GAME_RES_IMAGE_ICONS + "yes.png"))
                          .setRunnable(
                              new Runnable() {
                                @Override
                                public void run() {
                                  scfor.visible = true;
                                  herolist.setVisible(true);
                                  mask2.setVisible(true);
                                  layer = 2;
                                }
                              }));
            if (item.throwable)
              sellist
                  .getItems()
                  .add(
                      new ListItem("丢弃")
                          .setUserObject(Res.get(Setting.GAME_RES_IMAGE_ICONS + "bin.png"))
                          .setRunnable(
                              new Runnable() {
                                @Override
                                public void run() {
                                  group.setVisible(true);
                                  mask2.setVisible(true);
                                  can.run();
                                  currentCount = 1;
                                  layer = 3;
                                }
                              }));
            sellist
                .getItems()
                .add(
                    new ListItem("取消")
                        .setUserObject(Res.get(Setting.GAME_RES_IMAGE_ICONS + "no.png"))
                        .setRunnable(
                            new Runnable() {
                              @Override
                              public void run() {
                                can.run();
                              }
                            }));
            sellist.onDBClick(
                new Runnable() {
                  @Override
                  public void run() {
                    sellist.getSelected().run.run();
                  }
                });
            sellist.setVisible(true);
            sellist.setSelectedIndex(0);
            sellist.setItemHeight(27);
            sellist.padTop = 2;
            mask.setVisible(true);
            layer = 1;
          }
        });

    stage.addActor(mask2);
    scfor = Res.get(Setting.GAME_RES_IMAGE_MENU_ITEM + "selbg.png");
    scfor.setPosition(500, 87);

    herolist = new com.rpsg.rpg.system.ui.List<ListItem>(style);
    herolist.offsetX2 = 20;
    herolist
        .getItems()
        .add(new ListItem("取消").setUserObject(Res.get(Setting.GAME_RES_IMAGE_ICONS + "no.png")));
    for (Hero h : HeroController.heros) {
      herolist.getItems().add(new ListItem(h.name).setUserObject(h));
    }

    herolist
        .onDBClick(
            new Runnable() {
              @Override
              public void run() {}
            })
        .onClick(
            new Runnable() {
              @Override
              public void run() {
                Music.playSE("snd210");
              }
            });
    herolist.setPosition(492, 273);
    herolist.setSize(257, 140);
    herolist.layout();
    stage.addActor(herolist);

    can2 =
        new Runnable() {
          @Override
          public void run() {
            scfor.visible = false;
            herolist.setVisible(false);
            mask2.setVisible(false);
            layer = 1;
          }
        };
    TextButtonStyle butstyle = new TextButtonStyle();
    butstyle.over =
        butstyle.checkedOver = Res.getDrawable(Setting.GAME_RES_IMAGE_GLOBAL + "button_hover.png");
    butstyle.down = Res.getDrawable(Setting.GAME_RES_IMAGE_GLOBAL + "button_active.png");
    butstyle.up = Res.getDrawable(Setting.GAME_RES_IMAGE_GLOBAL + "button.png");
    group = new Group();
    Image tbg = new Image(Setting.GAME_RES_IMAGE_MENU_SC + "throw.png");
    tbg.setPosition(350, 200);
    group.addActor(tbg);
    TextButton button;
    button =
        new TextButton("确定", butstyle)
            .onClick(
                new Runnable() {
                  @Override
                  public void run() {
                    ItemUtil.throwItem(currentBar.name, item, currentCount);
                    AlertUtil.add("丢弃成功。", AlertUtil.Yellow);
                    ItemView.this.generateLists(currentBar.name);
                    item = new TipItem();
                    can3.run();
                  }
                });
    button.setPosition(630, 290);
    button.setSize(100, 50);
    group.addActor(button);
    TextButton button2 =
        new TextButton("取消", butstyle)
            .onClick(
                new Runnable() {
                  @Override
                  public void run() {
                    can3.run();
                  }
                });

    button2.setPosition(630, 225);
    button2.setSize(100, 50);
    group.addActor(button2);
    ImageButton upbutton1 =
        new ImageButton(
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "up.png"),
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "ups.png"));
    upbutton1
        .onClick(
            new Runnable() {
              @Override
              public void run() {
                if (currentCount + 100 <= item.count) currentCount += 100;
              }
            })
        .setPosition(395, 340);
    group.addActor(upbutton1);
    ImageButton upbutton2 =
        new ImageButton(
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "up.png"),
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "ups.png"));
    upbutton2
        .onClick(
            new Runnable() {
              @Override
              public void run() {
                if (currentCount + 10 <= item.count) currentCount += 10;
              }
            })
        .setPosition(435, 340);
    group.addActor(upbutton2);
    ImageButton upbutton3 =
        new ImageButton(
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "up.png"),
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "ups.png"));
    upbutton3
        .onClick(
            new Runnable() {
              @Override
              public void run() {
                if (currentCount + 1 <= item.count) currentCount += 1;
              }
            })
        .setPosition(475, 340);
    group.addActor(upbutton3);
    ImageButton dbutton1 =
        new ImageButton(
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "down.png"),
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "downs.png"));
    dbutton1
        .onClick(
            new Runnable() {
              @Override
              public void run() {
                if (currentCount - 100 >= 1) currentCount -= 100;
              }
            })
        .setPosition(395, 240);
    group.addActor(dbutton1);
    ImageButton dbutton2 =
        new ImageButton(
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "down.png"),
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "downs.png"));
    dbutton2
        .onClick(
            new Runnable() {
              @Override
              public void run() {
                if (currentCount - 10 >= 1) currentCount -= 10;
              }
            })
        .setPosition(435, 240);
    group.addActor(dbutton2);
    ImageButton dbutton3 =
        new ImageButton(
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "down.png"),
            Res.getDrawable(Setting.GAME_RES_IMAGE_NUMBER + "downs.png"));
    dbutton3
        .onClick(
            new Runnable() {
              @Override
              public void run() {
                if (currentCount - 1 >= 1) currentCount -= 1;
              }
            })
        .setPosition(475, 240);
    group.addActor(dbutton3);

    Table buttable = new Table();
    buttable
        .add(
            new TextButton("最大", butstyle, 16)
                .onClick(
                    new Runnable() {
                      @Override
                      public void run() {
                        currentCount = item.count == 0 ? 1 : item.count;
                      }
                    }))
        .size(80, 33)
        .row();
    buttable
        .add(
            new TextButton("+1", butstyle, 16)
                .onClick(
                    new Runnable() {
                      @Override
                      public void run() {
                        if (currentCount < item.count) currentCount++;
                      }
                    }))
        .size(80, 35)
        .row();
    buttable
        .add(
            new TextButton("-1", butstyle, 16)
                .onClick(
                    new Runnable() {
                      @Override
                      public void run() {
                        if (currentCount > 1) currentCount--;
                      }
                    }))
        .size(80, 35)
        .row();
    buttable
        .add(
            new TextButton("最小", butstyle, 16)
                .onClick(
                    new Runnable() {
                      @Override
                      public void run() {
                        currentCount = 1;
                      }
                    }))
        .size(80, 33)
        .row();
    for (Cell c : buttable.getCells()) {
      c.padTop(2).padBottom(2);
    }

    buttable.setPosition(575, 300);
    group.addActor(buttable);
    stage.addActor(group);
    for (final Actor a : group.getChildren()) {
      a.addListener(
          new InputListener() {
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
              if (!(a instanceof Image)) Music.playSE("snd210");
              return true;
            }
          });
    }

    can3 =
        new Runnable() {
          @Override
          public void run() {
            group.setVisible(false);
            mask2.setVisible(false);
            can.run();
          }
        };
    can3.run();
    can2.run();
    can.run();
  }