Examples of UIText


Examples of edu.ucf.cop4331.skitg.ui.UIText

    angle = new UISpinner(texArrow,font,"Angle",tank1.getAngle(),360,25,0);
    power = new UISpinner(texArrow,font,"Power",tank1.getPower(),100,150,0);
    moves = new UIMove(texArrow,font,tank1.getMoves(),275,0);
    fire = new UIFireButton(texFireButton,400,0);
    weaponSelector = new UIWeaponSelector(texArrow,font,500,0,tank1.getWeapons());
    playerIndicator = new UIText(font,"Player  1",Color.BLACK,380,Skitg.HEIGHT);
    player1score = new UIText(font,"0",Color.BLUE,100,Skitg.HEIGHT);
    player2score = new UIText(font,"0",Color.RED,700,Skitg.HEIGHT);
   
    batch = new SpriteBatch();
  }
View Full Code Here

Examples of org.terasology.rendering.nui.widgets.UIText

                commandLine.setText("");
                scrollArea.moveToBottom();
            }
        });

        final UIText history = find("messageHistory", UIText.class);
        history.bindText(new ReadOnlyBinding<String>() {
            @Override
            public String get() {
                StringBuilder messageList = new StringBuilder();
                Iterator<Message> messageIterator = console.getMessages().iterator();
                while (messageIterator.hasNext()) {
View Full Code Here

Examples of org.terasology.rendering.nui.widgets.UIText

    private boolean loadingAsServer;

    @Override
    @SuppressWarnings("unchecked")
    public void initialise() {
        final UIText worldName = find("worldName", UIText.class);
        if (worldName != null) {
            int gameNum = 1;
            for (GameInfo info : GameProvider.getSavedGames()) {
                if (info.getManifest().getTitle().startsWith(DEFAULT_GAME_NAME_PREFIX)) {
                    String remainder = info.getManifest().getTitle().substring(DEFAULT_GAME_NAME_PREFIX.length());
                    try {
                        gameNum = Math.max(gameNum, Integer.parseInt(remainder) + 1);
                    } catch (NumberFormatException e) {
                        logger.trace("Could not parse {} as integer (not an error)", remainder, e);
                    }
                }
            }

            worldName.setText(DEFAULT_GAME_NAME_PREFIX + gameNum);
        }

        final UIText seed = find("seed", UIText.class);
        if (seed != null) {
            seed.setText(new FastRandom().nextString(32));
        }

        final UIDropdown<Module> gameplay = find("gameplay", UIDropdown.class);
        gameplay.setOptions(getGameplayModules());
        gameplay.bindSelection(new Binding<Module>() {
            Module selected;

            @Override
            public Module get() {
                // try and be smart about auto selecting a gameplay
                if (selected == null) {
                    // get the default gameplay module from the config.  This is likely to have  a user triggered selection.
                    Module defaultGameplayModule = moduleManager.getRegistry().getLatestModuleVersion(
                            new Name(config.getDefaultModSelection().getDefaultGameplayModuleName()));
                    if (defaultGameplayModule != null) {
                        set(defaultGameplayModule);
                        return selected;
                    }

                    // find the first gameplay module that is available
                    for (Name moduleName : config.getDefaultModSelection().listModules()) {
                        Module module = moduleManager.getRegistry().getLatestModuleVersion(moduleName);

                        // module is null if it is no longer present
                        if (module != null && moduleManager.isGameplayModule(module)) {
                            set(module);
                            return selected;
                        }
                    }

                }

                return selected;
            }

            @Override
            public void set(Module value) {
                setSelectedGameplayModule(selected, value);
                selected = value;
            }
        });
        gameplay.setOptionRenderer(new StringTextRenderer<Module>() {
            @Override
            public String getString(Module value) {
                return value.getMetadata().getDisplayName().value();
            }
        });

        UILabel gameplayDescription = find("gameplayDescription", UILabel.class);
        gameplayDescription.bindText(new ReadOnlyBinding<String>() {
            @Override
            public String get() {
                Module selectedModule = gameplay.getSelection();
                if (selectedModule != null) {
                    return selectedModule.getMetadata().getDescription().value();
                } else {
                    return "";
                }

            }
        });

        final UIDropdown<WorldGeneratorInfo> worldGenerator = find("worldGenerator", UIDropdown.class);
        if (worldGenerator != null) {
            worldGenerator.bindOptions(new ReadOnlyBinding<List<WorldGeneratorInfo>>() {
                @Override
                public List<WorldGeneratorInfo> get() {
                    // grab all the module names and their dependencies
                    Set<Name> enabledModuleNames = Sets.newHashSet();
                    for (Name moduleName : getAllEnabledModuleNames()) {
                        enabledModuleNames.add(moduleName);
                    }

                    List<WorldGeneratorInfo> result = Lists.newArrayList();
                    for (WorldGeneratorInfo option : worldGeneratorManager.getWorldGenerators()) {
                        if (enabledModuleNames.contains(option.getUri().getModuleName())) {
                            result.add(option);
                        }
                    }

                    return result;
                }
            });
            worldGenerator.bindSelection(new Binding<WorldGeneratorInfo>() {
                @Override
                public WorldGeneratorInfo get() {
                    // get the default generator from the config.  This is likely to have  a user triggered selection.
                    WorldGeneratorInfo info = worldGeneratorManager.getWorldGeneratorInfo(config.getWorldGeneration().getDefaultGenerator());
                    if (info != null && getAllEnabledModuleNames().contains(info.getUri().getModuleName())) {
                        return info;
                    }

                    // get the default generator from the selected gameplay module
                    Module selectedGameplayModule = gameplay.getSelection();
                    if (selectedGameplayModule != null) {
                        String defaultWorldGenerator = selectedGameplayModule.getMetadata().getExtension(ModuleManager.DEFAULT_WORLD_GENERATOR_EXT, String.class);
                        if (defaultWorldGenerator != null) {
                            for (WorldGeneratorInfo worldGenInfo : worldGeneratorManager.getWorldGenerators()) {
                                if (worldGenInfo.getUri().equals(new SimpleUri(defaultWorldGenerator))) {
                                    set(worldGenInfo);
                                    return worldGenInfo;
                                }
                            }
                        }
                    }

                    // just use the first available generator
                    for (WorldGeneratorInfo worldGenInfo : worldGeneratorManager.getWorldGenerators()) {
                        if (getAllEnabledModuleNames().contains(worldGenInfo.getUri().getModuleName())) {
                            set(worldGenInfo);
                            return worldGenInfo;
                        }
                    }

                    return null;
                }

                @Override
                public void set(WorldGeneratorInfo value) {
                    if (value != null) {
                        config.getWorldGeneration().setDefaultGenerator(value.getUri());
                    }
                }
            });
            worldGenerator.setOptionRenderer(new StringTextRenderer<WorldGeneratorInfo>() {
                @Override
                public String getString(WorldGeneratorInfo value) {
                    if (value != null) {
                        return value.getDisplayName();
                    }
                    return "";
                }
            });
        }


        WidgetUtil.trySubscribe(this, "close", new ActivateEventListener() {
            @Override
            public void onActivated(UIWidget button) {
                getManager().popScreen();
            }
        });

        WidgetUtil.trySubscribe(this, "play", new ActivateEventListener() {
            @Override
            public void onActivated(UIWidget button) {
                if (worldGenerator.getSelection() == null) {
                    MessagePopup errorMessagePopup = getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class);
                    if (errorMessagePopup != null) {
                        errorMessagePopup.setMessage("No World Generator Selected", "Select a world generator (you may need to activate a mod with a generator first).");
                    }
                } else {
                    GameManifest gameManifest = new GameManifest();

                    gameManifest.setTitle(worldName.getText());
                    gameManifest.setSeed(seed.getText());
                    DependencyResolver resolver = new DependencyResolver(moduleManager.getRegistry());
                    ResolutionResult result = resolver.resolve(config.getDefaultModSelection().listModules());
                    if (!result.isSuccess()) {
                        MessagePopup errorMessagePopup = getManager().pushScreen(MessagePopup.ASSET_URI, MessagePopup.class);
                        if (errorMessagePopup != null) {
View Full Code Here

Examples of org.terasology.rendering.nui.widgets.UIText

    private UISlider sliderRed;
    private UIImage img;

    @Override
    public void initialise() {
        UIText nametext = find("playername", UIText.class);
        if (nametext != null) {
            nametext.bindText(BindHelper.bindBeanProperty("name", config.getPlayer(), String.class));
        }

        Color color = config.getPlayer().getColor();

        img = find("image", UIImage.class);
View Full Code Here

Examples of org.terasology.rendering.nui.widgets.UIText

            errorLabel.setVisible(false);
        }

        previewImage = find("preview", UIImage.class);

        UIText seed = find("seed", UIText.class);
        if (seed != null) {
            seed.bindText(seedBinding);
        }

        layerDropdown = find("display", UIDropdown.class);
        layerDropdown.bindOptions(new ReadOnlyBinding<List<String>>() {
            @Override
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.