Search in sources :

Example 6 with Profile

use of com.janfic.games.computercombat.model.Profile in project computercombat by janfic.

the class AWSServices method createUser.

public String createUser(String username, String email, String password) throws UsernameExistsException {
    AttributeType emailAttribute = AttributeType.builder().name("email").value(email).build();
    SignUpRequest request = SignUpRequest.builder().username(username).userAttributes(emailAttribute).password(password).clientId("7ivqqa7m71v3ob6qnof7djh90t").build();
    SignUpResponse response = cognito.signUp(request);
    String userSub = response.userSub();
    Profile p = new Profile(userSub);
    p.setEmail(email);
    p.setName(username);
    SQLAPI.getSingleton().saveProfile(p);
    FileHandle f = Gdx.files.internal("starterCollection.csv");
    Scanner scanner = new Scanner(f.readString());
    while (scanner.hasNextLine()) {
        int cardID = Integer.parseInt(scanner.nextLine());
        System.out.println(cardID);
        System.out.println(p.getUID());
        SQLAPI.getSingleton().addCardToProfile(cardID, p);
    }
    return userSub;
}
Also used : Scanner(java.util.Scanner) FileHandle(com.badlogic.gdx.files.FileHandle) Profile(com.janfic.games.computercombat.model.Profile)

Aggregations

Profile (com.janfic.games.computercombat.model.Profile)6 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)3 ClickListener (com.badlogic.gdx.scenes.scene2d.utils.ClickListener)3 Card (com.janfic.games.computercombat.model.Card)3 FileHandle (com.badlogic.gdx.files.FileHandle)1 OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)1 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)1 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)1 TextFieldFilter (com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldFilter)1 Window (com.badlogic.gdx.scenes.scene2d.ui.Window)1 DragAndDrop (com.badlogic.gdx.scenes.scene2d.utils.DragAndDrop)1 CollectionCard (com.janfic.games.computercombat.actors.CollectionCard)1 Deck (com.janfic.games.computercombat.model.Deck)1 Message (com.janfic.games.computercombat.network.Message)1 ResultSet (java.sql.ResultSet)1 SQLIntegrityConstraintViolationException (java.sql.SQLIntegrityConstraintViolationException)1 Statement (java.sql.Statement)1