Fix read.me
This commit is contained in:
parent
510a2961f6
commit
65286e0f6a
124
README.md
124
README.md
@ -29,124 +29,6 @@ Unity Input System support for Conjure Arcade Controllers.
|
|||||||
3. Click the "+" button and select "Add package from disk"
|
3. Click the "+" button and select "Add package from disk"
|
||||||
4. Select the `package.json` file from the downloaded folder
|
4. Select the `package.json` file from the downloaded folder
|
||||||
|
|
||||||
## Quick Start
|
|
||||||
|
|
||||||
### Basic Usage
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
using ConjureOS.Input;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class PlayerController : MonoBehaviour
|
|
||||||
{
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
var controller = ConjureArcadeController.current;
|
|
||||||
if (controller == null) return;
|
|
||||||
|
|
||||||
// Read stick input
|
|
||||||
Vector2 stickInput = controller.stick.ReadValue();
|
|
||||||
|
|
||||||
// Check button presses
|
|
||||||
if (controller.buttonA.wasPressedThisFrame)
|
|
||||||
{
|
|
||||||
// Handle A button press
|
|
||||||
}
|
|
||||||
|
|
||||||
if (controller.start.wasPressedThisFrame)
|
|
||||||
{
|
|
||||||
// Handle start button press
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using Input Actions
|
|
||||||
|
|
||||||
1. Create an Input Action Asset in your project
|
|
||||||
2. Add actions and bind them to Conjure controller inputs:
|
|
||||||
- Stick: `<ConjureArcadeController>/stick`
|
|
||||||
- Buttons: `<ConjureArcadeController>/buttonA`, `<ConjureArcadeController>/start`, etc.
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
using ConjureOS.Input;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.InputSystem;
|
|
||||||
|
|
||||||
public class InputActionExample : MonoBehaviour
|
|
||||||
{
|
|
||||||
[SerializeField] private InputActionAsset inputActions;
|
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
// Assign controller 0 to this input action asset
|
|
||||||
inputActions.AssignConjureController(0);
|
|
||||||
inputActions.Enable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Multi-Controller Support
|
|
||||||
|
|
||||||
```csharp
|
|
||||||
// Check how many controllers are connected
|
|
||||||
int controllerCount = ConjureArcadeController.ControllerCount;
|
|
||||||
|
|
||||||
// Get specific controller by index
|
|
||||||
ConjureArcadeController player1 = ConjureArcadeController.GetForIndex(0);
|
|
||||||
ConjureArcadeController player2 = ConjureArcadeController.GetForIndex(1);
|
|
||||||
|
|
||||||
// Check if controller exists for index
|
|
||||||
if (ConjureArcadeController.ExistForIndex(0))
|
|
||||||
{
|
|
||||||
// Controller 0 is available
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## API Reference
|
|
||||||
|
|
||||||
### ConjureArcadeController
|
|
||||||
|
|
||||||
Main controller class that provides access to all inputs.
|
|
||||||
|
|
||||||
**Properties:**
|
|
||||||
- `stick` - ConjureArcadeStickControl for joystick input
|
|
||||||
- `home`, `start` - ButtonControl for system buttons
|
|
||||||
- `button1`, `button2`, `button3` - ButtonControl for numbered buttons
|
|
||||||
- `buttonA`, `buttonB`, `buttonC` - ButtonControl for lettered buttons
|
|
||||||
- `ControllerIndex` - The index of this controller instance
|
|
||||||
|
|
||||||
**Static Properties:**
|
|
||||||
- `current` - Currently active controller
|
|
||||||
- `allControllers` - Array of all connected controllers
|
|
||||||
- `ControllerCount` - Number of connected controllers
|
|
||||||
|
|
||||||
**Static Methods:**
|
|
||||||
- `ExistForIndex(int)` - Check if controller exists for index
|
|
||||||
- `GetForIndex(int)` - Get controller by index
|
|
||||||
|
|
||||||
**Events:**
|
|
||||||
- `OnControllerAdded` - Fired when a controller is connected
|
|
||||||
- `OnControllerRemoved` - Fired when a controller is disconnected
|
|
||||||
|
|
||||||
### ConjureArcadeStickControl
|
|
||||||
|
|
||||||
Custom stick control that provides both Vector2 input and directional buttons.
|
|
||||||
|
|
||||||
**Properties:**
|
|
||||||
- `up`, `down`, `left`, `right` - ButtonControl for directional input
|
|
||||||
- Standard Vector2Control properties for analog input
|
|
||||||
|
|
||||||
### InputActionAssetExtension
|
|
||||||
|
|
||||||
Extension methods for InputActionAsset to simplify controller assignment.
|
|
||||||
|
|
||||||
**Methods:**
|
|
||||||
- `AssignConjureController(int, bool)` - Assign specific controller to asset
|
|
||||||
- `CanAssignConjureController(int)` - Check if controller can be assigned
|
|
||||||
- `GetConjureControllerIndex()` - Get assigned controller index
|
|
||||||
- `GetConjureControllerIndexes()` - Get all assigned controller indexes
|
|
||||||
|
|
||||||
## Input Bindings
|
## Input Bindings
|
||||||
|
|
||||||
When setting up Input Actions, use these binding paths:
|
When setting up Input Actions, use these binding paths:
|
||||||
@ -166,9 +48,3 @@ When setting up Input Actions, use these binding paths:
|
|||||||
- `<ConjureArcadeController>/buttonA`
|
- `<ConjureArcadeController>/buttonA`
|
||||||
- `<ConjureArcadeController>/buttonB`
|
- `<ConjureArcadeController>/buttonB`
|
||||||
- `<ConjureArcadeController>/buttonC`
|
- `<ConjureArcadeController>/buttonC`
|
||||||
|
|
||||||
## Hardware Information
|
|
||||||
|
|
||||||
The controller is detected as:
|
|
||||||
- **Interface**: HID
|
|
||||||
- **Product**: "Generic USB Joystick " (note the extra spaces)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user