{"action":"created","comment":{"url":"https://api.github.com/repos/cocos-creator/engine/pulls/comments/148703550","pull_request_review_id":73989077,"id":148703550,"diff_hunk":"@@ -0,0 +1,146 @@\n+/****************************************************************************\n+ Copyright (c) 2013-2016 Chukong Technologies Inc.\n+\n+ http://www.cocos.com\n+\n+ Permission is hereby granted, free of charge, to any person obtaining a copy\n+ of this software and associated engine source code (the \"Software\"), a limited,\n+  worldwide, royalty-free, non-assignable, revocable and  non-exclusive license\n+ to use Cocos Creator solely to develop games on your target platforms. You shall\n+  not use Cocos Creator software for developing other software or tools that's\n+  used for developing games. You are not granted to publish, distribute,\n+  sublicense, and/or sell copies of Cocos Creator.\n+\n+ The software or tools in this License Agreement are licensed, not sold.\n+ Chukong Aipu reserves all rights not expressly granted to you.\n+\n+ THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ THE SOFTWARE.\n+ ****************************************************************************/\n+\n+/**\n+ * !#en ToggleContainer is not a visiable UI component but a way to modify the behavior of a set of Toggles. </br>\n+ * Toggles that belong to the same group could only have one of them to be switched on at a time.</br>\n+ * Note: All the first layer child node containing the toggle component will auto be added to the container\n+ * !#zh ToggleContainer 不是一个可见的 UI 组件，它可以用来修改一组 Toggle 组件的行为。</br>\n+ * 当一组 Toggle 属于同一个 ToggleContainer 的时候，任何时候只能有一个 Toggle 处于选中状态。</br>\n+ * 注意：所有包含 Toggle 组件的一级子节点都会自动被添加到该容器中\n+ * @class ToggleContainer\n+ * @extends Component\n+ */\n+var ToggleContainer = cc.Class({\n+    name: 'cc.ToggleContainer',\n+    extends: cc.Component,\n+    editor: CC_EDITOR && {\n+        menu: 'i18n:MAIN_MENU.component.ui/ToggleContainer',\n+        help: 'i18n:COMPONENT.help_url.toggleContainer',\n+        executeInEditMode: true\n+    },\n+\n+    properties: {\n+        /**\n+         * !#en If this setting is true, a toggle could be switched off and on when pressed.\n+         * If it is false, it will make sure there is always only one toggle could be switched on\n+         * and the already switched on toggle can't be switched off.\n+         * !#zh 如果这个设置为 true， 那么 toggle 按钮在被点击的时候可以反复地被选中和未选中。\n+         * @property {Boolean} allowSwitchOff\n+         */\n+        allowSwitchOff: {\n+            tooltip: CC_DEV && 'i18n:COMPONENT.toggle_group.allowSwitchOff',\n+            default: false\n+        },\n+\n+        /**\n+         * !#en Read only property, return the toggle items array reference managed by ToggleContainer.\n+         * !#zh 只读属性，返回 ToggleContainer 管理的 toggle 数组引用\n+         * @property {Array} toggleItems\n+         */\n+        toggleItems: {\n+            get: function () {\n+                return this.node.getComponentsInChildren(cc.Toggle);\n+            }\n+        }\n+    },\n+\n+    updateToggles: function (toggle) {\n+        if(!this.enabledInHierarchy) return;\n+\n+        this.toggleItems.forEach(function (item){\n+            if(toggle.isChecked) {\n+                if (item !== toggle && item.isChecked && item.enabled) {","path":"cocos2d/core/components/CCToggleContainer.js","position":75,"original_position":75,"commit_id":"30d372e6632b3bbc2cf48771f6fb45f53e32f32a","original_commit_id":"30d372e6632b3bbc2cf48771f6fb45f53e32f32a","user":{"login":"jareguo","id":1503156,"avatar_url":"https://avatars3.githubusercontent.com/u/1503156?v=4","gravatar_id":"","url":"https://api.github.com/users/jareguo","html_url":"https://github.com/jareguo","followers_url":"https://api.github.com/users/jareguo/followers","following_url":"https://api.github.com/users/jareguo/following{/other_user}","gists_url":"https://api.github.com/users/jareguo/gists{/gist_id}","starred_url":"https://api.github.com/users/jareguo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jareguo/subscriptions","organizations_url":"https://api.github.com/users/jareguo/orgs","repos_url":"https://api.github.com/users/jareguo/repos","events_url":"https://api.github.com/users/jareguo/events{/privacy}","received_events_url":"https://api.github.com/users/jareguo/received_events","type":"User","site_admin":false},"body":"应该不论是否 enabled，isChecked 都要去掉吧？","created_at":"2017-11-03T02:52:09Z","updated_at":"2017-11-03T02:52:09Z","html_url":"https://github.com/cocos-creator/engine/pull/2091#discussion_r148703550","pull_request_url":"https://api.github.com/repos/cocos-creator/engine/pulls/2091","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/cocos-creator/engine/pulls/comments/148703550"},"html":{"href":"https://github.com/cocos-creator/engine/pull/2091#discussion_r148703550"},"pull_request":{"href":"https://api.github.com/repos/cocos-creator/engine/pulls/2091"}}},"pull_request":{"url":"https://api.github.com/repos/cocos-creator/engine/pulls/2091","id":150231305,"html_url":"https://github.com/cocos-creator/engine/pull/2091","diff_url":"https://github.com/cocos-creator/engine/pull/2091.diff","patch_url":"https://github.com/cocos-creator/engine/pull/2091.patch","issue_url":"https://api.github.com/repos/cocos-creator/engine/issues/2091","number":2091,"state":"open","locked":false,"title":"restore toggleGroup code and add CCToggleContainer","user":{"login":"knoxHuang","id":7564028,"avatar_url":"https://avatars2.githubusercontent.com/u/7564028?v=4","gravatar_id":"","url":"https://api.github.com/users/knoxHuang","html_url":"https://github.com/knoxHuang","followers_url":"https://api.github.com/users/knoxHuang/followers","following_url":"https://api.github.com/users/knoxHuang/following{/other_user}","gists_url":"https://api.github.com/users/knoxHuang/gists{/gist_id}","starred_url":"https://api.github.com/users/knoxHuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knoxHuang/subscriptions","organizations_url":"https://api.github.com/users/knoxHuang/orgs","repos_url":"https://api.github.com/users/knoxHuang/repos","events_url":"https://api.github.com/users/knoxHuang/events{/privacy}","received_events_url":"https://api.github.com/users/knoxHuang/received_events","type":"User","site_admin":false},"body":"Re: cocos-creator/fireball#5728\r\n\r\nChanges proposed in this pull request:\r\n * 还原原来的 ToggleGroup\r\n * 添加新的 CCToggleContainer\r\n\r\n@cocos-creator/engine-admins\r\n","created_at":"2017-11-02T08:40:53Z","updated_at":"2017-11-03T02:52:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e81184353dd4c81bac72894bdc5f74320be8ad5","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/cocos-creator/engine/pulls/2091/commits","review_comments_url":"https://api.github.com/repos/cocos-creator/engine/pulls/2091/comments","review_comment_url":"https://api.github.com/repos/cocos-creator/engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cocos-creator/engine/issues/2091/comments","statuses_url":"https://api.github.com/repos/cocos-creator/engine/statuses/30d372e6632b3bbc2cf48771f6fb45f53e32f32a","head":{"label":"knoxHuang:v1.7","ref":"v1.7","sha":"30d372e6632b3bbc2cf48771f6fb45f53e32f32a","user":{"login":"knoxHuang","id":7564028,"avatar_url":"https://avatars2.githubusercontent.com/u/7564028?v=4","gravatar_id":"","url":"https://api.github.com/users/knoxHuang","html_url":"https://github.com/knoxHuang","followers_url":"https://api.github.com/users/knoxHuang/followers","following_url":"https://api.github.com/users/knoxHuang/following{/other_user}","gists_url":"https://api.github.com/users/knoxHuang/gists{/gist_id}","starred_url":"https://api.github.com/users/knoxHuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knoxHuang/subscriptions","organizations_url":"https://api.github.com/users/knoxHuang/orgs","repos_url":"https://api.github.com/users/knoxHuang/repos","events_url":"https://api.github.com/users/knoxHuang/events{/privacy}","received_events_url":"https://api.github.com/users/knoxHuang/received_events","type":"User","site_admin":false},"repo":{"id":54607474,"name":"engine-2","full_name":"knoxHuang/engine-2","owner":{"login":"knoxHuang","id":7564028,"avatar_url":"https://avatars2.githubusercontent.com/u/7564028?v=4","gravatar_id":"","url":"https://api.github.com/users/knoxHuang","html_url":"https://github.com/knoxHuang","followers_url":"https://api.github.com/users/knoxHuang/followers","following_url":"https://api.github.com/users/knoxHuang/following{/other_user}","gists_url":"https://api.github.com/users/knoxHuang/gists{/gist_id}","starred_url":"https://api.github.com/users/knoxHuang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knoxHuang/subscriptions","organizations_url":"https://api.github.com/users/knoxHuang/orgs","repos_url":"https://api.github.com/users/knoxHuang/repos","events_url":"https://api.github.com/users/knoxHuang/events{/privacy}","received_events_url":"https://api.github.com/users/knoxHuang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/knoxHuang/engine-2","description":"New integrated engine to replace cocos2d-html5","fork":true,"url":"https://api.github.com/repos/knoxHuang/engine-2","forks_url":"https://api.github.com/repos/knoxHuang/engine-2/forks","keys_url":"https://api.github.com/repos/knoxHuang/engine-2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/knoxHuang/engine-2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/knoxHuang/engine-2/teams","hooks_url":"https://api.github.com/repos/knoxHuang/engine-2/hooks","issue_events_url":"https://api.github.com/repos/knoxHuang/engine-2/issues/events{/number}","events_url":"https://api.github.com/repos/knoxHuang/engine-2/events","assignees_url":"https://api.github.com/repos/knoxHuang/engine-2/assignees{/user}","branches_url":"https://api.github.com/repos/knoxHuang/engine-2/branches{/branch}","tags_url":"https://api.github.com/repos/knoxHuang/engine-2/tags","blobs_url":"https://api.github.com/repos/knoxHuang/engine-2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/knoxHuang/engine-2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/knoxHuang/engine-2/git/refs{/sha}","trees_url":"https://api.github.com/repos/knoxHuang/engine-2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/knoxHuang/engine-2/statuses/{sha}","languages_url":"https://api.github.com/repos/knoxHuang/engine-2/languages","stargazers_url":"https://api.github.com/repos/knoxHuang/engine-2/stargazers","contributors_url":"https://api.github.com/repos/knoxHuang/engine-2/contributors","subscribers_url":"https://api.github.com/repos/knoxHuang/engine-2/subscribers","subscription_url":"https://api.github.com/repos/knoxHuang/engine-2/subscription","commits_url":"https://api.github.com/repos/knoxHuang/engine-2/commits{/sha}","git_commits_url":"https://api.github.com/repos/knoxHuang/engine-2/git/commits{/sha}","comments_url":"https://api.github.com/repos/knoxHuang/engine-2/comments{/number}","issue_comment_url":"https://api.github.com/repos/knoxHuang/engine-2/issues/comments{/number}","contents_url":"https://api.github.com/repos/knoxHuang/engine-2/contents/{+path}","compare_url":"https://api.github.com/repos/knoxHuang/engine-2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/knoxHuang/engine-2/merges","archive_url":"https://api.github.com/repos/knoxHuang/engine-2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/knoxHuang/engine-2/downloads","issues_url":"https://api.github.com/repos/knoxHuang/engine-2/issues{/number}","pulls_url":"https://api.github.com/repos/knoxHuang/engine-2/pulls{/number}","milestones_url":"https://api.github.com/repos/knoxHuang/engine-2/milestones{/number}","notifications_url":"https://api.github.com/repos/knoxHuang/engine-2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/knoxHuang/engine-2/labels{/name}","releases_url":"https://api.github.com/repos/knoxHuang/engine-2/releases{/id}","deployments_url":"https://api.github.com/repos/knoxHuang/engine-2/deployments","created_at":"2016-03-24T02:09:50Z","updated_at":"2016-03-24T02:09:54Z","pushed_at":"2017-11-03T02:28:55Z","git_url":"git://github.com/knoxHuang/engine-2.git","ssh_url":"git@github.com:knoxHuang/engine-2.git","clone_url":"https://github.com/knoxHuang/engine-2.git","svn_url":"https://github.com/knoxHuang/engine-2","homepage":null,"size":28482,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cocos-creator:v1.7","ref":"v1.7","sha":"234220fbcbb74333e7bcdc5aa3945b1c0cbc87c4","user":{"login":"cocos-creator","id":6937061,"avatar_url":"https://avatars3.githubusercontent.com/u/6937061?v=4","gravatar_id":"","url":"https://api.github.com/users/cocos-creator","html_url":"https://github.com/cocos-creator","followers_url":"https://api.github.com/users/cocos-creator/followers","following_url":"https://api.github.com/users/cocos-creator/following{/other_user}","gists_url":"https://api.github.com/users/cocos-creator/gists{/gist_id}","starred_url":"https://api.github.com/users/cocos-creator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocos-creator/subscriptions","organizations_url":"https://api.github.com/users/cocos-creator/orgs","repos_url":"https://api.github.com/users/cocos-creator/repos","events_url":"https://api.github.com/users/cocos-creator/events{/privacy}","received_events_url":"https://api.github.com/users/cocos-creator/received_events","type":"Organization","site_admin":false},"repo":{"id":47440536,"name":"engine","full_name":"cocos-creator/engine","owner":{"login":"cocos-creator","id":6937061,"avatar_url":"https://avatars3.githubusercontent.com/u/6937061?v=4","gravatar_id":"","url":"https://api.github.com/users/cocos-creator","html_url":"https://github.com/cocos-creator","followers_url":"https://api.github.com/users/cocos-creator/followers","following_url":"https://api.github.com/users/cocos-creator/following{/other_user}","gists_url":"https://api.github.com/users/cocos-creator/gists{/gist_id}","starred_url":"https://api.github.com/users/cocos-creator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cocos-creator/subscriptions","organizations_url":"https://api.github.com/users/cocos-creator/orgs","repos_url":"https://api.github.com/users/cocos-creator/repos","events_url":"https://api.github.com/users/cocos-creator/events{/privacy}","received_events_url":"https://api.github.com/users/cocos-creator/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cocos-creator/engine","description":"The engine for Cocos Creator","fork":false,"url":"https://api.github.com/repos/cocos-creator/engine","forks_url":"https://api.github.com/repos/cocos-creator/engine/forks","keys_url":"https://api.github.com/repos/cocos-creator/engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cocos-creator/engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cocos-creator/engine/teams","hooks_url":"https://api.github.com/repos/cocos-creator/engine/hooks","issue_events_url":"https://api.github.com/repos/cocos-creator/engine/issues/events{/number}","events_url":"https://api.github.com/repos/cocos-creator/engine/events","assignees_url":"https://api.github.com/repos/cocos-creator/engine/assignees{/user}","branches_url":"https://api.github.com/repos/cocos-creator/engine/branches{/branch}","tags_url":"https://api.github.com/repos/cocos-creator/engine/tags","blobs_url":"https://api.github.com/repos/cocos-creator/engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cocos-creator/engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cocos-creator/engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/cocos-creator/engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cocos-creator/engine/statuses/{sha}","languages_url":"https://api.github.com/repos/cocos-creator/engine/languages","stargazers_url":"https://api.github.com/repos/cocos-creator/engine/stargazers","contributors_url":"https://api.github.com/repos/cocos-creator/engine/contributors","subscribers_url":"https://api.github.com/repos/cocos-creator/engine/subscribers","subscription_url":"https://api.github.com/repos/cocos-creator/engine/subscription","commits_url":"https://api.github.com/repos/cocos-creator/engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/cocos-creator/engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/cocos-creator/engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/cocos-creator/engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/cocos-creator/engine/contents/{+path}","compare_url":"https://api.github.com/repos/cocos-creator/engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cocos-creator/engine/merges","archive_url":"https://api.github.com/repos/cocos-creator/engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cocos-creator/engine/downloads","issues_url":"https://api.github.com/repos/cocos-creator/engine/issues{/number}","pulls_url":"https://api.github.com/repos/cocos-creator/engine/pulls{/number}","milestones_url":"https://api.github.com/repos/cocos-creator/engine/milestones{/number}","notifications_url":"https://api.github.com/repos/cocos-creator/engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cocos-creator/engine/labels{/name}","releases_url":"https://api.github.com/repos/cocos-creator/engine/releases{/id}","deployments_url":"https://api.github.com/repos/cocos-creator/engine/deployments","created_at":"2015-12-05T03:28:59Z","updated_at":"2017-10-31T04:08:42Z","pushed_at":"2017-11-03T02:28:56Z","git_url":"git://github.com/cocos-creator/engine.git","ssh_url":"git@github.com:cocos-creator/engine.git","clone_url":"https://github.com/cocos-creator/engine.git","svn_url":"https://github.com/cocos-creator/engine","homepage":"http://www.cocos2d-x.org/creator","size":29629,"stargazers_count":312,"watchers_count":312,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":220,"mirror_url":null,"archived":false,"open_issues_count":66,"forks":220,"open_issues":66,"watchers":312,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cocos-creator/engine/pulls/2091"},"html":{"href":"https://github.com/cocos-creator/engine/pull/2091"},"issue":{"href":"https://api.github.com/repos/cocos-creator/engine/issues/2091"},"comments":{"href":"https://api.github.com/repos/cocos-creator/engine/issues/2091/comments"},"review_comments":{"href":"https://api.github.com/repos/cocos-creator/engine/pulls/2091/comments"},"review_comment":{"href":"https://api.github.com/repos/cocos-creator/engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cocos-creator/engine/pulls/2091/commits"},"statuses":{"href":"https://api.github.com/repos/cocos-creator/engine/statuses/30d372e6632b3bbc2cf48771f6fb45f53e32f32a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jareguo"}}