Esempio n. 1
0
        public void Poll(PlayerIndex player, int slot)
        {
            InputConfig config = ConfigurationState.Instance.Hid.InputConfig.Value.Find(x => x.PlayerIndex == player);

            Orientation = new float[9];

            if (!config.EnableMotion || !_motionSource.TryGetData((int)player, slot, out MotionInput input))
            {
                Accelerometer = new Vector3();
                Gyroscope     = new Vector3();

                return;
            }

            Gyroscope     = Truncate(input.Gyroscrope * 0.0027f, 3);
            Accelerometer = Truncate(input.Accelerometer, 3);
            Rotation      = Truncate(input.Rotation * 0.0027f, 3);

            Matrix4x4 orientation = input.GetOrientation();

            Orientation[0] = Math.Clamp(orientation.M11, -1f, 1f);
            Orientation[1] = Math.Clamp(orientation.M12, -1f, 1f);
            Orientation[2] = Math.Clamp(orientation.M13, -1f, 1f);
            Orientation[3] = Math.Clamp(orientation.M21, -1f, 1f);
            Orientation[4] = Math.Clamp(orientation.M22, -1f, 1f);
            Orientation[5] = Math.Clamp(orientation.M23, -1f, 1f);
            Orientation[6] = Math.Clamp(orientation.M31, -1f, 1f);
            Orientation[7] = Math.Clamp(orientation.M32, -1f, 1f);
            Orientation[8] = Math.Clamp(orientation.M33, -1f, 1f);
        }
Esempio n. 2
0
        private bool RetrieveAddConfigs(ref InputConfig zInputConfig, ref OutputConfig zOutputConfig, ref RemapEntry zRemapEntry)
        {
            var zCurrentInputConfig  = (InputConfig)txtKeyIn.Tag;
            var zCurrentOutputConfig = (OutputConfig)txtKeyOut.Tag;

            if (null == zCurrentInputConfig || null == zCurrentOutputConfig)
            {
                MessageBox.Show(this, "Please specify both an input and output key.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            // build cloned configs based on the ui state
            zInputConfig  = UpdateInputFlags(new InputConfig(zCurrentInputConfig));
            zOutputConfig = UpdateOutputFlags(new OutputConfig(zCurrentOutputConfig));

            if (!ValidateOutputHasAction(zOutputConfig))
            {
                return(false);
            }

            zRemapEntry = new RemapEntry(zInputConfig, zOutputConfig);

            // flip this result for indicator of a good remap entry
            return(!IsInputAlreadyDefined(zRemapEntry));
        }
Esempio n. 3
0
        private void btnCalculate_Click(object sender, EventArgs e)
        {
            plotView.Series.Clear();

            InputConfig inputConfig = ReadInputConfig();

            PlotType plotType = GetPlotType();

            if (plotType == PlotType.Undefined)
            {
                MessageBox.Show("Please, select plot type", "Information", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            else
            {
                IDictionary <string, PointF[]> data = _reliabilityAssessor.CalculatePlot(plotType, inputConfig);

                DrawPlot(data, plotType);
                if (plotType == PlotType.SimulationModeling)
                {
                    rtbSimulationOutput.Text = _reliabilityAssessor.Output;
                }
                else
                {
                    rtbOutput.Text = _reliabilityAssessor.Output;
                }
            }
        }
Esempio n. 4
0
        public Runmode(ILoggerFactory loggerFactory, BaseConfig baseConfig, Func <RunmodeConfig> configLoader)
        {
            RunmodeConfig runmodeConfig = configLoader();

            _logger    = loggerFactory.CreateLogger <Runmode>();
            _stopToken = new StopToken();
            Setups.Databases repos = Setups.SetUpRepositories(_logger, baseConfig);
            (_broadcastServer, _overlayConnection) = Setups.SetUpOverlayServer(loggerFactory);
            _modeBase = new ModeBase(loggerFactory, repos, baseConfig, _stopToken, _overlayConnection, ProcessMessage);
            _modeBase.InstallAdditionalCommand(new Command("reloadinputconfig", _ =>
            {
                ReloadConfig(configLoader().InputConfig);
                return(Task.FromResult(new CommandResult {
                    Response = "input config reloaded"
                }));
            }));

            // TODO felk: this feels a bit messy the way it is done right now,
            //            but I am unsure yet how I'd integrate the individual parts in a cleaner way.
            InputConfig inputConfig = runmodeConfig.InputConfig;

            _inputParser      = inputConfig.ButtonsProfile.ToInputParser();
            _inputBufferQueue = new InputBufferQueue <QueuedInput>(CreateBufferConfig(inputConfig));
            _anarchyInputFeed = CreateInputFeedFromConfig(inputConfig);
            _inputServer      = new InputServer(loggerFactory.CreateLogger <InputServer>(),
                                                runmodeConfig.InputServerHost, runmodeConfig.InputServerPort,
                                                _anarchyInputFeed);
        }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUILayout.PropertyField(_inputConfigDatabase);
        serializedObject.ApplyModifiedProperties();

        InputConfig inputConfigDatabase = ((InputConfigBuilder)target).inputConfigDatabase;

        if (GUILayout.Button("Build Shortcut Input From Scratch"))
        {
            RepopulateInput(inputConfigDatabase);
        }

        if (GUILayout.Button("Build Shortcut Input Keep Names"))
        {
            RepopulateInput(inputConfigDatabase, true);
        }

        EditorGUILayout.Space();
        _newActionAdded = (MSChartEditorInputActions)EditorGUILayout.EnumPopup("New Action Added", _newActionAdded);

        // Use this when adding a new input into the middle of the rest of the pack
        if (GUILayout.Button("Do post added new action setup"))
        {
            InsertForNewActionAt(inputConfigDatabase, (int)_newActionAdded);
        }
    }
 public TapInputDetector()
 {
     if (InputConfig == null)
     {
         InputConfig = Config.Get <InputConfig>();
     }
 }
Esempio n. 7
0
        private void SetConfig(SizeInt32 size, bool directX)
        {
            Config = new InputConfig(
                new InputStreamProperties[]
            {
                new InputStreamProperties
                {
                    CodecProps = new CodecProperties
                    {
                        codec_type          = AVMediaType.AVMEDIA_TYPE_VIDEO,
                        sample_aspect_ratio = new AVRational {
                            num = 0, den = 1
                        },
                        codec_id = Core.Const.CODEC_ID_RAWVIDEO,
                        width    = size.Width,
                        height   = size.Height,
                        bits_per_coded_sample = 4 * 8,
                        format = directX ? Core.PIX_FMT_INTERNAL_DIRECTX : Core.Const.PIX_FMT_BGRA,

                        extradata = new byte[1024]
                    }
                }
            }
                );
        }
Esempio n. 8
0
        private void SaveToggle_Activated(object sender, EventArgs args)
        {
            InputConfig inputConfig = GetValues();

            if (_inputConfig == null && inputConfig != null)
            {
                ConfigurationState.Instance.Hid.InputConfig.Value.Add(inputConfig);
            }
            else
            {
                if (_inputDevice.ActiveId == "disabled")
                {
                    ConfigurationState.Instance.Hid.InputConfig.Value.Remove(_inputConfig);
                }
                else if (inputConfig != null)
                {
                    int index = ConfigurationState.Instance.Hid.InputConfig.Value.IndexOf(_inputConfig);

                    ConfigurationState.Instance.Hid.InputConfig.Value[index] = inputConfig;
                }
            }

            MainWindow.SaveConfig();

            Dispose();
        }
Esempio n. 9
0
        public void Awake()
        {
            mapMovingEntity.OnMovementFinished.RegisterListenerOnce(HandleMovementFinished);

            controls = new InputConfig();
            controls.Player.Movement.performed += ctx => MoveVector2(ctx.ReadValue <Vector2>());
        }
Esempio n. 10
0
 public InputsSystem(SystemConfig inConfig) : base(inConfig)
 {
     if (inConfig != null)
     {
         _config = inConfig as InputConfig;
     }
 }
Esempio n. 11
0
        private void SaveToggle_Activated(object sender, EventArgs args)
        {
            InputConfig inputConfig = GetValues();

            var newConfig = new List <InputConfig>();

            newConfig.AddRange(ConfigurationState.Instance.Hid.InputConfig.Value);

            if (_inputConfig == null && inputConfig != null)
            {
                newConfig.Add(inputConfig);
            }
            else
            {
                if (_inputDevice.ActiveId == "disabled")
                {
                    newConfig.Remove(_inputConfig);
                }
                else if (inputConfig != null)
                {
                    int index = newConfig.IndexOf(_inputConfig);

                    newConfig[index] = inputConfig;
                }
            }

            // Atomically replace and signal input change.
            // NOTE: Do not modify InputConfig.Value directly as other code depends on the on-change event.
            ConfigurationState.Instance.Hid.InputConfig.Value = newConfig;

            ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath);

            Dispose();
        }
Esempio n. 12
0
        public void OnStart(SceneContext ec, Scene previous = null)
        {
            Console.WriteLine("start");
            Random r    = new Random();
            Entity test = null;
            //for (int i = 0; i < 5; i++)
            //{
            double x = r.Next(100);
            double y = r.Next(100);

            string           concat = "{'x':" + x + ",'y':" + y + ", 'type':'test', 'rotation':5,'material':{'type':'SimpleTexturedMaterial','textureName':'table'},'mesh':{'type':'QuadMesh','width':12.0,'height':8.0},attributes:[{'type':'ActorData','speed':1,'rotationspeed':20,'speedmultiplicator':1.2,'maxspeed':0.005}],behaviours:['MovementInputHandlerBehaviour']}";
            EntityDefinition asd    = JsonConvert.DeserializeObject <EntityDefinition>(concat);

            test = EntityFactory.Instance.Generate(asd);

            EntityFactory.Instance.GenerateByName("TEST_WEAPON", (float)x, (float)y + 5);



            //}
            InputConfig ic = InputConfig.Instance;
            Crosshair   ch = new Crosshair(
                new Axis[] { ic.MOUSE, ic.RIGHT_AXIS }, ic.LEFT_MOUSE, ic.RIGHT_MOUSE,
                test, this.worldManager.World)
            {
                CursorSensitivity = 10, CursorRange = 50, CursorSize = 5, CursorImage = ec.SceneResourceManager.GetTexture("crosshair")
            };

            this.camera.TrackingBody = ch.Sensor;

            ec.Hud.Add(ch);
            // test = EntityFactory.Instance.Generate(asd);
        }
        /// <summary>Snippet for ImportCatalogItems</summary>
        public void ImportCatalogItemsResourceNames()
        {
            // Snippet: ImportCatalogItems(CatalogName, string, InputConfig, ImportErrorsConfig, CallSettings)
            // Create client
            CatalogServiceClient catalogServiceClient = CatalogServiceClient.Create();
            // Initialize request argument(s)
            CatalogName        parent       = CatalogName.FromProjectLocationCatalog("[PROJECT]", "[LOCATION]", "[CATALOG]");
            string             requestId    = "";
            InputConfig        inputConfig  = new InputConfig();
            ImportErrorsConfig errorsConfig = new ImportErrorsConfig();
            // Make the request
            Operation <ImportCatalogItemsResponse, ImportMetadata> response = catalogServiceClient.ImportCatalogItems(parent, requestId, inputConfig, errorsConfig);

            // Poll until the returned long-running operation is complete
            Operation <ImportCatalogItemsResponse, ImportMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            ImportCatalogItemsResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ImportCatalogItemsResponse, ImportMetadata> retrievedResponse = catalogServiceClient.PollOnceImportCatalogItems(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ImportCatalogItemsResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Esempio n. 14
0
        public DroneCam SetupCam(string name)
        {
            if (!inited)
            {
                Plugin.Log("Setting Up DroneCam");
                inited = true;
                GameObject orbitTargetGO = GameObject.Find("OrbitTarget");
                if (orbitTarget == null)
                {
                    orbitTarget = new GameObject("OrbitTarget").transform;
                    DontDestroyOnLoad(orbitTarget);
                }
                else
                {
                    orbitTarget = orbitTargetGO.transform;
                }
                orbitTarget.position = new Vector3(0, 1.5f, 0);

                GameObject droneCam = new GameObject($"{name}-DroneCam");
                DontDestroyOnLoad(droneCam);
                droneMovement = droneCam.AddComponent <DroneMovement>();
                InputConfig config = new InputConfig($"./UserData/CameraPlus/Input/{name}");
                customInput = droneCam.AddComponent(config.InputType) as CustomInput;
                customInput.droneMovement = droneMovement;
                customInput.Setup(config);
                droneMovement.droneCam   = this;
                smoothingTarget          = droneCam.transform;
                customInput.droneCam     = this;
                droneMovement.cameraPlus = GetComponent <CameraPlusBehaviour>();
            }
            return(this);
        }
        /// <summary>Snippet for ImportCatalogItemsAsync</summary>
        public async Task ImportCatalogItemsAsync()
        {
            // Snippet: ImportCatalogItemsAsync(string, string, InputConfig, ImportErrorsConfig, CallSettings)
            // Additional: ImportCatalogItemsAsync(string, string, InputConfig, ImportErrorsConfig, CancellationToken)
            // Create client
            CatalogServiceClient catalogServiceClient = await CatalogServiceClient.CreateAsync();

            // Initialize request argument(s)
            string             parent       = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]";
            string             requestId    = "";
            InputConfig        inputConfig  = new InputConfig();
            ImportErrorsConfig errorsConfig = new ImportErrorsConfig();
            // Make the request
            Operation <ImportCatalogItemsResponse, ImportMetadata> response = await catalogServiceClient.ImportCatalogItemsAsync(parent, requestId, inputConfig, errorsConfig);

            // Poll until the returned long-running operation is complete
            Operation <ImportCatalogItemsResponse, ImportMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            ImportCatalogItemsResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ImportCatalogItemsResponse, ImportMetadata> retrievedResponse = await catalogServiceClient.PollOnceImportCatalogItemsAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ImportCatalogItemsResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Esempio n. 16
0
        public void RefreshGameControllers()
        {
            IEnumerable <SharpDX.DirectInput.DeviceInstance> instances = directInputDevices.GetInputDevices(Model.AllDevices);

            foreach (var inputView in Model.Inputs.ToArray())
            {
                var device = inputView.ViewModel.Model.Device;
                if (device is DirectDevice && (!instances.Any(x => x.InstanceGuid == ((DirectDevice)device).Id) || !device.Connected))
                {
                    Model.Inputs.Remove(inputView);
                    inputView.ViewModel.Dispose();
                    device.Dispose();
                    InputDevices.Instance.Remove(device);
                }
            }
            foreach (var instance in instances)
            {
                if (!Model.Inputs.Select(c => c.ViewModel.Model.Device).OfType <DirectDevice>().Any(d => d.Id == instance.InstanceGuid))
                {
                    var device = directInputDevices.CreateDirectDevice(instance);
                    if (device == null)
                    {
                        continue;
                    }
                    InputMapper mapper      = settings.GetMapper(device.ToString());
                    InputConfig inputConfig = settings.GetInputConfiguration(device.ToString(), device.InputConfiguration);
                    device.Disconnected -= DispatchRefreshGameControllers;
                    device.Disconnected += DispatchRefreshGameControllers;
                    Model.Inputs.Add(new InputView(new InputViewModel(new InputModel(), device, Model.IsAdmin)));
                }
            }
        }
Esempio n. 17
0
    public static void LoadFromJson(string jsonFileContents, InputConfig inputConfig)
    {
        var saveableInputConfig = JsonUtility.FromJson <SaveableInputConfig>(jsonFileContents);

        inputConfig.shortcutInputs = new ShortcutInputConfig[EnumX <MSChartEditorInputActions> .Count];

        foreach (var inputProperty in saveableInputConfig.actionProperties)
        {
            MSChartEditorInputActions action;
            if (System.Enum.TryParse(inputProperty.mSChartEditorInputAction, out action))
            {
                ShortcutInputConfig scInputConfig = new ShortcutInputConfig();
                scInputConfig.shortcut   = action;
                scInputConfig.properties = inputProperty.properties;
                inputConfig.shortcutInputs[(int)action] = scInputConfig;
            }
        }

        foreach (MSChartEditorInputActions msAction in EnumX <MSChartEditorInputActions> .Values)
        {
            if (inputConfig.shortcutInputs[(int)msAction] == null)
            {
                // Populate a default onto it
                ShortcutInputConfig scInputConfig = new ShortcutInputConfig();
                scInputConfig.shortcut = msAction;

                inputConfig.shortcutInputs[(int)msAction] = scInputConfig;
            }

            Debug.Assert(inputConfig.shortcutInputs[(int)msAction].shortcut == msAction);
        }
    }
Esempio n. 18
0
        public frmInputConfig()
        {
            InitializeComponent();
            if (DesignMode)
            {
                return;
            }

            InputConfig cfg = ConfigManager.Config.Input.Clone();

            Entity = cfg;

            BaseConfigForm.InitializeComboBox((ComboBox)cboPlayer1, typeof(ControllerType));
            BaseConfigForm.InitializeComboBox((ComboBox)cboPlayer2, typeof(ControllerType));
            BaseConfigForm.InitializeComboBox((ComboBox)cboPlayer3, typeof(ControllerType));
            BaseConfigForm.InitializeComboBox((ComboBox)cboPlayer4, typeof(ControllerType));
            BaseConfigForm.InitializeComboBox((ComboBox)cboPlayer5, typeof(ControllerType));

            //Remove super scope for now
            cboPlayer1.Items.RemoveAt(3);
            cboPlayer2.Items.RemoveAt(3);

            cboPlayer1.SetEnumValue(cfg.Controllers[0].Type);
            cboPlayer2.SetEnumValue(cfg.Controllers[1].Type);
            cboPlayer3.SetEnumValue(cfg.Controllers[2].Type);
            cboPlayer4.SetEnumValue(cfg.Controllers[3].Type);
            cboPlayer5.SetEnumValue(cfg.Controllers[4].Type);
        }
        public override void FrameFeed()
        {
            if (characterInventory == null)
            {
                characterInventory = agent.RequestComponent <CharacterInventoryComponent>();
                throwTrajectory    = agent.RequestComponent <TrajectoryGizmo>();
                return;
            }

            if (characterInventory.HasItem(arrow))
            {
                if (InputConfig.Aim())
                {
                    Aim();
                }
                else if (InputConfig.ActionUp())
                {
                    ThrowArrow();
                    characterInventory.UseItem(arrow);
                }
                else
                {
                    ResetAim();
                }
            }
            else
            {
                ResetAim();
            }
        }
Esempio n. 20
0
        public frmInputConfig()
        {
            InitializeComponent();
            if (DesignMode)
            {
                return;
            }

            InputConfig cfg = ConfigManager.Config.Input.Clone();

            Entity = cfg;

            BaseConfigForm.InitializeComboBox((ComboBox)cboPlayer1, typeof(ControllerType), ControllerType.SuperScope);
            BaseConfigForm.InitializeComboBox((ComboBox)cboPlayer2, typeof(ControllerType));

            BaseConfigForm.InitializeComboBox((ComboBox)cboMultitap1, typeof(ControllerType), ControllerType.None, ControllerType.Multitap, ControllerType.SnesMouse, ControllerType.SuperScope);
            BaseConfigForm.InitializeComboBox((ComboBox)cboMultitap2, typeof(ControllerType), ControllerType.None, ControllerType.Multitap, ControllerType.SnesMouse, ControllerType.SuperScope);
            BaseConfigForm.InitializeComboBox((ComboBox)cboMultitap3, typeof(ControllerType), ControllerType.None, ControllerType.Multitap, ControllerType.SnesMouse, ControllerType.SuperScope);
            BaseConfigForm.InitializeComboBox((ComboBox)cboMultitap4, typeof(ControllerType), ControllerType.None, ControllerType.Multitap, ControllerType.SnesMouse, ControllerType.SuperScope);

            cboPlayer1.SetEnumValue(cfg.Controllers[0].Type);
            cboPlayer2.SetEnumValue(cfg.Controllers[1].Type);

            cboMultitap1.SetEnumValue(ControllerType.SnesController);
            cboMultitap2.SetEnumValue(ControllerType.SnesController);
            cboMultitap3.SetEnumValue(ControllerType.SnesController);
            cboMultitap4.SetEnumValue(ControllerType.SnesController);

            UpdateUiSections();
        }
Esempio n. 21
0
        public void UpdateUserConfiguration(InputConfig config)
        {
            if (config is StandardControllerInputConfig controllerConfig)
            {
                bool needsMotionInputUpdate = _config == null || (_config is StandardControllerInputConfig oldControllerConfig &&
                                                                  (oldControllerConfig.Motion.EnableMotion != controllerConfig.Motion.EnableMotion) &&
                                                                  (oldControllerConfig.Motion.MotionBackend != controllerConfig.Motion.MotionBackend));

                if (needsMotionInputUpdate)
                {
                    UpdateMotionInput(controllerConfig.Motion);
                }
            }
            else
            {
                // Non-controller doesn't have motions.
                _leftMotionInput = null;
            }

            _config = config;

            if (_isValid)
            {
                _gamepad.SetConfiguration(config);
            }
        }
        /// <summary>Snippet for ImportUserEvents</summary>
        public void ImportUserEvents()
        {
            // Snippet: ImportUserEvents(string, string, InputConfig, ImportErrorsConfig, CallSettings)
            // Create client
            UserEventServiceClient userEventServiceClient = UserEventServiceClient.Create();
            // Initialize request argument(s)
            string             parent       = "projects/[PROJECT]/locations/[LOCATION]/catalogs/[CATALOG]/eventStores/[EVENT_STORE]";
            string             requestId    = "";
            InputConfig        inputConfig  = new InputConfig();
            ImportErrorsConfig errorsConfig = new ImportErrorsConfig();
            // Make the request
            Operation <ImportUserEventsResponse, ImportMetadata> response = userEventServiceClient.ImportUserEvents(parent, requestId, inputConfig, errorsConfig);

            // Poll until the returned long-running operation is complete
            Operation <ImportUserEventsResponse, ImportMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            ImportUserEventsResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ImportUserEventsResponse, ImportMetadata> retrievedResponse = userEventServiceClient.PollOnceImportUserEvents(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ImportUserEventsResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Esempio n. 23
0
        /// <summary>Snippet for ImportDataAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task ImportDataAsync()
        {
            // Create client
            AutoMlClient autoMlClient = await AutoMlClient.CreateAsync();

            // Initialize request argument(s)
            string      name        = "projects/[PROJECT]/locations/[LOCATION]/datasets/[DATASET]";
            InputConfig inputConfig = new InputConfig();
            // Make the request
            Operation <Empty, OperationMetadata> response = await autoMlClient.ImportDataAsync(name, inputConfig);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, OperationMetadata> retrievedResponse = await autoMlClient.PollOnceImportDataAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
        }
Esempio n. 24
0
        public void SetConfiguration(InputConfig configuration)
        {
            lock (_userMappingLock)
            {
                _configuration = (StandardKeyboardInputConfig)configuration;

                _buttonsUserMapping.Clear();

                // Then left joycon
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftStick, (Key)_configuration.LeftJoyconStick.StickButton));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadUp, (Key)_configuration.LeftJoycon.DpadUp));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadDown, (Key)_configuration.LeftJoycon.DpadDown));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadLeft, (Key)_configuration.LeftJoycon.DpadLeft));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.DpadRight, (Key)_configuration.LeftJoycon.DpadRight));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Minus, (Key)_configuration.LeftJoycon.ButtonMinus));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftShoulder, (Key)_configuration.LeftJoycon.ButtonL));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.LeftTrigger, (Key)_configuration.LeftJoycon.ButtonZl));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger0, (Key)_configuration.LeftJoycon.ButtonSr));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger0, (Key)_configuration.LeftJoycon.ButtonSl));

                // Finally right joycon
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightStick, (Key)_configuration.RightJoyconStick.StickButton));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.A, (Key)_configuration.RightJoycon.ButtonA));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.B, (Key)_configuration.RightJoycon.ButtonB));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.X, (Key)_configuration.RightJoycon.ButtonX));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Y, (Key)_configuration.RightJoycon.ButtonY));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.Plus, (Key)_configuration.RightJoycon.ButtonPlus));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightShoulder, (Key)_configuration.RightJoycon.ButtonR));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.RightTrigger, (Key)_configuration.RightJoycon.ButtonZr));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleRightTrigger1, (Key)_configuration.RightJoycon.ButtonSr));
                _buttonsUserMapping.Add(new ButtonMappingEntry(GamepadButtonInputId.SingleLeftTrigger1, (Key)_configuration.RightJoycon.ButtonSl));
            }
        }
        /// <summary>Snippet for ImportUserEventsAsync</summary>
        public async Task ImportUserEventsResourceNamesAsync()
        {
            // Snippet: ImportUserEventsAsync(EventStoreName, string, InputConfig, ImportErrorsConfig, CallSettings)
            // Additional: ImportUserEventsAsync(EventStoreName, string, InputConfig, ImportErrorsConfig, CancellationToken)
            // Create client
            UserEventServiceClient userEventServiceClient = await UserEventServiceClient.CreateAsync();

            // Initialize request argument(s)
            EventStoreName     parent       = EventStoreName.FromProjectLocationCatalogEventStore("[PROJECT]", "[LOCATION]", "[CATALOG]", "[EVENT_STORE]");
            string             requestId    = "";
            InputConfig        inputConfig  = new InputConfig();
            ImportErrorsConfig errorsConfig = new ImportErrorsConfig();
            // Make the request
            Operation <ImportUserEventsResponse, ImportMetadata> response = await userEventServiceClient.ImportUserEventsAsync(parent, requestId, inputConfig, errorsConfig);

            // Poll until the returned long-running operation is complete
            Operation <ImportUserEventsResponse, ImportMetadata> completedResponse = await response.PollUntilCompletedAsync();

            // Retrieve the operation result
            ImportUserEventsResponse result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <ImportUserEventsResponse, ImportMetadata> retrievedResponse = await userEventServiceClient.PollOnceImportUserEventsAsync(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ImportUserEventsResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Esempio n. 26
0
        private void btnSetup_Click(object sender, EventArgs e)
        {
            int            index        = 0;
            ControllerType type         = ControllerType.None;
            string         selectedText = "";

            if (sender == btnSetupP1)
            {
                type         = cboPlayer1.GetEnumValue <ControllerType>();
                selectedText = cboPlayer1.SelectedItem.ToString();
                index        = 0;
            }
            else if (sender == btnSetupP2)
            {
                type         = cboPlayer2.GetEnumValue <ControllerType>();
                selectedText = cboPlayer2.SelectedItem.ToString();
                index        = 1;
            }
            else if (sender == btnSetupP3)
            {
                type         = cboPlayer3.GetEnumValue <ControllerType>();
                selectedText = cboPlayer3.SelectedItem.ToString();
                index        = 2;
            }
            else if (sender == btnSetupP4)
            {
                type         = cboPlayer4.GetEnumValue <ControllerType>();
                selectedText = cboPlayer4.SelectedItem.ToString();
                index        = 3;
            }
            else if (sender == btnSetupP5)
            {
                type         = cboPlayer4.GetEnumValue <ControllerType>();
                selectedText = cboPlayer5.SelectedItem.ToString();
                index        = 4;
            }

            BaseInputConfigForm frm = null;
            InputConfig         cfg = (InputConfig)Entity;

            switch (type)
            {
            case ControllerType.SnesController:
                frm = new frmControllerConfig(cfg.Controllers[index], index);
                break;

            case ControllerType.SuperScope:
                //frm = new frmSuperScopeConfig();
                break;

            case ControllerType.SnesMouse:
                //frm = new frmMouseConfig();
                break;
            }

            if (frm != null)
            {
                OpenSetupWindow(frm, (Button)sender, selectedText, index);
            }
        }
Esempio n. 27
0
        /// <summary>Snippet for ImportData</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void ImportDataResourceNames()
        {
            // Create client
            AutoMlClient autoMlClient = AutoMlClient.Create();
            // Initialize request argument(s)
            DatasetName name        = DatasetName.FromProjectLocationDataset("[PROJECT]", "[LOCATION]", "[DATASET]");
            InputConfig inputConfig = new InputConfig();
            // Make the request
            Operation <Empty, OperationMetadata> response = autoMlClient.ImportData(name, inputConfig);

            // Poll until the returned long-running operation is complete
            Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, OperationMetadata> retrievedResponse = autoMlClient.PollOnceImportData(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
        }
Esempio n. 28
0
 static InputConfig GetConfig()
 {
     if (InputConfig == null)
     {
         InputConfig = Config.Get <InputConfig>();
     }
     return(InputConfig);
 }
        private void UpdateCursorPosition()
        {
            cursorDeltaX += InputConfig.GetCursorMovement().x *AimingDirection() * agent.sensibility * Time.deltaTime;
            cursorDeltaX  = Mathf.Clamp(cursorDeltaX, -agent.shootRadius, agent.shootRadius - Mathf.Epsilon);

            cursorDeltaY += InputConfig.GetCursorMovement().y *AimingDirection() * agent.sensibility * Time.deltaTime;
            cursorDeltaY  = Mathf.Clamp(cursorDeltaY, -agent.shootRadius, agent.shootRadius);
        }
Esempio n. 30
0
    public void reset()
    {
        binds.setBinds(BindsConfig.createDefault());
        InputConfig defaultConfig = new InputConfig();

        setMouseSensitivity(defaultConfig.mouseSensitivity);
        setMouseYAxisInverted(defaultConfig.mouseYAxisInverted);
    }
Esempio n. 31
0
	//Unity Callbacks
	void Start()
	{
		AddObserver(GameManager.Instance);
		m_PlayerInputConfig = InputManager.Instance.m_InputConfigs[(int)PlayerNumber];
		m_Statistics = new ActorStatistics(gameObject.GetComponent<Actor>());
		if (m_HUD != null)
		{
			m_HUD.InitializeBars();
		}
		m_Interaction = GetComponentInChildren<Interaction>();
	}
        static void Main(string[] args)
        {
            Server _server = null;
            Application _application = null;            
            Query _results;
            //InputAdapter Config 
                InputConfig _inputConfig = new InputConfig();


                string _stopSignalName = "TimeToStop";                
                EventWaitHandle _adapterStopSignal = new EventWaitHandle(false, EventResetMode.ManualReset, _stopSignalName);                

                try
                {

                    // Creating the server and application
                    _server = Server.Create("localhost");
                    _application = _server.CreateApplication("TwitterStream");                    
                    var input = CepStream<TweetsType>.Create("TwitterInputStream", typeof(InputFactory), _inputConfig, EventShape.Point);

                    var query1 = from s in input
                                 group s by s.HashTag into grp
                                 from win in grp.TumblingWindow(TimeSpan.FromSeconds(10), HoppingWindowOutputPolicy.ClipToWindowEnd)
                                 select new
                                 {
                                     HashTag = grp.Key,
                                     cnt = win.Count()
                                 };
                    _results = query1.ToQuery(_application, "TweetsCount", "Data Query2", typeof(TotalCountOutputFactory),
                                          _stopSignalName,
                                          EventShape.Point,
                                          StreamEventOrder.FullyOrdered);
                    _adapterStopSignal.Reset();                    
                    //Start the Query                
                    _results.Start();
                    //_results2.Start();                    
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.ReadLine();
                }
        }
        static void Main(string[] args)
        {
            Server _server = null;
            Application _application = null;            
            Query _results, _results2;
            //InputAdapter Config 
                InputConfig _inputConfig = new InputConfig();


                string _stopSignalName = "TimeToStop";                
                EventWaitHandle _adapterStopSignal = new EventWaitHandle(false, EventResetMode.ManualReset, _stopSignalName);                

                try
                {

                    // Creating the server and application
                    _server = Server.Create("localhost");
                    _application = _server.CreateApplication("TwitterStream");                    
                    var input = CepStream<TweetsType>.Create("TwitterInputStream", typeof(InputFactory), _inputConfig, EventShape.Point);                    

                    var query1 = from e in input
                                 select new { text = e.Text, createdAt = e.CreatedAt, location=e.Location, lang=e.Lang, tweetid=e.TweetID, followercnt=e.FollowersCount, friendscnt=e.FriendsCount, hash = e.HashTag, userName = e.UserName, timeZone=e.TimeZone, lat = e.Latitude, lon = e.Longitude };

                    _results = query1.ToQuery(_application, "TweetsData", "Data Query", typeof(OutputFactory),
                                          _stopSignalName,
                                          EventShape.Point,
                                          StreamEventOrder.FullyOrdered);
                    _adapterStopSignal.Reset();                    
                    //Start the Query                
                    _results.Start();                    
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.ReadLine();
                }
        }
Esempio n. 34
0
	public void CreateActionInput(InputConfig aInputConfig, string aAction, Enum aPositiveInput, InputType aInputType = InputType.Hold, Enum aNegativeInput = null)
	{
		aInputConfig.InputObjects.Add(aAction, new InputObj());
		aInputConfig.InputObjects[aAction].InputElement = aPositiveInput;
		aInputConfig.InputObjects[aAction].Type = aInputType;
		if (aNegativeInput != null)
		{
			aInputConfig.InputObjects[aAction].InputElementNegative = aNegativeInput;
			aInputConfig.InputObjects[aAction].IsConstructedAxis = true;
			return;
		}
		aInputConfig.InputObjects[aAction].IsConstructedAxis = false;
	}
Esempio n. 35
0
	private void InitializeInputConfigs()
	{
		m_InputConfigs = new InputConfig[9];

		m_InputConfigs[0] = new InputConfig(new PeripheralPC(), PlayerNumber.God);
		for (int i = 0; i < m_ControllersConnected; i++)
		{
			m_InputConfigs[i + 1] = new InputConfig(new PeripheralXBOX(), (PlayerNumber)i + 1);
		}
		//if controllers connected == 3, set the fourth player to Keyboard
		if (m_ControllersConnected != 8)
		{
			// Every other controller should have peripheral NA after this...
			for (int i = 0; i < (m_InputConfigs.Length - 1) - m_ControllersConnected; i++)
			{
				m_InputConfigs[i + m_ControllersConnected + 1] = new InputConfig(new PeripheralNA(), (PlayerNumber)i + m_ControllersConnected + 1); // NULL INPUT PERIPHERAL
			}
			m_InputConfigs[m_ControllersConnected + 1] = new InputConfig(new PeripheralPC(), (PlayerNumber)m_ControllersConnected + 1);
		}
	}