public ServerClient(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; _logger = serviceProvider.GetService <ILoggerFactory>().CreateLogger <ServerClient>(); controllerSettings = serviceProvider.GetService <ControllerSettings>(); discoveryClient = serviceProvider.GetService <DiscoveryClient>(); enrollmentTimer.Elapsed += EnrollmentTimer_Elapsed; autoReconnectTimer.Elapsed += AutoReconnectTimer_Elapsed; if (String.IsNullOrEmpty(controllerSettings.Guid)) { _logger.LogInformation("Client is not enrolled. Starting enrollment timer."); enrollmentTimer.Start(); } else { _logger.LogInformation("Client is enrolled. Attempting immediate connection."); serverUrl = String.Format("https://{0}:{1}", controllerSettings.CCSHostname, controllerSettings.CCSPort); CreateConnectionBuilder(); Task.Run(Connect); } }
public virtual void Init(Rigidbody rb, ControllerSettings controller) { SetModeVoid(); rigidBody = rb; this.controller = controller; }
public override ControllerResult Start(ControllerSettings settings) { var gameSettings = (GameSettings)settings; var controllerResult = NextController.Game; InitializeGameState(gameSettings); RegisterHotkeys(); while (window.IsOpen() && controllerResult == NextController.Game) { worldView.Scroll(); window.Cycle(); window.DispatchEvents(); window.Clear(); window.Draw(worldView); window.Draw(guiView); window.Display(); } return(new ControllerResult { Next = NextController.Exit, Settings = null }); }
int dupeCount = FRAMES_TO_SEND_DUPLICATES; //so it doesnt send anything out before it's touched public void Initialize(ControllerSettings _controller) { sender = GetComponent <OscPropertySender>(); myController = _controller; sender.SetAddress(myController.GetAddress()); label.text = myController.name; name = myController.name + " " + myController.controlType; //load default values int defaultValue = myController.defaultValue; modValue = defaultValue; pModValue = defaultValue; targetModValue = defaultValue; slider.maxValue = myController.max; slider.minValue = myController.min; sortLeftButton.onClick.AddListener(SortLeft); sortRightButton.onClick.AddListener(SortRight); SetSortButtonVisibility(false); }
/// <summary> /// Load the settings page for the given controller settings object /// </summary> /// <param name="controllerSettings">The object containing controller-specific configurations</param> protected void LoadSettingsPage(ControllerSettings controllerSettings) { // Save the settings //TODO: This doesn't work! //if (ActiveControllerType != null) // Settings.Default[ActiveControllerType.FullName] = (ActiveController != null) ? ActiveController.Settings : scratchSettings; // Hook a notification for connection properties, which cause a complete controller re-load when changed // (So the user can verify that we can still connect for the new values) if (controllerSettings != null) { controllerSettings.ConnectionPropertyChanged += ControllerSettings_ConnectionPropertyChanged; } // Remove existing property page contentGrid.Children.Clear(); if (controllerSettings != null) { // Set new propery page var page = controllerSettings.GetSettingsPage(); if (page != null) { contentGrid.Children.Add(page); lblNotLoaded.Visibility = Visibility.Hidden; page.DataContext = controllerSettings; return; } } lblNotLoaded.Visibility = Visibility.Visible; }
public override ControllerResult Start(ControllerSettings settings) { var mainMenuResult = new AtomicReference <NextController>(NextController.MainMenu); var gameSettingsProvider = new AtomicReference <Func <GameSettings> >(); pages.InitializeComponents(window, mainMenuResult, gameSettingsProvider); mainScreen.InitializeMainScreen(window, MAIN_SCR_IMAGE); while (window.IsOpen() && mainMenuResult.Value == NextController.MainMenu) { window.DispatchEvents(); window.Clear(); window.Draw(mainScreen); window.Draw(pages.Active); window.Display(); } window.EnsureClosed(); return(new ControllerResult { Next = mainMenuResult.Value, Settings = gameSettingsProvider.Value?.Invoke() }); }
protected override void OnClosed(EventArgs e) { ControllerSettings.Dispose(); _currentAssigner?.Cancel(); _currentAssigner = null; base.OnClosed(e); }
private void SaveAndExit(object sender, MouseButtonEventArgs e) { ControllerSettings.SaveModel(this.modelGroupItem, this, this.viewGroupItem); ControllerGroupItem.ChangeGroupItem(this.modelGroupItem); this.Close(MessageBoxResult.Yes); }
GameObject SpawnControllerObject(ControllerSettings _config, GameObject _controlObject) { GameObject control = Instantiate(_controlObject); control.transform.SetParent(controllerParent, false); control.GetComponentInChildren <FaderControl>().Initialize(_config); return(control); }
public void RespawnController(ControllerSettings _config) { DestroyController(_config); GameObject control = SpawnController(_config); control.transform.SetSiblingIndex(_config.GetPosition()); //there are bound to be issues here with ordering when faders are deleted and stuff ipSetter.TryConnect(); //quick and easy way - reconnect all sliders when done respawning a controller }
public void Initialize() { _controllerSettings = _settingsService.GetSettings <ControllerSettings>(); lock (_syncRoot) { TryLoadResources(); } }
public void NewController() { ControllerSettings newControl = new ControllerSettings(NEW_CONTROLLER_NAME, ControlType.Fader, AddressType.CC, ValueRange.SevenBit, DefaultValueType.Min, MIDIChannel.All, CurveType.Linear); GameObject newController = SpawnController(newControl); if (newController != null) { newControl.SetPosition(newController.transform.GetSiblingIndex()); } }
ControllerUIGroup GetButtonGroupByConfig(ControllerSettings _config) { foreach (ControllerUIGroup cbg in controllerUIs) { if (cbg.controllerConfig == _config) { return(cbg); } } return(null); }
private void OnPortChanged(object sender, EventArgs eventArgs) { byte port = (byte)(controllerIdComboBox.SelectedIndex + 1); ControllerSettings controllerSettimgs = inputSettings[port]; if (controllerSettimgs != null) { TypeDescriptor.AddAttributes(controllerSettimgs, new Attribute[] { new ReadOnlyAttribute(true) }); } mappingsPropertyGrid.SelectedObject = controllerSettimgs; }
private void Construct(InputManager inputManager, PlayerMovement movement, ControllerSettings controllerSettings, GameplaySettings gameplaySettings, BulletManager bulletManager) { _inputManager = inputManager; _movement = movement; _controllerSettings = controllerSettings; _settings = gameplaySettings.PlayerSettings; _gameplaySettings = gameplaySettings; _bulletManager = bulletManager; //_fogManager = fogManager; }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (result == MessageBoxResult.No) { result = System.Windows.MessageBox.Show("Сохранить изменения?", "Yes/No", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { ControllerSettings.SaveModel(this.modelGroupItem, this, this.viewGroupItem); ControllerGroupItem.ChangeGroupItem(this.modelGroupItem); } } }
protected void TurnOnUser(GameObject user) { EPSONcamera = user.transform.FindChild("HeadControl/NeckJoint/Camera BT-200/Stereoscopic Camera").gameObject; EPSONcamera.SetActive(true); LeftEyeCamera = EPSONcamera.transform.FindChild("leftCam").GetComponent <Camera>(); RightEyeCamera = EPSONcamera.transform.FindChild("rightCam").GetComponent <Camera>();; cSettings = user.transform.GetComponentInChildren <ControllerSettings>(); cSettings.IsActiveUser = true; cSettings.SetCurrentController(cSettings.ControllerType); }
private async Task SaveSettings() { await ViewModel.SaveSettings(); ControllerSettings?.SaveCurrentProfile(); if (Owner is MainWindow window && ViewModel.DirectoryChanged) { window.ViewModel.LoadApplications(); } ViewModel.DirectoryChanged = false; }
protected void TurnOffUser(GameObject user) { EPSONcamera = user.transform.FindChild("HeadControl/NeckJoint/Camera BT-200/Stereoscopic Camera").gameObject; EPSONcamera.SetActive(false); EPSONcamera = null; LeftEyeCamera = null; RightEyeCamera = null; cSettings = user.transform.GetComponentInChildren <ControllerSettings>(); cSettings.IsActiveUser = false; cSettings.SetCurrentController(cSettings.ControllerType); }
void SpawnDefaultControllers() { Debug.Log("Spawning Defaults"); NukeControllers(); controllers = new List <ControllerSettings>(); for (int i = 0; i < defaultControllers.Length; i++) { ControllerSettings c = new ControllerSettings(defaultControllers[i]); c.SetPosition(i); controllers.Add(c); } SpawnControllers(true); }
public GameObject SpawnController(ControllerSettings _config) { bool error = true; string errorDebug = "doesn't exist!"; GameObject control = null; foreach (ControllerType t in controllerTypes) { if (t.controlType == _config.controlType) { //spawn this type if (t.controlObject != null) { control = SpawnControllerObject(_config, t.controlObject); controllerObjects.Add(_config, control); error = false; break; } else { //let it continue looking for one that does have a game object if it exists, but throw an appropriate error errorDebug = "exists, but doesn't have a game object!"; } } } if (error) { Debug.LogError($"{typeof(ControllerType).ToString()} for {_config.controlType.ToString()} {errorDebug}!"); } if (control == null) { Debug.LogError("Null control object! not in controller types?"); } uiManager.SpawnFaderOptions(_config, control); if (!controllers.Contains(_config)) { controllers.Add(_config); } return(control); }
void LoadControllers(string _profile) { Debug.Log($"Loading"); if (_profile != DEFAULT_SAVE_NAME) { string json = LoadFile(_profile); if (json != null) { FaderSaver loadedData = JsonUtility.FromJson <FaderSaver>(json); NukeControllers(); if (loadedData != null || loadedData.GetControllers().Count > 0) { List <ControllerSettings> temp = loadedData.GetControllers(); //properly initialize each controller settings for (int i = 0; i < temp.Count; i++) { temp[i] = new ControllerSettings(temp[i]); } controllers = temp; SpawnControllers(); } else { //spawn defaults if no save data SpawnDefaultControllers(); Debug.LogError("Saved data was empty"); } } else { Debug.LogError($"JSON object was null"); SpawnDefaultControllers(); } } else { Debug.Log($"Profile was default"); SpawnDefaultControllers(); } }
/// <summary> /// Handles communication to and from /// the Alarm Failsafe Management Controller (FMC). /// </summary> public FmcController(IServiceProvider serviceProvider) { controllerSettings = serviceProvider.GetService <ControllerSettings>(); serverClient = serviceProvider.GetService <ServerClient>(); ILoggerFactory factory = serviceProvider.GetService <ILoggerFactory>(); logger = factory.CreateLogger <FmcController>(); serialController = new SerialController(serviceProvider); serialController.SerialInitialized += SerialController_SerialInitialized; serialController.SerialRecieved += SerialController_SerialRecieved; serverClient.ServerCommandRecieved += ServerClient_ServerCommandRecieved; syncTimer.Start(); syncTimer.Elapsed += SyncTimer_Elapsed; }
public void SpawnFaderOptions(ControllerSettings _config, GameObject _control) { //check if any other controller buttons exist for this, then destroy all its contents //make sure to destroy faderOptions as well ControllerUIGroup dupe = GetButtonGroupByConfig(_config); if (dupe != null) { DestroyControllerGroup(dupe); } ControllerUIGroup buttonGroup = new ControllerUIGroup(_config, faderOptionsPrefab, faderOptionsActivationPrefab, _control); buttonGroup.faderOptions.transform.SetParent(optionsPanel.transform, false); controllerUIs.Add(buttonGroup); SetFaderWidth(buttonGroup); SortOptionsButtons(); RefreshFaderLayoutGroup(); }
/// <summary> /// Attempt to load the given controller type, /// and show the appropriate settings page for it /// </summary> /// <param name="controllerType">The type of the class of the controller</param> protected void LoadController(Type controllerType) { // Try load the controller if (controllerType != null) { ActiveControllerType = controllerType; if (ActiveController != null) { ActiveController = null; // Close any existing connections } try { ActiveController = Controllers.LoadController(Settings.Default, controllerType); SetError(null); } catch (Exception ex) { // Couldn't load the controller, show the error message and destroy the active controller SetError(ex); ActiveController = null; } } else { // Loading a null controller ActiveController = null; ActiveControllerType = null; SetError(null); } if (ActiveController != null) { // Controller loaded, use its settings LoadSettingsPage(ActiveController.Settings); } else { // Create a temporary scratch settings page until we can properly instantiate the controller scratchSettings = Controllers.GetControllerSettings(HexLight.Properties.Settings.Default, controllerType); LoadSettingsPage(scratchSettings); } }
private void Positions_Load(object sender, EventArgs e) { toolStripStatusLabel.Text = ""; _machine = Machine.GetMachine(); _settings = _machine.Settings; // Subscribe to events _machine.OnCommandResponse += Machine_OnCommandResponse; _machine.OnCommandSending += Machine_OnCommandSending; _machine.OnLocationChanged += Machine_OnLocationChanged; _machine.OnEStopNotification += Machine_OnEStopNotification; txtSpeed.Text = _machine.Settings.FeedRateManual.ToString(); UpdateCurrentPositionDisplay(); UpdateDisplayLabels(); PopulateOffsetSetting(); }
public ControllerUIGroup(ControllerSettings _config, GameObject _faderOptionsPrefab, GameObject _optionsActivateButtonPrefab, GameObject _controlObject) { faderOptions = Instantiate(_faderOptionsPrefab).GetComponent <FaderOptions>(); faderOptions.gameObject.name = _config.name + " Options Panel"; faderOptions.controllerConfig = _config; controllerConfig = _config; faderMenuButton = Instantiate(_optionsActivateButtonPrefab).GetComponent <Button>(); faderMenuButton.gameObject.name = _config.name + " Options"; faderMenuButton.GetComponentInChildren <Text>().text = _config.name + " Options"; // change visible button title faderMenuButton.onClick.AddListener(DisplayFaderOptions); activationToggle = faderMenuButton.GetComponentInChildren <Toggle>(); activationToggle.onValueChanged.AddListener(ToggleControlVisibility); controlObject = _controlObject; controlObjectTransform = _controlObject.GetComponent <RectTransform>(); control = _controlObject.GetComponent <FaderControl>(); }
private async Task RunController() { controllerSettings = await ControllerSettings.ReadAsync(); // Build the service collection IServiceCollection serviceCollection = new ServiceCollection(); serviceCollection.AddLogging(builder => builder .AddDebug() .SetMinimumLevel(LogLevel.Debug)); ILoggerFactory logger = serviceCollection.BuildServiceProvider().GetRequiredService <ILoggerFactory>(); serviceCollection.AddSingleton(new DiscoveryClient(logger.CreateLogger(typeof(DiscoveryClient)), Guid.Parse(controllerSettings.Guid))); serviceCollection.AddSingleton(typeof(ControllerSettings), controllerSettings); serviceCollection.AddSingleton(new ServerClient(serviceCollection.BuildServiceProvider())); IServiceProvider serviceProvider = serviceCollection.BuildServiceProvider(); FmcController alarmController = new FmcController(serviceProvider); alarmController.FmcReadyEvent += AlarmController_FmcReadyEvent; await alarmController.Initialize(); }
private void Construct(ControllerSettings controllerSettings) { _deadZone = controllerSettings.DeadZone; }
public ControllerSettings(ControllerSettings _c) { SetVariables(_c.name, _c.controlType, _c.addressType, _c.range, _c.defaultType, _c.channel, _c.curveType, _c.ccNumber, _c.smoothTime); id = ControlsManager.GetUniqueID(); position = _c.position; }