Search in sources :

Example 1 with MultimeterState_MF47

use of com.cas.circuit.state.MultimeterState_MF47 in project TeachingInSimulation by ScOrPiOzzy.

the class ConnectionController method multimeterClick.

// private void setMouseVisible(boolean visible) {
// //		鼠标显示或隐藏
// SimpleApplication app = Dispatcher.getIns().getMainApp();
// InputManager inputManager = app.getInputManager();
// app.getFlyByCamera().setEnabled(!visible);
// app.getStateManager().getState(AimPointState.class).setVisible(!visible);
// inputManager.setCursorVisible(visible);
// }
public void multimeterClick() {
    SimpleApplication app = Dispatcher.getIns().getMainApp();
    MultimeterState_MF47 multimeterState = app.getStateManager().getState(MultimeterState_MF47.class);
    if (multimeterState != null) {
        multimeterState.setEnabled(!multimeterState.isEnabled());
    }
}
Also used : MultimeterState_MF47(com.cas.circuit.state.MultimeterState_MF47) SimpleApplication(com.jme3.app.SimpleApplication)

Example 2 with MultimeterState_MF47

use of com.cas.circuit.state.MultimeterState_MF47 in project TeachingInSimulation by ScOrPiOzzy.

the class LinkTargetHandler method select.

public void select() {
    MultimeterState_MF47 multimeterState = stateManager.getState(MultimeterState_MF47.class);
    if (multimeterState.isEnabled() && target instanceof Terminal) {
        multimeterState.putPenToTerminal((Terminal) target, target.getModel());
        return;
    }
    if (!handler.checkConnect(target)) {
        return;
    }
    LinkerMsg reqMsg = handler.offlineConnect(target);
    // 如果当前为多人联机模式则向服务器发送连线请求
    if (!handler.isAlone()) {
        reqMsg.setType(LinkerMsg.ADD_LINKER);
        ClientMgr.send(reqMsg);
    }
    if (!(target instanceof Terminal)) {
        return;
    }
    // 螺丝拧上拧下
    Node parent = (Node) target.getModel();
    // findCylinder(parent);
    final Spatial luosi = parent.getChild("screw");
    if (luosi == null) {
        throw new RuntimeException("螺丝的模型结构有问题, 没有指出螺杆节点");
    }
    if (luosi.getNumControls() > 0) {
        AbstractControl control = (AbstractControl) luosi.getControl(0);
        control.setEnabled(true);
    }
}
Also used : Spatial(com.jme3.scene.Spatial) MultimeterState_MF47(com.cas.circuit.state.MultimeterState_MF47) Node(com.jme3.scene.Node) AbstractControl(com.jme3.scene.control.AbstractControl) Terminal(com.cas.circuit.vo.Terminal) LinkerMsg(com.cas.circuit.msg.LinkerMsg)

Aggregations

MultimeterState_MF47 (com.cas.circuit.state.MultimeterState_MF47)2 LinkerMsg (com.cas.circuit.msg.LinkerMsg)1 Terminal (com.cas.circuit.vo.Terminal)1 SimpleApplication (com.jme3.app.SimpleApplication)1 Node (com.jme3.scene.Node)1 Spatial (com.jme3.scene.Spatial)1 AbstractControl (com.jme3.scene.control.AbstractControl)1