Example usage for com.badlogic.gdx.scenes.scene2d.ui ScrollPane ScrollPane

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ScrollPane ScrollPane

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui ScrollPane ScrollPane.

Prototype

public ScrollPane(Actor widget, Skin skin, String styleName) 

Source Link

Usage

From source file:com.digitale.screens.CharCreator.java

License:Open Source License

public CharCreator(final Integer muser) {
    Stardust3d.currencharacteruid = "" + Stardust3d.charList[0].getUid();
    // populate avatardropdown
    for (int i = 0; i < Stardust3d.avatarList.size(); i++) {
        listEntries[i] = Stardust3d.avatarList.get(i).getDescription();
        // do avatar dropdown population from db here
    }//from  www .  jav a 2  s .co m
    selectedAvatar = ("avatar00.jpg");
    OrthographicCamera camera;
    batch = new SpriteBatch();
    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));
    xfadeTexture = new Texture(Gdx.files.internal("data/blackpixel.png"), Format.RGB565, true);
    xfadeTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);
    background = new Texture(Gdx.files.internal("data/bgpland.jpg"));
    camera = new OrthographicCamera();
    camera.setToOrtho(false, Gdx.app.getGraphics().getWidth(), Gdx.app.getGraphics().getHeight());

    fadeIn();
    stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);
    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;

    final Button buttonSaveCharacter = new TextButton("Save Character", skin.getStyle(TextButtonStyle.class),
            "button-save-char");
    final Button buttonCancel = new TextButton("Cancel", skin.getStyle(TextButtonStyle.class), "button-cancel");
    final Button buttonRandName = new TextButton("Generate Random Name", skin.getStyle(TextButtonStyle.class),
            "button-random-name");
    final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo");
    final SelectBox dropdownsex = new SelectBox(listsexEntries, skin.getStyle(SelectBoxStyle.class),
            "combosex");
    final SelectBox dropdownrace = new SelectBox(listraceEntries, skin.getStyle(SelectBoxStyle.class),
            "comborace");
    final TextField textfieldFirstName = new TextField("", "Firstname", skin.getStyle(TextFieldStyle.class),
            "textfieldfirstname");
    final TextField textfieldSurName = new TextField("", "Surname", skin.getStyle(TextFieldStyle.class),
            "textfieldsurname");
    final Label lableracepicker = new Label("Race", skin.getStyle(LabelStyle.class), "label-race-picker");
    final Label lablesexpicker = new Label("Sex", skin.getStyle(LabelStyle.class), "label-sex-picker");
    final Label lableportraitpicker = new Label("Portrait", skin.getStyle(LabelStyle.class),
            "label-portrait-picker");
    final Label lablefirstname = new Label("First name", skin.getStyle(LabelStyle.class), "label-firstname");
    final Label lablesurname = new Label("Surname", skin.getStyle(LabelStyle.class), "label-surname");

    imageActor = new Image(image0);

    final FlickScrollPane scrollPane = new FlickScrollPane(imageActor, "flickscroll");
    final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list");
    final ScrollPane scrollPane2 = new ScrollPane(list, skin.getStyle(ScrollPaneStyle.class), "scroll");
    scrollPane2.setWidget(list);
    final SplitPane splitPane = new SplitPane(scrollPane, scrollPane, false,
            skin.getStyle("default-horizontal", SplitPaneStyle.class), "split");

    final Label lablerace = new Label(racetext, skin.getStyle(LabelStyle.class), "label-race");
    lablerace.setWrap(true);
    final ScrollPane scrollPanerace = new ScrollPane(lablerace, skin.getStyle(ScrollPaneStyle.class), "scroll");
    // set defaults
    selectedAvatar = (Stardust3d.avatarList.get(0).getImagename());

    racetext = "Humans small size compared to other races, nimble hands and excellent sight allows them to handle thier ships with more finesse than other races.";
    racetext = racetext + "\n\n Racial Bonus:- +1 to dexterity.";
    racetext = racetext + "\n Skilled with Human ships and weaponry.";
    PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 1 + "\nSocial " + 1 + "\nDexterity " + 2
            + "\nLeadership " + 1 + "\nRecuperation " + 1 + "";
    final Label PrimaryStatLabel = new Label(PrimaryStat + Stardust3d.myCharacter.getIntelligence(),
            skin.getStyle(LabelStyle.class), "primary-stat");
    Window window = new Window("Create Character", skin.getStyle(WindowStyle.class), "window");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    window.defaults().spaceBottom(5).align("top");
    window.row().fill().expandX();
    window.add(buttonCancel).colspan(2);
    window.add().colspan(2).maxWidth(200);
    window.add(buttonSaveCharacter).colspan(2);
    window.row();
    window.add(lableracepicker).align("middleleft");
    window.add(dropdownrace).colspan(1).maxHeight(32);
    window.add(lableportraitpicker).align("middleleft");
    window.add(dropdown).colspan(1).maxHeight(32);
    window.add(lablesexpicker).align("middleleft");
    window.add(dropdownsex).colspan(1).maxHeight(32);
    window.row();
    window.add(scrollPanerace).fill().expand().colspan(2).align("topleft");
    window.add(PrimaryStatLabel).colspan(2);
    window.add().minHeight(256).colspan(2);
    window.row();
    window.add(lablefirstname).align("middleleft");
    window.add(textfieldFirstName);
    window.add(lablesurname).align("middleleft");
    window.add(textfieldSurName);
    window.add(buttonRandName).colspan(2);

    window.pack();

    stage.addActor(window);

    dropdown.setSelectionListener(new SelectionListener() {
        @Override
        public void selected(Actor actor, int index, String value) {
            SoundManager.playuiclick();
            selectedAvatar = (Stardust3d.avatarList.get(index).getImagename());

        }
    });
    dropdownsex.setSelectionListener(new SelectionListener() {
        @Override
        public void selected(Actor actor, int index, String value) {
            SoundManager.playuiclick();
            selectedSex = value;

        }
    });
    dropdownrace.setSelectionListener(new SelectionListener() {
        @Override
        public void selected(Actor actor, int index, String value) {
            SoundManager.playuiclick();
            switch (index) {
            case 0:
                racetext = "Humans small size compared to other races, nimble hands and excellent sight allows them to handle thier ships with more finesse than other races.";
                racetext = racetext + "\n\n Racial Bonus:- +1 to dexterity.";
                racetext = racetext + "\n Skilled with Human ships and weaponry.";
                selectedRace = "Human";

                PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 1 + "\nSocial " + 1 + "\nDexterity " + 2
                        + "\nLeadership " + 1 + "\nRecuperation " + 1;
                break;
            case 1:
                racetext = "Jelkek are a war-like race, for generations they have subjugated the Orinians to further their technological advancement. Fearless and bloodthirsty tendencies make their combat pilots unequalled.";
                racetext = racetext + "\n\n Racial Bonus:- +1 to recuperation.";
                racetext = racetext + "\n Skilled with Jelkek ships and weaponry.";
                selectedRace = "Jelkek";
                PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 1 + "\nSocial " + 1 + "\nDexterity " + 1
                        + "\nLeadership " + 1 + "\nRecuperation " + 2;
                break;
            case 2:
                racetext = "Orinians are masters of biotechnology, their skills make them the foremost manufacturers in the universe.";
                racetext = racetext + "\n\n Racial Bonus:- +1 to intelligence.";
                racetext = racetext + "\n Skilled with Orinian ships and weaponry.";
                selectedRace = "Orinian";
                PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 2 + "\nSocial " + 1 + "\nDexterity " + 1
                        + "\nLeadership " + 1 + "\nRecuperation " + 1;
                break;
            case 3:
                racetext = "Gulhurg colonies are unarguably the most complex systems known to science. Their hive-like social structure gives them an unrivalled empathy with others, making them excellent traders.";
                racetext = racetext + "\n\n Racial Bonus:- +1 to social.";
                racetext = racetext + "\n Skilled with Gulhurg ships and weaponry.";
                selectedRace = "Gulhurg";
                PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 1 + "\nSocial " + 2 + "\nDexterity " + 1
                        + "\nLeadership " + 1 + "\nRecuperation " + 1;
                break;
            }
        }
    });
    buttonSaveCharacter.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            if (Stardust3d.DEBUG)
                System.out.println("Charmaker Complete");

            if (textfieldFirstName.getText().length() < 1) {
                SoundManager.playError();
                stage.addActor(Actors.bottomToast("Character first name cannot be blank.", 4, skin));
            } else {
                SoundManager.playuiclick();
                // populate game from db, based on this char
                // Stardust3d.gameMode = 4;

                String result = Stardust3d.MyDataOp.makeAvatar(selectedAvatar, selectedRace, selectedSex,
                        textfieldFirstName.getText(), textfieldSurName.getText(), muser);
                if (Stardust3d.DEBUG)
                    System.out.println(LOG_TAG + "Everworld: char creation result: " + result);
                if (result.trim().equals("ok")) {
                    Stardust3d.gameMode = 3;
                    // repopulate players characters
                    Stardust3d.populateCharacterlist(Stardust3d.muser);

                    doneflag = true;
                } else {
                    SoundManager.playError();
                    stage.addActor(Actors.bottomToast("This character name is taken, please choose another.", 4,
                            skin));
                }
            }

        }
    });
    buttonCancel.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {

            SoundManager.playuiclick();

            stage.addActor(Actors.bottomToast("Cancelling character creation", 4, skin));
            doneflag = true;
            Stardust3d.gameMode = 3;
        }

    });
    buttonRandName.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {

            SoundManager.playuiclick();
            // generate human female name
            if (selectedSex.equals("Female") && selectedRace.equals("Human")) {
                Stardust3d.MyDataOp.getRandomHumanFemaleName();
                textfieldFirstName.setText(Stardust3d.generatedFirstName);
                textfieldSurName.setText(Stardust3d.generatedSurName);
                // generate human male name
            } else if (selectedSex.equals("Male") && selectedRace.equals("Human")) {
                Stardust3d.MyDataOp.getRandomHumanMaleName();
                textfieldFirstName.setText(Stardust3d.generatedFirstName);
                textfieldSurName.setText(Stardust3d.generatedSurName);

                // generate Jelkek female name
            } else if (selectedSex.equals("Female") && selectedRace.equals("Jelkek")) {
                Stardust3d.MyDataOp.getRandomHumanMaleName();
                textfieldFirstName.setText(Stardust3d.generatedFirstName);
                textfieldSurName.setText(Stardust3d.generatedSurName);
                // generate Jelkek male name
            } else if (selectedSex.equals("Male") && selectedRace.equals("Jelkek")) {
                Stardust3d.MyDataOp.getRandomHumanMaleName();
                textfieldFirstName.setText(Stardust3d.generatedFirstName);
                textfieldSurName.setText(Stardust3d.generatedSurName);

                // generate Orinian female name
            } else if (selectedSex.equals("Female") && selectedRace.equals("Orinian")) {
                Stardust3d.MyDataOp.getRandomHumanMaleName();
                textfieldFirstName.setText(Stardust3d.generatedFirstName);
                textfieldSurName.setText(Stardust3d.generatedSurName);
                // generate Orinain male name
            } else if (selectedSex.equals("Male") && selectedRace.equals("Orinain")) {
                Stardust3d.MyDataOp.getRandomHumanMaleName();
                textfieldFirstName.setText(Stardust3d.generatedFirstName);
                textfieldSurName.setText(Stardust3d.generatedSurName);

                // generate Gulhurg female name
            } else if (selectedSex.equals("Female") && selectedRace.equals("Gulhurg")) {
                Stardust3d.MyDataOp.getRandomHumanMaleName();
                textfieldFirstName.setText(Stardust3d.generatedFirstName);
                textfieldSurName.setText(Stardust3d.generatedSurName);
                // generate Gulhurg male name
            } else if (selectedSex.equals("Male") && selectedRace.equals("Gulhurg")) {
                Stardust3d.MyDataOp.getRandomHumanMaleName();
                textfieldFirstName.setText(Stardust3d.generatedFirstName);
                textfieldSurName.setText(Stardust3d.generatedSurName);
            }
        }

    });
    DialogListener dialogListener = (new DialogListener() {

        @Override
        public void optionSelected(int option) {
            if (Stardust3d.DEBUG)
                System.out.println("option " + option);
            if (option == 1) {
                if (Stardust3d.DEBUG)
                    System.out.println("no");
                stage.removeActor(dialog);
            }
            if (option == 0) {
                if (Stardust3d.DEBUG)
                    System.out.println("yes");
                stage.removeActor(dialog);
            }

        }

    });

}

From source file:com.digitale.screens.Chat.java

License:Open Source License

public Chat(String chatlines, Stage stage) {
    // populate channel dropdown
    for (int i = 0; i < Stardust3d.channelList.size(); i++) {
        listEntries[i] = Stardust3d.channelList.get(i).getChannelname();
    }//from w  ww  . j a v  a 2  s  .c o  m
    //get prefs, if no prefs (-1) use factory setting
    int temp = prefs.getInteger("selectedchatchannel", -1);
    if (temp > 0) {
        selectedChannel = temp;
    } else if (temp < -1) {
        selectedChannel = 8;
    }
    temp = prefs.getInteger("chatchanneltype", -1);
    if (temp != -1)
        selectedChannelType = temp;

    batch = new SpriteBatch();
    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));
    xfadeTexture = new Texture(Gdx.files.internal("data/blackpixel.png"), Format.RGB565, true);
    xfadeTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);
    fadeIn();

    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;

    final Button buttonSend = new TextButton("Send", skin.getStyle(TextButtonStyle.class), "buttonsend");
    final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "buttonClose");
    final TextField textfieldText = new TextField("", "Type message here", skin.getStyle(TextFieldStyle.class),
            "textfield");
    final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo");

    // final List list = new List(listEntries,
    // skin.getStyle(ListStyle.class), "list");
    final Label labelchatlines = new Label("Chat:", skin.getStyle(LabelStyle.class), "labelchat");
    final Label labelchattitle = new Label("Chat:", skin.getStyle(LabelStyle.class), "labelchattitle");

    labelchatlines.setWrap(true);
    final ScrollPane scrollPane2 = new ScrollPane(labelchatlines, skin.getStyle(ScrollPaneStyle.class),
            "scroll");
    dropdown.setSelection(selectedChannel);
    final Label lableNews = new Label("Chat: ", skin);

    Window window = new Window("Chat Screen", skin.getStyle(WindowStyle.class), "chatWindow");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    // build table
    window.row().fill().expandX();
    window.add(dropdown).align("Centre");
    window.add();

    window.add(buttonSend).colspan(1).align("right");
    window.add(buttonClose).colspan(1).align("center");
    window.row();
    window.add(textfieldText).minWidth(100).expandX().fillX().colspan(4);

    window.row();
    window.add(labelchattitle).align("left");
    window.row();
    window.add(scrollPane2).fill().expand().colspan(4);
    window.row();
    window.pack();
    stage.addActor(window);

    textfieldText.setTextFieldListener(new TextFieldListener() {
        public void keyTyped(TextField textField, char key) {
            if (key == '\n')
                textField.getOnscreenKeyboard().show(false);
        }
    });
    dropdown.setSelectionListener(new SelectionListener() {
        @Override
        public void selected(Actor actor, int index, String value) {
            SoundManager.playuiclick();
            selectedChannelType = (Stardust3d.channelList.get(index).getChanneltype());
            selectedChannel = (Stardust3d.channelList.get(index).getUid());

            Stardust3d.chatChannel = selectedChannel;
            Stardust3d.chatChannelName = Stardust3d.channelList.get(index).getChannelname();
            prefs.putInteger("chatchanneltype", selectedChannelType);
            prefs.putInteger("selectedchatchannel", selectedChannel);
            prefs.flush();
            Stardust3d.chatListReset = true;
            Stardust3d.refreshChat(Stardust3d.chatChannel, false);

        }
    });
    buttonClose.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            if (Stardust3d.DEBUG)
                System.out.println("close chat button pressed");
            SoundManager.playuiclick();
            Stardust3d.stationScreen = 104;
            doneflag = true;
            isDone();
        }
    });

    buttonSend.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            SoundManager.playuiclick();

            if (Stardust3d.DEBUG)
                System.out.println("send button pressed");
            text = textfieldText.getText().toString();
            if (selectedChannelType == 0 || selectedChannelType == 8) {
                Renderer.stage
                        .addActor(Actors.bottomToast("You cannot send messages to this channel.", 4, skin));
                SoundManager.playError();

            } else if (!text.isEmpty()) {
                String passed = Stardust3d.MyDataOp.postChat(text, selectedChannel,
                        Stardust3d.myCharacter.getUid());
                textfieldText.setText("");
                Stardust3d.refreshChat(selectedChannel, false);

            }
        }
    });

}

From source file:com.digitale.screens.FactoryScreen.java

License:Open Source License

public FactoryScreen(Stage stage) {

    Stardust3d.myInventory.clear();/*from   ww  w.j a  v a 2 s  .  co m*/
    Stardust3d.MyDataOp.get3dChar(Integer.valueOf(Stardust3d.currencharacteruid));
    Stardust3d.MyDataOp.getInventory(Integer.valueOf(Stardust3d.currencharacteruid), false);

    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));
    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;
    final Label tradegoodsLabel = new Label("Your Tradegoods", skin.getStyle(LabelStyle.class),
            "tradegoodslable");
    final Label blueprintsLabel = new Label("Your Blueprints", skin.getStyle(LabelStyle.class),
            "blueprintslable");
    final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close");
    final Button buttonBuild = new TextButton("Build", skin.getStyle(TextButtonStyle.class), "buttonbuild");
    final Label balance = new Label(Stardust3d.myCharacter.getCredits() + " $D",
            skin.getStyle(LabelStyle.class), "balancelable");
    final Table gridCargo = initBlueprints();

    final Table gridWarehouse = initTradegoods();
    final ScrollPane paneCargo = new ScrollPane(gridCargo, skin.getStyle(ScrollPaneStyle.class), "blueprints");
    final ScrollPane paneWarehouse = new ScrollPane(gridWarehouse, skin.getStyle(ScrollPaneStyle.class),
            "tradegoods");
    final SplitPane splitPane = new SplitPane(paneCargo, paneWarehouse, false,
            skin.getStyle("default-horizontal", SplitPaneStyle.class), "split");

    Window window = new Window("Factory Screen", skin.getStyle(WindowStyle.class), "factoryWindow");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    window.defaults().spaceBottom(5);
    window.row().fill().expandX();
    window.add(balance);
    window.add();
    window.add(buttonBuild).minWidth(150);
    window.add(buttonClose).minWidth(150);
    window.row();
    window.add(blueprintsLabel).colspan(2);
    window.add(tradegoodsLabel).colspan(2);
    window.row().fill().expandY();
    window.add(splitPane).colspan(4);
    window.pack();

    stage.addActor(window);
    buttonClose.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("factory Close");
            SoundManager.playuiclick();
            Stardust3d.MyDataOp.getInventory(Integer.valueOf(Stardust3d.currencharacteruid), false);
            Stardust3d.stationScreen = 111;
            //Renderer.stage.clear();
        }
    });
    buttonBuild.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("build item");
            SoundManager.playuiclick();
            //Stardust3d.MyDataOp.newRequest("movealltowarehouse#");
            for (int i = 0; i < Stardust3d.myInventory.size(); i++) {
                Inventory item = Stardust3d.myInventory.get(i);
                if (item.getSlot_id() == 0) {

                    //Renderer.stage.findActor(""+item.getInventoryid()).remove();
                }
            }
        }
    });
}

From source file:com.digitale.screens.Help.java

License:Open Source License

public Help(String newslines) {
    OrthographicCamera camera;//from  ww w .j av  a 2  s.c  o m
    batch = new SpriteBatch();
    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));
    xfadeTexture = new Texture(Gdx.files.internal("data/blackpixel.png"), Format.RGB565, true);
    xfadeTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);

    background = new Texture(Gdx.files.internal("data/bgpland.jpg"));

    camera = new OrthographicCamera();

    camera.setToOrtho(false, Gdx.app.getGraphics().getWidth(), Gdx.app.getGraphics().getHeight());

    fadeIn();
    stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);

    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;

    final Button buttonLogin = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "buttonLogin");
    final Label labelStories = new Label(newslines, skin);
    labelStories.setWrap(true);
    final ScrollPane scrollPane2 = new ScrollPane(labelStories, skin.getStyle(ScrollPaneStyle.class), "scroll");

    // configures an example of a TextField in password mode.
    final Label lableNews = new Label("Basic Help: ", skin);

    Window window = new Window("Help Screen", skin.getStyle(WindowStyle.class), "window");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    //build table
    window.row().fill().expandX();
    window.add();
    window.add();
    window.add();
    window.add(buttonLogin).colspan(1).align("right");

    window.row();
    window.add(lableNews).align("left");
    window.row();
    window.add(scrollPane2).fill().expand().colspan(4);
    window.row();
    window.pack();
    stage.addActor(window);

    buttonLogin.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("help Close pressed");
            SoundManager.playuiclick();
            if (Stardust3d.mloginOK) {
                Stardust3d.gameMode = 4;

                doneflag = true;
            } else {
                Stardust3d.gameMode = 2;
                doneflag = true;
            }
        }
    });

}

From source file:com.digitale.screens.InGameHelp.java

License:Open Source License

public InGameHelp(Stage stage, String newslines) {
    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));

    Gdx.input.setInputProcessor(stage);//from w  w  w .  j  av  a2 s .  c  o m

    // Group.debug = true;

    final Button buttonLogin = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "buttonLogin");
    final Label labelHelpText = new Label(newslines, skin);
    labelHelpText.setWrap(true);
    final ScrollPane scrollPane2 = new ScrollPane(labelHelpText, skin.getStyle(ScrollPaneStyle.class),
            "scroll");

    // configures an example of a TextField in password mode.
    final Label lableHelpTitle = new Label("Basic Help: ", skin);

    Window window = new Window("Help Screen", skin.getStyle(WindowStyle.class), "helpWindow");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    //build table
    window.row().fill().expandX();
    window.add();
    window.add();
    window.add();
    window.add(buttonLogin).colspan(1).align("right");
    window.row();
    window.add(lableHelpTitle).align("left");
    window.row();
    window.add(scrollPane2).fill().expand().colspan(4);
    window.row();
    window.pack();
    stage.addActor(window);

    buttonLogin.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("help Close pressed");
            SoundManager.playuiclick();
            Stardust3d.stationScreen = 108;
        }
    });
}

From source file:com.digitale.screens.Login.java

License:Open Source License

public Login(String newslines) {
    //all sounds loaded, now bind them 

    try {/*w  ww  .  ja v  a 2 s .c om*/
        Renderer.bindMeshes(0);
    } catch (IOException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    }
    OrthographicCamera camera;
    batch = new SpriteBatch();
    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));
    xfadeTexture = new Texture(Gdx.files.internal("data/blackpixel.png"), Format.RGB565, true);
    xfadeTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear);

    background = new Texture(Gdx.files.internal("data/bgpland.jpg"));

    camera = new OrthographicCamera();

    camera.setToOrtho(false, Gdx.app.getGraphics().getWidth(), Gdx.app.getGraphics().getHeight());

    fadeIn();
    stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false);

    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;

    final Button buttonLogin = new TextButton("Log in", skin.getStyle(TextButtonStyle.class), "buttonLogin");
    final Button buttonHelp = new TextButton("Quick Help", skin.getStyle(TextButtonStyle.class), "buttonHelp");
    final Button buttonNewAccount = new TextButton("New Account", skin.getStyle(TextButtonStyle.class),
            "buttonNewAccount");
    final Button buttonOptions = new TextButton("Options", skin.getStyle(TextButtonStyle.class),
            "buttonOptions");
    final CheckBox checkBox = new CheckBox("Remember account name and password.",
            skin.getStyle(CheckBoxStyle.class), "checkbox");
    final TextField textfieldUserName = new TextField("", "Account Name", skin.getStyle(TextFieldStyle.class),
            "textfield");
    // final List list = new List(listEntries,
    // skin.getStyle(ListStyle.class), "list");
    final Label labelStories = new Label(newslines, skin);
    labelStories.setWrap(true);
    final ScrollPane scrollPane2 = new ScrollPane(labelStories, skin.getStyle(ScrollPaneStyle.class), "scroll");

    // configures an example of a TextField in password mode.
    final Label lableNews = new Label("News: ", skin);
    final TextField passwordTextField = new TextField("", "password", skin);
    passwordTextField.setPasswordCharacter('*');
    passwordTextField.setPasswordMode(true);
    textfieldUserName.getOnscreenKeyboard().show(true);

    Boolean booltemp = prefs.getBoolean("nopoly", false);
    //is save account checked in prefs
    if (booltemp) {
        //if preferences account is too short to have been set to a valid account name
        checkBox.setChecked(true);
        String temp = prefs.getString("un", "");
        ac = temp;
        textfieldUserName.setText(ac);
        temp = prefs.getString("cullingtree", "");
        String pw = null;
        try {
            pw = new String(mcrypt.decrypt(temp.trim()));
            pw = pw.replace('~', ' ').trim();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        passwordTextField.setText(pw);
    }
    Window window = new Window("Login Screen", skin.getStyle(WindowStyle.class), "window");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    //build table
    window.row().fill().expandX();
    window.add(buttonNewAccount).colspan(1).align("Centre");
    window.add(buttonOptions).colspan(1).align("center");
    window.add(buttonHelp).colspan(1).align("center");
    window.add(buttonLogin).colspan(1).align("right");
    window.row();

    window.add(textfieldUserName).minWidth(100).expandX().fillX().colspan(2);
    window.add(passwordTextField).minWidth(100).expandX().fillX().colspan(2);
    window.row();
    window.add(lableNews).align("left");
    window.row();
    window.add(scrollPane2).fill().expand().colspan(4);
    window.row();
    window.add(checkBox).colspan(4);
    window.row();
    window.pack();
    stage.addActor(window);
    SoundManager.init();
    try {
        Renderer.bindMeshes(1);
    } catch (IOException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    }

    textfieldUserName.setTextFieldListener(new TextFieldListener() {

        public void keyTyped(TextField textField, char key) {
            if (key == '\n')
                textField.getOnscreenKeyboard().show(false);
        }

    });

    buttonLogin.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            try {
                Renderer.bindMeshes(2);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            if (Stardust3d.DEBUG)
                System.out.println("login button pressed");
            SoundManager.playuiclick();

            ac = textfieldUserName.getText().toString();
            String pw = passwordTextField.getText().toString();

            if (checkpass(pw, pw) && checkuser(ac)) {

                String passed = Stardust3d.MyDataOp.login(ac, pw);
                if (Stardust3d.DEBUG)
                    System.out.println("passed " + passed);
                if (passed.equals("true")) {
                    SoundManager.playconfirm();
                    stage.addActor(Actors.bottomToast("Login sucessful", 4, skin));

                    Stardust3d.mloginOK = true;
                    Stardust3d.gameMode = 3;
                    //get players characters
                    Stardust3d.populateCharacterlist(Stardust3d.muser);

                    doneflag = true;
                    isDone();
                } else if (passed.equals("NOT_ACTIVE")) {
                    SoundManager.playError();
                    stage.addActor(Actors.bottomToast(
                            "Login failed, this account is not active, check your Email.", 4, skin));

                } else if (passed.equals("false")) {
                    SoundManager.playError();
                    stage.addActor(Actors.bottomToast(
                            "Login failed, please check your account name and password.", 4, skin));
                }
            }

        }
    });

    buttonOptions.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            if (Stardust3d.DEBUG)
                System.out.println("options button pressed");
            SoundManager.playuiclick();
            Stardust3d.gameMode = 6;
            doneflag = true;
        }
    });
    buttonNewAccount.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            if (Stardust3d.DEBUG)
                System.out.println("New account button pressed");
            SoundManager.playuiclick();
            Stardust3d.gameMode = 14;
            doneflag = true;
        }
    });
    buttonHelp.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            if (Stardust3d.DEBUG)
                System.out.println("help button pressed");
            SoundManager.playuiclick();
            Stardust3d.gameMode = 9;
            doneflag = true;
        }
    });
    checkBox.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            SoundManager.playuiclick();
            String encrypted = null;
            if (Stardust3d.DEBUG)
                System.out.println("remeber account name pressed");
            Stardust3d.mremeberAccountname = checkBox.isChecked();
            //if user wants to save login
            if (Stardust3d.mremeberAccountname) {
                String pw = passwordTextField.getText().toString();
                String acc = textfieldUserName.getText().toString();
                //check user has entered account details before saving
                if (pw.length() > 8 && acc.length() > 8) {

                    /* Encrypt */
                    try {
                        encrypted = (mcrypt.encrypt(pw));
                    } catch (Exception e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }
                    prefs.putBoolean("nopoly", Stardust3d.mremeberAccountname);
                    prefs.putString("un", acc);
                    prefs.putString("cullingtree", encrypted);
                    prefs.flush();
                } else {
                    stage.addActor(Actors.bottomToast(
                            "You need to enter your account name and password before trying to save them.", 4,
                            skin));
                    checkBox.setChecked(false);
                }
            } else {
                stage.addActor(Actors.bottomToast("Saved account details cleared.", 4, skin));
                //clear saved account details
                prefs.putBoolean("nopoly", Stardust3d.mremeberAccountname);
                prefs.putString("un", "");
                prefs.putString("cullingtree", "");
                prefs.flush();
            }
        }
    });
}

From source file:com.digitale.screens.MapScreen.java

License:Open Source License

public MapScreen(Stage stage) {

    for (int i = 0; i < Stardust3d.charList.length; i++) {
        listEntries[i] = (Stardust3d.charList[i].getFirstname() + " \n" + Stardust3d.charList[i].getSurname()
                + " \n " + "10000c ");
        listEntries[i] = listEntries[i] + ("System " + Stardust3d.charList[i].getSystem() + " \nSta "
                + Stardust3d.charList[i].getStamina() + " Int " + Stardust3d.charList[i].getIntelligence()
                + " Soc " + Stardust3d.charList[i].getSocial() + " Dex " + Stardust3d.charList[i].getDexterity()
                + " Led " + Stardust3d.charList[i].getLeadership() + " Rec "
                + Stardust3d.charList[i].getRecuperation() + " \nFlying: "
                + Util.asCapFirstChar(Stardust3d.charList[i].getShipname()));
    }/*from w w  w.ja  v a  2s.  c  o m*/

    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));
    texture1 = new Texture(Gdx.files.internal("data/stickleback.png"));
    texture2 = new Texture(Gdx.files.internal("data/salx.png"));
    TextureRegion image = new TextureRegion(texture1);
    TextureRegion image2 = new TextureRegion(texture2);

    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;
    final Label nameLabel = new Label(
            Stardust3d.myCharacter.getFirstname() + Stardust3d.myCharacter.getSurname(),
            skin.getStyle(LabelStyle.class), "namelable");
    final Label IntelligenceLabel = new Label("PLACEHOLDER " + Stardust3d.myCharacter.getIntelligence(),
            skin.getStyle(LabelStyle.class), "intelligencelable");

    final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close");

    final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo");
    final Image imageActor = new Image(image2);
    final FlickScrollPane scrollPane = new FlickScrollPane(imageActor, "flickscroll");
    final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list");
    final ScrollPane scrollPane2 = new ScrollPane(list, skin.getStyle(ScrollPaneStyle.class), "scroll");
    scrollPane2.setWidget(list);
    final SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false,
            skin.getStyle("default-horizontal", SplitPaneStyle.class), "split");

    final Label fpsLabel = new Label("fps:", skin.getStyle(LabelStyle.class), "label");

    selectedCharacter = ("Character: " + Stardust3d.charList[0].getFirstname() + " \n"
            + Stardust3d.charList[0].getSurname());

    Window window = new Window("Map Screen", skin.getStyle(WindowStyle.class), "mapWindow");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    window.defaults().spaceBottom(5);
    window.row().fill().expandX();
    window.add();
    window.add(buttonClose).colspan(1);
    window.row();
    window.add(nameLabel);
    window.add();
    window.add();
    window.add();
    window.row();
    window.add(IntelligenceLabel);

    window.row();
    // window.add(setWidget(list));
    window.row();
    window.add(splitPane).colspan(4);
    window.row();
    window.row();

    window.pack();

    // stage.addActor(new Button("Behind Window", skin));
    stage.addActor(window);

    dropdown.setSelectionListener(new SelectionListener() {
        @Override
        public void selected(Actor actor, int index, String value) {
            SoundManager.playuiclick();
            selectedCharacter = ("Character: " + Stardust3d.charList[index].getFirstname() + " \n"
                    + Stardust3d.charList[index].getSurname());
            Stardust3d.currencharacteruid = "" + Stardust3d.charList[index].getUid();

        }
    });

    buttonClose.setClickListener(new ClickListener() {
        public void click(Actor actor, float x, float y) {
            System.out.println("mapscreen Close");
            SoundManager.playuiclick();
            Stardust3d.stationScreen = 112;
            doneflag = true;

        }
    });
}

From source file:com.digitale.screens.Market.java

License:Open Source License

public Market(Stage stage) {

    for (int i = 0; i < Stardust3d.charList.length; i++) {
        listEntries[i] = (Stardust3d.charList[i].getFirstname() + " \n" + Stardust3d.charList[i].getSurname()
                + " \n " + "10000c ");
        listEntries[i] = listEntries[i] + ("System " + Stardust3d.charList[i].getSystem() + " \nSta "
                + Stardust3d.charList[i].getStamina() + " Int " + Stardust3d.charList[i].getIntelligence()
                + " Soc " + Stardust3d.charList[i].getSocial() + " Dex " + Stardust3d.charList[i].getDexterity()
                + " Led " + Stardust3d.charList[i].getLeadership() + " Rec "
                + Stardust3d.charList[i].getRecuperation() + " \nFlying: "
                + Util.asCapFirstChar(Stardust3d.charList[i].getShipname()));
    }/*from   ww w .  ja va  2s . co  m*/
    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));
    texture1 = new Texture(Gdx.files.internal("data/beer.png"));
    texture2 = new Texture(Gdx.files.internal("data/blueprint.png"));
    TextureRegion image = new TextureRegion(texture1);
    TextureRegion image2 = new TextureRegion(texture2);

    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;
    final Label nameLabel = new Label(
            Stardust3d.myCharacter.getFirstname() + " \n" + Stardust3d.myCharacter.getSurname(),
            skin.getStyle(LabelStyle.class), "namelable");
    final Label IntelligenceLabel = new Label("PLACEHOLDER " + Stardust3d.myCharacter.getIntelligence(),
            skin.getStyle(LabelStyle.class), "intelligencelable");

    final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close");

    final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo");
    final Image imageActor = new Image(image2);
    final FlickScrollPane scrollPane = new FlickScrollPane(imageActor, "flickscroll");
    final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list");
    final ScrollPane scrollPane2 = new ScrollPane(list, skin.getStyle(ScrollPaneStyle.class), "scroll");
    scrollPane2.setWidget(list);
    final SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false,
            skin.getStyle("default-horizontal", SplitPaneStyle.class), "split");

    final Label fpsLabel = new Label("fps:", skin.getStyle(LabelStyle.class), "label");

    selectedCharacter = ("Character: " + Stardust3d.charList[0].getFirstname() + " \n"
            + Stardust3d.charList[0].getSurname());

    // window.debug();
    Window window = new Window("Market Screen", skin.getStyle(WindowStyle.class), "marketWindow");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    window.defaults().spaceBottom(5);
    window.row().fill().expandX();
    window.add();
    window.add(buttonClose).colspan(1);
    window.row();
    window.add(nameLabel);
    window.add();
    window.add();
    window.add();
    window.row();
    window.add(IntelligenceLabel);
    window.row();
    // window.add(setWidget(list));
    window.row();
    window.add(splitPane).colspan(4);
    window.row();
    window.row();
    window.add(fpsLabel).colspan(4);
    window.pack();

    // stage.addActor(new Button("Behind Window", skin));
    stage.addActor(window);

    dropdown.setSelectionListener(new SelectionListener() {
        @Override
        public void selected(Actor actor, int index, String value) {
            SoundManager.playuiclick();
            selectedCharacter = ("Character: " + Stardust3d.charList[index].getFirstname() + " \n"
                    + Stardust3d.charList[index].getSurname());
            Stardust3d.currencharacteruid = "" + Stardust3d.charList[index].getUid();

        }
    });

    buttonClose.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("Market Close");
            SoundManager.playuiclick();
            Stardust3d.stationScreen = 109;

        }
    });
}

From source file:com.digitale.screens.MissionLog.java

License:Open Source License

public MissionLog(Stage stage) {

    Stardust3d.myMissions.clear();//from ww w.ja v  a2 s . co  m
    Stardust3d.MyDataOp.getMissionLog(0);

    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));
    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;
    final Label missionTitleLabel = new Label("No Missions Accepted", skin.getStyle(LabelStyle.class),
            "missionlable");
    final Label missionTextLabel = new Label("", skin.getStyle(LabelStyle.class), "missiontextlable");
    final Label missionCounter = new Label("", skin.getStyle(LabelStyle.class), "missioncounterlable");

    missionTextLabel.setWrap(true);
    final Label negotiatorLabel = new Label("Negotiator:", skin.getStyle(LabelStyle.class), "negotiatorlable");
    final Label negotiatorInfoLabel = new Label("Negotiator Info", skin.getStyle(LabelStyle.class),
            "negotiatorinfolable");
    negotiatorInfoLabel.setWrap(true);
    // buttons
    final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close");
    final Button buttonPrev = new TextButton("Previous", skin.getStyle(TextButtonStyle.class),
            "buttonprevious");
    final Button buttonNext = new TextButton("Next", skin.getStyle(TextButtonStyle.class), "buttonnext");
    final Button buttonCompleted = new TextButton("Incomplete", skin.getStyle(TextButtonStyle.class),
            "buttoncompleted");
    final Button buttonComplete = new TextButton("Complete", skin.getStyle(TextButtonStyle.class),
            "buttoncomplete");

    String uidString = "bob";
    final Image newItem = new Image(new TextureRegion(new Texture(Gdx.files.internal("data/avatar02.jpg"))),
            Scaling.none, Align.CENTER, uidString);

    final ScrollPane paneCargo = new ScrollPane(newItem, skin.getStyle(ScrollPaneStyle.class), "cargo");
    // paneCargo.addActor(negotiatorInfoLabel);
    final ScrollPane paneMission = new ScrollPane(missionTextLabel, skin.getStyle(ScrollPaneStyle.class),
            "warehouse");
    final SplitPane splitPane = new SplitPane(paneCargo, paneMission, false,
            skin.getStyle("default-horizontal", SplitPaneStyle.class), "split");

    Window window = new Window("Mission Log Screen", skin.getStyle(WindowStyle.class), "logWindow");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    window.defaults().spaceBottom(5);
    window.row().fill().expandX();
    window.add(buttonPrev).minWidth(150);
    window.add(buttonNext).minWidth(150);
    window.add(buttonComplete).minWidth(150);
    //window.add(buttonCompleted).minWidth(150);
    window.add(buttonClose).minWidth(150);
    window.row();
    window.add(negotiatorLabel).colspan(2);
    window.add(missionCounter);
    window.add(missionTitleLabel).colspan(2);
    window.row().fill().expandY();
    window.add(splitPane).colspan(5);
    window.pack();

    stage.addActor(window);
    if (currentMission == 0) {
        buttonPrev.visible = false;
    }
    if (currentMission == Stardust3d.myMissions.size() - 1) {
        buttonNext.visible = false;
    }
    buttonClose.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("mission log Close");
            SoundManager.playuiclick();
            Stardust3d.stationScreen = 113;
            // Renderer.stage.clear();
        }
    });
    buttonPrev.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("show previous mission");
            SoundManager.playuiclick();
            if (currentMission > 0) {
                currentMission = currentMission - 1;
                System.out.println("missionID" + currentMission);
            }
            if (currentMission == 0) {
                buttonPrev.visible = false;
            }
            if (currentMission < Stardust3d.myMissions.size() - 1) {
                buttonNext.visible = true;
            }

        }
    });
    buttonNext.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("show next mission");
            if (currentMission < Stardust3d.myMissions.size() - 1) {
                currentMission = currentMission + 1;
                System.out.println("missionID" + currentMission);
            }
            SoundManager.playuiclick();
            if (currentMission == Stardust3d.myMissions.size() - 1) {
                buttonNext.visible = false;
            }
            if (currentMission != 0) {
                buttonPrev.visible = true;
            }
        }
    });
    buttonCompleted.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            currentMission = 0;
            SoundManager.playuiclick();
            if (completeflag == true) {
                ((TextButton) buttonCompleted).setText("Incomplete");
                completeflag = false;
                System.out.println("show incomplete");
                Stardust3d.myMissions.clear();
                Stardust3d.MyDataOp.getMissionLog(0);
                buttonComplete.visible = true;
                System.out.println(Stardust3d.myMissions.isEmpty());
                //missionTitleLabel.setText(Stardust3d.myMissions.get(
                //      currentMission).getTitle());
            } else {
                ((TextButton) buttonCompleted).setText("Completed");
                completeflag = true;
                System.out.println("show completed");
                Stardust3d.myMissions.clear();
                Stardust3d.MyDataOp.getMissionLog(1);
                buttonComplete.visible = false;
                System.out.println(Stardust3d.myMissions.isEmpty());
                //missionTitleLabel.setText(Stardust3d.myMissions.get(
                //      currentMission).getTitle());
            }

            buttonPrev.visible = false;

            if (currentMission == Stardust3d.myMissions.size() - 1) {
                buttonNext.visible = false;
            } else {
                buttonNext.visible = true;
            }
        }
    });
    buttonComplete.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("complete mission");
            // check requsites have been fulfilled
            // flag mission as completed
            // award rewards
            SoundManager.playuiclick();

        }
    });
}

From source file:com.digitale.screens.MissionScreen.java

License:Open Source License

public MissionScreen(Stage stage) {

    Stardust3d.missionDefs.clear();// www .j a  v a 2 s .  c  o  m
    Stardust3d.myMissions.clear();
    Stardust3d.MyDataOp.getMissionDefs();

    skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png"));
    Gdx.input.setInputProcessor(stage);

    // Group.debug = true;
    final Label missionTitleLabel = new Label(Stardust3d.missionDefs.get(0).getTitle(),
            skin.getStyle(LabelStyle.class), "missionlable");
    final Label negotiatorLabel = new Label("Negotiator", skin.getStyle(LabelStyle.class), "negotiatorlable");
    final Label missionTextLabel = new Label(
            Stardust3d.missionDefs.get(0).getText() + "\n" + Stardust3d.missionDefs.get(0).getConditions()
                    + "\n" + Stardust3d.missionDefs.get(0).getRewards(),
            skin.getStyle(LabelStyle.class), "missiontextlable");
    missionTextLabel.setWrap(true);
    final Label negotiatorInfoLabel = new Label("Negotiator Info", skin.getStyle(LabelStyle.class),
            "negotiatorinfolable");
    negotiatorInfoLabel.setWrap(true);
    //buttons
    final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close");
    final Button buttonPrev = new TextButton("Previous", skin.getStyle(TextButtonStyle.class),
            "buttonprevious");
    final Button buttonNext = new TextButton("Next", skin.getStyle(TextButtonStyle.class), "buttonnext");
    final Button buttonAccept = new TextButton("Accept", skin.getStyle(TextButtonStyle.class), "buttonpaccept");
    final Button buttonComplete = new TextButton("Complete", skin.getStyle(TextButtonStyle.class),
            "buttoncomplete");

    String uidString = "bob";
    final Image newItem = new Image(new TextureRegion(new Texture(Gdx.files.internal("data/avatar02.jpg"))),
            Scaling.none, Align.CENTER, uidString);

    final ScrollPane paneCargo = new ScrollPane(newItem, skin.getStyle(ScrollPaneStyle.class), "cargo");
    //paneCargo.addActor(negotiatorInfoLabel);
    final ScrollPane paneMission = new ScrollPane(missionTextLabel, skin.getStyle(ScrollPaneStyle.class),
            "warehouse");
    final SplitPane splitPane = new SplitPane(paneCargo, paneMission, false,
            skin.getStyle("default-horizontal", SplitPaneStyle.class), "split");

    Window window = new Window("Mission Screen", skin.getStyle(WindowStyle.class), "missionWindow");
    if (Stardust3d.DEBUG)
        window.debug();
    window.x = window.y = 0;
    window.setFillParent(true);
    window.setMovable(false);
    window.defaults().pad(5);
    window.defaults().spaceBottom(5);
    window.row().fill().expandX();
    window.add(buttonPrev).minWidth(150);
    window.add(buttonNext).minWidth(150);
    window.add(buttonAccept).minWidth(150);
    window.add(buttonClose).minWidth(150);
    window.row();
    window.add(negotiatorLabel).colspan(2);
    window.add(missionTitleLabel).colspan(2);
    window.row().fill().expandY();
    window.add(splitPane).colspan(4);
    window.pack();

    stage.addActor(window);
    buttonClose.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("mission Close");
            SoundManager.playuiclick();
            Stardust3d.stationScreen = 110;
            //Renderer.stage.clear();
        }
    });
    buttonPrev.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("show previous mission");
            SoundManager.playuiclick();
            if (currentMission > 0) {
                currentMission = currentMission - 1;
                System.out.println("missionID" + currentMission);
            }

        }
    });
    buttonNext.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("show next mission");
            if (currentMission < Stardust3d.missionDefs.size() - 1) {
                currentMission = currentMission + 1;
                System.out.println("missionID" + currentMission);
            }
            SoundManager.playuiclick();

        }
    });
    buttonAccept.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("accept mission");
            // check mission is not already accepted.
            /*   for (int i = 0; i < Stardust3d.myMissions.size(); i++) {
               //if this mission already exists in char mission list and it is not repeatable
                  if((Stardust3d.myMissions.get(i).getMissionUid()==
                     Stardust3d.missionDefs.get(currentMission).getUid()) &&
                     Stardust3d.missionDefs.get(currentMission).get()){
                          
               }
               }*/
            //flag mission as accepted
            Stardust3d.MyDataOp.acceptMission(Stardust3d.missionDefs.get(currentMission).getUid());
            SoundManager.playuiclick();

        }
    });
    buttonComplete.setClickListener(new ClickListener() {

        public void click(Actor actor, float x, float y) {
            System.out.println("complete mission");
            //check requsites have been fulfilled
            //flag mission as completed
            //award rewards
            SoundManager.playuiclick();

        }
    });
}