menu
This commit is contained in:
1 parent
5135c50172
commit
268608a459
46 files changed
+5298
-74
No files matched your search
+11
-10
@@ -1,11 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class ShipControls : MonoBehaviour, ShipInput.IMovementActions {
|
||||
public class ShipControls : MonoBehaviour, SpaceRaceInput.IShipActions {
|
||||
public Camera aim;
|
||||
public Timing timing;
|
||||
|
||||
ShipInput shipInput;
|
||||
SpaceRaceInput input;
|
||||
InputAction lookAction;
|
||||
InputAction accelerateAction;
|
||||
InputAction decelerateAction;
|
||||
@@ -39,7 +39,7 @@ public class ShipControls : MonoBehaviour, ShipInput.IMovementActions {
|
||||
rigidBody.freezeRotation = true;
|
||||
|
||||
initialPosition = rigidBody.transform.position;
|
||||
initialAim = aim.transform.rotation;
|
||||
initialAim = rigidBody.transform.rotation;
|
||||
initialForce = Vector3.forward;
|
||||
|
||||
thrust = Vector3.zero;
|
||||
@@ -54,15 +54,15 @@ public class ShipControls : MonoBehaviour, ShipInput.IMovementActions {
|
||||
camYaw = initialAim.eulerAngles.y;
|
||||
forceMode = ForceMode.Acceleration;
|
||||
|
||||
if (shipInput == null) {
|
||||
shipInput = new ShipInput();
|
||||
shipInput.movement.SetCallbacks(this);
|
||||
if (input == null) {
|
||||
input = new SpaceRaceInput();
|
||||
input.ship.SetCallbacks(this);
|
||||
}
|
||||
shipInput.movement.Enable();
|
||||
input.ship.Enable();
|
||||
|
||||
lookAction = shipInput.FindAction("look");
|
||||
accelerateAction = shipInput.FindAction("accelerate");
|
||||
decelerateAction = shipInput.FindAction("decelerate");
|
||||
lookAction = input.FindAction("look");
|
||||
accelerateAction = input.FindAction("accelerate");
|
||||
decelerateAction = input.FindAction("decelerate");
|
||||
}
|
||||
|
||||
void Update() {
|
||||
@@ -158,6 +158,7 @@ public class ShipControls : MonoBehaviour, ShipInput.IMovementActions {
|
||||
rigidBody.transform.forward = initialForce;
|
||||
rigidBody.velocity = new Vector3(0f, 0f, 0f);
|
||||
rigidBody.angularVelocity = new Vector3(0f, 0f, 0f);
|
||||
rigidBody.transform.rotation = initialAim;
|
||||
aim.transform.rotation = initialAim;
|
||||
|
||||
camPitch = initialAim.eulerAngles.x;
|
||||
|
||||
+136
-44
@@ -2,7 +2,7 @@
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.6.1
|
||||
// from Assets/Resources/ShipInput.inputactions
|
||||
// from Assets/Resources/SpaceRaceInput.inputactions
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -15,16 +15,16 @@ using System.Collections.Generic;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
||||
public partial class @ShipInput: IInputActionCollection2, IDisposable
|
||||
public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable
|
||||
{
|
||||
public InputActionAsset asset { get; }
|
||||
public @ShipInput()
|
||||
public @SpaceRaceInput()
|
||||
{
|
||||
asset = InputActionAsset.FromJson(@"{
|
||||
""name"": ""ShipInput"",
|
||||
""name"": ""SpaceRaceInput"",
|
||||
""maps"": [
|
||||
{
|
||||
""name"": ""movement"",
|
||||
""name"": ""ship"",
|
||||
""id"": ""f52df5ad-4b20-4a0e-a4c8-bbf76c26b2c5"",
|
||||
""actions"": [
|
||||
{
|
||||
@@ -337,18 +337,60 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""menu"",
|
||||
""id"": ""88ca6226-1e9b-4abe-b02e-7b1304ef28ae"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""ToggleMenu"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""cee6d41d-d488-4548-b2d6-11e16bb6b116"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""264c9b3e-9257-4ea7-ad15-c2469ae762f2"",
|
||||
""path"": ""<Gamepad>/start"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""ToggleMenu"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""1a12ee48-3233-43b7-88a3-175016b24098"",
|
||||
""path"": ""<Keyboard>/escape"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""ToggleMenu"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": []
|
||||
}");
|
||||
// movement
|
||||
m_movement = asset.FindActionMap("movement", throwIfNotFound: true);
|
||||
m_movement_accelerate = m_movement.FindAction("accelerate", throwIfNotFound: true);
|
||||
m_movement_decelerate = m_movement.FindAction("decelerate", throwIfNotFound: true);
|
||||
m_movement_strafe = m_movement.FindAction("strafe", throwIfNotFound: true);
|
||||
m_movement_look = m_movement.FindAction("look", throwIfNotFound: true);
|
||||
m_movement_respawn = m_movement.FindAction("respawn", throwIfNotFound: true);
|
||||
m_movement_quit = m_movement.FindAction("quit", throwIfNotFound: true);
|
||||
// ship
|
||||
m_ship = asset.FindActionMap("ship", throwIfNotFound: true);
|
||||
m_ship_accelerate = m_ship.FindAction("accelerate", throwIfNotFound: true);
|
||||
m_ship_decelerate = m_ship.FindAction("decelerate", throwIfNotFound: true);
|
||||
m_ship_strafe = m_ship.FindAction("strafe", throwIfNotFound: true);
|
||||
m_ship_look = m_ship.FindAction("look", throwIfNotFound: true);
|
||||
m_ship_respawn = m_ship.FindAction("respawn", throwIfNotFound: true);
|
||||
m_ship_quit = m_ship.FindAction("quit", throwIfNotFound: true);
|
||||
// menu
|
||||
m_menu = asset.FindActionMap("menu", throwIfNotFound: true);
|
||||
m_menu_ToggleMenu = m_menu.FindAction("ToggleMenu", throwIfNotFound: true);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -407,34 +449,34 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable
|
||||
return asset.FindBinding(bindingMask, out action);
|
||||
}
|
||||
|
||||
// movement
|
||||
private readonly InputActionMap m_movement;
|
||||
private List<IMovementActions> m_MovementActionsCallbackInterfaces = new List<IMovementActions>();
|
||||
private readonly InputAction m_movement_accelerate;
|
||||
private readonly InputAction m_movement_decelerate;
|
||||
private readonly InputAction m_movement_strafe;
|
||||
private readonly InputAction m_movement_look;
|
||||
private readonly InputAction m_movement_respawn;
|
||||
private readonly InputAction m_movement_quit;
|
||||
public struct MovementActions
|
||||
// ship
|
||||
private readonly InputActionMap m_ship;
|
||||
private List<IShipActions> m_ShipActionsCallbackInterfaces = new List<IShipActions>();
|
||||
private readonly InputAction m_ship_accelerate;
|
||||
private readonly InputAction m_ship_decelerate;
|
||||
private readonly InputAction m_ship_strafe;
|
||||
private readonly InputAction m_ship_look;
|
||||
private readonly InputAction m_ship_respawn;
|
||||
private readonly InputAction m_ship_quit;
|
||||
public struct ShipActions
|
||||
{
|
||||
private @ShipInput m_Wrapper;
|
||||
public MovementActions(@ShipInput wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @accelerate => m_Wrapper.m_movement_accelerate;
|
||||
public InputAction @decelerate => m_Wrapper.m_movement_decelerate;
|
||||
public InputAction @strafe => m_Wrapper.m_movement_strafe;
|
||||
public InputAction @look => m_Wrapper.m_movement_look;
|
||||
public InputAction @respawn => m_Wrapper.m_movement_respawn;
|
||||
public InputAction @quit => m_Wrapper.m_movement_quit;
|
||||
public InputActionMap Get() { return m_Wrapper.m_movement; }
|
||||
private @SpaceRaceInput m_Wrapper;
|
||||
public ShipActions(@SpaceRaceInput wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @accelerate => m_Wrapper.m_ship_accelerate;
|
||||
public InputAction @decelerate => m_Wrapper.m_ship_decelerate;
|
||||
public InputAction @strafe => m_Wrapper.m_ship_strafe;
|
||||
public InputAction @look => m_Wrapper.m_ship_look;
|
||||
public InputAction @respawn => m_Wrapper.m_ship_respawn;
|
||||
public InputAction @quit => m_Wrapper.m_ship_quit;
|
||||
public InputActionMap Get() { return m_Wrapper.m_ship; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
public bool enabled => Get().enabled;
|
||||
public static implicit operator InputActionMap(MovementActions set) { return set.Get(); }
|
||||
public void AddCallbacks(IMovementActions instance)
|
||||
public static implicit operator InputActionMap(ShipActions set) { return set.Get(); }
|
||||
public void AddCallbacks(IShipActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_MovementActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_MovementActionsCallbackInterfaces.Add(instance);
|
||||
if (instance == null || m_Wrapper.m_ShipActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_ShipActionsCallbackInterfaces.Add(instance);
|
||||
@accelerate.started += instance.OnAccelerate;
|
||||
@accelerate.performed += instance.OnAccelerate;
|
||||
@accelerate.canceled += instance.OnAccelerate;
|
||||
@@ -455,7 +497,7 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable
|
||||
@quit.canceled += instance.OnQuit;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(IMovementActions instance)
|
||||
private void UnregisterCallbacks(IShipActions instance)
|
||||
{
|
||||
@accelerate.started -= instance.OnAccelerate;
|
||||
@accelerate.performed -= instance.OnAccelerate;
|
||||
@@ -477,22 +519,68 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable
|
||||
@quit.canceled -= instance.OnQuit;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(IMovementActions instance)
|
||||
public void RemoveCallbacks(IShipActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_MovementActionsCallbackInterfaces.Remove(instance))
|
||||
if (m_Wrapper.m_ShipActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
public void SetCallbacks(IMovementActions instance)
|
||||
public void SetCallbacks(IShipActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_MovementActionsCallbackInterfaces)
|
||||
foreach (var item in m_Wrapper.m_ShipActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_MovementActionsCallbackInterfaces.Clear();
|
||||
m_Wrapper.m_ShipActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
public MovementActions @movement => new MovementActions(this);
|
||||
public interface IMovementActions
|
||||
public ShipActions @ship => new ShipActions(this);
|
||||
|
||||
// menu
|
||||
private readonly InputActionMap m_menu;
|
||||
private List<IMenuActions> m_MenuActionsCallbackInterfaces = new List<IMenuActions>();
|
||||
private readonly InputAction m_menu_ToggleMenu;
|
||||
public struct MenuActions
|
||||
{
|
||||
private @SpaceRaceInput m_Wrapper;
|
||||
public MenuActions(@SpaceRaceInput wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @ToggleMenu => m_Wrapper.m_menu_ToggleMenu;
|
||||
public InputActionMap Get() { return m_Wrapper.m_menu; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
public bool enabled => Get().enabled;
|
||||
public static implicit operator InputActionMap(MenuActions set) { return set.Get(); }
|
||||
public void AddCallbacks(IMenuActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_MenuActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_MenuActionsCallbackInterfaces.Add(instance);
|
||||
@ToggleMenu.started += instance.OnToggleMenu;
|
||||
@ToggleMenu.performed += instance.OnToggleMenu;
|
||||
@ToggleMenu.canceled += instance.OnToggleMenu;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(IMenuActions instance)
|
||||
{
|
||||
@ToggleMenu.started -= instance.OnToggleMenu;
|
||||
@ToggleMenu.performed -= instance.OnToggleMenu;
|
||||
@ToggleMenu.canceled -= instance.OnToggleMenu;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(IMenuActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_MenuActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
public void SetCallbacks(IMenuActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_MenuActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_MenuActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
public MenuActions @menu => new MenuActions(this);
|
||||
public interface IShipActions
|
||||
{
|
||||
void OnAccelerate(InputAction.CallbackContext context);
|
||||
void OnDecelerate(InputAction.CallbackContext context);
|
||||
@@ -501,4 +589,8 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable
|
||||
void OnRespawn(InputAction.CallbackContext context);
|
||||
void OnQuit(InputAction.CallbackContext context);
|
||||
}
|
||||
public interface IMenuActions
|
||||
{
|
||||
void OnToggleMenu(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
@@ -15,15 +15,15 @@ public enum SectorColour {
|
||||
public readonly struct SectorTime {
|
||||
public SectorTime(int i, double t) {
|
||||
Sector = i;
|
||||
Value = t;
|
||||
Seconds = t;
|
||||
Colour = SectorColour.White;
|
||||
}
|
||||
|
||||
public int Sector { get; }
|
||||
public double Value { get; }
|
||||
public double Seconds { get; }
|
||||
public SectorColour Colour { get; }
|
||||
|
||||
public override string ToString() => $"{Value:0.000}";
|
||||
public override string ToString() => $"{Seconds:0.000}";
|
||||
|
||||
// public string ColourClass() => Colour switch {
|
||||
// SectorColour.Green => "green",
|
||||
@@ -38,12 +38,13 @@ public struct Lap {
|
||||
public int Number { get; set; }
|
||||
public List<SectorTime> Sectors { get; set; }
|
||||
|
||||
// 0:1:39
|
||||
public override string ToString() {
|
||||
return $"Lap {Number} : {TimeSpan.FromSeconds(TotalTime()):g} {String.Join(" ", Sectors.ConvertAll(s => s.ToString()))}";
|
||||
return $"{TimeSpan.FromSeconds(TotalTime()):m\\:ss\\.fff}";
|
||||
}
|
||||
|
||||
public double TotalTime() {
|
||||
return Sectors.Sum(s => s.Value);
|
||||
return Sectors.Sum(s => s.Seconds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +155,7 @@ public class Timing: MonoBehaviour {
|
||||
var fastestLap = lapTimes.MinBy(l => l.TotalTime());
|
||||
var fastestSector = fastestLap.Sectors.Single(fls => fls.Sector == s.Sector);
|
||||
|
||||
return (s.Value < fastestSector.Value) switch {
|
||||
return (s.Seconds < fastestSector.Seconds) switch {
|
||||
true => SectorColour.Green,
|
||||
false => SectorColour.Yellow,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cb6aa050e90de06e84c577b183b9655
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,61 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
[SerializeField]
|
||||
UIDocument menuDoc;
|
||||
|
||||
[SerializeField]
|
||||
UIDocument timingDoc;
|
||||
|
||||
[SerializeField]
|
||||
ShipControls shipControls;
|
||||
|
||||
SpaceRaceInput input;
|
||||
bool visible = false;
|
||||
|
||||
void Start() {
|
||||
if (input == null) {
|
||||
input = new SpaceRaceInput();
|
||||
input.menu.SetCallbacks(this);
|
||||
}
|
||||
input.menu.Enable();
|
||||
Debug.Log($"Menu {visible}");
|
||||
Hide();
|
||||
}
|
||||
|
||||
void Show() {
|
||||
visible = true;
|
||||
UnityEngine.Cursor.lockState = CursorLockMode.None;
|
||||
menuDoc.enabled = true;
|
||||
|
||||
// take control off the ship
|
||||
timingDoc.enabled = false;
|
||||
shipControls.enabled = false;
|
||||
|
||||
}
|
||||
|
||||
void Hide() {
|
||||
visible = false;
|
||||
UnityEngine.Cursor.lockState = CursorLockMode.Locked;
|
||||
menuDoc.enabled = false;
|
||||
|
||||
// resume control of the ship
|
||||
timingDoc.enabled = true;
|
||||
shipControls.enabled = true;
|
||||
}
|
||||
|
||||
public void OnToggleMenu(InputAction.CallbackContext ctx) {
|
||||
visible = !visible;
|
||||
Debug.Log($"Menu {visible}");
|
||||
|
||||
if (visible) {
|
||||
Show();
|
||||
return;
|
||||
}
|
||||
|
||||
Hide();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7da082ca2a8e6ee9a5b1151245f535f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,284 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.6.1
|
||||
// from Assets/Src/UI/MenuInput.inputactions
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
||||
public partial class @MenuInput: IInputActionCollection2, IDisposable
|
||||
{
|
||||
public InputActionAsset asset { get; }
|
||||
public @MenuInput()
|
||||
{
|
||||
asset = InputActionAsset.FromJson(@"{
|
||||
""name"": ""MenuInput"",
|
||||
""maps"": [
|
||||
{
|
||||
""name"": ""menu"",
|
||||
""id"": ""fddbd52a-f0f1-4589-8706-8a70d80fffc7"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""Toggle"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""ad2f7940-95f2-4063-87a1-7d42f3791e9f"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""e4962cb0-d885-416a-a080-db19f4a0a4c4"",
|
||||
""path"": ""<Keyboard>/escape"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard&Mouse"",
|
||||
""action"": ""Toggle"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""a9401517-73d8-4cc5-baaa-56db81951850"",
|
||||
""path"": ""<Gamepad>/start"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Gamepad"",
|
||||
""action"": ""Toggle"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
""controlSchemes"": [
|
||||
{
|
||||
""name"": ""Keyboard&Mouse"",
|
||||
""bindingGroup"": ""Keyboard&Mouse"",
|
||||
""devices"": [
|
||||
{
|
||||
""devicePath"": ""<Keyboard>"",
|
||||
""isOptional"": false,
|
||||
""isOR"": false
|
||||
},
|
||||
{
|
||||
""devicePath"": ""<Mouse>"",
|
||||
""isOptional"": false,
|
||||
""isOR"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""Gamepad"",
|
||||
""bindingGroup"": ""Gamepad"",
|
||||
""devices"": [
|
||||
{
|
||||
""devicePath"": ""<Gamepad>"",
|
||||
""isOptional"": false,
|
||||
""isOR"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""Touch"",
|
||||
""bindingGroup"": ""Touch"",
|
||||
""devices"": [
|
||||
{
|
||||
""devicePath"": ""<Touchscreen>"",
|
||||
""isOptional"": false,
|
||||
""isOR"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""Joystick"",
|
||||
""bindingGroup"": ""Joystick"",
|
||||
""devices"": [
|
||||
{
|
||||
""devicePath"": ""<Joystick>"",
|
||||
""isOptional"": false,
|
||||
""isOR"": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
""name"": ""XR"",
|
||||
""bindingGroup"": ""XR"",
|
||||
""devices"": [
|
||||
{
|
||||
""devicePath"": ""<XRController>"",
|
||||
""isOptional"": false,
|
||||
""isOR"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}");
|
||||
// menu
|
||||
m_menu = asset.FindActionMap("menu", throwIfNotFound: true);
|
||||
m_menu_Toggle = m_menu.FindAction("Toggle", throwIfNotFound: true);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEngine.Object.Destroy(asset);
|
||||
}
|
||||
|
||||
public InputBinding? bindingMask
|
||||
{
|
||||
get => asset.bindingMask;
|
||||
set => asset.bindingMask = value;
|
||||
}
|
||||
|
||||
public ReadOnlyArray<InputDevice>? devices
|
||||
{
|
||||
get => asset.devices;
|
||||
set => asset.devices = value;
|
||||
}
|
||||
|
||||
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
|
||||
|
||||
public bool Contains(InputAction action)
|
||||
{
|
||||
return asset.Contains(action);
|
||||
}
|
||||
|
||||
public IEnumerator<InputAction> GetEnumerator()
|
||||
{
|
||||
return asset.GetEnumerator();
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public void Enable()
|
||||
{
|
||||
asset.Enable();
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
{
|
||||
asset.Disable();
|
||||
}
|
||||
|
||||
public IEnumerable<InputBinding> bindings => asset.bindings;
|
||||
|
||||
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
|
||||
{
|
||||
return asset.FindAction(actionNameOrId, throwIfNotFound);
|
||||
}
|
||||
|
||||
public int FindBinding(InputBinding bindingMask, out InputAction action)
|
||||
{
|
||||
return asset.FindBinding(bindingMask, out action);
|
||||
}
|
||||
|
||||
// menu
|
||||
private readonly InputActionMap m_menu;
|
||||
private List<IMenuActions> m_MenuActionsCallbackInterfaces = new List<IMenuActions>();
|
||||
private readonly InputAction m_menu_Toggle;
|
||||
public struct MenuActions
|
||||
{
|
||||
private @MenuInput m_Wrapper;
|
||||
public MenuActions(@MenuInput wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @Toggle => m_Wrapper.m_menu_Toggle;
|
||||
public InputActionMap Get() { return m_Wrapper.m_menu; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
public bool enabled => Get().enabled;
|
||||
public static implicit operator InputActionMap(MenuActions set) { return set.Get(); }
|
||||
public void AddCallbacks(IMenuActions instance)
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_MenuActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_MenuActionsCallbackInterfaces.Add(instance);
|
||||
@Toggle.started += instance.OnToggle;
|
||||
@Toggle.performed += instance.OnToggle;
|
||||
@Toggle.canceled += instance.OnToggle;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(IMenuActions instance)
|
||||
{
|
||||
@Toggle.started -= instance.OnToggle;
|
||||
@Toggle.performed -= instance.OnToggle;
|
||||
@Toggle.canceled -= instance.OnToggle;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(IMenuActions instance)
|
||||
{
|
||||
if (m_Wrapper.m_MenuActionsCallbackInterfaces.Remove(instance))
|
||||
UnregisterCallbacks(instance);
|
||||
}
|
||||
|
||||
public void SetCallbacks(IMenuActions instance)
|
||||
{
|
||||
foreach (var item in m_Wrapper.m_MenuActionsCallbackInterfaces)
|
||||
UnregisterCallbacks(item);
|
||||
m_Wrapper.m_MenuActionsCallbackInterfaces.Clear();
|
||||
AddCallbacks(instance);
|
||||
}
|
||||
}
|
||||
public MenuActions @menu => new MenuActions(this);
|
||||
private int m_KeyboardMouseSchemeIndex = -1;
|
||||
public InputControlScheme KeyboardMouseScheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_KeyboardMouseSchemeIndex == -1) m_KeyboardMouseSchemeIndex = asset.FindControlSchemeIndex("Keyboard&Mouse");
|
||||
return asset.controlSchemes[m_KeyboardMouseSchemeIndex];
|
||||
}
|
||||
}
|
||||
private int m_GamepadSchemeIndex = -1;
|
||||
public InputControlScheme GamepadScheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_GamepadSchemeIndex == -1) m_GamepadSchemeIndex = asset.FindControlSchemeIndex("Gamepad");
|
||||
return asset.controlSchemes[m_GamepadSchemeIndex];
|
||||
}
|
||||
}
|
||||
private int m_TouchSchemeIndex = -1;
|
||||
public InputControlScheme TouchScheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_TouchSchemeIndex == -1) m_TouchSchemeIndex = asset.FindControlSchemeIndex("Touch");
|
||||
return asset.controlSchemes[m_TouchSchemeIndex];
|
||||
}
|
||||
}
|
||||
private int m_JoystickSchemeIndex = -1;
|
||||
public InputControlScheme JoystickScheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_JoystickSchemeIndex == -1) m_JoystickSchemeIndex = asset.FindControlSchemeIndex("Joystick");
|
||||
return asset.controlSchemes[m_JoystickSchemeIndex];
|
||||
}
|
||||
}
|
||||
private int m_XRSchemeIndex = -1;
|
||||
public InputControlScheme XRScheme
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_XRSchemeIndex == -1) m_XRSchemeIndex = asset.FindControlSchemeIndex("XR");
|
||||
return asset.controlSchemes[m_XRSchemeIndex];
|
||||
}
|
||||
}
|
||||
public interface IMenuActions
|
||||
{
|
||||
void OnToggle(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 337598c194bddae77922f951b35575d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -5,11 +5,10 @@
|
||||
--purple: rgb(164, 35, 188);
|
||||
--yellow: rgb(255, 161, 0);
|
||||
--white: rgb(245, 245, 245);
|
||||
}
|
||||
|
||||
#shipUi {
|
||||
color: var(--white);
|
||||
font-size: 24px;
|
||||
letter-spacing: 24px;
|
||||
unity-font: "Jura Medium";
|
||||
}
|
||||
|
||||
#list-entry {
|
||||
@@ -31,7 +30,6 @@
|
||||
|
||||
.green {
|
||||
color: var(--green);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.purple {
|
||||
File renamed without changes.
Reference in new issue
Block a user