colours n shit
This commit is contained in:
1 parent
6d33a2b018
commit
067104c1e1
9 files changed
+144
-38
No files matched your search
@@ -430,6 +430,15 @@
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "CloseMenu",
|
||||
"type": "Button",
|
||||
"id": "1652c3df-4953-4d94-931d-fa97b3642209",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
@@ -454,6 +463,17 @@
|
||||
"action": "ToggleMenu",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "6ac57c61-730a-42a5-987d-b1190e7a6882",
|
||||
"path": "<Gamepad>/buttonEast",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "CloseMenu",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class LapService {
|
||||
}
|
||||
|
||||
public IEnumerator GetLapTimes() {
|
||||
string uri = $"https://spacerace.systems/api/LapTimes?userId={_player.Id}&mapName={_mapName}";
|
||||
string uri = $"https://spacerace.systems/LapTimes?userId={_player.Id}&mapName={_mapName}";
|
||||
using (UnityWebRequest req = UnityWebRequest.Get(uri)) {
|
||||
yield return req.SendWebRequest();
|
||||
|
||||
@@ -95,7 +95,7 @@ public class LapService {
|
||||
|
||||
Debug.Log($"Posting lap: {JsonConvert.SerializeObject(dto)}");
|
||||
|
||||
using (UnityWebRequest req = UnityWebRequest.Post("https://spacerace.systems/api/Lap", JsonConvert.SerializeObject(dto), "application/json")) {
|
||||
using (UnityWebRequest req = UnityWebRequest.Post("https://spacerace.systems/Lap", JsonConvert.SerializeObject(dto), "application/json")) {
|
||||
yield return req.SendWebRequest();
|
||||
|
||||
if (req.result != UnityWebRequest.Result.Success) {
|
||||
|
||||
+31
-1
@@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
|
||||
// version 1.6.1
|
||||
// version 1.6.3
|
||||
// from Assets/Resources/SpaceRaceInput.inputactions
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
@@ -452,6 +452,15 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""CloseMenu"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""1652c3df-4953-4d94-931d-fa97b3642209"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
}
|
||||
],
|
||||
""bindings"": [
|
||||
@@ -476,6 +485,17 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable
|
||||
""action"": ""ToggleMenu"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""6ac57c61-730a-42a5-987d-b1190e7a6882"",
|
||||
""path"": ""<Gamepad>/buttonEast"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""CloseMenu"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -497,6 +517,7 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable
|
||||
// menu
|
||||
m_menu = asset.FindActionMap("menu", throwIfNotFound: true);
|
||||
m_menu_ToggleMenu = m_menu.FindAction("ToggleMenu", throwIfNotFound: true);
|
||||
m_menu_CloseMenu = m_menu.FindAction("CloseMenu", throwIfNotFound: true);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -677,11 +698,13 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable
|
||||
private readonly InputActionMap m_menu;
|
||||
private List<IMenuActions> m_MenuActionsCallbackInterfaces = new List<IMenuActions>();
|
||||
private readonly InputAction m_menu_ToggleMenu;
|
||||
private readonly InputAction m_menu_CloseMenu;
|
||||
public struct MenuActions
|
||||
{
|
||||
private @SpaceRaceInput m_Wrapper;
|
||||
public MenuActions(@SpaceRaceInput wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @ToggleMenu => m_Wrapper.m_menu_ToggleMenu;
|
||||
public InputAction @CloseMenu => m_Wrapper.m_menu_CloseMenu;
|
||||
public InputActionMap Get() { return m_Wrapper.m_menu; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
@@ -694,6 +717,9 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable
|
||||
@ToggleMenu.started += instance.OnToggleMenu;
|
||||
@ToggleMenu.performed += instance.OnToggleMenu;
|
||||
@ToggleMenu.canceled += instance.OnToggleMenu;
|
||||
@CloseMenu.started += instance.OnCloseMenu;
|
||||
@CloseMenu.performed += instance.OnCloseMenu;
|
||||
@CloseMenu.canceled += instance.OnCloseMenu;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(IMenuActions instance)
|
||||
@@ -701,6 +727,9 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable
|
||||
@ToggleMenu.started -= instance.OnToggleMenu;
|
||||
@ToggleMenu.performed -= instance.OnToggleMenu;
|
||||
@ToggleMenu.canceled -= instance.OnToggleMenu;
|
||||
@CloseMenu.started -= instance.OnCloseMenu;
|
||||
@CloseMenu.performed -= instance.OnCloseMenu;
|
||||
@CloseMenu.canceled -= instance.OnCloseMenu;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(IMenuActions instance)
|
||||
@@ -734,5 +763,6 @@ public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable
|
||||
public interface IMenuActions
|
||||
{
|
||||
void OnToggleMenu(InputAction.CallbackContext context);
|
||||
void OnCloseMenu(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,55 @@
|
||||
--purple: rgb(164, 35, 188);
|
||||
--yellow: rgb(255, 161, 0);
|
||||
--white: rgb(245, 245, 245);
|
||||
color: rgb(245, 245, 245);
|
||||
color: var(--white);
|
||||
border-color: var(--white);
|
||||
font-size: 24px;
|
||||
letter-spacing: 24px;
|
||||
-unity-font: url("/Assets/UI Toolkit/Fonts/Jura-Medium.otf");
|
||||
-unity-font-definition: initial;
|
||||
}
|
||||
|
||||
Button:focus {
|
||||
border-color: var(--green);
|
||||
}
|
||||
|
||||
Button:hover {
|
||||
border-color: var(--green);
|
||||
}
|
||||
|
||||
Slider:focus {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
Slider:hover {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
Slider:active {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
Slider:focus Label {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
Slider:hover Label {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
Slider:active Label {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
Toggle:focus Label {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
Toggle:hover Label {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
Toggle:active Label {
|
||||
color: var(--green);
|
||||
}
|
||||
|
||||
+9
-16
@@ -9,25 +9,18 @@
|
||||
height: 256px;
|
||||
}
|
||||
|
||||
#settings {
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
#tracksCtr {
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
Button {
|
||||
background-color: rgba(0, 0, 0, 0.26);
|
||||
color: rgb(255, 255, 255);
|
||||
border-radius: 5px;
|
||||
border-width: 3px;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
Button:focus {
|
||||
border-color: var(--green);
|
||||
}
|
||||
|
||||
Button:hover {
|
||||
border-color: var(--green);
|
||||
}
|
||||
|
||||
Toggle:focus {
|
||||
border-color: var(--green);
|
||||
}
|
||||
|
||||
Toggle:hover {
|
||||
border-color: var(--green);
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
<ui:VisualElement name="main" class="nav" style="flex-grow: 1;">
|
||||
<ui:VisualElement name="logo" />
|
||||
<ui:VisualElement name="tracksCtr" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0);">
|
||||
<ui:Label tabindex="-1" text="TRACK" display-tooltip-when-elided="true" name="Track" style="-unity-font: url('project://database/Assets/UI%20Toolkit/Fonts/Jura-DemiBold.otf?fileID=12800000&guid=1d103e83da4f14189b3e8b0b865eca3d&type=3#Jura-DemiBold'); -unity-font-style: bold;" />
|
||||
<ui:Label text="TRACK" display-tooltip-when-elided="true" name="Track" style="-unity-font: url('project://database/Assets/UI%20Toolkit/Fonts/Jura-DemiBold.otf?fileID=12800000&guid=1d103e83da4f14189b3e8b0b865eca3d&type=3#Jura-DemiBold'); -unity-font-style: bold;" />
|
||||
<ui:VisualElement name="tracks">
|
||||
<ui:Button text="sr_junglism" display-tooltip-when-elided="true" />
|
||||
<ui:Button text="sr_silverstorage" display-tooltip-when-elided="true" />
|
||||
@@ -12,9 +12,10 @@
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="settings" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0); flex-direction: column; display: flex; visibility: visible; align-items: flex-start; width: 33%;">
|
||||
<ui:Label tabindex="-1" text="SETTINGS" display-tooltip-when-elided="true" style="-unity-font-style: bold;" />
|
||||
<ui:Slider picking-mode="Ignore" label="View Sensitivity" value="1" high-value="3" name="mouseSens" low-value="0.1" style="width: 100%;" />
|
||||
<ui:Toggle label="Invert Y" name="invertY" tooltip="NYI" />
|
||||
<ui:Slider label="View Sensitivity" value="1" high-value="3" name="mouseSens" low-value="0.1" show-input-field="false" style="width: 100%;" />
|
||||
<ui:Label tabindex="-1" text="Label" display-tooltip-when-elided="true" name="viewSensLabel" style="-unity-text-align: upper-right; align-self: flex-end;" />
|
||||
<ui:Toggle label="Invert Y" name="invertY" tooltip="Invert Y Axis Controls" />
|
||||
</ui:VisualElement>
|
||||
<ui:Button text="EXIT" display-tooltip-when-elided="true" name="exit" style="flex-shrink: 1;" />
|
||||
<ui:Button text="EXIT" display-tooltip-when-elided="true" name="exit" tabindex="2" style="flex-shrink: 1; margin-left: 25px; margin-bottom: 24px;" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -2,7 +2,7 @@ using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
public class MenuControls : MonoBehaviour {
|
||||
UIDocument menuDoc;
|
||||
|
||||
[SerializeField]
|
||||
@@ -29,16 +29,14 @@ public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
|
||||
Toggle invertYToggle;
|
||||
Slider viewSensSlider;
|
||||
Label viewSensLabel;
|
||||
|
||||
bool visible = false;
|
||||
|
||||
void Awake() {
|
||||
menuDoc = GetComponent<UIDocument>();
|
||||
|
||||
if (input == null) {
|
||||
input = new SpaceRaceInput();
|
||||
input.menu.SetCallbacks(this);
|
||||
}
|
||||
if (input == null) input = new SpaceRaceInput();
|
||||
input.menu.Enable();
|
||||
|
||||
menuUi = GetComponent<MenuUI>();
|
||||
@@ -47,11 +45,22 @@ public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
return;
|
||||
}
|
||||
|
||||
SetupActions();
|
||||
Hide();
|
||||
}
|
||||
|
||||
void SetupActions() {
|
||||
if (input == null)
|
||||
input = new SpaceRaceInput();
|
||||
|
||||
input.menu.Enable();
|
||||
input.menu.ToggleMenu.started += OnToggleMenu;
|
||||
input.menu.CloseMenu.started += OnCloseMenu;
|
||||
}
|
||||
|
||||
void OnDestroy() {
|
||||
input.menu.RemoveCallbacks(this);
|
||||
input.menu.ToggleMenu.started -= OnToggleMenu;
|
||||
input.menu.CloseMenu.started -= OnCloseMenu;
|
||||
}
|
||||
|
||||
void Show() {
|
||||
@@ -87,9 +96,8 @@ public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
shipControls.enabled = true;
|
||||
}
|
||||
|
||||
public void OnToggleMenu(InputAction.CallbackContext ctx) {
|
||||
void OnToggleMenu(InputAction.CallbackContext _ctx) {
|
||||
visible = !visible;
|
||||
// Debug.Log($"Menu {visible}");
|
||||
|
||||
if (visible) {
|
||||
Show();
|
||||
@@ -100,11 +108,22 @@ public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions {
|
||||
return;
|
||||
}
|
||||
|
||||
void OnCloseMenu(InputAction.CallbackContext _ctx) {
|
||||
if (visible) Hide();
|
||||
}
|
||||
|
||||
void BindSettings() {
|
||||
Debug.Log("Setting controls change callbacks");
|
||||
invertYToggle = menuDoc.rootVisualElement.Q<Toggle>("invertY");
|
||||
viewSensSlider = menuDoc.rootVisualElement.Q<Slider>("mouseSens");
|
||||
viewSensLabel = menuDoc.rootVisualElement.Q<Label>("viewSensLabel");
|
||||
|
||||
viewSensLabel.text = $"{viewSensSlider.value:0.00}";
|
||||
|
||||
invertYToggle.RegisterValueChangedCallback(evt => shipControls.InvertY = evt.newValue);
|
||||
viewSensSlider.RegisterValueChangedCallback(evt => shipControls.ViewSens = evt.newValue);
|
||||
viewSensSlider.RegisterValueChangedCallback(evt => {
|
||||
shipControls.ViewSens = evt.newValue;
|
||||
viewSensLabel.text = $"{evt.newValue:0.00}";
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -134,8 +134,7 @@ PlayerSettings:
|
||||
vulkanEnableCommandBufferRecycling: 1
|
||||
loadStoreDebugModeEnabled: 0
|
||||
bundleVersion: 0.1
|
||||
preloadedAssets:
|
||||
- {fileID: 11400000, guid: 020903acd8b50dd45a683fb9312ba7af, type: 2}
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
m_HolographicPauseOnTrackingLoss: 1
|
||||
|
||||
Reference in new issue
Block a user