Java 类com.badlogic.gdx.scenes.scene2d.Event 实例源码

项目:Planet-Generator    文件:ObjectEditor.java   
public VisSlider createSlider(String label, float minimum, float maximum, float[] snapValues, float threshold, float initialValue, ChangeListener changeListener) {
    if(!label.isEmpty()) {
        add(new VisLabel(label)).left().padRight(10).padTop(20);
    }
    add(new VisLabel((int)minimum + "")).padRight(5).padTop(20);

    VisSlider slider = new VisSlider(minimum, maximum, 1, false);
    slider.setSnapToValues(snapValues, threshold);
    slider.setValue(initialValue);
    slider.addListener(new EventListener() {
        @Override
        public boolean handle(Event event) {
            event.stop();
            return false;
        }
    });

    slider.addListener(changeListener);

    add(slider).expandX().fill().padRight(5).padTop(20);
    add(new VisLabel("" + (int)maximum)).padTop(20).row();

    return slider;
}
项目:Cubes_2    文件:ServerRunningMenu.java   
public ServerRunningMenu(Save save, int port) {
  super(Localization.get("menu.general.loading"), Localization.get("menu.server.stop"));
  this.save = save;
  this.port = port;

  addButtonListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
      if (!(event instanceof ChangeListener.ChangeEvent)) return false;
      try {
        Adapter.gotoMainMenu();
      } catch (StopLoopException ignored) {
      }
      return true;
    }
  });
}
项目:Cubes_2    文件:DropDownSetting.java   
@Override
public Actor getActor(VisualSettingManager visualSettingManager) {
    final SelectBox<String> selectBox = new SelectBox<String>(visualSettingManager.getSkin());
    selectBox.setItems(options);
    selectBox.setSelected(selected);
    selectBox.addListener(new EventListener() {
        @Override
        public boolean handle(Event event) {
            if (!(event instanceof SettingsMenu.SaveEvent))
                return false;
            set(selectBox.getSelected());
            return true;
        }
    });
    return selectBox;
}
项目:summer17-android    文件:MenuState.java   
public void create() {
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    //font = new BitmapFont();
    //skin = new Skin();
    //buttonAtlas = new TextureAtlas(Gdx.files.internal());
    //skin.addRegions(buttonAtlas);

    button = new Button();
    button.setStyle(new Button.ButtonStyle());

    button.addCaptureListener(new EventListener() {
        @Override
        public boolean handle(Event event) {
            Gdx.app.log("LOG", "event " + event);
            return false;
        }
    });
    stage.addActor(button);
}
项目:Cubes    文件:ServerRunningMenu.java   
public ServerRunningMenu(Save save, int port) {
  super(Localization.get("menu.general.loading"), Localization.get("menu.server.stop"));
  this.save = save;
  this.port = port;

  addButtonListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
      if (!(event instanceof ChangeListener.ChangeEvent)) return false;
      try {
        Adapter.gotoMainMenu();
      } catch (StopLoopException ignored) {
      }
      return true;
    }
  });
}
项目:fabulae    文件:TradingPanel.java   
@Override
public boolean handle(Event event) {
    if (event instanceof InputEvent) {
        InputEvent inputEvent = (InputEvent) event;
        if (Type.touchDown.equals(inputEvent.getType())) {
            Inventory junkBag = GameState.getPlayerCharacterGroup().getInventory();
            if (junkBag.getTotalNumberOfItems() > 0) {
                int totalCost = junkBag.getTotalTradingCost(BagType.BACKPACK, getDisplayedCustomer(), displayedMerchant, false);
                UIManager.displayConfirmation(
                        Strings.getString(UIManager.STRING_TABLE, "sellAllQuestion"),
                        Strings.getString(UIManager.STRING_TABLE, "sellAllConfirmation", totalCost), 
                        callback);
            }
            return true;
        }
    }
    return false;
}
项目:fabulae    文件:InventoryItemButton.java   
public boolean handle(Event event) {
    if (item == null) {
        return false;
    }
    if (item.equals(UIManager.getDraggedItem())) {
        UIManager.hideToolTip();
        return false;
    }
    if (event instanceof InputEvent) {
        Type inputEventType = ((InputEvent) event).getType();
        if (Type.enter.equals(inputEventType)) {
            getTooltip().updateText(UIManager.getDisplayedCharacter());
            if (getTooltip().shouldDisplay()) {
                UIManager.setToolTip(getTooltip());
            }
        }
        if (Type.exit.equals(inputEventType)) {
            UIManager.hideToolTip();
        }
    }
    return false;
}
项目:fabulae    文件:SkillChangeButton.java   
@Override
public boolean handle(Event event) {
    if (event instanceof ChangeEvent) {
        Actor target = event.getTarget();
        boolean isDecrease = target.equals(decreaseButton);
        int skillIncreases = stats.getSkillIncreasesThisLevel(skill);

        if (isDecrease && increases > 0) {
            --increases;
            stats.decrementSkillIncreasesThisLevel(skill);
            stats.setSkillPoints(stats.getSkillPoints()+1);
            stats.skills().decreaseSkillRank(skill);
            return true;
        } else if (!isDecrease && skillIncreases < Configuration.getSkillIncreasesPerLevel()) {
            ++increases;
            stats.incrementSkillIncreasesThisLevel(skill);
            stats.setSkillPoints(stats.getSkillPoints()-1);
            stats.skills().increaseSkillRank(skill);
            return true;
        }
    }
    return false;
}
项目:fabulae    文件:ModuleSelectionScreen.java   
@Override
public boolean handle(Event event) {
    if (event instanceof ChangeEvent) {
        if ("EXIT".equals(event.getTarget().getName())) {
            dispose();
            Gdx.app.exit();
        } else if ("OK".equals(event.getTarget().getName())) {
            SelectOption<String> selected = moduleSelectBox.getSelected(); 
            if (selected != null) {
                FileHandle currentModuleFile = Gdx.files.local(Configuration.FILE_LAST_MODULE);
                currentModuleFile.writeString(selected.value, false);
                dispose();
                game.reloadGame();
            }
        }
        return true;
    }
    return false;
}
项目:fabulae    文件:PlayerCharacterController.java   
@Override
public boolean handle(Event event) {
    // disable the combat path in case any UI element is being hovered
    if (event instanceof InputEvent) {
        InputEvent inputEvent = (InputEvent) event;
        if (Type.enter.equals(inputEvent.getType())) {
            overUIElement = true;
            if (UIManager.isThisTooltipSet(combatTooltip)) {
                UIManager.hideToolTip();
            }
        }
        if (Type.exit.equals(inputEvent.getType())) {
            overUIElement = false;
            overCharacterPortrait = false;
        }
        if (Type.mouseMoved.equals(inputEvent.getType())) {
            Actor hitActor = UIManager.getStage().hit(inputEvent.getStageX(), inputEvent.getStageY(), true);
            overUIElement = hitActor != null;
            overCharacterPortrait = UIManager.isPCPortrait(hitActor);
        }
    }
    return false;
}
项目:swampmachine    文件:SwampTextButton.java   
@Override
public boolean fire(Event event) {
    if (event instanceof ChangeListener.ChangeEvent) {
        if (changeConditions.isSatisfied()) {

            for (Invokable invokeEffect_: invokeEffects) {
                invokeEffect_.invoke();
            }

            return super.fire(event);
        } else return false;
    } 

    else {
        return super.fire(event);
    }
}
项目:flopsydroid    文件:FlopsyScreen.java   
public FlopsyScreen(FlopsyDroidGame game, OnGlobalListener listener) {
    mStage = new Stage();

    mGlobalListener = listener;

    game.getAssetManager().load("flopsy.sprites", TextureAtlas.class);
    game.getAssetManager().finishLoading();
    mTextureAtlas = game.getAssetManager().get("flopsy.sprites", TextureAtlas.class);

    mLabelStyle = new Label.LabelStyle();
    mLabelStyle.font = new BitmapFont(Gdx.files.internal("flappyfont.fnt"),
            Gdx.files.internal("flappyfont.png"), false);

    mStage.addListener(new EventListener() {
        @Override
        public boolean handle(Event event) {

            if(event.getTarget().equals(mAndy)) {
                mGround.onDroidCollision();
                return true;
            }

            return false;
        }
    });
}
项目:gaiasky    文件:DesktopMusicActors.java   
@Override
   public Actor[] getActors(Skin skin) {
ImageButton musicTooltip = new OwnImageButton(skin, "tooltip");
musicTooltip.addListener(new TextTooltip(
    I18n.bundle.format("gui.tooltip.music", SysUtilsFactory.getSysUtils().getDefaultMusicDir()), skin));

ImageButton reloadMusic = new OwnImageButton(skin, "reload");
reloadMusic.setName("reload music");
reloadMusic.addListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
    if (event instanceof ChangeEvent) {
        EventManager.instance.post(Events.MUSIC_RELOAD_CMD);
        return true;
    }
    return false;
    }
});
reloadMusic.addListener(new TextTooltip(I18n.bundle.get("gui.music.reload"), skin));

return new Actor[] { musicTooltip, reloadMusic };
   }
项目:gaiasky    文件:OwnImageButton.java   
private void initialize() {
    if (cursorLocation == null) {
        cursor = GlobalResources.linkCursor;
    } else {
        cursor = new Pixmap(Gdx.files.internal(cursorLocation));
    }
    listeners = new DelayedRemovalArray<EventListener>();
    this.addListener(new EventListener() {
        @Override
        public boolean handle(Event event) {
            if (event instanceof InputEvent) {
                Type type = ((InputEvent) event).getType();
                if (type == Type.enter) {
                    if (!me.isDisabled())
                        Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursor, 4, 0));
                    return true;
                } else if (type == Type.exit) {
                    Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
                    return true;
                }

            }
            return false;
        }
    });
}
项目:gaiasky    文件:OwnTextButton.java   
private void initialize() {
    this.addListener(new EventListener() {
        @Override
        public boolean handle(Event event) {
            if (event instanceof InputEvent) {
                Type type = ((InputEvent) event).getType();
                if (type == Type.enter) {
                    if (!me.isDisabled())
                        Gdx.graphics.setCursor(Gdx.graphics.newCursor(cursor != null ? cursor : GlobalResources.linkCursor, 4, 0));
                    return true;
                } else if (type == Type.exit) {
                    Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
                    return true;
                }

            }
            return false;
        }
    });
}
项目:gaiasky    文件:Link.java   
private void initialize() {
    this.addListener(new EventListener() {
        @Override
        public boolean handle(Event event) {
            if (event instanceof InputEvent) {
                Type type = ((InputEvent) event).getType();
                // Click
                if (type == Type.touchUp && ((InputEvent) event).getButton() == Buttons.LEFT) {
                    Gdx.net.openURI(linkURL);
                } else if (type == Type.enter) {
                    Gdx.graphics.setCursor(Gdx.graphics.newCursor(GlobalResources.linkCursor, 4, 0));
                } else if (type == Type.exit) {
                    Gdx.graphics.setSystemCursor(SystemCursor.Arrow);
                }
                return true;
            }
            return false;
        }
    });
}
项目:gdx.automation    文件:InputVisualizer.java   
@Override
public boolean handle(Event event) {
    if (event instanceof InputEvent) {
        InputEvent ev = (InputEvent) event;
        if (ev.getType() == Type.mouseMoved) {
            MouseEvent mevent = eventPool.obtain();
            v.x = ev.getStageX();
            v.y = ev.getStageY();
            v = InputVisualizer.this.getStage()
                    .stageToScreenCoordinates(v);
            mevent.x = v.x;
            mevent.y = Gdx.graphics.getHeight() - v.y;
            mevent.extent = 1;
            mevent.overGrown = false;
            MouseEvent overwritten;
            synchronized (eventBuffer) {
                overwritten = eventBuffer.push(mevent);
            }
            if (overwritten != null) {
                eventPool.free(overwritten);
            }
        }
    }
    return true;
}
项目:gdx.automation    文件:SimpleRecordPlaybackScreen.java   
@Override
public boolean handle(Event event) {
    if (event instanceof ChangeEvent) {
        currentState = State.PLAYBACK;
        final InputPlayer player = new InputPlayer(writer.getReader());
        player.addPlaybackListener(new PlaybackAdapter() {
            @Override
            public void onSyncPropertiesFinish() {
                player.stopPlayback();
                currentState = State.BEFORE_RECORD;
                layout();
            }
        });
        layout();
        player.startPlayback();
    }
    return true;
}
项目:ead    文件:SceneTreeListener.java   
@Override
public boolean handle(Event event) {
    if (event instanceof SceneTreeEvent) {
        SceneTreeEvent sceneTreeEvent = (SceneTreeEvent) event;
        Node node = sceneTreeEvent.getNode();
        switch (sceneTreeEvent.getType()) {
        case ADDED:
            return nodeAdded(sceneTreeEvent, node);
        case UPDATED:
            return nodeUpdated(sceneTreeEvent, node);
        case REMOVED:
            return nodeRemoved(sceneTreeEvent, node);
        }
    }
    return false;
}
项目:Cubes_2    文件:ClientErrorMenu.java   
@Override
public void render() {
  super.render();
  if (!firstRender) return;
  addButtonListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
      if (!(event instanceof ChangeListener.ChangeEvent)) return false;
      Adapter.setMenu(new MainMenu());
      return true;
    }
  });
  firstRender = false;
}
项目:Cubes_2    文件:StringSetting.java   
@Override
public Actor getActor(VisualSettingManager visualSettingManager) {
    final TextField textField = new TextField(s, visualSettingManager.getSkin());
    textField.addListener(new EventListener() {
        @Override
        public boolean handle(Event event) {
            if (!(event instanceof SettingsMenu.SaveEvent))
                return false;
            set(textField.getText());
            return true;
        }
    });
    return textField;
}
项目:Cubes    文件:ClientErrorMenu.java   
@Override
public void render() {
  super.render();
  if (!firstRender) return;
  addButtonListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
      if (!(event instanceof ChangeListener.ChangeEvent)) return false;
      Adapter.setMenu(new MainMenu());
      return true;
    }
  });
  firstRender = false;
}
项目:Cubes    文件:StringSetting.java   
@Override
public Actor getActor(VisualSettingManager visualSettingManager) {
  final TextField textField = new TextField(s, visualSettingManager.getSkin());
  textField.addListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
      if (!(event instanceof SettingsMenu.SaveEvent)) return false;
      set(textField.getText());
      return true;
    }
  });
  return textField;
}
项目:Cubes    文件:DropDownSetting.java   
@Override
public Actor getActor(VisualSettingManager visualSettingManager) {
  final SelectBox<String> selectBox = new SelectBox<String>(visualSettingManager.getSkin());
  selectBox.setItems(options);
  selectBox.setSelected(selected);
  selectBox.addListener(new EventListener() {
    @Override
    public boolean handle(Event event) {
      if (!(event instanceof SettingsMenu.SaveEvent)) return false;
      set(selectBox.getSelected());
      return true;
    }
  });
  return selectBox;
}
项目:skin-composer    文件:DialogCustomProperty.java   
@Override
public boolean handle(Event event) {
    if (event instanceof CustomPropertyEvent) {
        CustomPropertyEvent newPropertyEvent = (CustomPropertyEvent) event;
        if (newPropertyEvent.result) {
            newPropertyEntered(newPropertyEvent.propertyName, newPropertyEvent.propertyType);
        } else {
            cancelled();
        }
    }
    return false;
}
项目:skin-composer    文件:DialogCustomStyle.java   
@Override
public boolean handle(Event event) {
    if (event instanceof CustomStyleEvent) {
        CustomStyleEvent newStyleEvent = (CustomStyleEvent) event;
        if (newStyleEvent.result) {
            newStyleEntered(newStyleEvent.name);
        } else {
            cancelled();
        }
    }
    return false;
}
项目:skin-composer    文件:DialogCustomClass.java   
@Override
public boolean handle(Event event) {
    if (event instanceof CustomClassEvent) {
        CustomClassEvent newClassEvent = (CustomClassEvent) event;
        if (newClassEvent.result) {
            newClassEntered(newClassEvent.fullyQualifiedName, newClassEvent.displayName);
        } else {
            cancelled();
        }
    }
    return false;
}
项目:skin-composer    文件:DialogColorPicker.java   
@Override
public boolean handle(Event event) {
    if (event instanceof ColorEvent) {
        selected(((ColorEvent) event).color);
    }
    return false;
}
项目:skin-composer    文件:StageResizeListener.java   
@Override
public boolean handle(Event event) {
    if (event instanceof StageResizeEvent) {
        StageResizeEvent sEvent = (StageResizeEvent) event;
        resized(sEvent.getWidth(), sEvent.getHeight());
    }

    return false;
}
项目:skin-composer    文件:MenuButton.java   
@Override
public boolean handle(Event event) {
    if (event instanceof MenuButtonEvent) {
        menuClicked();
        return true;
    } else {
        return false;
    }
}
项目:skin-composer    文件:RootTable.java   
@Override
public boolean handle(Event event) {
    if (event instanceof RootTableEvent) {
        rootEvent((RootTableEvent) event);
    } else if (event instanceof LoadClassesEvent) {
        loadClasses(((LoadClassesEvent) event).classSelectBox);
    } else if (event instanceof LoadStylesEvent) {
        loadStyles(((LoadStylesEvent) event).classSelectBox, ((LoadStylesEvent) event).styleSelectBox);
    } else if (event instanceof StylePropertyEvent) {
        stylePropertyChanged(((StylePropertyEvent) event).styleProperty, ((StylePropertyEvent) event).styleActor);
    } else if (event instanceof CustomPropertyEvent) {
        CustomPropertyEvent propertyEvent = (CustomPropertyEvent) event;
        if (null != propertyEvent.customPropertyEnum) switch (propertyEvent.customPropertyEnum) {
            case NEW:
                newCustomProperty();
                break;
            case DELETE:
                deleteCustomProperty(propertyEvent.customProperty);
                break;
            case RENAME:
                renameCustomProperty(propertyEvent.customProperty);
                break;
            case DUPLICATE:
                duplicateCustomProperty(propertyEvent.customProperty);
                break;
            case CHANGE_VALUE:
                customPropertyValueChanged(propertyEvent.customProperty, propertyEvent.styleActor);
                break;
            default:
                break;
        }
    }
    return false;
}
项目:skin-composer    文件:MenuList.java   
@Override
public boolean handle(Event event) {
    if (event instanceof MenuListEvent) {
        menuClicked();
    }
    return false;
}
项目:dice-heroes    文件:IngredientWindow.java   
@Override public boolean handle(Event event) {
    if (event instanceof Bought) {
        bought();
        return true;
    }
    return false;
}
项目:dice-heroes    文件:RefreshListener.java   
@Override public final boolean handle(Event event) {
    if (event == RefreshEvent.INSTANCE) {
        refreshed();
        return true;
    }
    return false;
}
项目:dice-heroes    文件:AnimationListener.java   
@Override public boolean handle(Event event) {
    if (event instanceof AnimationEvent) {
        onAnimationEvent((AnimationEvent) event);
        return true;
    }
    return false;
}
项目:dice-heroes    文件:ResizeListener.java   
@Override public boolean handle(Event event) {
    if (event instanceof ResizeEvent) {
        resize();
        return true;
    }
    return false;
}
项目:dice-heroes    文件:WindowListener.java   
@Override public final boolean handle(Event event) {
    if (event instanceof WindowEvent) {
        WindowEvent windowEvent = (WindowEvent) event;
        return notify(windowEvent);
    }
    return false;
}
项目:dice-heroes    文件:GdxHelper.java   
public static void showStageEvents(final Stage stage) {
    EventListener listener = new EventListener() {
        private final Vector2 tmp = new Vector2();
        private Actor actor = new Actor() {
            @Override public void draw(Batch batch, float parentAlpha) {
                if (target == null)
                    return;
                batch.end();
                Config.shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
                Config.shapeRenderer.setProjectionMatrix(stage.getCamera().combined);
                Gdx.gl.glLineWidth(6);
                Config.shapeRenderer.setColor(Color.ORANGE);
                Vector2 pos = target.localToStageCoordinates(tmp.set(0, 0));
                float x = pos.x, y = pos.y;
                Vector2 top = target.localToStageCoordinates(tmp.set(target.getWidth(), target.getHeight()));
                float maxX = top.x, maxY = top.y;
                Config.shapeRenderer.rect(x, y, maxX - x, maxY - y);

                Config.shapeRenderer.end();
                batch.begin();
            }
        };

        {
            stage.addActor(actor);
        }

        public Actor target;

        @Override public boolean handle(Event event) {
            target = event.getTarget();
            return false;
        }
    };
    stage.addListener(listener);
}
项目:fabulae    文件:DialoguePanel.java   
@Override
public boolean handle(Event event) {
    if (!(event instanceof ChangeEvent)) {
        return false;
    }
    changed((ChangeEvent)event, event.getTarget());
    return false;
}
项目:fabulae    文件:UsePerksPanel.java   
@Override
public boolean handle(Event event) {
    if (event instanceof InputEvent) {
        InputEvent inputEvent = (InputEvent) event;
        if (Type.touchDown.equals(inputEvent.getType())) {
            clicked(inputEvent, inputEvent.getTarget());
        }
    }
    return false;
}