public Actor pref() { return getRoot().getChildren().peek(); }
String javaStr = fileHandle.readString(); String[] javaStrLines = javaStr.split("\n");//Ѵ밴кŴŽ for (final Actor actor : stage.getRoot().getChildren()) { Data data = allDatas.get(actor); if (data == null) return;
/** * 移除所有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); }
public void resize(float width, float height) { changing(width, height); getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); if (isStretching) {//拉伸适配的时候,计算一下iphoneX的安全边距 calculationCuts(); calculationAafeArea(1, 1); return; } float bl = getWidth() / getHeight() * Gdx.graphics.getHeight() / Gdx.graphics.getWidth(); if (bl < 1) { cutWidth = (1 - bl) * getWidth() / 2f; cutHeight = 0; getRoot().setScale(bl, 1); getRoot().setPosition(cutWidth, 0); cutWidth = cutWidth / getRoot().getScaleX(); calculationAafeArea(bl, 1); } else if (bl >= 1) { cutWidth = 0; cutHeight = (1 - 1 / bl) * getHeight() / 2f; getRoot().setScale(1, 1 / bl); getRoot().setPosition(0, cutHeight); cutHeight = cutHeight / getRoot().getScaleY(); calculationAafeArea(1, bl); } calculationCuts(); }
public VDialog(VGame game, boolean isStretching) { this.isStretching = isStretching; this.game = game; stageTop = game.getTopStage(); //在有内置虚拟按钮的安卓上会出现屏幕分辨率被改变的状况造成遮盖层无法完全覆盖底层,故强制放大1.5倍解决这个问题 bg0 = game.getImage(stageTop.getFullWidth()*1.5f, stageTop.getFullHeight()*1.5f, Color.BLACK) .setPosition(game.getCenterX(), game.getCenterY(), Align.center).getActor(); if (isStretching) { setScale(1f / stageTop.getRoot().getScaleX(), 1f / stageTop.getRoot().getScaleY()); } addBackgroundAcition(); }
protected Matrix4 computeTransform() { Affine2 worldTransform = this.worldTransform; Group root = getRoot(); worldTransform.setToTrnRotScl(root.getX(), root.getY(), 0, root.getScaleX(), root.getScaleY()); computedTransform.set(worldTransform); return computedTransform; } }
/** * 显示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); } }
public void drawBackground() { if (bgList.size() != 0) { Batch batch = getBatch(); batch.begin(); batch.setColor(1, 1, 1, 1); for (Actor bg : bgList) { float prefx = bg.getX(); float prefy = bg.getY(); bg.setPosition(getWidth() / 2, getHeight() / 2, Align.center); bg.draw(batch, getRoot().getColor().a); bg.setPosition(prefx, prefy); } batch.end(); } }
if (getRoot().getTouchable() == Touchable.enabled) { back();