예제 #1
0
  @Override
  public void create() {

    GeneralStorage.load();
    MenuStorage.load();
    SplashStorage.load();
    MenuStorage.load();
    PauseStorage.load();
    RunningStorage.load();
    GameOverStorage.load();

    GeneralStorage.estado = GeneralStorage.state.splash;
    MenuStorage.HelpTouched = false;
    // Init the particle effect
    particle1 = new ParticleEffect();
    particleLeft = new ParticleEffect();
    particleRight = new ParticleEffect();
    // load the particle, first parameter is path and name file when is the particle,
    // second one the fold when is the particle image.
    particle1.load(Gdx.files.internal("efectos/vuelo2"), Gdx.files.internal("efectos"));
    particleLeft.load(Gdx.files.internal("efectos/efLateral3"), Gdx.files.internal("efectos"));
    particleRight.load(Gdx.files.internal("efectos/efLateral3"), Gdx.files.internal("efectos"));
    // Sprites of button of the menu screen to music, sound and button help

    spHelp = new Sprite(GeneralStorage.imgBTHelp);
    spHelp.setSize(GeneralStorage.w / 10, GeneralStorage.w / 10);
    spHelp.setPosition(
        GeneralStorage.w - GeneralStorage.w / 4 - spHelp.getWidth() / 2, GeneralStorage.h / 4);

    // storage the background color
    colorFondo = MenuStorage.spBackGroundGame.getColor();
    // Time to splash screen.
    timer = 100;
  }
예제 #2
0
 @Override
 public ParticleEffect load(
     AssetManager am, String fileName, FileHandle file, ParticleEffectParameter param) {
   ParticleEffect effect = new ParticleEffect();
   if (param != null && param.atlasFile != null)
     effect.load(file, am.get(param.atlasFile, TextureAtlas.class));
   else if (param != null && param.imagesDir != null) effect.load(file, param.imagesDir);
   else effect.load(file, file.parent());
   return effect;
 }
예제 #3
0
  public Ship(
      String appearanceLocation,
      float collisionScale,
      World world,
      float startX,
      float startY,
      float maxV,
      ArrayList<ViewedCollidable> aliveThings,
      int factionCode) {
    super(appearanceLocation, collisionScale, world, startX, startY, aliveThings, factionCode);
    // TODO Auto-generated constructor stub
    m_maxVelocity = maxV;
    me = new InertialManeuverEngine(this, maxV);
    ce = new ConventionalCruiseEngine(this, maxV);
    m_aliveThings = aliveThings;

    m_shieldEffect.load(
        Gdx.files.internal("data/shield.p"),
        Gdx.files.internal("data/" + appearanceLocation + "/"));
    m_shieldEffectPool = new ParticleEffectPool(m_shieldEffect, 1, 2);
    m_pooledShieldEffect = m_shieldEffectPool.obtain();

    m_starSlingEnterEffect.load(
        Gdx.files.internal("data/starsling.p"), Gdx.files.internal("data/"));
    m_starSlingEnterEffectPool = new ParticleEffectPool(m_starSlingEnterEffect, 1, 2);
    m_pooledStarSlingEnterEffect = m_starSlingEnterEffectPool.obtain();

    m_starSlingExitEffect.load(
        Gdx.files.internal("data/starslingexit.p"), Gdx.files.internal("data/"));
    m_starSlingExitEffectPool = new ParticleEffectPool(m_starSlingExitEffect, 1, 2);
    m_pooledStarSlingExitEffect = m_starSlingExitEffectPool.obtain();

    float radius = Math.max(m_objectAppearance.getWidth(), m_objectAppearance.getHeight());
    m_pooledStarSlingEnterEffect.getEmitters().get(0).getSpawnHeight().setHigh(radius);
    m_pooledStarSlingEnterEffect.getEmitters().get(0).getSpawnWidth().setHigh(radius);
    m_pooledStarSlingEnterEffect.getEmitters().get(1).getScale().setHigh(radius * 2);
    m_pooledStarSlingEnterEffect.getEmitters().get(1).getScale().setLow(radius);
    m_pooledStarSlingEnterEffect.reset();

    m_pooledStarSlingExitEffect.getEmitters().get(0).getSpawnHeight().setHigh(radius);
    m_pooledStarSlingExitEffect.getEmitters().get(0).getSpawnWidth().setHigh(radius);
    m_pooledStarSlingExitEffect.getEmitters().get(1).getScale().setHigh(radius * 2);
    m_pooledStarSlingExitEffect.getEmitters().get(1).getScale().setLow(radius);
    m_pooledStarSlingExitEffect.reset();

    m_detectionRange = 50f;
    m_font = new BitmapFont(Gdx.files.internal("data/font16.fnt"), false);
    m_shieldDamageReductions[DamageType.Energy.value] = 1f;
  }
예제 #4
0
  private void loadCurrentProjectParticles(String path) {
    particleEffects.clear();
    FileHandle sourceDir = new FileHandle(path);
    for (FileHandle entry : sourceDir.list()) {
      File file = entry.file();
      String filename = file.getName();
      if (file.isDirectory() || filename.endsWith(".DS_Store")) continue;

      ParticleEffect particleEffect = new ParticleEffect();
      particleEffect.load(Gdx.files.internal(file.getAbsolutePath()), currentProjectAtlas, "");
      particleEffects.put(filename, particleEffect);
    }
  }
예제 #5
0
 public void init(Weather type) {
   this.type = type;
   RPG.global.weather = type;
   if (eff != null) eff.dispose();
   if (stage == null)
     stage =
         new Stage(
             new ScalingViewport(Scaling.stretch, 1024, 576, new OrthographicCamera()),
             GameViews.batch);
   if (type == Weather.rain) {
     eff = new ParticleEffect();
     eff.load(
         Gdx.files.internal(Setting.PARTICLE + "rainp.p"), Gdx.files.internal(Setting.PARTICLE));
     eff.start();
   } else {
     eff = null;
   }
   logic();
 }
예제 #6
0
    @Override
    public void onLoadedResourcesCompleted() {
      final ParticleEffect particleEffect = new ParticleEffect();
      particleEffect.load(
          Gdx.files.internal("data/particles/D.pp"), Gdx.files.internal("data/particles/"));

      SceneStage stage = new SceneStage();
      {
        final ParticleEffectActor actor = new ParticleEffectActor(particleEffect, "balloon");
        actor.setColor(WebColors.GREEN_YELLOW.get());
        actor.setPosition(100, -100);
        stage.addActor(actor);
      }
      {
        final ParticleEffectActor actor = new ParticleEffectActor(particleEffect, "balloon");
        actor.setColor(WebColors.RED.get());
        actor.setPosition(100, -100);
        stage.addActor(actor);
      }
      Engine.setMainScene(stage);
    }
예제 #7
0
  public static void load(NanoCat nano) {

    pref = Gdx.app.getPreferences("NanoGameState");

    if (!pref.getBoolean("hdState")) {
      if (nano.getTime() < 15 && nano.getTime() >= 5) {
        bgTexture = new Texture(Gdx.files.internal("data/bg_1_s.png"));
        bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_1_s.png"));
        bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

      } else if (nano.getTime() < 20 && nano.getTime() >= 15) {
        bgTexture = new Texture(Gdx.files.internal("data/bg_2_s.png"));
        bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_2_s.png"));
        bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
      } else if (nano.getTime() >= 20) {
        bgTexture = new Texture(Gdx.files.internal("data/bg_3_s.png"));
        bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_3_s.png"));
        bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
      } else {
        bgTexture = new Texture(Gdx.files.internal("data/bg_3_s.png"));
        bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_3_s.png"));
        bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
      }
    } else if (pref.getBoolean("hdState")) {
      if (nano.getTime() < 15 && nano.getTime() >= 5) {
        bgTexture = new Texture(Gdx.files.internal("data/bg_1.png"));
        bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_1.png"));
        bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
      } else if (nano.getTime() < 20 && nano.getTime() >= 15) {
        bgTexture = new Texture(Gdx.files.internal("data/bg_2.png"));
        bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_2.png"));
        bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
      } else if (nano.getTime() >= 20) {
        bgTexture = new Texture(Gdx.files.internal("data/bg_3.png"));
        bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_3.png"));
        bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
      } else {
        bgTexture = new Texture(Gdx.files.internal("data/bg_3.png"));
        bgTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

        bgBackTexture = new Texture(Gdx.files.internal("data/bg_dist_3.png"));
        bgBackTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
      }
    }

    bgBack = new TextureRegion(bgBackTexture, 0, 0, 4096, 580);

    // Particle Stuff

    smoke = new Texture(Gdx.files.internal("data/smoke_particle.png"));
    smokeSprite = new Sprite(smoke);
    smokeEmitter = new ParticleEmitter();
    smokeParticle = new ParticleEffect();
    smokeParticle.load(Gdx.files.internal("data/particlesmoke"), Gdx.files.internal("data"));
    smokeParticle.findEmitter("smoke").getScale().setHigh(50f);

    starEmitter = new ParticleEmitter();
    starParticle = new ParticleEffect();
    starParticle.load(Gdx.files.internal("data/particles"), Gdx.files.internal("data"));
    starParticle.findEmitter("star").getScale().setHigh(5f);
    starParticle.findEmitter("star2").getScale().setHigh(5f);

    //		smokeParticle.getScale().setHigh(5f);

    // End Particle Stuff

    texture = new Texture(Gdx.files.internal("data/nano_region.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);

    nanoRun = new TextureAtlas(Gdx.files.internal("data/nanorun.atlas"));
    platform = new TextureAtlas(Gdx.files.internal("data/platform.atlas"));

    catRun1 = nanoRun.findRegion("nanorun0001");
    catRun2 = nanoRun.findRegion("nanorun0005");
    catRun3 = nanoRun.findRegion("nanorun0009");
    catRun4 = nanoRun.findRegion("nanorun0013");
    catRun5 = nanoRun.findRegion("nanorun0017");
    catRun6 = nanoRun.findRegion("nanorun0021");
    catRun7 = nanoRun.findRegion("nanorun0025");
    catRun8 = nanoRun.findRegion("nanorun0029");
    catRun9 = nanoRun.findRegion("nanorun0033");
    catRun10 = nanoRun.findRegion("nanorun0037");
    catRun11 = nanoRun.findRegion("nanorun0041");
    catRun12 = nanoRun.findRegion("nanorun0045");
    catRun13 = nanoRun.findRegion("nanorun0049");
    catRun14 = nanoRun.findRegion("nanorun0053");
    catRun15 = nanoRun.findRegion("nanorun0057");

    catCollide1 = nanoRun.findRegion("nanocollide0080");
    catCollide2 = nanoRun.findRegion("nanocollide0084");
    catCollide3 = nanoRun.findRegion("nanocollide0088");
    catCollide4 = nanoRun.findRegion("nanocollide0092");
    catCollide5 = nanoRun.findRegion("nanocollide0096");
    catCollide6 = nanoRun.findRegion("nanocollide0100");
    catCollide7 = nanoRun.findRegion("nanocollide0104");
    catCollide8 = nanoRun.findRegion("nanocollide0108");

    case0 = platform.findRegion("case0");
    case1 = platform.findRegion("case1");
    case2 = platform.findRegion("case2");
    case3 = platform.findRegion("case3");
    case4 = platform.findRegion("case4");
    case5 = platform.findRegion("case5");
    case6 = platform.findRegion("case6");
    caseDefault = platform.findRegion("default");

    TextureRegion[] catRun = {
      catRun1, catRun2, catRun3, catRun4, catRun5, catRun6, catRun7, catRun8, catRun9, catRun10,
      catRun11, catRun12, catRun13, catRun14, catRun15
    };
    catRunAnim = new Animation(.015f, catRun);
    catRunAnim.setPlayMode(Animation.PlayMode.LOOP);

    TextureRegion[] catJump = {
      catRun1, catRun2, catRun3, catRun4, catRun5, catRun6, catRun7, catRun8, catRun9, catRun9,
      catRun9, catRun9, catRun9, catRun9, catRun9, catRun9
    };
    catJumpAnim = new Animation(.04f, catJump);
    catJumpAnim.setPlayMode(Animation.PlayMode.LOOP);

    TextureRegion[] catCollide = {
      catCollide1,
      catCollide2,
      catCollide3,
      catCollide4,
      catCollide5,
      catCollide6,
      catCollide7,
      catCollide8
    };
    catCollideAnim = new Animation(.02f, catCollide);
    catCollideAnim.setPlayMode(Animation.PlayMode.NORMAL);

    fontFilter = new Texture(Gdx.files.internal("data/roboto_lt.png"));
    fontFilter.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    robotoLt =
        new BitmapFont(
            Gdx.files.internal("data/roboto_lt.fnt"), new TextureRegion(fontFilter), false);
    robotoLt.setScale(.5f, .5f);

    fontFilter2 = new Texture(Gdx.files.internal("data/roboto_blk.png"));
    fontFilter2.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    robotoBlk =
        new BitmapFont(
            Gdx.files.internal("data/roboto_blk.fnt"), new TextureRegion(fontFilter2), false);
    robotoBlk.setScale(.5f, .5f);

    panel = new Texture(Gdx.files.internal("data/panelcolor.png"));
    panel.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    panelSprite = new Sprite(panel, 500, 300);

    fbShare = new Texture(Gdx.files.internal("data/fbshare.png"));
    fbShare.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    fbShareSprite = new Sprite(fbShare, 199, 57);

    menuBack = new Texture(Gdx.files.internal("data/menu_back.png"));
    menuBack.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    menuBackSprite = new Sprite(menuBack, 320, 50);

    collision = Gdx.audio.newSound(Gdx.files.internal("data/audio/collide.wav"));
    milestone = Gdx.audio.newSound(Gdx.files.internal("data/audio/milestone.wav"));
    milestone50 = Gdx.audio.newSound(Gdx.files.internal("data/audio/milestone50.wav"));
    jump = Gdx.audio.newSound(Gdx.files.internal("data/audio/nanojump.wav"));
    jumpSound = Gdx.audio.newSound(Gdx.files.internal("data/audio/jump_sound.wav"));
    dblJump = Gdx.audio.newSound(Gdx.files.internal("data/audio/nanojump2.wav"));
    hit = Gdx.audio.newSound(Gdx.files.internal("data/audio/hit.wav"));
    select = Gdx.audio.newSound(Gdx.files.internal("data/audio/select.wav"));
    run = Gdx.audio.newSound(Gdx.files.internal("data/audio/run.wav"));
    highScore = Gdx.audio.newSound(Gdx.files.internal("data/audio/highscore.wav"));

    // Scoring
    score = Gdx.app.getPreferences("NanoCat");

    if (!score.contains("distance")) {
      score.putFloat("distance", 0);
    }

    if (!score.contains("highScore")) {
      score.putFloat("highScore", 0);
    }

    if (!score.contains("totalFall")) {
      score.putInteger("totalFall", 0);
    }
  }
예제 #8
0
  public Giant(
      World world,
      RayHandler rh,
      BulletHandler bh,
      Color aColor,
      float rad,
      float critSize,
      float xPos,
      float yPos,
      String particlePath,
      EntityHandler eh,
      float facingDirection,
      float velocity,
      float angularVel,
      boolean isDynamic) {
    super("data/particle-fire.png", aColor, rad);

    bulletHandler = bh;
    criticalRadius = critSize;
    canChangeColor = false;
    canChangeSize = true;
    lightSize = 10 * radius;
    ignoreSize = true;
    ignoreExistence = true;

    originalDirection = facingDirection;
    originalVelocity = velocity;
    angularVelocity = angularVel;

    entityHandler = eh;
    rayHandler = rh;
    originalRadius = rad; // Used for exploding

    BodyDef circleDef = new BodyDef();

    if (isDynamic) circleDef.type = BodyType.DynamicBody;
    else circleDef.type = BodyType.StaticBody;

    circleDef.position.set(xPos, yPos);

    Body circleBody = world.createBody(circleDef);

    CircleShape circleShape = new CircleShape();
    circleShape.setRadius(rad);

    FixtureDef circleFixture = new FixtureDef();
    circleFixture.shape = circleShape;
    circleFixture.density = 1.0f;
    circleFixture.friction = 1.0f;
    circleFixture.restitution = 0.0f;
    circleFixture.filter.categoryBits = LightGameFilters.CATEGORY_ENTITY;
    circleFixture.filter.maskBits = LightGameFilters.MASK_ENTITY;

    circleBody.createFixture(circleFixture);

    // Lights
    ArrayList<Light> blueGiantLights = new ArrayList<Light>();
    PointLight pl = new PointLight(rayHandler, 400, aColor, rad * 10, 0, 0);
    pl.setXray(true);
    pl.attachToBody(circleBody, 0, 0);
    blueGiantLights.add(pl);

    // Set the variables in Entity
    entityBody = circleBody;
    lights = blueGiantLights;

    giantEffect = new ParticleEffect();
    giantEffect.load(Gdx.files.internal(particlePath), Gdx.files.internal("data"));
    giantEffect.setPosition(entityBody.getPosition().x, entityBody.getPosition().y);
    giantEffect.start();
  }
  @Override
  public void create() {
    spriteBatch = new SpriteBatch();

    effect = new ParticleEffect();
    effect.load(Gdx.files.internal("data/test.p"), Gdx.files.internal("data"));
    effect.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
    // Of course, a ParticleEffect is normally just used, without messing around with its emitters.
    emitters = new Array(effect.getEmitters());
    effect.getEmitters().clear();
    effect.getEmitters().add(emitters.get(0));

    inputProcessor =
        new InputProcessorLW() {
          public boolean touchUp(int x, int y, int pointer, int button) {
            return false;
          }

          public boolean touchDragged(int x, int y, int pointer) {
            effect.setPosition(x, Gdx.graphics.getHeight() - y);
            return false;
          }

          public boolean touchDown(int x, int y, int pointer, int newParam) {
            effect.setPosition(x, Gdx.graphics.getHeight() - y);
            return false;
          }

          public boolean keyUp(int keycode) {
            return false;
          }

          public boolean keyTyped(char character) {
            return false;
          }

          public boolean keyDown(int keycode) {
            ParticleEmitter emitter = emitters.get(emitterIndex);
            if (keycode == Input.Keys.DPAD_UP) particleCount += 5;
            else if (keycode == Input.Keys.DPAD_DOWN) particleCount -= 5;
            else if (keycode == Input.Keys.SPACE) {
              emitterIndex = (emitterIndex + 1) % emitters.size;
              emitter = emitters.get(emitterIndex);
              particleCount =
                  (int)
                      (emitter.getEmission().getHighMax() * emitter.getLife().getHighMax() / 1000f);
            } else return false;
            particleCount = Math.max(0, particleCount);
            if (particleCount > emitter.getMaxParticleCount())
              emitter.setMaxParticleCount(particleCount * 2);
            emitter.getEmission().setHigh(particleCount / emitter.getLife().getHighMax() * 1000);
            effect.getEmitters().clear();
            effect.getEmitters().add(emitter);
            return false;
          }

          @Override
          public boolean touchMoved(int x, int y) {
            return false;
          }

          @Override
          public boolean scrolled(int amount) {
            return false;
          }

          @Override
          public void touchTap(int x, int y) {

            ParticleEmitter emitter = emitters.get(emitterIndex);
            //				if (keycode == Input.Keys.DPAD_UP)
            //					particleCount += 5;
            //				else if (keycode == Input.Keys.DPAD_DOWN)
            //					particleCount -= 5;
            //				else if (keycode == Input.Keys.SPACE) {
            emitterIndex = (emitterIndex + 1) % emitters.size;
            emitter = emitters.get(emitterIndex);
            particleCount =
                (int) (emitter.getEmission().getHighMax() * emitter.getLife().getHighMax() / 1000f);
            //				} else
            //					return false;
            particleCount = Math.max(0, particleCount);
            if (particleCount > emitter.getMaxParticleCount())
              emitter.setMaxParticleCount(particleCount * 2);
            emitter.getEmission().setHigh(particleCount / emitter.getLife().getHighMax() * 1000);
            effect.getEmitters().clear();
            effect.getEmitters().add(emitter);

            effect.setPosition(x, Gdx.graphics.getHeight() - y);
          }

          @Override
          public void touchDrop(int x, int y) {
            // TODO Auto-generated method stub

          }
        };

    Gdx.input.setInputProcessor(inputProcessor);
  }
예제 #10
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();
  }