void OnControllerPreDisconnect(ControllerStatusChangedEventArgs args) { // This function will be called when a controller is about to be disconnected // You can get information about the controller that is being disconnected via the args parameter // You can use this event to save the controller's maps before it's disconnected Debug.Log("A controller is being disconnected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); }
private void ReInputOnControllerPreDisconnectEvent(ControllerStatusChangedEventArgs controllerStatusChangedEventArgs) { foreach (var player in ReInput.players.Players) { if (player.controllers.ContainsController( controllerStatusChangedEventArgs.controllerType, controllerStatusChangedEventArgs.controllerId)) { RemoveController(player); } } }
// This function will be called when a controller is connected // You can get information about the controller that was connected via the args parameter void OnControllerConnected(ControllerStatusChangedEventArgs args) { Debug.Log("A controller was connected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); if (args.controllerType == ControllerType.Joystick) { if (args.controllerId == 0) { _player1 = ReInput.players.GetPlayer(args.controllerId); _buttons[0].GetComponent <Image>().color = _buttons[0].GetComponent <Button>().colors.highlightedColor; } _controllerIDToPlayerID.Add(args.controllerId, args.controllerId); } _controllerIDToPlayerID.Add(args.controllerId, args.controllerId); }
void OnControllerDisconnected(ControllerStatusChangedEventArgs args) { Debug.Log("A controller was disconnected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); if (args.name == "XInput Gamepad 1") { xboxIn = false; } if (args.name == "Sony DualShock 4") { playstationIn = false; } }
void OnControllerConnected(ControllerStatusChangedEventArgs args) { if (args.controllerType != ControllerType.Joystick) { return; } foreach (Player p in ReInput.players.Players) { if (p.controllers.ContainsController(args.controllerType, args.controllerId)) { manager.ActivatePlayer(p.id); manager.RouteActivationInput(p.id); } } }
void OnControllerConnected(ControllerStatusChangedEventArgs args) { if (args.controllerType != ControllerType.Joystick) { return; } // Check if this Joystick has already been assigned. If so, just let Auto-Assign do its job. if (assignedJoysticks.Contains(args.controllerId)) { return; } // Assign Joystick to the System Player until it's been explicitly assigned ReInput.players.GetSystemPlayer().controllers.AddController <Joystick>(args.controllerId, true); }
private void OnReInputOnControllerConnectedEvent( ControllerStatusChangedEventArgs controllerStatusChangedEventArgs) { if (controllerStatusChangedEventArgs.controllerType != ControllerType.Joystick) { return; } AssignController(); foreach (var joystick in ReInput.controllers.Joysticks) { var index = Array.IndexOf(_player.controllers.Joysticks.ToArray(), joystick); ControllerMapLoader.CategoryHistory.ForEach(x => _player.controllers.maps.LoadMap(ControllerType.Joystick, index, x, "Default", true)); } }
void OnControllerDisconnected(ControllerStatusChangedEventArgs args) { Debug.Log("Controller disconnected: Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); int player_id = args.controllerId; // Find the player related to the controller. ConnectedPlayer connected_player = connected_players[player_id]; connected_player.rewired.controllers.ClearAllControllers(); // And destroy them! KillPlayer(player_id); connected_players.Remove(player_id); }
/// <summary> /// Calls after a controller has been disconnected. /// </summary> /// <param name="args">ControllerStatusChangedEventArgs</param> protected override void OnControllerPreDiscconnect(ControllerStatusChangedEventArgs args) { if (!isEnabled) { return; } // Save data before joystick is disconnected if (args.controllerType == ControllerType.Joystick) { SaveJoystickData(args.controllerId); #if UNITY_EDITOR Debug.Log("Rewired: " + thisScriptName + " saved Joystick " + args.controllerId + " (" + ReInput.controllers.GetJoystick(args.controllerId).hardwareName + ") data to XML."); #endif } }
void OnControllerPreDisconnected(ControllerStatusChangedEventArgs args) { j = ReInput.controllers.GetJoystick(args.controllerId); if (j.tag == "assigned") { for (int i = 0; i < 4; i++) { if (p[i].controllers.ContainsController(j)) { p[i].controllers.RemoveController(j); players[i].color = Color.black; players[i].sprite = unReady[THOptions.characterChoices[i]]; THOptions.playerIsUsingController[i] = false; readyText[i].text = ""; if (i == 0) { controls[0].text = "Press W\nor X / A\non a controller\nto join game"; p1r = false; p1inGame = false; } if (i == 1) { controls[1].text = "Press T\nor X / A\non a controller\nto join game"; p2r = false; p2inGame = false; } if (i == 2) { controls[2].text = "Press I\nor X / A\non a controller\nto join game"; b1r = false; p3inGame = false; } if (i == 3) { controls[3].text = "Press ▲\nor X / A\non a controller\nto join game"; b2r = false; p4inGame = false; } playersInGame--; THOptions.playerIsInGame[i] = false; } } } }
void OnControllerPreDisconnected(ControllerStatusChangedEventArgs args) { j = ReInput.controllers.GetJoystick(args.controllerId); if (j.tag == "assigned") { for (int i = 0; i < 4; i++) { if (p[i].controllers.ContainsController(j)) { p[i].controllers.RemoveController(j); images[i].color = Color.black; images[i].sprite = unReadied[SkydiversOptions.characterChoices[i]]; images[i + 4].sprite = redLight; SkydiversOptions.playerIsUsingController[i] = false; if (i == 0) { controls[0].text = "Press S or X / A\non a controller\nto join game"; p1r.text = ""; p1Ready = false; p1InGame = false; } if (i == 1) { controls[1].text = "Press G or X / A\non a controller\nto join game"; p2r.text = ""; p2Ready = false; p2InGame = false; } if (i == 2) { controls[2].text = "Press K or X / A\non a controller\nto join game"; p3r.text = ""; p3Ready = false; p3InGame = false; } if (i == 3) { controls[3].text = "Press ▼ or X / A\non a controller\nto join game"; p4r.text = ""; p4Ready = false; p4InGame = false; } } } } }
void OnControllerDisconnected(ControllerStatusChangedEventArgs _args) { int controller_id = _args.controllerId; // Remove controller from the player it is attached to. ConnectedPlayer connected_player = player_dictionary[controller_id]; connected_player.input.controllers.ClearAllControllers(); // Clean up the player's attached USBCharacter if it exists. if (connected_player.character) { PlayerLeave(controller_id); } // Remove the player entry from the list. player_dictionary.Remove(controller_id); }
/// <summary> /// Called when a controller is connected. /// </summary> /// <param name="args">ControllerStatusChangedEventArgs</param> protected override void OnControllerConnected(ControllerStatusChangedEventArgs args) { if (!isEnabled) { return; } // Load data when joystick is connected if (args.controllerType == ControllerType.Joystick) { int count = LoadJoystickData(args.controllerId); #if UNITY_EDITOR if (count > 0) { Debug.Log("Rewired: " + thisScriptName + " loaded Joystick " + args.controllerId + " (" + ReInput.controllers.GetJoystick(args.controllerId).hardwareName + ") data from XML. " + editorLoadedMessage); } #endif } }
void OnControllerConnected(ControllerStatusChangedEventArgs args) { if (args.controllerType != ControllerType.Joystick) { return; } // Check if this Joystick has already been assigned. If so, just let Auto-Assign do its job. if (assignedJoysticks.Contains(args.controllerId)) { return; } // Joystick hasn't ever been assigned before. Make sure it's assigned to the System Player until it's been explicitly assigned ReInput.players.GetSystemPlayer().controllers.AddController( args.controllerType, args.controllerId, true // remove any auto-assignments that might have happened ); }
protected override void OnControllerConnected(ControllerStatusChangedEventArgs args) { if (!this.isEnabled) { return; } if (args.controllerType == ControllerType.Joystick) { int num = this.LoadJoystickData(args.controllerId); if (this.loadDataOnStart && this.loadJoystickAssignments && !this.wasJoystickEverDetected) { base.StartCoroutine(this.LoadJoystickAssignmentsDeferred()); } if (this.loadJoystickAssignments && !this.deferredJoystickAssignmentLoadPending) { this.SaveControllerAssignments(); } this.wasJoystickEverDetected = true; } }
// This function will be called when a controller is connected // You can get information about the controller that was connected via the args parameter void OnControllerConnected(ControllerStatusChangedEventArgs args) { Debug.Log("A controller was connected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); if (args.controllerType != ControllerType.Joystick) { return; } // Check if this Joystick has already been assigned. If so, just let Auto-Assign do its job. if (assignedController.Contains(args.controllerId)) { return; } // Joystick hasn't ever been assigned before. Make sure it's assigned to the System Player until it's been explicitly assigned ReInput.players.GetSystemPlayer().controllers.AddController <Joystick>( ReInput.controllers.GetJoystick(args.controllerId).id, true // remove any auto-assignments that might have happened ); }
public virtual void OnControllerConnected(ControllerStatusChangedEventArgs args) { if (!inputDevices.Contains(InputDevice.Gamepad)) { inputDevices = inputDevices.Add(InputDevice.Gamepad); } if (inputters[0].controllers.joystickCount == 0) { inputters[0].controllers.AddController(args.controller, true); if (humanPlayers.Length == 2) { inputters[1].controllers.AddController(inputters[0].controllers.GetLastActiveController(ControllerType.Keyboard), true); } } else if (inputters[1].controllers.joystickCount == 0) { inputters[1].controllers.AddController(args.controller, true); } foreach (_Text text in _Text.instances) { text.UpdateText(); } }
private void JoystickDisconnected(ControllerStatusChangedEventArgs args) { // Close dialogs and clear queue if a joystick is disconnected if(showMenu) ClearWorkingVars(); // Always force reidentification of all joysticks when a joystick is added or removed when using Unity input if(ReInput.unityJoystickIdentificationRequired) IdentifyAllJoysticks(); }
/// <summary> /// Called when a controller is connected. /// </summary> /// <param name="args">ControllerStatusChangedEventArgs</param> protected override void OnControllerConnected(ControllerStatusChangedEventArgs args) { if(!isEnabled) return; // Load data when joystick is connected if(args.controllerType == ControllerType.Joystick) LoadJoystickData(args.controllerId); }
private void OnControllerConnected(ControllerStatusChangedEventArgs args) { // This function will be called when a controller is connected // You can get information about the controller that was connected via the args parameter Debug.Log("A controller was connected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); SetPlayerReady(args.controllerId, false); }
private void JoystickPreDisconnect(ControllerStatusChangedEventArgs args) { // Check if the current editing controller was just disconnected and deselect it if(selectedController.hasSelection && args.controllerType == selectedController.type && args.controllerId == selectedController.id) { ClearControllerSelection(); // joystick was disconnected } // Save the user maps before the joystick is disconnected if in the menu since user may have changed something if(showMenu) SaveJoystickMaps(args.controllerId); }
/// <summary> /// Called when a controller is about to be disconnected. /// </summary> /// <param name="args">ControllerStatusChangedEventArgs</param> protected override void OnControllerDisconnected(ControllerStatusChangedEventArgs args) { if(!isEnabled) return; // Nothing to do }
private void JoystickConnected(ControllerStatusChangedEventArgs args) { // Reload maps if a joystick is connected LoadJoystickMaps(args.controllerId); // Always force reidentification of all joysticks when a joystick is added or removed when using Unity input if(ReInput.usingUnityInput) IdentifyAllJoysticks(); }
// Get the current connected gamepads when a controller is connected or disconnected private void ControllerEventChange(ControllerStatusChangedEventArgs args) { GetGamepads(); }
/// <summary> /// Called when a controller is connected. /// </summary> /// <param name="args">ControllerStatusChangedEventArgs</param> protected override void OnControllerConnected(ControllerStatusChangedEventArgs args) { if(!isEnabled) return; // Load data when joystick is connected if(args.controllerType == ControllerType.Joystick) { int count = LoadJoystickData(args.controllerId); #if UNITY_EDITOR if(count > 0) Debug.Log("Rewired: " + thisScriptName + " loaded Joystick " + args.controllerId + " (" + ReInput.controllers.GetJoystick(args.controllerId).hardwareName + ") data from XML. " + editorLoadedMessage); #endif } }
void OnControllerConnected(ControllerStatusChangedEventArgs args) { j = ReInput.controllers.GetJoystick(args.controllerId); allControllers.controllers.AddController(j, true); j.tag = null; }
// This function will be called when a controller is about to be disconnected // You can get information about the controller that is being disconnected via the args parameter // You can use this event to save the controller's maps before it's disconnected void OnControllerPreDisconnect(ControllerStatusChangedEventArgs args) { Debug.Log("A controller is being disconnected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); }
private void JoystickConnected(ControllerStatusChangedEventArgs args) { this.LoadJoystickMaps(args.controllerId); if (ReInput.unityJoystickIdentificationRequired) { this.IdentifyAllJoysticks(); } }
private void JoystickDisconnected(ControllerStatusChangedEventArgs args) { if (this.showMenu) { this.ClearWorkingVars(); } if (ReInput.unityJoystickIdentificationRequired) { this.IdentifyAllJoysticks(); } }
private void OnControllerDisconnected(ControllerStatusChangedEventArgs args) { // This function will be called when a controller is fully disconnected // You can get information about the controller that was disconnected via the args parameter Debug.Log("A controller was disconnected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); SetPlayerReady(args.controllerId, true); if(numberOfPlayers > 0) { DecrementPlayerCount(); } }
/// <summary> /// Calls after a controller has been disconnected. /// </summary> /// <param name="args">ControllerStatusChangedEventArgs</param> protected override void OnControllerPreDiscconnect(ControllerStatusChangedEventArgs args) { if(!isEnabled) return; // Save data before joystick is disconnected if(args.controllerType == ControllerType.Joystick) SaveJoystickData(args.controllerId); }
//these two methods are for ReWired, if any of you guys have any questions about it I can answer them, but you don't need to worry about this for working on the game - Buscemi void OnControllerConnected(ControllerStatusChangedEventArgs arg) { CheckController(myPlayer); }
private void OnControllerConnectedEvent(ControllerStatusChangedEventArgs obj) { if (this) { this.ResetUI(); } }
protected override void OnControllerPreDiscconnect(ControllerStatusChangedEventArgs args) { if (!this.isEnabled) { return; } if (args.controllerType == ControllerType.Joystick) { this.SaveJoystickData(args.controllerId); } }
/// <summary> /// Calls after a controller has been disconnected. /// </summary> /// <param name="args">ControllerStatusChangedEventArgs</param> protected override void OnControllerPreDiscconnect(ControllerStatusChangedEventArgs args) { if(!isEnabled) return; // Save data before joystick is disconnected if(args.controllerType == ControllerType.Joystick) { SaveJoystickData(args.controllerId); #if UNITY_EDITOR Debug.Log("Rewired: " + thisScriptName + " saved Joystick " + args.controllerId + " (" + ReInput.controllers.GetJoystick(args.controllerId).hardwareName + ") data to XML."); #endif } }
void OnControllerChanged(ControllerStatusChangedEventArgs args) { controller_index = 0; LoadControllerList(); ChangeController(0); }
private void OnControllerDisconnected(ControllerStatusChangedEventArgs args) { DrawLabels(); }
private void JoystickPreDisconnect(ControllerStatusChangedEventArgs args) { if (this.selectedController.hasSelection && args.controllerType == this.selectedController.type && args.controllerId == this.selectedController.id) { this.ClearControllerSelection(); } if (this.showMenu) { this.SaveJoystickMaps(args.controllerId); } }
private void JoystickDisconnected(ControllerStatusChangedEventArgs args) { this.IdentifyAllJoysticks(); }
private void OnControllerConnectedEvent(ControllerStatusChangedEventArgs obj) { bool flag = false; Debug.Log("OnControllerConnectedEvent"); IList<Player> allPlayers = ReInput.players.AllPlayers; for (int i = 1; i < allPlayers.Count; i++) { Player player = allPlayers[i]; bool flag2 = player.controllers.ContainsController(obj.controllerType, obj.controllerId); bool flag3 = InputDeviceManager.UseDevice(ReInput.controllers.GetController(obj.controllerType, obj.controllerId).hardwareIdentifier); if (!flag2 && flag3) { flag = true; Debug.Log(string.Concat(new object[] { "Adding controller to player ", i, " (", player.name, ")" })); player.controllers.AddController(obj.controllerType, obj.controllerId, false); } else if (flag2 && !flag3) { flag = true; Debug.Log(string.Concat(new object[] { "Removing controller to player ", i, " (", player.name, ")" })); player.controllers.RemoveController(obj.controllerType, obj.controllerId); } } if (flag && !InputMapping.holdLoadingMaps) { if (LocalPlayer.Inventory && LocalPlayer.Inventory.CurrentView == PlayerInventory.PlayerViews.World) { base.Invoke("LoadAllMaps", 0.5f); } else { this.LoadAllMaps(); } } }
private void JoystickConnected(ControllerStatusChangedEventArgs args) { // Reload maps if a joystick is connected LoadJoystickMaps(args.controllerId); // Always force reidentification of all joysticks when a joystick is added or removed when using Unity input on a platform that requires manual identification if(ReInput.unityJoystickIdentificationRequired) IdentifyAllJoysticks(); }
private void OnControllerChanged(ControllerStatusChangedEventArgs args) { SetSelectedController(selectedControllerType); }
private void OnControllerConnected(ControllerStatusChangedEventArgs args) { AssignPrimaryDevice(); }
private void OnControllerDisconnected(ControllerStatusChangedEventArgs args) { hasEvent = true; storeControllerName.Value = args.name; storeControllerId.Value = args.controllerId; storeControllerType.Value = (int)args.controllerType; }
// This function will be called when a controller is connected // You can get information about the controller that was connected via the args parameter void OnControllerConnected(ControllerStatusChangedEventArgs args) { Debug.Log("A controller was connected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); AssignJoystickToNextOpenPlayer(ReInput.controllers.GetJoystick(args.controllerId)); }
private void OnControllerConnectedEvent(ControllerStatusChangedEventArgs obj) { this.ResetUI(); }
/// <summary> /// a controller is disconnected /// </summary> void OnControllerDisconnected(ControllerStatusChangedEventArgs args) { Debug.Log("A controller was disconnected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); updatePlayerController(args.controllerId, false); }
private void JoystickDisconnected(ControllerStatusChangedEventArgs args) { // Identify all joysticks on connect or disconnect because ids are not reliable in Unity IdentifyAllJoysticks(); }
void OnControllerDisconnected(ControllerStatusChangedEventArgs args) { // This function will be called when a controller is fully disconnected // You can get information about the controller that was disconnected via the args parameter Debug.Log("A controller was disconnected! Name = " + args.name + " Id = " + args.controllerId + " Type = " + args.controllerType); }
protected override void OnControllerDisconnected(ControllerStatusChangedEventArgs args) { if (!this.isEnabled) { return; } }