Пример #1
0
        /// <summary>
        /// Override to set up inputs for the left and right controllers in a single def on 3DOF.
        /// </summary>
        protected override void Initialize()
        {
            loadedButtonDefs = TBInput.LoadButtonDefs(GetDefaultDefs(), fileName);

            if (TBCore.GetActiveHeadset() == VRHeadset.GearVR)
            {
                _instance.model = VRController.GearVRController;
            }

            loadedButtonDefs.Add(new TBInput.ButtonDef <OVRInput.RawButton>()
            {
                rawButton      = OVRInput.RawButton.LTouchpad,
                virtualButtons = loadedButtonDefs[0].virtualButtons,
                name           = "Touchpad Left",
                supportsTouch  = true,
                supportsAxis2D = true
            });
            loadedButtonDefs.Add(new TBInput.ButtonDef <OVRInput.RawButton>()
            {
                rawButton      = OVRInput.RawButton.LIndexTrigger,
                virtualButtons = loadedButtonDefs[1].virtualButtons,
                name           = "Trigger Left",
                supportsTouch  = false,
                supportsAxis2D = false
            });

            lookupTable = TBInput.NewLookupTableFromDefs(loadedButtonDefs);
            loaded      = true;
        }
Пример #2
0
 protected virtual void Initialize()
 {
     trackingOffsets  = GetDefaultTrackingOffsets();
     loadedButtonDefs = TBInput.LoadButtonDefs <T>(GetDefaultDefs(), fileName);
     lookupTable      = TBInput.NewLookupTableFromDefs <T>(loadedButtonDefs);
     loaded           = true;
 }
Пример #3
0
        /// <summary>
        /// Loads controller data into memory for a given SDK.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="controllers"></param>
        /// <param name="controllerName"></param>
        /// <param name="defaultButtonDefs"></param>
        /// <param name="fileName"></param>
        public static string LoadController <T>(ref Dictionary <string, ButtonMapGroup <TBInput.ButtonDef <T> > > controllers, string controllerName, List <TBInput.ButtonDef <T> > defaultButtonDefs, string fileName)
        {
            ButtonMapGroup <TBInput.ButtonDef <T> > newController;

            if (controllers.TryGetValue(controllerName, out newController))
            {
                return(controllerName);
            }
            else
            {
                newController                = new ButtonMapGroup <TBInput.ButtonDef <T> >();
                newController.fileName       = fileName;
                newController.controllerName = controllerName;
                newController.defs           = defaultButtonDefs;

                // If a custom mapping exits, try to use it.
                if (File.Exists(settingsPath + TBSettings.settingsFolder + newController.fileName + ".json"))
                {
                    newController.defs = TBInput.LoadButtonDefs(defaultButtonDefs, fileName);
                    TBLogging.LogMessage("Found and loaded button maps for " + controllerName + ".", null, messageEnd);
                }
                else
                {
                    // If no custom mapping, we use the default one. A custom one will be saved if you make any changes.
                    TBLogging.LogMessage("Could not find custom button maps for " + controllerName + " in " + settingsPath + TBSettings.settingsFolder + newController.fileName + ".json. Created new maps from default.", null, messageEnd);
                }
                controllers.Add(controllerName, newController);
                return(controllerName);
            }
        }
        /// <summary>
        /// Override to set up inputs for the left and right controllers in a single def on 3DOF.
        /// </summary>
        protected override void Initialize()
        {
            loadedButtonDefs = TBInput.LoadButtonDefs(GetDefaultDefs(), fileName);

            loadedButtonDefs.Add(new TBInput.ButtonDef <OVRInput.RawButton>()
            {
                rawButton      = OVRInput.RawButton.LTouchpad,
                virtualButtons = loadedButtonDefs[0].virtualButtons,
                name           = "Touchpad Left",
                supportsTouch  = true,
                supportsAxis2D = true
            });
            loadedButtonDefs.Add(new TBInput.ButtonDef <OVRInput.RawButton>()
            {
                rawButton      = OVRInput.RawButton.LIndexTrigger,
                virtualButtons = loadedButtonDefs[1].virtualButtons,
                name           = "Trigger Left",
                supportsTouch  = false,
                supportsAxis2D = false
            });

            lookupTable = TBInput.NewLookupTableFromDefs(loadedButtonDefs);
            loaded      = true;
        }
Пример #5
0
 protected static List <TBInput.ButtonDef <T> > LoadMappingsForController(TBControllerBase <T> controller)
 {
     return(TBInput.LoadButtonDefs <T>(controller.GetDefaultDefs(), controller.GetFileName()));
 }