/// <summary> /// 唤醒代码 /// </summary> /// <param name="hasFocus">If set to <c>true</c> has focus.</param> void onApplicationFocus(bool hasFocus) { if (hasFocus) { int BluetoothConnect = AndroidConnection.Instance.Call <int> ("unityBTConnected", 0); if (BluetoothConnect == 0) { AirInput.unConnected(0); } else { AirInput.connected(0); } BluetoothConnect = AndroidConnection.Instance.Call <int> ("unityBTConnected", 1); if (BluetoothConnect == 0) { AirInput.unConnected(1); } else { AirInput.connected(1); } } }
void update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (!AirInput.escapeDown()) { ShadowSystem.Quit(); } } if (target != null) { //持续按鼠标 // SCInput.MousePosition = getMousePosition(); drag(); return; } get3Dof(); // if (_enableAcc) { // float[] array = AndroidConnection.Instance.Call<float[]> ("unityACCMatrix"); // if (array == null) { // return; // } // // AirInput.BluetoothHandleAcc = new Vector3 (array [0], array [1], array [2]); // Debug.Log ("wjh.BluetoothHandleAcc====>" + AirInput.BluetoothHandleAcc.ToString ()); // } }
public void onConnectionStateChange(int index, int state) { if (state == 0) { //蓝牙手柄从链接到断开 AirInput.unConnected(index); } else if (state == 1) { //蓝牙手柄从断开到链接 AirInput.connected(index); } }
void onKeyEventChanged(int keycode, int keyevent, int deviceId) { AirInput.controllerClick(keycode, keyevent, deviceId); if (keycode == 16) { if (keyevent == 0) { this.begin(deviceId); } else { this.end(deviceId); } } }