{"action":"created","comment":{"url":"https://api.github.com/repos/zliving/File-Play/pulls/comments/87124454","pull_request_review_id":7748547,"id":87124454,"diff_hunk":"@@ -0,0 +1,143 @@\n+package UIElements;\n+\n+import com.badlogic.gdx.Game;\n+import com.badlogic.gdx.Gdx;\n+import com.badlogic.gdx.graphics.g2d.BitmapFont;\n+import com.badlogic.gdx.graphics.g2d.TextureAtlas;\n+import com.badlogic.gdx.scenes.scene2d.Stage;\n+import com.badlogic.gdx.scenes.scene2d.ui.Skin;\n+import com.badlogic.gdx.scenes.scene2d.ui.TextButton;\n+import com.badlogic.gdx.utils.Array;\n+\n+\n+import GameObjects.TriviaQuestion;\n+import GameObjects.TriviaQuestionBuilder;\n+import InputListeners.TriviaButtonListener;\n+\n+\n+/**\n+ * Created by zach on 10/23/16.\n+ * TriviaButtonBuilder will create sets of buttons for each trivia question.\n+ * Will return an array of buttons for each question. To update the screen\n+ * you need to call updateTriviaButton after each question is answered.\n+ */\n+\n+public class TriviaButtonBuilder extends Game {\n+\n+    // The stage is where we place the buttons since they\n+    // will be actors now rather than just textures.\n+    Stage stage;\n+    // TextButton is the standard actor we will use to display any text on the buttons.\n+    // These buttons have a their own listeners and states\n+    TextButton button;\n+    // TextButtonStyle allows us to change the look of the button based on its state\n+    TextButton.TextButtonStyle textButtonStyle;\n+    // Allows us to place a created font on the buttons\n+    BitmapFont font;\n+    // The Skin allows us to dynamically change how the buttons look.\n+    Skin skin;\n+    // This is how we will use textures as they will be in one file and we use\n+    // The atlas to get regions of the texture pack to place as single textures\n+    TextureAtlas buttonAtlas;\n+    String question;\n+    float xButtonPosition = 50;\n+    float yButtonPosition = 400;\n+    int questionNumber = 0;\n+    TriviaButtonListener buttonListener = new TriviaButtonListener();\n+\n+\n+    private Array<TriviaQuestion> generateTriviaData(String url) {\n+\n+        // Get an array of questions from the database.\n+        TriviaQuestionBuilder newTriviaGame = new TriviaQuestionBuilder();\n+        url = \"https://www.opentdb.com/api.php?amount=10&type=multiple\";\n+        Array<TriviaQuestion> newQuestionSet = newTriviaGame.getTriviaQuestions(url);\n+\n+        return newQuestionSet;\n+    }\n+\n+    private Array<TextButton> generateButtons(TriviaQuestion currentQuestion) {\n+        font = new BitmapFont();\n+        skin = new Skin();\n+        //buttonAtlas = new TextureAtlas(Gdx.files.internal(\"buttons/buttons.pack\"));\n+        //skin.addRegions(buttonAtlas);\n+        textButtonStyle = new TextButton.TextButtonStyle();\n+        textButtonStyle.font = font;\n+        //textButtonStyle.up = skin.getDrawable(\"up-button\");\n+        //textButtonStyle.down = skin.getDrawable(\"down-button\");\n+        //textButtonStyle.checked = skin.getDrawable(\"checked-button\");\n+        //button = new TextButton(\"Button1\", textButtonStyle);\n+\n+        // Generate new array of TextButtons for each question.\n+        // Build static buttons for the correct answer and question.\n+        Array<TextButton> newQuestionBlock = new Array<TextButton>();\n+        TextButton questionButton = new TextButton(currentQuestion.question, textButtonStyle);\n+        questionButton.setPosition(xButtonPosition,yButtonPosition);\n+        yButtonPosition -= questionButton.getHeight();\n+        TextButton correctAnswerButton = new TextButton(currentQuestion.correctAnswer, textButtonStyle);\n+        correctAnswerButton.setPosition(xButtonPosition,yButtonPosition);\n+        yButtonPosition -= questionButton.getHeight();\n+\n+        // Push the question and correctAnswerButton onto the array.\n+        newQuestionBlock.add(questionButton);\n+        newQuestionBlock.add(correctAnswerButton);\n+\n+        // Create a button for each incorrect answer.\n+        TextButton incorrectAnswerButton;\n+        Array<TextButton> incorrectButtons = new Array<TextButton>();\n+        for(int i = 0; i<currentQuestion.incorrectAnswers.length; i++) {\n+            incorrectAnswerButton = new TextButton(currentQuestion.incorrectAnswers[i], textButtonStyle);\n+            incorrectAnswerButton.setPosition(xButtonPosition,yButtonPosition);\n+            yButtonPosition -= incorrectAnswerButton.getHeight();\n+            newQuestionBlock.add(incorrectAnswerButton);\n+        }\n+\n+        // Add the custom buttonListener to each button.\n+        for(int i = 0; i<newQuestionBlock.size; i++)\n+        {\n+            newQuestionBlock.get(i).addListener(buttonListener);\n+        }\n+\n+\n+        //button = new TextButton(question, textButtonStyle);\n+        //stage.addActor(button);\n+        return newQuestionBlock;\n+    }\n+\n+    private Array<TextButton> updateTriviaButtons(Array<TextButton> questionSet, TriviaQuestion newQuestion) {\n+\n+        return questionSet;\n+    }\n+\n+    @Override\n+    public void create() {\n+        stage = new Stage();\n+\n+        // On the creation of the class build the trivia buttons and add them to the stage.\n+        Array<TriviaQuestion> newTriviaGame = generateTriviaData(\"\");\n+\n+        Array<TextButton> questionSet = generateButtons(newTriviaGame.get(questionNumber));\n+        for(int i = 0; i< questionSet.size; i++)\n+        {\n+            stage.addActor(questionSet.get(i));\n+        }\n+        Gdx.input.setInputProcessor(stage);\n+\n+","path":"core/src/main/java/UIElements/TriviaButtonBuilder.java","position":126,"original_position":126,"commit_id":"b6ae7a1192bd077c47da507998925c06cc4646c1","original_commit_id":"b6ae7a1192bd077c47da507998925c06cc4646c1","user":{"login":"cvasqu09","id":16127222,"avatar_url":"https://avatars.githubusercontent.com/u/16127222?v=3","gravatar_id":"","url":"https://api.github.com/users/cvasqu09","html_url":"https://github.com/cvasqu09","followers_url":"https://api.github.com/users/cvasqu09/followers","following_url":"https://api.github.com/users/cvasqu09/following{/other_user}","gists_url":"https://api.github.com/users/cvasqu09/gists{/gist_id}","starred_url":"https://api.github.com/users/cvasqu09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvasqu09/subscriptions","organizations_url":"https://api.github.com/users/cvasqu09/orgs","repos_url":"https://api.github.com/users/cvasqu09/repos","events_url":"https://api.github.com/users/cvasqu09/events{/privacy}","received_events_url":"https://api.github.com/users/cvasqu09/received_events","type":"User","site_admin":false},"body":"Get rid of whitespace.","created_at":"2016-11-09T02:17:59Z","updated_at":"2016-11-09T02:22:21Z","html_url":"https://github.com/zliving/File-Play/pull/30#discussion_r87124454","pull_request_url":"https://api.github.com/repos/zliving/File-Play/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/zliving/File-Play/pulls/comments/87124454"},"html":{"href":"https://github.com/zliving/File-Play/pull/30#discussion_r87124454"},"pull_request":{"href":"https://api.github.com/repos/zliving/File-Play/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/zliving/File-Play/pulls/30","id":92852128,"html_url":"https://github.com/zliving/File-Play/pull/30","diff_url":"https://github.com/zliving/File-Play/pull/30.diff","patch_url":"https://github.com/zliving/File-Play/pull/30.patch","issue_url":"https://api.github.com/repos/zliving/File-Play/issues/30","number":30,"state":"open","locked":false,"title":"Refactor the TriviaQuestionBuilder class","user":{"login":"zliving","id":16127179,"avatar_url":"https://avatars.githubusercontent.com/u/16127179?v=3","gravatar_id":"","url":"https://api.github.com/users/zliving","html_url":"https://github.com/zliving","followers_url":"https://api.github.com/users/zliving/followers","following_url":"https://api.github.com/users/zliving/following{/other_user}","gists_url":"https://api.github.com/users/zliving/gists{/gist_id}","starred_url":"https://api.github.com/users/zliving/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zliving/subscriptions","organizations_url":"https://api.github.com/users/zliving/orgs","repos_url":"https://api.github.com/users/zliving/repos","events_url":"https://api.github.com/users/zliving/events{/privacy}","received_events_url":"https://api.github.com/users/zliving/received_events","type":"User","site_admin":false},"body":"The TriviaBuilderClass now uses HttpsURLConncection to make the database call.","created_at":"2016-11-08T20:23:47Z","updated_at":"2016-11-09T02:22:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bdb04ea6441a77c7516f3f075fe01734a5f58c9d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zliving/File-Play/pulls/30/commits","review_comments_url":"https://api.github.com/repos/zliving/File-Play/pulls/30/comments","review_comment_url":"https://api.github.com/repos/zliving/File-Play/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zliving/File-Play/issues/30/comments","statuses_url":"https://api.github.com/repos/zliving/File-Play/statuses/b6ae7a1192bd077c47da507998925c06cc4646c1","head":{"label":"zliving:feature/refactor-trivia-builder","ref":"feature/refactor-trivia-builder","sha":"b6ae7a1192bd077c47da507998925c06cc4646c1","user":{"login":"zliving","id":16127179,"avatar_url":"https://avatars.githubusercontent.com/u/16127179?v=3","gravatar_id":"","url":"https://api.github.com/users/zliving","html_url":"https://github.com/zliving","followers_url":"https://api.github.com/users/zliving/followers","following_url":"https://api.github.com/users/zliving/following{/other_user}","gists_url":"https://api.github.com/users/zliving/gists{/gist_id}","starred_url":"https://api.github.com/users/zliving/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zliving/subscriptions","organizations_url":"https://api.github.com/users/zliving/orgs","repos_url":"https://api.github.com/users/zliving/repos","events_url":"https://api.github.com/users/zliving/events{/privacy}","received_events_url":"https://api.github.com/users/zliving/received_events","type":"User","site_admin":false},"repo":{"id":69578566,"name":"File-Play","full_name":"zliving/File-Play","owner":{"login":"zliving","id":16127179,"avatar_url":"https://avatars.githubusercontent.com/u/16127179?v=3","gravatar_id":"","url":"https://api.github.com/users/zliving","html_url":"https://github.com/zliving","followers_url":"https://api.github.com/users/zliving/followers","following_url":"https://api.github.com/users/zliving/following{/other_user}","gists_url":"https://api.github.com/users/zliving/gists{/gist_id}","starred_url":"https://api.github.com/users/zliving/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zliving/subscriptions","organizations_url":"https://api.github.com/users/zliving/orgs","repos_url":"https://api.github.com/users/zliving/repos","events_url":"https://api.github.com/users/zliving/events{/privacy}","received_events_url":"https://api.github.com/users/zliving/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zliving/File-Play","description":"File Play game!","fork":false,"url":"https://api.github.com/repos/zliving/File-Play","forks_url":"https://api.github.com/repos/zliving/File-Play/forks","keys_url":"https://api.github.com/repos/zliving/File-Play/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zliving/File-Play/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zliving/File-Play/teams","hooks_url":"https://api.github.com/repos/zliving/File-Play/hooks","issue_events_url":"https://api.github.com/repos/zliving/File-Play/issues/events{/number}","events_url":"https://api.github.com/repos/zliving/File-Play/events","assignees_url":"https://api.github.com/repos/zliving/File-Play/assignees{/user}","branches_url":"https://api.github.com/repos/zliving/File-Play/branches{/branch}","tags_url":"https://api.github.com/repos/zliving/File-Play/tags","blobs_url":"https://api.github.com/repos/zliving/File-Play/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zliving/File-Play/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zliving/File-Play/git/refs{/sha}","trees_url":"https://api.github.com/repos/zliving/File-Play/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zliving/File-Play/statuses/{sha}","languages_url":"https://api.github.com/repos/zliving/File-Play/languages","stargazers_url":"https://api.github.com/repos/zliving/File-Play/stargazers","contributors_url":"https://api.github.com/repos/zliving/File-Play/contributors","subscribers_url":"https://api.github.com/repos/zliving/File-Play/subscribers","subscription_url":"https://api.github.com/repos/zliving/File-Play/subscription","commits_url":"https://api.github.com/repos/zliving/File-Play/commits{/sha}","git_commits_url":"https://api.github.com/repos/zliving/File-Play/git/commits{/sha}","comments_url":"https://api.github.com/repos/zliving/File-Play/comments{/number}","issue_comment_url":"https://api.github.com/repos/zliving/File-Play/issues/comments{/number}","contents_url":"https://api.github.com/repos/zliving/File-Play/contents/{+path}","compare_url":"https://api.github.com/repos/zliving/File-Play/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zliving/File-Play/merges","archive_url":"https://api.github.com/repos/zliving/File-Play/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zliving/File-Play/downloads","issues_url":"https://api.github.com/repos/zliving/File-Play/issues{/number}","pulls_url":"https://api.github.com/repos/zliving/File-Play/pulls{/number}","milestones_url":"https://api.github.com/repos/zliving/File-Play/milestones{/number}","notifications_url":"https://api.github.com/repos/zliving/File-Play/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zliving/File-Play/labels{/name}","releases_url":"https://api.github.com/repos/zliving/File-Play/releases{/id}","deployments_url":"https://api.github.com/repos/zliving/File-Play/deployments","created_at":"2016-09-29T15:00:40Z","updated_at":"2016-10-27T13:24:27Z","pushed_at":"2016-11-08T20:48:05Z","git_url":"git://github.com/zliving/File-Play.git","ssh_url":"git@github.com:zliving/File-Play.git","clone_url":"https://github.com/zliving/File-Play.git","svn_url":"https://github.com/zliving/File-Play","homepage":null,"size":22657,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"zliving:develop","ref":"develop","sha":"c291afed5ef55d70d6d97bd9b39b4f337f663d49","user":{"login":"zliving","id":16127179,"avatar_url":"https://avatars.githubusercontent.com/u/16127179?v=3","gravatar_id":"","url":"https://api.github.com/users/zliving","html_url":"https://github.com/zliving","followers_url":"https://api.github.com/users/zliving/followers","following_url":"https://api.github.com/users/zliving/following{/other_user}","gists_url":"https://api.github.com/users/zliving/gists{/gist_id}","starred_url":"https://api.github.com/users/zliving/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zliving/subscriptions","organizations_url":"https://api.github.com/users/zliving/orgs","repos_url":"https://api.github.com/users/zliving/repos","events_url":"https://api.github.com/users/zliving/events{/privacy}","received_events_url":"https://api.github.com/users/zliving/received_events","type":"User","site_admin":false},"repo":{"id":69578566,"name":"File-Play","full_name":"zliving/File-Play","owner":{"login":"zliving","id":16127179,"avatar_url":"https://avatars.githubusercontent.com/u/16127179?v=3","gravatar_id":"","url":"https://api.github.com/users/zliving","html_url":"https://github.com/zliving","followers_url":"https://api.github.com/users/zliving/followers","following_url":"https://api.github.com/users/zliving/following{/other_user}","gists_url":"https://api.github.com/users/zliving/gists{/gist_id}","starred_url":"https://api.github.com/users/zliving/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zliving/subscriptions","organizations_url":"https://api.github.com/users/zliving/orgs","repos_url":"https://api.github.com/users/zliving/repos","events_url":"https://api.github.com/users/zliving/events{/privacy}","received_events_url":"https://api.github.com/users/zliving/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zliving/File-Play","description":"File Play game!","fork":false,"url":"https://api.github.com/repos/zliving/File-Play","forks_url":"https://api.github.com/repos/zliving/File-Play/forks","keys_url":"https://api.github.com/repos/zliving/File-Play/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zliving/File-Play/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zliving/File-Play/teams","hooks_url":"https://api.github.com/repos/zliving/File-Play/hooks","issue_events_url":"https://api.github.com/repos/zliving/File-Play/issues/events{/number}","events_url":"https://api.github.com/repos/zliving/File-Play/events","assignees_url":"https://api.github.com/repos/zliving/File-Play/assignees{/user}","branches_url":"https://api.github.com/repos/zliving/File-Play/branches{/branch}","tags_url":"https://api.github.com/repos/zliving/File-Play/tags","blobs_url":"https://api.github.com/repos/zliving/File-Play/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zliving/File-Play/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zliving/File-Play/git/refs{/sha}","trees_url":"https://api.github.com/repos/zliving/File-Play/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zliving/File-Play/statuses/{sha}","languages_url":"https://api.github.com/repos/zliving/File-Play/languages","stargazers_url":"https://api.github.com/repos/zliving/File-Play/stargazers","contributors_url":"https://api.github.com/repos/zliving/File-Play/contributors","subscribers_url":"https://api.github.com/repos/zliving/File-Play/subscribers","subscription_url":"https://api.github.com/repos/zliving/File-Play/subscription","commits_url":"https://api.github.com/repos/zliving/File-Play/commits{/sha}","git_commits_url":"https://api.github.com/repos/zliving/File-Play/git/commits{/sha}","comments_url":"https://api.github.com/repos/zliving/File-Play/comments{/number}","issue_comment_url":"https://api.github.com/repos/zliving/File-Play/issues/comments{/number}","contents_url":"https://api.github.com/repos/zliving/File-Play/contents/{+path}","compare_url":"https://api.github.com/repos/zliving/File-Play/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zliving/File-Play/merges","archive_url":"https://api.github.com/repos/zliving/File-Play/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zliving/File-Play/downloads","issues_url":"https://api.github.com/repos/zliving/File-Play/issues{/number}","pulls_url":"https://api.github.com/repos/zliving/File-Play/pulls{/number}","milestones_url":"https://api.github.com/repos/zliving/File-Play/milestones{/number}","notifications_url":"https://api.github.com/repos/zliving/File-Play/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zliving/File-Play/labels{/name}","releases_url":"https://api.github.com/repos/zliving/File-Play/releases{/id}","deployments_url":"https://api.github.com/repos/zliving/File-Play/deployments","created_at":"2016-09-29T15:00:40Z","updated_at":"2016-10-27T13:24:27Z","pushed_at":"2016-11-08T20:48:05Z","git_url":"git://github.com/zliving/File-Play.git","ssh_url":"git@github.com:zliving/File-Play.git","clone_url":"https://github.com/zliving/File-Play.git","svn_url":"https://github.com/zliving/File-Play","homepage":null,"size":22657,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zliving/File-Play/pulls/30"},"html":{"href":"https://github.com/zliving/File-Play/pull/30"},"issue":{"href":"https://api.github.com/repos/zliving/File-Play/issues/30"},"comments":{"href":"https://api.github.com/repos/zliving/File-Play/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/zliving/File-Play/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/zliving/File-Play/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zliving/File-Play/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/zliving/File-Play/statuses/b6ae7a1192bd077c47da507998925c06cc4646c1"}}}}
{"actor":{"display_login":"cvasqu09"}}