shapeGroup.setBounds(300, 300, 300, 300); shapeGroup.setOrigin(50, 75); shapeGroup.setTouchable(Touchable.childrenOnly); shapeGroup.addActor(shapeActor); stage.addActor(shapeGroup);
@Override public Group widgetChildrenParse(CocoCreatorUIEditor editor, ObjectData widget, Group parent, Actor actor) { Group group = super.widgetChildrenParse(editor, widget, parent, actor); group.setTouchable(Touchable.enabled); return group; } }
@Override public boolean act(float delta) { if (actionNext != null) { setScreen(nextScreen); nextScreen.getStage().addAction(actionNext); nextScreen.getStage().getRoot() .setTouchable(Touchable.enabled); isDisposeScreen = disposeScreen; } else { setScreen(nextScreen); nextScreen.getStage().getRoot() .setTouchable(Touchable.enabled); isDisposeScreen = disposeScreen; } return true; } }));
public StagePref(VGame game) { super(game); bg = game.getImage(game.WIDTH, game.HEIGHT, Color.BLACK).getActor(); bg.setTouchable(Touchable.disabled); addActor(bg); getRoot().setTouchable(Touchable.disabled); }
final Action actionNext, final boolean disposeScreen) { currentScreen.getStage().getRoot().setTouchable(Touchable.disabled); nextScreen.getStage().getRoot().setTouchable(Touchable.disabled); if (actionNext != null) { setScreen(nextScreen); nextScreen.getStage().getRoot().setTouchable(Touchable.enabled); nextScreen.getStage().addAction(actionNext); isDisposeScreen = disposeScreen; } else { setScreen(nextScreen); nextScreen.getStage().getRoot().setTouchable(Touchable.enabled); isDisposeScreen = disposeScreen;
/** * 移除所有Dialog */ public void removeAllDialog() { // 遍历获取顶层所有对话框对象 Array<VDialog> dialogs = new Array<VDialog>(); for (Actor actor : stageTop.getActors()) { if (actor instanceof VDialog) { setNativeTextFieldsHidden((VDialog)actor,true); dialogs.add((VDialog) actor); } } for(VDialog dialog:dialogs){ dialog.remove(); } stage.getRoot().setTouchable(Touchable.enabled); stage.resume(); setNativeTextFieldsHidden(stage.getRoot(),false); }
/** * 显示dialog并禁止下层响应 * * @param dialog * @return */ public <T> VDialog showDialog(Class<T> dialog) { // 禁止其他dialog响应 for (VDialog dia : poolDialog.values()) { dia.pause(); dia.setTouchable(Touchable.disabled); setNativeTextFieldsHidden(dia,true); } // 禁止底层stage响应 if (stage != null) { stage.pause(); stage.getRoot().setTouchable(Touchable.disabled); setNativeTextFieldsHidden(stage.getRoot(),true); } VDialog dia = getDialog(dialog); dia.setTouchable(Touchable.enabled); stageTop.addActor(dia); setNativeTextFieldsHidden(dia,false); dia.show(); return dia; }
/** * 移除dialog并恢复下层响应 */ public void removeDialog(VDialog dialog) { setNativeTextFieldsHidden(dialog,true); dialog.remove(); // 遍历获取顶层所有对话框对象 Array<VDialog> dialogs = new Array<VDialog>(); for (Actor actor : stageTop.getActors()) { if (actor instanceof VDialog) { dialogs.add((VDialog) actor); } } if (dialogs.size > 0) { VDialog nowDialog=dialogs.peek(); nowDialog.setTouchable(Touchable.enabled); nowDialog.resume(); setNativeTextFieldsHidden(nowDialog,false); } else { stage.getRoot().setTouchable(Touchable.enabled); stage.resume(); setNativeTextFieldsHidden(stage.getRoot(),false); } }
/** * 移除顶层dialog */ public void removeTopDialog() { // 遍历获取顶层所有对话框对象 Array<VDialog> dialogs = new Array<VDialog>(); for (Actor actor : stageTop.getActors()) { if (actor instanceof VDialog) { dialogs.add((VDialog) actor); } } VDialog dialog=dialogs.pop(); setNativeTextFieldsHidden(dialog,true); dialog.remove(); if (dialogs.size > 0) { VDialog nowDialog=dialogs.peek(); nowDialog.setTouchable(Touchable.enabled); nowDialog.resume(); setNativeTextFieldsHidden(nowDialog,false); } else { stage.getRoot().setTouchable(Touchable.enabled); stage.resume(); setNativeTextFieldsHidden(stage.getRoot(),false); } }