{"action":"created","comment":{"url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/comments/51367098","id":51367098,"diff_hunk":"@@ -375,21 +375,112 @@\n     },\n \n     /**\n+     * Отрисовка многоугольника на канвасе\n+     */\n+    _drawPolygon: function(TopPoint, RightPoint, BottomPoint, LeftPoint, pointOffset, fillColor) {\n+      this.ctx.beginPath();\n+      this.ctx.fillStyle = fillColor;\n+      // Верхний левый угол\n+      this.ctx.moveTo(LeftPoint, TopPoint);\n+      this.ctx.lineTo(LeftPoint + pointOffset, TopPoint);\n+      this.ctx.lineTo(LeftPoint + pointOffset, TopPoint - pointOffset);\n+      // Верхний правый угол\n+      this.ctx.lineTo(RightPoint - pointOffset, TopPoint - pointOffset);\n+      this.ctx.lineTo(RightPoint - pointOffset, TopPoint);\n+      this.ctx.lineTo(RightPoint, TopPoint);\n+      // Нижний правый угол\n+      this.ctx.lineTo(RightPoint, BottomPoint - pointOffset);\n+      this.ctx.lineTo(RightPoint - pointOffset, BottomPoint - pointOffset);\n+      this.ctx.lineTo(RightPoint - pointOffset, BottomPoint);\n+      // Треуголник под нижней границей\n+      this.ctx.lineTo(RightPoint / 2 + pointOffset * 10, BottomPoint);\n+      this.ctx.lineTo(RightPoint / 2, BottomPoint + pointOffset * 10);\n+      this.ctx.lineTo(RightPoint / 2, BottomPoint);\n+      // Нижний левый угол\n+      this.ctx.lineTo(LeftPoint + pointOffset, BottomPoint);\n+      this.ctx.lineTo(LeftPoint + pointOffset, BottomPoint - pointOffset);\n+      this.ctx.lineTo(LeftPoint, BottomPoint - pointOffset);\n+      // Снова верхний левый угол\n+      this.ctx.lineTo(LeftPoint, TopPoint);\n+      this.ctx.fill();\n+    },\n+\n+    /**\n+     * Отрисовка текста на канвасе с автоматическим переносом\n+     */\n+    _drawText: function(text, marginLeft, marginTop, textWidth, lineHeight, font, color) {\n+      this.ctx.font = font;\n+      this.ctx.fillStyle = color;\n+      var words = text.split(\" \");\n+      var countWords = words.length;\n+      var line = \"\";\n+      for (var n = 0; n < countWords; n++) {\n+        var testLine = line + words[n] + \" \";\n+        var testWidth = this.ctx.measureText(testLine).width;\n+        if (testWidth > textWidth) {\n+          this.ctx.fillText(line, marginLeft, marginTop);\n+          line = words[n] + \" \";\n+          marginTop += lineHeight;\n+        }\n+        else {\n+          line = testLine;\n+        }\n+      }\n+      this.ctx.fillText(line, marginLeft, marginTop);\n+\n+    },\n+\n+    /**\n+     * Отрисовка многоугольника с тенью и текстом\n+     */\n+    _drawPolygonWithShadowAndText: function(text) {\n+      // Конфигурация многоуголника\n+      var TopPoint = 25;\n+      var RightPoint = 625;\n+      var BottomPoint = 165;\n+      var LeftPoint = 250;\n+      var pointOffset = 5;\n+      var screenColor = '#FFFFFF';\n+      var shadowOffset = 10;\n+      var shadowColor = 'rgba(0, 0, 0, 0.7)';\n+\n+      // Конфигурация текста\n+      var textWidth = RightPoint - LeftPoint - pointOffset * 4;\n+      var lineHeight = 25;\n+      var marginLeft = LeftPoint + pointOffset * 4;\n+      var marginTop = TopPoint + pointOffset * 4;\n+      var font = '16px monospace';\n+      var color = '#000000';\n+\n+      this._drawPolygon(TopPoint+shadowOffset, RightPoint+shadowOffset, BottomPoint+shadowOffset, LeftPoint+shadowOffset, pointOffset, shadowColor);\n+      this._drawPolygon(TopPoint, RightPoint, BottomPoint, LeftPoint, pointOffset, screenColor);\n+      this._drawText(text, marginLeft, marginTop, textWidth, lineHeight, font, color);\n+    },\n+\n+    /**\n      * Отрисовка экрана паузы.\n      */\n     _drawPauseScreen: function() {\n       switch (this.state.currentStatus) {\n         case Verdict.WIN:\n-          console.log('you have won!');\n+          var textWin = \"Ты всех победил! Ты больше не салага! Го на автепати!\";\n+          this._drawPolygonWithShadowAndText(textWin);\n+          console.log(textWin);\n           break;\n         case Verdict.FAIL:\n-          console.log('you have failed!');\n+          var textFail = \"Ты проиграл, салага! Но у тебя всегда есть шанс отомстить тем, кто так с тобой поступил.\";\n+          this._drawPolygonWithShadowAndText(textFail);\n+          console.log(textFail);\n           break;\n         case Verdict.PAUSE:\n+          var textPause = \"Мир вот-вот будет уничтожен, а ты решил передохнуть? Не лучшее время.\";\n+          this._drawPolygonWithShadowAndText(textPause);\n           console.log('game is on pause!');\n           break;\n         case Verdict.INTRO:\n-          console.log('welcome to the game! Press Space to start');\n+          var textIntro = \"Ну что, салага, ты готов надрать кому-нибудь задницу? Например, кроне этого дерева? Давай, испепели ее фаерболом! Клацни пробел и погнали!\";\n+          this._drawPolygonWithShadowAndText(textIntro);\n+          console.log(textIntro);\n           break;\n       }","path":"js/game.js","position":114,"original_position":114,"commit_id":"13078317b0f7aadfcb7d1612c2832523412d28c9","original_commit_id":"13078317b0f7aadfcb7d1612c2832523412d28c9","user":{"login":"azbykov","id":3133099,"avatar_url":"https://avatars.githubusercontent.com/u/3133099?v=3","gravatar_id":"","url":"https://api.github.com/users/azbykov","html_url":"https://github.com/azbykov","followers_url":"https://api.github.com/users/azbykov/followers","following_url":"https://api.github.com/users/azbykov/following{/other_user}","gists_url":"https://api.github.com/users/azbykov/gists{/gist_id}","starred_url":"https://api.github.com/users/azbykov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azbykov/subscriptions","organizations_url":"https://api.github.com/users/azbykov/orgs","repos_url":"https://api.github.com/users/azbykov/repos","events_url":"https://api.github.com/users/azbykov/events{/privacy}","received_events_url":"https://api.github.com/users/azbykov/received_events","type":"User","site_admin":false},"body":"Можно добавить сюда default (это хороший тон - поддерживать состояние по умолчанию)","created_at":"2016-01-31T20:46:51Z","updated_at":"2016-01-31T20:46:51Z","html_url":"https://github.com/htmlacademy-javascript/17257-code-and-magick/pull/3#discussion_r51367098","pull_request_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/comments/51367098"},"html":{"href":"https://github.com/htmlacademy-javascript/17257-code-and-magick/pull/3#discussion_r51367098"},"pull_request":{"href":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/3","id":57778758,"html_url":"https://github.com/htmlacademy-javascript/17257-code-and-magick/pull/3","diff_url":"https://github.com/htmlacademy-javascript/17257-code-and-magick/pull/3.diff","patch_url":"https://github.com/htmlacademy-javascript/17257-code-and-magick/pull/3.patch","issue_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/issues/3","number":3,"state":"open","locked":false,"title":"Задание #6 Canvas","user":{"login":"ncer","id":6255458,"avatar_url":"https://avatars.githubusercontent.com/u/6255458?v=3","gravatar_id":"","url":"https://api.github.com/users/ncer","html_url":"https://github.com/ncer","followers_url":"https://api.github.com/users/ncer/followers","following_url":"https://api.github.com/users/ncer/following{/other_user}","gists_url":"https://api.github.com/users/ncer/gists{/gist_id}","starred_url":"https://api.github.com/users/ncer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncer/subscriptions","organizations_url":"https://api.github.com/users/ncer/orgs","repos_url":"https://api.github.com/users/ncer/repos","events_url":"https://api.github.com/users/ncer/events{/privacy}","received_events_url":"https://api.github.com/users/ncer/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-31T20:14:51Z","updated_at":"2016-01-31T20:46:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"efda34fcc8268c3fd24842ecb50c270df0ecfdcf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/3/commits","review_comments_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/3/comments","review_comment_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/comments{/number}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/issues/3/comments","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/statuses/13078317b0f7aadfcb7d1612c2832523412d28c9","head":{"label":"ncer:module2-task1","ref":"module2-task1","sha":"13078317b0f7aadfcb7d1612c2832523412d28c9","user":{"login":"ncer","id":6255458,"avatar_url":"https://avatars.githubusercontent.com/u/6255458?v=3","gravatar_id":"","url":"https://api.github.com/users/ncer","html_url":"https://github.com/ncer","followers_url":"https://api.github.com/users/ncer/followers","following_url":"https://api.github.com/users/ncer/following{/other_user}","gists_url":"https://api.github.com/users/ncer/gists{/gist_id}","starred_url":"https://api.github.com/users/ncer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncer/subscriptions","organizations_url":"https://api.github.com/users/ncer/orgs","repos_url":"https://api.github.com/users/ncer/repos","events_url":"https://api.github.com/users/ncer/events{/privacy}","received_events_url":"https://api.github.com/users/ncer/received_events","type":"User","site_admin":false},"repo":{"id":50130644,"name":"code-and-magick","full_name":"ncer/code-and-magick","owner":{"login":"ncer","id":6255458,"avatar_url":"https://avatars.githubusercontent.com/u/6255458?v=3","gravatar_id":"","url":"https://api.github.com/users/ncer","html_url":"https://github.com/ncer","followers_url":"https://api.github.com/users/ncer/followers","following_url":"https://api.github.com/users/ncer/following{/other_user}","gists_url":"https://api.github.com/users/ncer/gists{/gist_id}","starred_url":"https://api.github.com/users/ncer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncer/subscriptions","organizations_url":"https://api.github.com/users/ncer/orgs","repos_url":"https://api.github.com/users/ncer/repos","events_url":"https://api.github.com/users/ncer/events{/privacy}","received_events_url":"https://api.github.com/users/ncer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ncer/code-and-magick","description":"Павел Захаров","fork":true,"url":"https://api.github.com/repos/ncer/code-and-magick","forks_url":"https://api.github.com/repos/ncer/code-and-magick/forks","keys_url":"https://api.github.com/repos/ncer/code-and-magick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ncer/code-and-magick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ncer/code-and-magick/teams","hooks_url":"https://api.github.com/repos/ncer/code-and-magick/hooks","issue_events_url":"https://api.github.com/repos/ncer/code-and-magick/issues/events{/number}","events_url":"https://api.github.com/repos/ncer/code-and-magick/events","assignees_url":"https://api.github.com/repos/ncer/code-and-magick/assignees{/user}","branches_url":"https://api.github.com/repos/ncer/code-and-magick/branches{/branch}","tags_url":"https://api.github.com/repos/ncer/code-and-magick/tags","blobs_url":"https://api.github.com/repos/ncer/code-and-magick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ncer/code-and-magick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ncer/code-and-magick/git/refs{/sha}","trees_url":"https://api.github.com/repos/ncer/code-and-magick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ncer/code-and-magick/statuses/{sha}","languages_url":"https://api.github.com/repos/ncer/code-and-magick/languages","stargazers_url":"https://api.github.com/repos/ncer/code-and-magick/stargazers","contributors_url":"https://api.github.com/repos/ncer/code-and-magick/contributors","subscribers_url":"https://api.github.com/repos/ncer/code-and-magick/subscribers","subscription_url":"https://api.github.com/repos/ncer/code-and-magick/subscription","commits_url":"https://api.github.com/repos/ncer/code-and-magick/commits{/sha}","git_commits_url":"https://api.github.com/repos/ncer/code-and-magick/git/commits{/sha}","comments_url":"https://api.github.com/repos/ncer/code-and-magick/comments{/number}","issue_comment_url":"https://api.github.com/repos/ncer/code-and-magick/issues/comments{/number}","contents_url":"https://api.github.com/repos/ncer/code-and-magick/contents/{+path}","compare_url":"https://api.github.com/repos/ncer/code-and-magick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ncer/code-and-magick/merges","archive_url":"https://api.github.com/repos/ncer/code-and-magick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ncer/code-and-magick/downloads","issues_url":"https://api.github.com/repos/ncer/code-and-magick/issues{/number}","pulls_url":"https://api.github.com/repos/ncer/code-and-magick/pulls{/number}","milestones_url":"https://api.github.com/repos/ncer/code-and-magick/milestones{/number}","notifications_url":"https://api.github.com/repos/ncer/code-and-magick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ncer/code-and-magick/labels{/name}","releases_url":"https://api.github.com/repos/ncer/code-and-magick/releases{/id}","deployments_url":"https://api.github.com/repos/ncer/code-and-magick/deployments","created_at":"2016-01-21T19:17:53Z","updated_at":"2016-01-24T18:16:03Z","pushed_at":"2016-01-31T20:13:55Z","git_url":"git://github.com/ncer/code-and-magick.git","ssh_url":"git@github.com:ncer/code-and-magick.git","clone_url":"https://github.com/ncer/code-and-magick.git","svn_url":"https://github.com/ncer/code-and-magick","homepage":null,"size":1053,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"htmlacademy-javascript:master","ref":"master","sha":"adb0aa5d5b2c6a0a3fe03a66a7a15e6fe084c385","user":{"login":"htmlacademy-javascript","id":14179712,"avatar_url":"https://avatars.githubusercontent.com/u/14179712?v=3","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-javascript","html_url":"https://github.com/htmlacademy-javascript","followers_url":"https://api.github.com/users/htmlacademy-javascript/followers","following_url":"https://api.github.com/users/htmlacademy-javascript/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-javascript/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-javascript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-javascript/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-javascript/orgs","repos_url":"https://api.github.com/users/htmlacademy-javascript/repos","events_url":"https://api.github.com/users/htmlacademy-javascript/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-javascript/received_events","type":"Organization","site_admin":false},"repo":{"id":50060357,"name":"17257-code-and-magick","full_name":"htmlacademy-javascript/17257-code-and-magick","owner":{"login":"htmlacademy-javascript","id":14179712,"avatar_url":"https://avatars.githubusercontent.com/u/14179712?v=3","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-javascript","html_url":"https://github.com/htmlacademy-javascript","followers_url":"https://api.github.com/users/htmlacademy-javascript/followers","following_url":"https://api.github.com/users/htmlacademy-javascript/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-javascript/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-javascript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-javascript/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-javascript/orgs","repos_url":"https://api.github.com/users/htmlacademy-javascript/repos","events_url":"https://api.github.com/users/htmlacademy-javascript/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-javascript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/htmlacademy-javascript/17257-code-and-magick","description":"Павел Захаров","fork":false,"url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick","forks_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/forks","keys_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/teams","hooks_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/hooks","issue_events_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/issues/events{/number}","events_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/events","assignees_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/assignees{/user}","branches_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/branches{/branch}","tags_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/tags","blobs_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/git/refs{/sha}","trees_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/statuses/{sha}","languages_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/languages","stargazers_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/stargazers","contributors_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/contributors","subscribers_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/subscribers","subscription_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/subscription","commits_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/commits{/sha}","git_commits_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/git/commits{/sha}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/comments{/number}","issue_comment_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/issues/comments{/number}","contents_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/contents/{+path}","compare_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/merges","archive_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/downloads","issues_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/issues{/number}","pulls_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls{/number}","milestones_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/milestones{/number}","notifications_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/labels{/name}","releases_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/releases{/id}","deployments_url":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/deployments","created_at":"2016-01-20T21:08:31Z","updated_at":"2016-01-21T21:30:49Z","pushed_at":"2016-01-31T20:14:51Z","git_url":"git://github.com/htmlacademy-javascript/17257-code-and-magick.git","ssh_url":"git@github.com:htmlacademy-javascript/17257-code-and-magick.git","clone_url":"https://github.com/htmlacademy-javascript/17257-code-and-magick.git","svn_url":"https://github.com/htmlacademy-javascript/17257-code-and-magick","homepage":"https://github.com/ncer/17257-code-and-magick","size":1054,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/3"},"html":{"href":"https://github.com/htmlacademy-javascript/17257-code-and-magick/pull/3"},"issue":{"href":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/issues/3"},"comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/htmlacademy-javascript/17257-code-and-magick/statuses/13078317b0f7aadfcb7d1612c2832523412d28c9"}}}}