Beispiel #1
0
 protected override void CustomNodeListNode()
 {
     if (TypeInfos != null)
     {
         BTType type = EditorUI.DrawSelectBtnGuid <BTType>(ref TypeInfos, TypeW, TypeH);
     }
 }
 ///API-No.160
 /// <summary>
 /// BTRight/BTLeft 碰撞信息
 /// </summary>
 /// <returns></returns>
 public static RaycastHit BTHitInfo(BTType type = BTType.Right)
 {
     if (BTPointerEventData(type) != null)
     {
         return(BTPointerEventData(type).hitinfo);
     }
     return(new RaycastHit());
 }
 ///API-No.161
 /// <summary>
 /// BTRight/BTLeft 拖拽的物体
 /// </summary>
 public static GameObject BTDragTarget(BTType type = BTType.Right)
 {
     if (BTPointerEventData(type) != null)
     {
         return(BTPointerEventData(type).pointerDrag);
     }
     return(null);
 }
 ///API-No.160
 /// <summary>
 /// BTRight/BTLeft 碰撞信息
 /// </summary>
 /// <returns></returns>
 public static RaycastResult BTHitInfo(BTType type = BTType.Right)
 {
     if (BTPointerEventData(type) != null)
     {
         return(BTPointerEventData(type).pointerCurrentRaycast);
     }
     return(new RaycastResult());
 }
 ///API-No.159
 /// <summary>
 /// BTRight/BTLeft 碰撞到Collider,若不为null,可以通过BTHitInfo获取碰撞信息,
 /// </summary>
 /// <param name="type">右手柄 BTRight /  左手柄 BTLeft</param>
 /// <returns></returns>
 public static GameObject BTHitTarget(BTType type = BTType.Right)
 {
     if (BTPointerEventData(type) != null)
     {
         return(BTPointerEventData(type).pointerCurrentRaycast.gameObject);
     }
     return(null);
 }
 ///API-No.168
 /// <summary>
 /// BTRight/BTLeft设置可见光束的长度 默认3米
 /// </summary>
 /// <param name="distance">单位米</param>
 public static void SetBTEndPointerDistance(float distance, BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         BTRight.inputDeviceTargetDetecterBase.MaxEndPointRange = distance;
     }
     else if (BTLeft && type == BTType.Left)
     {
         BTLeft.inputDeviceTargetDetecterBase.MaxEndPointRange = distance;
     }
 }
 ///API-No.172
 /// <summary>
 /// 关闭BTRight/BTLeft
 /// </summary>
 /// <param name="type"></param>
 public static void DisableBT(BTType type = BTType.Right)
 {
     if (BTDevice && type == BTType.Right)
     {
         BTDevice.OneGCActive = false;
     }
     else if (BTDevice && type == BTType.Left)
     {
         BTDevice.TwoGCActive = false;
     }
 }
 ///API-No.168
 /// <summary>
 /// BTRight/BTLeft设置可见光束的长度 默认3米
 /// </summary>
 /// <param name="distance">单位米</param>
 public static void SetBTEndPointerDistance(float distance, BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         GetBTCursor(type).DefaultDistance = distance;
     }
     else if (BTLeft && type == BTType.Left)
     {
         GetBTCursor(type).DefaultDistance = distance;
     }
 }
 ///API-No.167
 /// <summary>
 /// BTRight/BTLeft设置可检测Collider的范围半径 默认30米
 /// </summary>
 /// <param name="distance">单位米</param>
 public static void SetBTRayCastDistance(float distance, BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         BTRight.bT3DofDetector.bT3DofPointer.MaxDetectDistance = distance;
     }
     else if (BTLeft && type == BTType.Left)
     {
         BTLeft.bT3DofDetector.bT3DofPointer.MaxDetectDistance = distance;
     }
 }
 ///API-No.172
 /// <summary>
 /// 关闭BTRight/BTLeft
 /// </summary>
 /// <param name="type"></param>
 public static void DisableableBT(BTType type = BTType.Right)
 {
     if (BTDevice && type == BTType.Right)
     {
         BTDevice.OneHandShankOpen = false;
     }
     else if (BTDevice && type == BTType.Left)
     {
         BTDevice.TwoHandShankOpen = false;
     }
 }
 ///API-No.155
 /// <summary>
 /// BTRight/BTLeft 的触摸板是否触摸
 /// </summary>
 /// <param name="type">右手柄 BTRight /  左手柄 BTLeft</param>
 /// <returns>ture表示被触摸,反之</returns>
 public static bool IsBTTpTouch(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.isTpTouch);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.isTpTouch);
     }
     return(false);
 }
 ///API-No.165
 /// <summary>
 /// BTRight/BTLeft某个按键的实时状态,参考Input.GetKey
 /// </summary>
 /// <param name="inputKeyCode">具体按键,BTRight/BTLeft支持Enter/Back/Function</param>
 /// <returns></returns>
 public static InputKeyState BTKeyCurrentState(InputKeyCode inputKeyCode, BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.inputKeys.GetKeyCurrentState(inputKeyCode));
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.inputKeys.GetKeyCurrentState(inputKeyCode));
     }
     return(InputKeyState.Null);
 }
 ///API-No.163
 /// <summary>
 /// BTRight/BTLeft某个按键是否按下后松开,当前帧有效,下帧复位,参考Input.GetKeyUp
 /// </summary>
 /// <param name="inputKeyCode">具体按键,BTRight/BTLeft支持Enter/Back/Function</param>
 /// <returns></returns>
 public static bool IsBTKeyUp(InputKeyCode inputKeyCode, BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.inputKeys.GetKeyUp(inputKeyCode));
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.inputKeys.GetKeyUp(inputKeyCode));
     }
     return(false);
 }
 ///API-No.157
 /// <summary>
 /// BTRight/BTLeft 的触摸板触摸数据
 /// </summary>
 /// <param name="type">右手柄 BTRight /  左手柄 BTLeft</param>
 /// <returns></returns>
 public static string BTName(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataHandShank.blueToothName);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataHandShank.blueToothName);
     }
     return("");
 }
 ///API-No.169
 /// <summary>
 /// BTRight/BTLeft获取光束终点的Focus对象
 /// </summary>
 /// <param name="distance">单位米</param>
 public static Focus GetBTFocus(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDeviceUIBase.model.lineIndicate.focus);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDeviceUIBase.model.lineIndicate.focus);
     }
     return(null);
 }
Beispiel #16
0
 ///API-No.173
 /// <summary>
 /// 获取BTRight/BTLeft的ACC数据
 /// </summary>
 /// <param name="type"></param>
 public static int[] GetAcc(BTType type = BTType.Right)
 {
     if (BTDevice && type == BTType.Right)
     {
         return(BTRight.inputDataGetHandShank.inputDataGetHandShankIMU.GetAcc());
     }
     else if (BTDevice && type == BTType.Left)
     {
         return(BTLeft.inputDataGetHandShank.inputDataGetHandShankIMU.GetAcc());
     }
     return(temp);
 }
 ///API-No.158
 /// <summary>
 /// BTRight/BTLeft 检测到碰撞信息集合,包含碰撞到的物体,数据等
 /// </summary>
 /// <param name="type">右手柄 BTRight /  左手柄 BTLeft</param>
 /// <returns></returns>
 public static SCPointEventData BTPointerEventData(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.SCPointEventData);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.SCPointEventData);
     }
     return(null);
 }
 ///API-No.157
 /// <summary>
 /// BTRight/BTLeft 的触摸板的手柄名称
 /// </summary>
 /// <param name="type">右手柄 BTRight /  左手柄 BTLeft</param>
 /// <returns></returns>
 public static string BTName(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.GCName);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.GCName);
     }
     return("");
 }
 ///API-No.156
 /// <summary>
 /// BTRight/BTLeft 的触摸板触摸位置数据
 /// </summary>
 /// <param name="type">右手柄 BTRight /  左手柄 BTLeft</param>
 /// <returns></returns>
 public static Vector2 BTTpTouchInfo(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.tpPosition);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.tpPosition);
     }
     return(Vector2.zero);
 }
 ///API-No.170
 /// <summary>
 /// BTRight/BTLeft获取光束
 /// </summary>
 /// <param name="distance">单位米</param>
 public static LineRenderer GetBTLine(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDeviceUIBase.model.lineIndicate.line);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDeviceUIBase.model.lineIndicate.line);
     }
     return(null);
 }
 ///API-No.154
 /// <summary>
 /// BTRight/BTLeft的位置信息,全局坐标
 /// </summary>
 /// <param name="type">右手柄 BTRight /  左手柄 BTLeft</param>
 /// <returns></returns>
 public static Vector3 BTPosition(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.position);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.position);
     }
     return(Vector3.zero);
 }
 ///API-No.153
 /// <summary>
 /// BTRight/BTLeft的四元数,全局坐标
 /// </summary>
 /// <param name="type">右手柄 BTRight /  左手柄 BTLeft</param>
 /// <returns></returns>
 public static Quaternion BTRotation(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.inputDataBT3Dof.rotation);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.inputDataBT3Dof.rotation);
     }
     return(Quaternion.identity);
 }
 ///API-No.174
 /// <summary>
 /// 获取BTRight/BTLeft的Gyro数据
 /// </summary>
 /// <param name="type"></param>
 public static int[] GetGyro(BTType type = BTType.Right)
 {
     if (BTDevice && type == BTType.Right)
     {
         return(BTRight.inputDataGetBT3Dof.inputDataGetBT3DofIMU.GetGyro());
     }
     else if (BTDevice && type == BTType.Left)
     {
         return(BTLeft.inputDataGetBT3Dof.inputDataGetBT3DofIMU.GetGyro());
     }
     return(temp);
 }
 ///API-No.170
 /// <summary>
 /// BTRight/BTLeft获取光束
 /// </summary>
 public static LineRenderer GetBTLine(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.detectorBase.pointerBase.lineBase.lineRenderer);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.detectorBase.pointerBase.lineBase.lineRenderer);
     }
     return(null);
 }
 ///API-No.169
 /// <summary>
 /// BTRight/BTLeft获取光束终点的光标Cursor对象
 /// </summary>
 public static DefaultCursor GetBTCursor(BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         return(BTRight.detectorBase.pointerBase.cursorBase as DefaultCursor);
     }
     else if (BTLeft && type == BTType.Left)
     {
         return(BTLeft.detectorBase.pointerBase.cursorBase as DefaultCursor);
     }
     return(null);
 }
Beispiel #26
0
        protected override void DispatchNode(Node downNode, object o)
        {
            Data          data      = o as Data;
            MemoSpecState memo      = data.MemoSpecState;
            PointerToNode ptrUpNode = data.PointerToNode;

            this.state.Recall(memo, data.ObjectHashtable);

            BTType btType = Annotation.GetNodeBTType(downNode);

            if (btType == BTType.Static)
            {
                Node nextDownNode = this.state.InterpretNode(downNode);
                this.AddTask(nextDownNode, ptrUpNode);
            }
            else
            {
                Variable[] vars1;
                Node       upNode;
                Variable[] vars2;
                this.getUpNode(downNode, memo, out vars1, out upNode, out vars2);
                if (upNode != null)
                {
                    SpecializingVisitor.createSubstitution(vars2, vars1, ptrUpNode, upNode);
                }
                else if (btType == BTType.eXclusive)
                {
                    this.CallVisitorMethod(downNode, data);
                }
                else
                {
                    upNode = ptrUpNode.Node = downNode.Clone();
                    for (int i = 0; i < downNode.NextArray.Count; i++)
                    {
                        this.AddTask(downNode.NextArray[i], new PointerToNode(upNode, i));
                    }
                }
            }

            if (ptrUpNode.Node != null)
            {
                this.setUpAndDownNode(downNode, memo, ptrUpNode.Node);
            }
        }
Beispiel #27
0
    public void ToggleButton(BTType type, int quesno)
    {
        switch (type)
        {
        case BTType.pos:
        {
            switch (quesno)
            {
            case 1:
            {
                for (int i = 0; i < posImg1.Count; i++)
                {
                    WhiteButton(posImg1[i]);
                }
            }
            break;

            case 2:
            {
                foreach (Image i in posImg2)
                {
                    WhiteButton(i);
                }
            }
            break;

            case 3:
            {
                foreach (Image i in posImg3)
                {
                    WhiteButton(i);
                }
            }
            break;

            case 4:
            {
                foreach (Image i in posImg4)
                {
                    WhiteButton(i);
                }
            }
            break;

            case 5:
            {
                foreach (Image i in posImg5)
                {
                    WhiteButton(i);
                }
            }
            break;
            }
        }
        break;

        case BTType.neg:
        {
            switch (quesno)
            {
            case 1:
            {
                foreach (Image i in negImg1)
                {
                    WhiteButton(i);
                }
            }
            break;

            case 2:
            {
                foreach (Image i in negImg2)
                {
                    WhiteButton(i);
                }
            }
            break;

            case 3:
            {
                foreach (Image i in negImg3)
                {
                    WhiteButton(i);
                }
            }
            break;

            case 4:
            {
                foreach (Image i in negImg4)
                {
                    WhiteButton(i);
                }
            }
            break;

            case 5:
            {
                foreach (Image i in negImg5)
                {
                    WhiteButton(i);
                }
            }
            break;
            }
        }
        break;
        }
    }
 ///API-No.166
 /// <summary>
 /// BTRight/BTLeft发送一个按键,注意,发送按键至少需发送一个Down,然后再发送一个Up,此API模拟按键按下动作
 /// </summary>
 /// <param name="inputKeyCode">具体按键</param>
 /// <param name="inputKeyState">按键的状态</param>
 public static void BTKeyAddKey(InputKeyCode inputKeyCode, InputKeyState inputKeyState, BTType type = BTType.Right)
 {
     if (BTRight && type == BTType.Right)
     {
         BTRight.inputDataBT3Dof.inputKeys.InputDataAddKey(inputKeyCode, inputKeyState);
     }
     else if (BTLeft && type == BTType.Left)
     {
         BTLeft.inputDataBT3Dof.inputKeys.InputDataAddKey(inputKeyCode, inputKeyState);
     }
 }