Commit 5bcec6f2 authored by 李维's avatar 李维

添加点击按钮区域外可隐藏按钮功能

parent 757d6bf5
This diff is collapsed.
......@@ -183,6 +183,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
showCloseBtn: Function = null;
initActionButton() {
const canvas = cc.find("Canvas");
const actionBtnMaskBg = cc.find("Canvas/ActionBtnMaskBg");
const actionBtnContainer = cc.find("Canvas/ActionBtn");
const defaultBtn = cc.find("btn_default", actionBtnContainer)
const submitBtn = cc.find("btn_submit_new", actionBtnContainer)
......@@ -226,6 +227,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
const showSubmitBtn = () => {
submitBtn.opacity = 0;
submitBtn.active = true;
// 启用透明背景,点击按钮区域外 按钮收回
actionBtnMaskBg.active = true;
cc.tween(actionBtnContainer).to(0.1, {y: topY, scale: 1}).start();
cc.tween(submitBtn).to(0.1, {opacity: 255}).start();
cc.tween(defaultBtn).to(0.1, {opacity: 0}).call(()=>{
......@@ -236,6 +239,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
const showReplayBtn = () => {
replayBtn.opacity = 0;
replayBtn.active = true;
// 启用透明背景,点击按钮区域外 按钮收回
actionBtnMaskBg.active = true;
cc.tween(actionBtnContainer).to(0.1, {y: topY, scale: 1}).start();
cc.tween(replayBtn).to(0.1, {opacity: 255}).start();
cc.tween(defaultBtn).to(0.1, {opacity: 0}).call(()=>{
......@@ -263,6 +268,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
// }).start();
}
actionBtnMaskBg.on("click", ()=>{
showDefaultBtn();
actionBtnMaskBg.active = false;
})
defaultBtn.on("click", ()=>{
if(this.submitted) {
showReplayBtn()
......@@ -273,6 +283,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
submitBtn.on("click", async ()=>{
// await showDefaultBtn();
// 隐藏掉背景 保持返回按钮一直显示
actionBtnMaskBg.active = false;
this.submit();
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment