Beispiel #1
0
        public InputDataGetKS(InputDeviceKSPart inputDeviceKSPart) : base(inputDeviceKSPart)
        {
            this.inputDeviceKSPart = inputDeviceKSPart;

            dataGetOneList.Add(inputDataGetGCPosture  = inputDataGetKSPosture = new InputDataGetKSPosture(this));
            dataGetOneList.Add(inputDataGetGCKey      = inputDataGetKSKey = new InputDataGetKSKey(this));
            dataGetOneList.Add(inputDataGetKSJoystick = new InputDataGetKSJoystick(this));
            dataGetOneList.Add(inputDataGetKSHall     = new InputDataGetKSHall(this));
        }
        protected virtual bool UpdateDeviceInfo(InputDeviceKSPart part, bool isClear = false)
        {
            if (isClear == true)
            {
                part.inputDataKS.GCType       = GCType.Null;
                part.inputDataKS.GCName       = "";
                part.inputDataKS.SoftVesion   = -1;
                part.inputDataKS.BatteryPower = -1;
                DebugMy.LogError("UpdateDeviceInfo Clear!", this);
                return(false);
            }

            KSIndex index = part.inputDataKS.ksIndex;

            if (index != KSIndex.Left && index != KSIndex.Right)
            {
                DebugMy.LogError("UpdateDeviceInfo Error:" + index, this);
                return(false);
            }

            try {
                int typeFlag = SvrPlugin.Instance.HandShank_Getbond((int)index);

                if (index == KSIndex.Left)
                {
                    if ((int)KSTypeFlag.K11 == (typeFlag & 0xF))
                    {
                        part.inputDataKS.GCType = GCType.K11;
                    }
                    else if ((int)KSTypeFlag.K101 == (typeFlag & 0xF))
                    {
                        if (API_Module_SDKConfiguration.HasKey("Module_InputSystem", "UseK102Model"))
                        {
                            part.inputDataKS.GCType = API_Module_SDKConfiguration.GetBool("Module_InputSystem", "UseK102Model", 0) ? GCType.K102 : GCType.K101;
                        }
                        else
                        {
                            part.inputDataKS.GCType = GCType.K101;
                        }
                    }
                }
                else if (part.inputDataKS.ksIndex == KSIndex.Right)
                {
                    if ((int)KSTypeFlag.K11 == ((typeFlag & 0xF0) >> 4))
                    {
                        part.inputDataKS.GCType = GCType.K11;
                    }
                    else if ((int)KSTypeFlag.K101 == ((typeFlag & 0xF0) >> 4))
                    {
                        if (API_Module_SDKConfiguration.HasKey("Module_InputSystem", "UseK102Model"))
                        {
                            part.inputDataKS.GCType = API_Module_SDKConfiguration.GetBool("Module_InputSystem", "UseK102Model", 0) ? GCType.K102 : GCType.K101;
                        }
                        else
                        {
                            part.inputDataKS.GCType = GCType.K101;
                        }
                    }
                }

                if (part.inputDataKS.GCType != GCType.K11 && part.inputDataKS.GCType != GCType.K101 && part.inputDataKS.GCType != GCType.K102)
                {
                    DebugMy.LogError("UpdateDeviceInfo Error:" + part.inputDataKS.GCType, this);
                    return(false);
                }

                part.inputDataKS.GCName       = part.inputDataKS.GCType.ToString();
                part.inputDataKS.SoftVesion   = SvrPlugin.Instance.HandShank_GetVersion((int)index);
                part.inputDataKS.BatteryPower = SvrPlugin.Instance.HandShank_GetBattery((int)index);


                if (part.PostureType == PostureType.UnKown)
                {
                    if (API_Module_SDKConfiguration.HasKey("Module_InputSystem", "KSMode6Dof"))
                    {
                        part.PostureType = API_Module_SDKConfiguration.GetBool("Module_InputSystem", "KSMode6Dof", 0) ? PostureType._6Dof : PostureType._3Dof;
                    }
                }

                DebugMy.Log("UpdateDeviceInfo : "
                            + " isConnected=" + part.inputDataKS.isConnected
                            + " GCName=" + part.inputDataKS.GCName
                            + " PostureType=" + part.PostureType
                            + " SoftVesion=" + part.inputDataKS.SoftVesion
                            + " BatteryPower=" + part.inputDataKS.BatteryPower
                            , this, true);
            } catch (Exception e) {
                Debug.Log(e);
            }

            return(true);
        }
 public InputDeviceKSPartStatus(InputDeviceKSPart inputDeviceKSPart) : base(inputDeviceKSPart)
 {
     this.inputDeviceKSPart = inputDeviceKSPart;
 }
 public InputDevicePartDispatchEventKS(InputDeviceKSPart inputDeviceKSPart) : base(inputDeviceKSPart)
 {
     this.inputDeviceKSPart = inputDeviceKSPart;
 }
Beispiel #5
0
 public InputDataKS(InputDeviceKSPart inputDeviceKSPart) : base(inputDeviceKSPart)
 {
     this.inputDeviceKSPart = inputDeviceKSPart;
 }