当前位置: 首页>>代码示例>>Java>>正文


Java Event类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.Event的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Event类属于com.badlogic.gdx.scenes.scene2d包,在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createSlider

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
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;
}
 
开发者ID:ZKasica,项目名称:Planet-Generator,代码行数:25,代码来源:ObjectEditor.java

示例2: ServerRunningMenu

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
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;
    }
  });
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:18,代码来源:ServerRunningMenu.java

示例3: getActor

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@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;
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:17,代码来源:DropDownSetting.java

示例4: create

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
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);
}
 
开发者ID:MissionBit,项目名称:summer17-android,代码行数:21,代码来源:MenuState.java

示例5: handle

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:19,代码来源:TradingPanel.java

示例6: handle

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:23,代码来源:InventoryItemButton.java

示例7: handle

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:24,代码来源:SkillChangeButton.java

示例8: handle

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:20,代码来源:ModuleSelectionScreen.java

示例9: handle

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@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;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:24,代码来源:PlayerCharacterController.java

示例10: fire

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:kibertoad,项目名称:swampmachine,代码行数:18,代码来源:SwampTextButton.java

示例11: FlopsyScreen

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
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;
        }
    });
}
 
开发者ID:mauimauer,项目名称:flopsydroid,代码行数:27,代码来源:FlopsyScreen.java

示例12: getActors

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
@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 };
   }
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:23,代码来源:DesktopMusicActors.java

示例13: initialize

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
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;
        }
    });
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:27,代码来源:OwnImageButton.java

示例14: initialize

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
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;
        }
    });
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:21,代码来源:OwnTextButton.java

示例15: initialize

import com.badlogic.gdx.scenes.scene2d.Event; //导入依赖的package包/类
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;
        }
    });
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:21,代码来源:Link.java


注:本文中的com.badlogic.gdx.scenes.scene2d.Event类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。