{"action":"created","comment":{"url":"https://api.github.com/repos/sin-us/sdhk/pulls/comments/116227177","pull_request_review_id":37835338,"id":116227177,"diff_hunk":"@@ -0,0 +1,189 @@\n+﻿using System.Collections.Generic;\n+using Microsoft.Xna.Framework.Input;\n+using MonoGameWorld.Inputs.Keyboard;\n+using MonoGameWorld.Inputs.Mouse;\n+\n+namespace MonoGameWorld.Configurations\n+{\n+    public static class InputConfigManager\n+    {\n+        private static Dictionary<string, ActionType> descriptionToActionBinding = new Dictionary<string, ActionType>();\n+        private static Dictionary<ActionType, List<KeyBinding>> actionToKeyBindings = new Dictionary<ActionType, List<KeyBinding>>();\n+\n+        public static Dictionary<string, ActionType> DescriptionToActionBinding { get { return descriptionToActionBinding; } }\n+        public static Dictionary<ActionType, List<KeyBinding>> ActionToKeyBindings { get { return actionToKeyBindings; } }\n+\n+        public static void DefaultInitialization()\n+        {\n+            List<KeyBinding> keyBindingList;\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.W) };\n+            AddDescriptionActionKeyBinding(\"Camera move forward\", ActionType.CameraMoveForward, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.S) };\n+            AddDescriptionActionKeyBinding(\"Camera move backward\", ActionType.CameraMoveBackward, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.A) };\n+            AddDescriptionActionKeyBinding(\"Camera move left\", ActionType.CameraMoveLeft, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.D) };\n+            AddDescriptionActionKeyBinding(\"Camera move right\", ActionType.CameraMoveRight, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.Space) };\n+            AddDescriptionActionKeyBinding(\"Camera move up\", ActionType.CameraMoveUp, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.LeftControl) };\n+            AddDescriptionActionKeyBinding(\"Camera move down\", ActionType.CameraMoveDown, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.Q) };\n+            AddDescriptionActionKeyBinding(\"Camera tilt left\", ActionType.CameraTiltLeft, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.E) };\n+            AddDescriptionActionKeyBinding(\"Camera tilt right\", ActionType.CameraTiltRight, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.Left) };\n+            AddDescriptionActionKeyBinding(\"Camera rotate left\", ActionType.CameraRotateLeft, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.Right) };\n+            AddDescriptionActionKeyBinding(\"Camera rotate right\", ActionType.CameraRotateRight, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.Up) };\n+            AddDescriptionActionKeyBinding(\"Camera rotate up\", ActionType.CameraRotateUp, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.Down) };\n+            AddDescriptionActionKeyBinding(\"Camera rotate down\", ActionType.CameraRotateDown, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.P) };\n+            AddDescriptionActionKeyBinding(\"Toggle wireframe\", ActionType.ToggleWireframe, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.T) };\n+            AddDescriptionActionKeyBinding(\"Toggle fullscreen\", ActionType.ToggleFullscreen, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.R) };\n+            AddDescriptionActionKeyBinding(\"Toggle fixed framerate\", ActionType.ToggleFixedFramerate, keyBindingList);\n+\n+            keyBindingList = new List<KeyBinding>() { new KeyBinding(ControllerType.Keyboard, Keys.Escape) };\n+            AddDescriptionActionKeyBinding(\"Exit\", ActionType.Exit, keyBindingList);\n+        }\n+\n+        private static void AddDescriptionActionKeyBinding(string description, ActionType actionType, List<KeyBinding> keyBindingList)\n+        {\n+            descriptionToActionBinding.Add(description, actionType);\n+            actionToKeyBindings.Add(actionType, keyBindingList);\n+        }\n+\n+        public static string AssignKeyToAction(string description, List<KeyBinding> keyBindingList, bool isForceAssign)\n+        {\n+            ActionType actionType = descriptionToActionBinding[description];\n+\n+            if (isForceAssign == false)\n+            {\n+                foreach (var actionToKeyPair in actionToKeyBindings)\n+                {\n+                    if ((actionToKeyPair.Value == keyBindingList) && (actionToKeyPair.Key != actionType))\n+                    {\n+                        foreach (var descriptionToActionPair in descriptionToActionBinding)\n+                        {\n+                            if (descriptionToActionPair.Value == actionToKeyPair.Key)\n+                            {\n+                                return descriptionToActionPair.Key;\n+                            }\n+                        }\n+                    }\n+                }\n+            }\n+            else\n+            {\n+                actionToKeyBindings[actionType] = keyBindingList;\n+            }\n+\n+            return \"\";\n+        }\n+\n+        public static bool IsActionKeysDown(ActionType actionType)\n+        {\n+            List<KeyBinding> keyBindingList = actionToKeyBindings[actionType];\n+            bool result = true;\n+\n+            foreach (KeyBinding keyBinding in keyBindingList)\n+            {\n+                if (keyBinding.Type == ControllerType.Keyboard)\n+                {\n+                    Keys keyboardKey = (Keys)keyBinding.Key;\n+                    if (KeyboardManager.IsKeyDown(keyboardKey) == false)\n+                    {\n+                        result = false;\n+                        break;\n+                    }\n+                }\n+                else if (keyBinding.Type == ControllerType.Mouse)\n+                {\n+                    ButtonStatus mouseButton = (ButtonStatus)keyBinding.Key;\n+                    if (mouseButton.IsDown == false)","path":"GameWorld/Configurations/InputConfigManager.cs","position":122,"original_position":122,"commit_id":"61dd1d74baacec2056204824f0525718c1435a47","original_commit_id":"61dd1d74baacec2056204824f0525718c1435a47","user":{"login":"Elzianor","id":8407410,"avatar_url":"https://avatars0.githubusercontent.com/u/8407410?v=3","gravatar_id":"","url":"https://api.github.com/users/Elzianor","html_url":"https://github.com/Elzianor","followers_url":"https://api.github.com/users/Elzianor/followers","following_url":"https://api.github.com/users/Elzianor/following{/other_user}","gists_url":"https://api.github.com/users/Elzianor/gists{/gist_id}","starred_url":"https://api.github.com/users/Elzianor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elzianor/subscriptions","organizations_url":"https://api.github.com/users/Elzianor/orgs","repos_url":"https://api.github.com/users/Elzianor/repos","events_url":"https://api.github.com/users/Elzianor/events{/privacy}","received_events_url":"https://api.github.com/users/Elzianor/received_events","type":"User","site_admin":false},"body":"changed","created_at":"2017-05-12T13:20:30Z","updated_at":"2017-05-12T13:20:31Z","html_url":"https://github.com/sin-us/sdhk/pull/10#discussion_r116227177","pull_request_url":"https://api.github.com/repos/sin-us/sdhk/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/sin-us/sdhk/pulls/comments/116227177"},"html":{"href":"https://github.com/sin-us/sdhk/pull/10#discussion_r116227177"},"pull_request":{"href":"https://api.github.com/repos/sin-us/sdhk/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/sin-us/sdhk/pulls/10","id":120308091,"html_url":"https://github.com/sin-us/sdhk/pull/10","diff_url":"https://github.com/sin-us/sdhk/pull/10.diff","patch_url":"https://github.com/sin-us/sdhk/pull/10.patch","issue_url":"https://api.github.com/repos/sin-us/sdhk/issues/10","number":10,"state":"open","locked":false,"title":"Implementation of InputConfigManager","user":{"login":"Elzianor","id":8407410,"avatar_url":"https://avatars0.githubusercontent.com/u/8407410?v=3","gravatar_id":"","url":"https://api.github.com/users/Elzianor","html_url":"https://github.com/Elzianor","followers_url":"https://api.github.com/users/Elzianor/followers","following_url":"https://api.github.com/users/Elzianor/following{/other_user}","gists_url":"https://api.github.com/users/Elzianor/gists{/gist_id}","starred_url":"https://api.github.com/users/Elzianor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elzianor/subscriptions","organizations_url":"https://api.github.com/users/Elzianor/orgs","repos_url":"https://api.github.com/users/Elzianor/repos","events_url":"https://api.github.com/users/Elzianor/events{/privacy}","received_events_url":"https://api.github.com/users/Elzianor/received_events","type":"User","site_admin":false},"body":"Now it is possible to store user input binding configs (including Keyboard / Mouse combinations).","created_at":"2017-05-12T12:02:10Z","updated_at":"2017-05-12T13:20:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bfc26b09fb58152db0b16d02bdd406c4d6fd3011","assignee":null,"assignees":[],"requested_reviewers":[{"login":"harmonickolobok","id":6259259,"avatar_url":"https://avatars1.githubusercontent.com/u/6259259?v=3","gravatar_id":"","url":"https://api.github.com/users/harmonickolobok","html_url":"https://github.com/harmonickolobok","followers_url":"https://api.github.com/users/harmonickolobok/followers","following_url":"https://api.github.com/users/harmonickolobok/following{/other_user}","gists_url":"https://api.github.com/users/harmonickolobok/gists{/gist_id}","starred_url":"https://api.github.com/users/harmonickolobok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harmonickolobok/subscriptions","organizations_url":"https://api.github.com/users/harmonickolobok/orgs","repos_url":"https://api.github.com/users/harmonickolobok/repos","events_url":"https://api.github.com/users/harmonickolobok/events{/privacy}","received_events_url":"https://api.github.com/users/harmonickolobok/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/sin-us/sdhk/pulls/10/commits","review_comments_url":"https://api.github.com/repos/sin-us/sdhk/pulls/10/comments","review_comment_url":"https://api.github.com/repos/sin-us/sdhk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sin-us/sdhk/issues/10/comments","statuses_url":"https://api.github.com/repos/sin-us/sdhk/statuses/61dd1d74baacec2056204824f0525718c1435a47","head":{"label":"sin-us:feature/InputConfigManager","ref":"feature/InputConfigManager","sha":"61dd1d74baacec2056204824f0525718c1435a47","user":{"login":"sin-us","id":4677928,"avatar_url":"https://avatars0.githubusercontent.com/u/4677928?v=3","gravatar_id":"","url":"https://api.github.com/users/sin-us","html_url":"https://github.com/sin-us","followers_url":"https://api.github.com/users/sin-us/followers","following_url":"https://api.github.com/users/sin-us/following{/other_user}","gists_url":"https://api.github.com/users/sin-us/gists{/gist_id}","starred_url":"https://api.github.com/users/sin-us/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sin-us/subscriptions","organizations_url":"https://api.github.com/users/sin-us/orgs","repos_url":"https://api.github.com/users/sin-us/repos","events_url":"https://api.github.com/users/sin-us/events{/privacy}","received_events_url":"https://api.github.com/users/sin-us/received_events","type":"User","site_admin":false},"repo":{"id":89856989,"name":"sdhk","full_name":"sin-us/sdhk","owner":{"login":"sin-us","id":4677928,"avatar_url":"https://avatars0.githubusercontent.com/u/4677928?v=3","gravatar_id":"","url":"https://api.github.com/users/sin-us","html_url":"https://github.com/sin-us","followers_url":"https://api.github.com/users/sin-us/followers","following_url":"https://api.github.com/users/sin-us/following{/other_user}","gists_url":"https://api.github.com/users/sin-us/gists{/gist_id}","starred_url":"https://api.github.com/users/sin-us/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sin-us/subscriptions","organizations_url":"https://api.github.com/users/sin-us/orgs","repos_url":"https://api.github.com/users/sin-us/repos","events_url":"https://api.github.com/users/sin-us/events{/privacy}","received_events_url":"https://api.github.com/users/sin-us/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sin-us/sdhk","description":null,"fork":false,"url":"https://api.github.com/repos/sin-us/sdhk","forks_url":"https://api.github.com/repos/sin-us/sdhk/forks","keys_url":"https://api.github.com/repos/sin-us/sdhk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sin-us/sdhk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sin-us/sdhk/teams","hooks_url":"https://api.github.com/repos/sin-us/sdhk/hooks","issue_events_url":"https://api.github.com/repos/sin-us/sdhk/issues/events{/number}","events_url":"https://api.github.com/repos/sin-us/sdhk/events","assignees_url":"https://api.github.com/repos/sin-us/sdhk/assignees{/user}","branches_url":"https://api.github.com/repos/sin-us/sdhk/branches{/branch}","tags_url":"https://api.github.com/repos/sin-us/sdhk/tags","blobs_url":"https://api.github.com/repos/sin-us/sdhk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sin-us/sdhk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sin-us/sdhk/git/refs{/sha}","trees_url":"https://api.github.com/repos/sin-us/sdhk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sin-us/sdhk/statuses/{sha}","languages_url":"https://api.github.com/repos/sin-us/sdhk/languages","stargazers_url":"https://api.github.com/repos/sin-us/sdhk/stargazers","contributors_url":"https://api.github.com/repos/sin-us/sdhk/contributors","subscribers_url":"https://api.github.com/repos/sin-us/sdhk/subscribers","subscription_url":"https://api.github.com/repos/sin-us/sdhk/subscription","commits_url":"https://api.github.com/repos/sin-us/sdhk/commits{/sha}","git_commits_url":"https://api.github.com/repos/sin-us/sdhk/git/commits{/sha}","comments_url":"https://api.github.com/repos/sin-us/sdhk/comments{/number}","issue_comment_url":"https://api.github.com/repos/sin-us/sdhk/issues/comments{/number}","contents_url":"https://api.github.com/repos/sin-us/sdhk/contents/{+path}","compare_url":"https://api.github.com/repos/sin-us/sdhk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sin-us/sdhk/merges","archive_url":"https://api.github.com/repos/sin-us/sdhk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sin-us/sdhk/downloads","issues_url":"https://api.github.com/repos/sin-us/sdhk/issues{/number}","pulls_url":"https://api.github.com/repos/sin-us/sdhk/pulls{/number}","milestones_url":"https://api.github.com/repos/sin-us/sdhk/milestones{/number}","notifications_url":"https://api.github.com/repos/sin-us/sdhk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sin-us/sdhk/labels{/name}","releases_url":"https://api.github.com/repos/sin-us/sdhk/releases{/id}","deployments_url":"https://api.github.com/repos/sin-us/sdhk/deployments","created_at":"2017-04-30T14:51:13Z","updated_at":"2017-05-02T17:52:17Z","pushed_at":"2017-05-12T12:02:10Z","git_url":"git://github.com/sin-us/sdhk.git","ssh_url":"git@github.com:sin-us/sdhk.git","clone_url":"https://github.com/sin-us/sdhk.git","svn_url":"https://github.com/sin-us/sdhk","homepage":null,"size":669,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"sin-us:master","ref":"master","sha":"ab87a1f41bd28698177fc4dabfc80ff39f7d983d","user":{"login":"sin-us","id":4677928,"avatar_url":"https://avatars0.githubusercontent.com/u/4677928?v=3","gravatar_id":"","url":"https://api.github.com/users/sin-us","html_url":"https://github.com/sin-us","followers_url":"https://api.github.com/users/sin-us/followers","following_url":"https://api.github.com/users/sin-us/following{/other_user}","gists_url":"https://api.github.com/users/sin-us/gists{/gist_id}","starred_url":"https://api.github.com/users/sin-us/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sin-us/subscriptions","organizations_url":"https://api.github.com/users/sin-us/orgs","repos_url":"https://api.github.com/users/sin-us/repos","events_url":"https://api.github.com/users/sin-us/events{/privacy}","received_events_url":"https://api.github.com/users/sin-us/received_events","type":"User","site_admin":false},"repo":{"id":89856989,"name":"sdhk","full_name":"sin-us/sdhk","owner":{"login":"sin-us","id":4677928,"avatar_url":"https://avatars0.githubusercontent.com/u/4677928?v=3","gravatar_id":"","url":"https://api.github.com/users/sin-us","html_url":"https://github.com/sin-us","followers_url":"https://api.github.com/users/sin-us/followers","following_url":"https://api.github.com/users/sin-us/following{/other_user}","gists_url":"https://api.github.com/users/sin-us/gists{/gist_id}","starred_url":"https://api.github.com/users/sin-us/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sin-us/subscriptions","organizations_url":"https://api.github.com/users/sin-us/orgs","repos_url":"https://api.github.com/users/sin-us/repos","events_url":"https://api.github.com/users/sin-us/events{/privacy}","received_events_url":"https://api.github.com/users/sin-us/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sin-us/sdhk","description":null,"fork":false,"url":"https://api.github.com/repos/sin-us/sdhk","forks_url":"https://api.github.com/repos/sin-us/sdhk/forks","keys_url":"https://api.github.com/repos/sin-us/sdhk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sin-us/sdhk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sin-us/sdhk/teams","hooks_url":"https://api.github.com/repos/sin-us/sdhk/hooks","issue_events_url":"https://api.github.com/repos/sin-us/sdhk/issues/events{/number}","events_url":"https://api.github.com/repos/sin-us/sdhk/events","assignees_url":"https://api.github.com/repos/sin-us/sdhk/assignees{/user}","branches_url":"https://api.github.com/repos/sin-us/sdhk/branches{/branch}","tags_url":"https://api.github.com/repos/sin-us/sdhk/tags","blobs_url":"https://api.github.com/repos/sin-us/sdhk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sin-us/sdhk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sin-us/sdhk/git/refs{/sha}","trees_url":"https://api.github.com/repos/sin-us/sdhk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sin-us/sdhk/statuses/{sha}","languages_url":"https://api.github.com/repos/sin-us/sdhk/languages","stargazers_url":"https://api.github.com/repos/sin-us/sdhk/stargazers","contributors_url":"https://api.github.com/repos/sin-us/sdhk/contributors","subscribers_url":"https://api.github.com/repos/sin-us/sdhk/subscribers","subscription_url":"https://api.github.com/repos/sin-us/sdhk/subscription","commits_url":"https://api.github.com/repos/sin-us/sdhk/commits{/sha}","git_commits_url":"https://api.github.com/repos/sin-us/sdhk/git/commits{/sha}","comments_url":"https://api.github.com/repos/sin-us/sdhk/comments{/number}","issue_comment_url":"https://api.github.com/repos/sin-us/sdhk/issues/comments{/number}","contents_url":"https://api.github.com/repos/sin-us/sdhk/contents/{+path}","compare_url":"https://api.github.com/repos/sin-us/sdhk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sin-us/sdhk/merges","archive_url":"https://api.github.com/repos/sin-us/sdhk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sin-us/sdhk/downloads","issues_url":"https://api.github.com/repos/sin-us/sdhk/issues{/number}","pulls_url":"https://api.github.com/repos/sin-us/sdhk/pulls{/number}","milestones_url":"https://api.github.com/repos/sin-us/sdhk/milestones{/number}","notifications_url":"https://api.github.com/repos/sin-us/sdhk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sin-us/sdhk/labels{/name}","releases_url":"https://api.github.com/repos/sin-us/sdhk/releases{/id}","deployments_url":"https://api.github.com/repos/sin-us/sdhk/deployments","created_at":"2017-04-30T14:51:13Z","updated_at":"2017-05-02T17:52:17Z","pushed_at":"2017-05-12T12:02:10Z","git_url":"git://github.com/sin-us/sdhk.git","ssh_url":"git@github.com:sin-us/sdhk.git","clone_url":"https://github.com/sin-us/sdhk.git","svn_url":"https://github.com/sin-us/sdhk","homepage":null,"size":669,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sin-us/sdhk/pulls/10"},"html":{"href":"https://github.com/sin-us/sdhk/pull/10"},"issue":{"href":"https://api.github.com/repos/sin-us/sdhk/issues/10"},"comments":{"href":"https://api.github.com/repos/sin-us/sdhk/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/sin-us/sdhk/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/sin-us/sdhk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sin-us/sdhk/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/sin-us/sdhk/statuses/61dd1d74baacec2056204824f0525718c1435a47"}}}}
{"actor":{"display_login":"Elzianor"}}