本文整理汇总了Java中de.lessvoid.nifty.Nifty.gotoScreen方法的典型用法代码示例。如果您正苦于以下问题:Java Nifty.gotoScreen方法的具体用法?Java Nifty.gotoScreen怎么用?Java Nifty.gotoScreen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.lessvoid.nifty.Nifty
的用法示例。
在下文中一共展示了Nifty.gotoScreen方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
public void show(Nifty nifty, final String message) {
this.nifty = nifty;
ScreenBuilder builder;
if (Constants.android) {
builder = createAndroid(message);
} else {
builder = createDesktop(message);
}
Screen scr = builder.build(nifty);
textField = scr.findNiftyControl("textField", TextField.class);
nifty.addScreen(SCREEN_ID, scr);
nifty.gotoScreen(SCREEN_ID);
}
示例2: init
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
public static void init(){
LwjglInputSystem inputSystem = new LwjglInputSystem();
try {
inputSystem.startup();
} catch (Exception e) {
e.printStackTrace();
}
nifty = new Nifty(
new LwjglRenderDevice(),
new NullSoundDevice(),
inputSystem,
new AccurateTimeProvider());
drawGameScreen();
itemImages.put(ItemListEnum.LASERRIFLE,
nifty.createImage("assets/textures/laserRifle.png",
true));
nifty.gotoScreen("gui");
}
示例3: init
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
private void init() {
guiNode.detachAllChildren();
sceneNode.detachAllChildren();
voronoi = new Voronoi();
Nifty nifty = app.getNifty();
screenController = new PolygonalScreenController(this);
nifty.registerScreenController(screenController);
nifty.addXml("org/shaman/terrain/polygonal/PolygonalScreen.xml");
nifty.gotoScreen("Polygonal");
}
示例4: initNifty
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
private void initNifty() {
Nifty nifty = app.getNifty();
screenController = new SketchTerrainScreenController(this);
nifty.registerScreenController(screenController);
nifty.addXml("org/shaman/terrain/sketch/SketchTerrainScreen.xml");
nifty.gotoScreen("SketchTerrain");
sendAvailablePresets();
// nifty.setDebugOptionPanelColors(true);
}
示例5: show
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
public void show(Nifty nifty, String title, String message) {
ScreenBuilder builder;
if (Constants.android) {
builder = createMobile(title, message);
} else {
builder = createDesktop(title, message);
}
Screen scr = builder.build(nifty);
nifty.addScreen(SCREEN_ID, scr);
nifty.gotoScreen(SCREEN_ID);
}
示例6: ScreenManager
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
public ScreenManager(Nifty nifty, InputManager inputManager, Startable mainApp){
this.inputManager = inputManager;
this.nifty = nifty;
//create start controller
StartScreenController startController = new StartScreenController("start");
StartScreen startScreen = new StartScreen(nifty,startController);
startScreen.generateScreen();
//create hud controller and screen
hudController = new HudScreenController("hud",nifty,this);
HeadsUpScreen hudScreen = new HeadsUpScreen(nifty,hudController);
hudScreen.generateScreen();
//create loading controller and screen
loadController = new LoadingScreenController("loading", mainApp);
LoadingScreen loadScreen = new LoadingScreen(nifty, loadController);
loadScreen.generateScreen();
victoryScreen = new VictoryScreen(nifty);
victoryScreen.generateScreen();
//switch to start screen
nifty.gotoScreen("start");
im = new InventoryManager(hudController, nifty, this);
psm = new PlayerStatManager(nifty, this);
}
示例7: enable
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
@Override
protected void enable() {
app.enableWater(0);
app.setSkyEnabled(true);
app.setCameraEnabled(true);
map = (Heightmap) properties.get(KEY_HEIGHTMAP);
originalMap = map.clone();
scaledMap = originalMap;
app.setTerrain(map);
originalMapScale = app.getHeightmapSpatial().getLocalScale().clone();
originalTemperature = (Heightmap) properties.get(KEY_TEMPERATURE);
if (originalTemperature == null) {
originalTemperature = new Heightmap(originalMap.getSize());
originalTemperature.fillHeight(0.5f);
}
temperature = originalTemperature.clone();
originalMoisture = (Heightmap) properties.get(KEY_MOISTURE);
if (originalMoisture == null) {
originalMoisture = new Heightmap(originalMap.getSize());
originalMoisture.fillHeight(0.5f);
}
moisture = originalMoisture.clone();
Nifty nifty = app.getNifty();
screenController = new WaterErosionScreenController(this, originalMap.getSize());
nifty.registerScreenController(screenController);
nifty.addXml("org/shaman/terrain/erosion/WaterErosionScreen.xml");
nifty.gotoScreen("WaterErosion");
temperatureMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
moistureMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
heightDiffMaterial = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
updateTextures();
brushSphere = new Geometry("brush", new Sphere(32, 32, 1));
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", new ColorRGBA(1, 1, 1, 0.5f));
mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
brushSphere.setMaterial(mat);
brushSphere.setQueueBucket(RenderQueue.Bucket.Transparent);
sceneNode.attachChild(brushSphere);
brushSphere.setCullHint(Spatial.CullHint.Always);
brushSphere.setLocalScale(brushSize*TerrainHeighmapCreator.TERRAIN_SCALE);
solverMaterial = new Material(app.getAssetManager(), "org/shaman/terrain/shader/TerrainLightingExt.j3md");
solverMaterial.setBoolean("useTriPlanarMapping", true);
solverMaterial.setFloat("Shininess", 0.0f);
Texture darkRock = app.getAssetManager().loadTexture("org/shaman/terrain/rock2.jpg");
darkRock.setWrap(Texture.WrapMode.Repeat);
solverMaterial.setTexture("DiffuseMap", darkRock);
solverMaterial.setFloat("DiffuseMap_0_scale", 1/16f);
Texture grass = app.getAssetManager().loadTexture("org/shaman/terrain/grass.jpg");
grass.setWrap(Texture.WrapMode.Repeat);
solverMaterial.setTexture("DiffuseMap_1", grass);
solverMaterial.setFloat("DiffuseMap_1_scale", 1/8f);
Texture water = app.getAssetManager().loadTexture("org/shaman/terrain/textures/Water.jpg");
water.setWrap(Texture.WrapMode.Repeat);
solverMaterial.setTexture("DiffuseMap_2", water);
solverMaterial.setFloat("DiffuseMap_2_scale", 1/8f);
registerListener();
riverSourceNode = new Node("river sources");
sceneNode.attachChild(riverSourceNode);
}
示例8: enable
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected void enable() {
app.enableWater(0);
app.setSkyEnabled(true);
app.setCameraEnabled(true);
map = (Heightmap) properties.get(KEY_HEIGHTMAP);
temperature = (Heightmap) properties.get(KEY_TEMPERATURE);
moisture = (Heightmap) properties.get(KEY_MOISTURE);
water = (Heightmap) properties.get(KEY_WATER);
riverSources = (List<? extends RiverSource>) properties.get(KEY_RIVER_SOURCES);
if (properties.containsKey(KEY_TERRAIN_SCALE)) {
scaleFactor = (float) properties.get(KEY_TERRAIN_SCALE);
} else {
LOG.warning("no terrain scale factor defined, use default one");
scaleFactor = 0.5f; //test
}
LOG.info("terrain scale factor: "+scaleFactor);
Nifty nifty = app.getNifty();
screenController = new VegetationScreenController(this);
nifty.registerScreenController(screenController);
nifty.addXml("org/shaman/terrain/vegetation/VegetationScreen.xml");
nifty.gotoScreen("Vegetation");
app.setTerrain(map);
originalMapScale = app.getHeightmapSpatial().getLocalScale().clone();
app.getHeightmapSpatial().setLocalScale(originalMapScale.x * scaleFactor, originalMapScale.y, originalMapScale.z * scaleFactor);
brushSphere = new Geometry("brush", new Sphere(32, 32, 1));
Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", new ColorRGBA(1, 1, 1, 0.5f));
mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
brushSphere.setMaterial(mat);
brushSphere.setQueueBucket(RenderQueue.Bucket.Transparent);
sceneNode.attachChild(brushSphere);
brushSphere.setCullHint(Spatial.CullHint.Always);
guiBrushSizeChanged(brushSize);
registerListener();
//initial biomes
Vectorfield biomes = new Vectorfield(map.getSize(), Biome.values().length);
for (int x=0; x<map.getSize(); ++x) {
for (int y=0; y<map.getSize(); ++y) {
float m = clamp(moisture.getHeightAt(x, y));
float t = clamp(temperature.getHeightAt(x, y));
float h = map.getHeightAt(x, y);
if (h<=0) {
biomes.setScalarAt(x, y, Biome.OCEAN.ordinal(), 1);
} else {
Biome b = Biome.getBiome(t, 1-m);
biomes.setScalarAt(x, y, b.ordinal(), 1);
}
}
}
materialCreator = new BiomesMaterialCreator(app.getAssetManager(), biomes);
app.forceTerrainMaterial(materialCreator.getMaterial(textured));
recording = new Recording(app, app.getCamera(), sceneNode);
}
示例9: bind
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
this.nifty = nifty;
final ScreenController This = this;
Screen dialog = new ScreenBuilder(SCREEN_ID) {
{
controller(This);
layer(new LayerBuilder("foreground") {
{
childLayoutCenter();
control(new ListBoxBuilder("moleculeList") {
{
childLayoutVertical();
set("horizontal", "false");
displayItems(10);
selectionModeSingle();
optionalVerticalScrollbar();
optionalHorizontalScrollbar();
width("85%");
height("85%");
x("8%");
y("10%");
}
});
}
});
}
}.build(nifty);
//Element e = dialog.findElementByName("foreground");
/*CreateListBoxControl clistBox = new CreateListBoxControl("listBoxDynamic");
clistBox.set("horizontal", "false");
clistBox.setWidth("85%");
clistBox.setHeight("85%");
//clistBox.setY("10%");
//clistBox.setX("8%");
clistBox.setChildLayout("vertical");
clistBox.set("displayItems", "10");
clistBox.set("vertical", "optional");
clistBox.set("horizontal", "optional");
listBox = clistBox.create(nifty, dialog, e);
File dir = Constants.getMoleculeLocation();
File[] fs = dir.listFiles();
if (fs == null) {
fs = new File[0];
}
for (File f : fs) {
String name = FileTools.getFileName(f);
listBox.addItem(name);
}*/
ListBox box = dialog.findNiftyControl("moleculeList", ListBox.class);
// add items; box.addItem
File dir = Constants.getMoleculeLocation();
String[] fs = FileTools.listSubFiles(dir);
for (String subF : fs) {
box.addItem(subF);
}
nifty.addScreen(SCREEN_ID, dialog);
nifty.gotoScreen(SCREEN_ID);
}
示例10: simpleInitApp
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(
assetManager, inputManager, audioRenderer, guiViewPort);
Nifty nifty = niftyDisplay.getNifty();
guiViewPort.addProcessor(niftyDisplay);
flyCam.setDragToRotate(true);
nifty.loadStyleFile("nifty-default-styles.xml");
nifty.loadControlFile("nifty-default-controls.xml");
/* ------------------ NEW CODE ----------------- */
DefaultInstanceResolutor defaultInstanceResolutor = new DefaultInstanceResolutor();
ScreenFlowManager screenFlowManager = new ScreenFlowManagerImpl(nifty, defaultInstanceResolutor);
//Main structures, made up resolutors depending on what you prefer to use
LiveInstanceResolutor liveInstanceResolutor = new LiveInstanceResolutor();
defaultInstanceResolutor.addResolutor("static", new StaticScreenGeneratorResolutor(nifty));
defaultInstanceResolutor.addResolutor("live", liveInstanceResolutor);
//Some examples of live instances, in case you prefer them
RootScreenController screenController = new RootScreenController().setScreenFlowManager(screenFlowManager).setApplication(this);
ScreenController screenController2 = new Controller2(screenFlowManager);
ScreenController screenController4 = new Controller4(screenFlowManager);
liveInstanceResolutor.addController("root", screenController);
liveInstanceResolutor.addGenerator("root", new RootScreenGenerator(nifty, screenController, screenFlowManager));
liveInstanceResolutor.addController("controller1", new Controller1(screenFlowManager));
liveInstanceResolutor.addController("controller2", screenController2);
liveInstanceResolutor.addController("controller3", new Controller3(screenFlowManager));
liveInstanceResolutor.addController("controller4", new Controller4(screenFlowManager));
liveInstanceResolutor.addGenerator("generator2", new Generator2(nifty, screenController2));
liveInstanceResolutor.addGenerator("generator4", new Generator4(nifty, screenController4));
try {
//My first flow definition
screenFlowManager.addScreenDefinition(new ScreenDefinition("root", "live:root", "live:root"));
screenFlowManager.addScreenDefinition(new ScreenDefinition("screen1", "live:controller1", "static:/screen.xml"));
screenFlowManager.addScreenDefinition(new ScreenDefinition("screen2", "live:controller2", "live:generator2"));
screenFlowManager.addScreenDefinition(new ScreenDefinition("screen3", "live:controller1", "static:/screen.xml"));
screenFlowManager.addScreenDefinition(new ScreenDefinition("screen4", "live:controller4", "live:generator4"));
screenFlowManager.addFlowDefinition("root", Optional.<String>absent(), newArrayList("root")); //parent is absent, this is root.
screenFlowManager.addFlowDefinition("screenFlow1", of("root:root"), newArrayList("screen1", "screen2", "screen3", "screen4"));
screenFlowManager.addFlowDefinition("screenFlow2", of("root:root"), newArrayList("screen1", "screen4"));
//Once I finished to load flows, I'm ready to start, mandatory name, mandatory implementation
nifty.addScreen("redirector", new ScreenBuilder("start", new RedirectorScreenController().setScreenFlowManager(screenFlowManager)).build(nifty));
nifty.gotoScreen("redirector");
} catch (InstanceResolutionException e) {
e.printStackTrace();
}
}
示例11: initializeNifty
import de.lessvoid.nifty.Nifty; //导入方法依赖的package包/类
private void initializeNifty() throws PromiseException
{
inputSystem = new LwjglInputSystem();
try
{
inputSystem.startup();
}
catch (Exception ex)
{
throw new Error(ex);
}
nifty = new Nifty(new LwjglRenderDevice(), new NullSoundDevice(), inputSystem, new AccurateTimeProvider());
NiftyResourceLoader niftyResourceLoader = nifty.getResourceLoader();
niftyResourceLoader.removeAllResourceLocations();
// nifty first tries stuff on the class path (needed for its internal files)
niftyResourceLoader.addResourceLocation(new ClasspathLocation());
// Then try the same reference as a resource key
// (add this second so that zones can not override nifty build-ins)
niftyResourceLoader.addResourceLocation(new DBNiftyResourceLocation(resourceDB));
TriggerOnShowEffect.registerEffect(nifty);
SpriteAnimationEffect.registerEffect(nifty);
BackgroundColorSpriteEffect.registerEffect(nifty);
BackgroundColorAnimated.registerEffect(nifty);
ClockTextEffect.registerEffect(nifty);
niftyCameraImpl = new NiftyCameraImpl(resourceDB, mapEntities, mapClassic, stars);
CameraNiftyController.registerControl(nifty, niftyCameraImpl);
boolean first = true;
/*{
Logger logger = Logger.getLogger("de.lessvoid.nifty");
logger.setLevel(Level.FINER);
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.FINER);
logger.addHandler(handler);
}*/
for (String res : networkedGame.niftyGuiResources)
{
if (first)
{
nifty.fromXmlWithoutStartScreen(res);
first = false;
}
else
{
nifty.addXml(res);
}
}
mainScreen = nifty.getScreen("aphelion-main");
if (mainScreen == null)
{
throw new PromiseException("Missing nifty-gui screen: aphelion-main");
}
ScreenController screenControl = mainScreen.getScreenController();
if (screenControl instanceof MainScreenController)
{
((MainScreenController) screenControl).aphelionBind(networkedGame);
}
nifty.gotoScreen("aphelion-main");
}