/// <inheritdoc /> public Controller CreateController(string controllerName, ControllerProfile profile, bool initializeFields) { if (string.IsNullOrEmpty(controllerName)) { throw new ArgumentNullException(nameof(controllerName)); } if (_controllerAssembly.TryGetControllerType(controllerName, profile, out Type controllerType)) { return(CreateController(controllerType, initializeFields)); } throw new ArgumentException("Unknown controller type."); }
public FormMain() { InitializeComponent(); Dictionary <string, ToolStripMenuItem> menuItems = new Dictionary <string, ToolStripMenuItem>(); menuItems.Add("Dictionary", itemDictionary); menuItems.Add("Booking", itemBooking); menuItems.Add("Statistic", itemStatistic); menuItems.Add("Setting", itemSetting); menuItems.Add("CheckIn", itemCheckIn); menuItems.Add("Payment", itemPayment); menuItems.Add("BookingAll", itemBookingAll); controller = new ControllerMain(menuItems); controllerProfile = new ControllerProfile(); }
private async Task DeleteControllerProfileAsync(ControllerProfile controllerProfile) { try { if (await _dialogService.ShowQuestionDialogAsync("Confirm", $"Are you sure to delete profile {controllerProfile.Name}?", "Yes", "No", _disappearingTokenSource.Token)) { await _dialogService.ShowProgressDialogAsync( false, async (progressDialog, token) => await _creationManager.DeleteControllerProfileAsync(controllerProfile), "Deleting..."); } } catch (OperationCanceledException) { } }
public FormRegister() { InitializeComponent(); Dictionary <string, TextBox> textBoxs = new Dictionary <string, TextBox>(); Dictionary <string, RadioButton> radioButtons = new Dictionary <string, RadioButton>(); textBoxs.Add("FirstName", tbFirstName); textBoxs.Add("LastName", tbLastName); textBoxs.Add("Email", tbEmail); textBoxs.Add("Telephone", tbTelephone); textBoxs.Add("Login", tbLogin); textBoxs.Add("Password", tbPassword1); radioButtons.Add("Male", rBMale); radioButtons.Add("Female", rBFemale); controller = new ControllerProfile(textBoxs, dTPBirth, radioButtons); }
private async Task DeleteControllerProfileAsync(ControllerProfile controllerProfile) { try { if (await _dialogService.ShowQuestionDialogAsync( Translate("Confirm"), $"{Translate("AreYouSureToDeleteProfile")} '{controllerProfile.Name}'?", Translate("Yes"), Translate("No"), _disappearingTokenSource.Token)) { await _dialogService.ShowProgressDialogAsync( false, async (progressDialog, token) => await _creationManager.DeleteControllerProfileAsync(controllerProfile), Translate("Deleting")); } } catch (OperationCanceledException) { } }
private async Task AddControllerProfileAsync() { try { var result = await _dialogService.ShowInputDialogAsync( Translate("ControllerProfile"), Translate("EnterProfileName"), null, Translate("ProfileName"), Translate("Create"), Translate("Cancel"), KeyboardType.Text, _disappearingTokenSource.Token); if (result.IsOk) { if (string.IsNullOrWhiteSpace(result.Result)) { await _dialogService.ShowMessageBoxAsync( Translate("Warning"), Translate("ProfileNameCanNotBeEmpty"), Translate("Ok"), _disappearingTokenSource.Token); return; } ControllerProfile controllerProfile = null; await _dialogService.ShowProgressDialogAsync( false, async (progressDialog, token) => controllerProfile = await _creationManager.AddControllerProfileAsync(Creation, result.Result), Translate("Creating")); await NavigationService.NavigateToAsync <ControllerProfilePageViewModel>(new NavigationParameters(("controllerprofile", controllerProfile))); } } catch (OperationCanceledException) { } }
void Awake() { if (Instance != null) { Destroy(gameObject); } else { DontDestroyOnLoad(gameObject); Instance = this; } SetCursorTexture((Texture2D)Resources.Load("UI/cursor")); controllerProfile = ControllerProfile.WASD; menuActive = MenuActive.MENU; customKey = new KeyCode[8]; TogglePlayerMovement = true; navMeshController = GameObject.FindWithTag("Manager/NavMeshManager").GetComponent <NavMeshController>(); projectileManager = GameObject.FindWithTag("Manager/ProjectileManager").GetComponent <ProjectileManager>(); buffManager = GameObject.FindWithTag("Manager/BuffManager").GetComponent <BuffManager>(); _largeProjectile = (GameObject)Resources.Load("Prefabs/LargeProjectile"); _smallProjectile = (GameObject)Resources.Load("Prefabs/SmallProjectile"); _smoke = (GameObject)Resources.Load("Prefabs/Particles/Smoke"); _bot = (GameObject)Resources.Load("Prefabs/Bot"); _blankImage = GameObject.FindWithTag("UI/GameCanvas").transform.FindChild("Blank").GetComponent <Image>(); _shootEffectPrefab = (GameObject)Resources.Load("Prefabs/Particles/ShootEffect"); activeEntities = GameObject.FindWithTag("ActiveEntities"); Player = GameObject.FindGameObjectWithTag("Player"); inventoryManager = new InventoryManager(); AddQuickItemSlotToList(); EnableMenu(MenuActive.MENU); if (EventManager.OnShoot != null) { EventManager.OnShoot(); } }
//Receive all the connected Controllers async Task ControllerReceiveAllConnected() { try { //Add Win Usb Devices IEnumerable <EnumerateInfo> SelectedWinDevice = EnumerateDevicesDi(GuidClassScpDS3Driver, true); foreach (EnumerateInfo EnumDevice in SelectedWinDevice) { try { //Get vendor and product hex id string VendorHexId = "0x" + AVFunctions.StringShowAfter(EnumDevice.DevicePath, "vid_", 4).ToLower(); string ProductHexId = "0x" + AVFunctions.StringShowAfter(EnumDevice.DevicePath, "pid_", 4).ToLower(); //Validate the connected controller if (!ControllerValidate(VendorHexId, ProductHexId, EnumDevice.DevicePath, string.Empty)) { continue; } //Create new Json controller profile if it doesnt exist IEnumerable <ControllerProfile> profileList = vDirectControllersProfile.Where(x => x.ProductID.ToLower() == ProductHexId && x.VendorID.ToLower() == VendorHexId); if (!profileList.Any()) { //Create controller profile ControllerProfile controllerProfile = new ControllerProfile() { ProductID = ProductHexId, VendorID = VendorHexId, ProductName = EnumDevice.Description, VendorName = "Unknown" }; //Add profile to list vDirectControllersProfile.Add(controllerProfile); //Save profile to Json file JsonSaveObject(controllerProfile, GenerateJsonNameControllerProfile(controllerProfile)); Debug.WriteLine("Added win profile: " + EnumDevice.Description); } ControllerProfile profileController = profileList.FirstOrDefault(); //Check if controller is wireless bool ConnectedWireless = EnumDevice.DevicePath.ToLower().Contains("00805f9b34fb"); ControllerDetails newController = new ControllerDetails() { Type = ControllerType.WinUsbDevice, Profile = profileController, DisplayName = EnumDevice.Description, Path = EnumDevice.DevicePath, Wireless = ConnectedWireless }; //Connect with the controller await ControllerConnect(newController); } catch { } } //Add Hid Usb Devices IEnumerable <EnumerateInfo> SelectedHidDevice = EnumerateDevicesDi(GuidClassHidDevice, true); foreach (EnumerateInfo EnumDevice in SelectedHidDevice) { try { //Read information from the controller HidDevice foundHidDevice = new HidDevice(EnumDevice.DevicePath, EnumDevice.ModelId, false, true); //Check if device is a gamepad or joystick bool genericGamePad = foundHidDevice.Capabilities.UsageGeneric == (short)HID_USAGE_GENERIC_DESKTOP_PAGE.HID_USAGE_GENERIC_GAMEPAD; bool genericJoystick = foundHidDevice.Capabilities.UsageGeneric == (short)HID_USAGE_GENERIC_DESKTOP_PAGE.HID_USAGE_GENERIC_JOYSTICK; if (!genericGamePad && !genericJoystick) { continue; } //Get vendor and product hex id string VendorHexId = foundHidDevice.Attributes.VendorHexId.ToLower(); string ProductHexId = foundHidDevice.Attributes.ProductHexId.ToLower(); //Validate the connected controller if (!ControllerValidate(VendorHexId, ProductHexId, EnumDevice.DevicePath, foundHidDevice.Attributes.SerialNumber)) { continue; } //Get controller product information string ProductNameString = foundHidDevice.Attributes.ProductName; string VendorNameString = foundHidDevice.Attributes.VendorName; //Create new Json controller profile if it doesnt exist IEnumerable <ControllerProfile> profileList = vDirectControllersProfile.Where(x => x.ProductID.ToLower() == ProductHexId && x.VendorID.ToLower() == VendorHexId); if (!profileList.Any()) { //Create controller profile ControllerProfile controllerProfile = new ControllerProfile() { ProductID = ProductHexId, VendorID = VendorHexId, ProductName = ProductNameString, VendorName = VendorNameString }; //Add profile to list vDirectControllersProfile.Add(controllerProfile); //Save profile to Json file JsonSaveObject(controllerProfile, GenerateJsonNameControllerProfile(controllerProfile)); Debug.WriteLine("Added hid profile: " + ProductNameString + " (" + VendorNameString + ")"); } ControllerProfile profileController = profileList.FirstOrDefault(); //Check if controller is wireless bool ConnectedWireless = foundHidDevice.DevicePath.ToLower().Contains("00805f9b34fb"); ControllerDetails newController = new ControllerDetails() { Type = ControllerType.HidDevice, Profile = profileController, DisplayName = ProductNameString, ModelId = foundHidDevice.ModelId, Path = foundHidDevice.DevicePath, Wireless = ConnectedWireless }; //Connect with the controller await ControllerConnect(newController); } catch { } } } catch (Exception ex) { Debug.WriteLine("Failed adding new controller: " + ex.Message); } }
public FormLogin() { InitializeComponent(); controller = new ControllerProfile(); }
public WindowProfile() { controller = new ControllerProfile(); InitializeComponent(); this.DataContext = controller.GetContext(); }
private async void CreateRectilinearPlane(int x, int y, float barWidth) { Material blackMaterial = await Addressables.LoadAssetAsync <Material>( PRC.Addressables.Materials.Black ).Task; Mesh barMesh = Copy( (await Addressables.LoadAssetAsync <GameObject>(PRC.Addressables.Prefabs.Cube).Task) .GetComponent <MeshFilter>() .sharedMesh ); const float barDistance = 0.005f; DOTools.Meshing.ScaleMesh(ref barMesh, new float3(barWidth, 1, barWidth)); barMesh.RecalculateNormals(); EntityArchetype barArchetype = EntityManager.CreateArchetype( // Tags. ComponentType.ReadWrite <BarTag>(), // Transform. ComponentType.ReadWrite <LocalToWorld>(), ComponentType.ReadWrite <Translation>(), ComponentType.ReadWrite <Rotation>(), ComponentType.ReadWrite <Scale>(), // Rendering. ComponentType.ReadWrite <RenderMesh>(), ComponentType.ReadWrite <RenderBounds>(), ComponentType.ReadWrite <WorldRenderBounds>(), ComponentType.ReadWrite <ChunkWorldRenderBounds>(), // Physics. ComponentType.ReadWrite <PhysicsCollider>(), // Controller data. ComponentType.ReadWrite <ControllerInputData>(), ComponentType.ReadWrite <ControllerCharacteristics>() ); ControllerProfile profile = await Addressables.LoadAssetAsync <ControllerProfile>( PRC.Addressables.Profiles.Controller ).Task; for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { Entity bar = World.EntityManager.CreateEntity(barArchetype); float3 position = new float3(i * (barWidth + barDistance), 0, j * (barWidth + barDistance)); float3 scale = new float3(barWidth, 1, barWidth); EntityManager.SetSharedComponentData(bar, new RenderMesh() { mesh = barMesh, material = blackMaterial }); EntityManager.SetSharedComponentData(bar, profile.characteristics); EntityManager.SetComponentData(bar, new Translation() { Value = position }); EntityManager.SetComponentData(bar, new Scale() { Value = 1f }); PhysicsCollider collider = new PhysicsCollider() { Value = BoxCollider.Create(new BoxGeometry() { Center = float3.zero, Orientation = quaternion.identity, Size = scale, BevelRadius = 0.01f }) }; EntityManager.SetComponentData(bar, collider); /*EntityManager.SetComponentData(bar, PhysicsMass.CreateDynamic(collider.MassProperties, 1f)); * * EntityManager.SetComponentData(bar, new PhysicsVelocity { * Linear = 0, * Angular = 0 * }); * * EntityManager.SetComponentData(bar, new PhysicsDamping { * Linear = 0.01f, * Angular = 0.05f * });*/ } } }
private static void AddOrUpdate(IDictionary <ControllerProfile, Dictionary <string, Type> > controllerTypes, ControllerProfile profile, Type remoteType) { if (controllerTypes[profile].ContainsKey(remoteType.Name)) { controllerTypes[profile][remoteType.Name] = remoteType; } else { controllerTypes[profile].Add(remoteType.Name, remoteType); } }