This commit is contained in:
ntr committed 2023-07-30 20:25:20 +10:00
1 parent acc348b824
commit 57c19e56fc
4 files changed
+235 -44

No files matched your search

@@ -198,19 +198,19 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -1288.6 value: -1063.3
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 177.8 value: 123
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 3777.4 value: 3196.1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
value: 0.9992902 value: 0.99997115
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
@@ -218,7 +218,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: -0.037671022 value: -0.0075994497
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
@@ -230,7 +230,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y propertyPath: m_LocalEulerAnglesHint.y
value: -4.318 value: -0.871
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
@@ -305,15 +305,15 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3} - target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3}
propertyPath: m_LocalScale.x propertyPath: m_LocalScale.x
value: 3 value: 2.5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3} - target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3}
propertyPath: m_LocalScale.y propertyPath: m_LocalScale.y
value: 3 value: 2.5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3} - target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3}
propertyPath: m_LocalScale.z propertyPath: m_LocalScale.z
value: 3 value: 2.5
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3} - target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
@@ -321,7 +321,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3} - target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: -1229 value: -1030
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3} - target: {fileID: -8679921383154817045, guid: 64b045a17d258ce37b459b444db394d4, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
@@ -843,7 +843,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 2269 value: 1976.1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
@@ -851,7 +851,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 3942 value: 3195.2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} - target: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
+140 -1
View File
@@ -370,6 +370,17 @@ Transform:
m_CorrespondingSourceObject: {fileID: 7588376663361902483, guid: 73ab56de058af21389c312279181f856, type: 3} m_CorrespondingSourceObject: {fileID: 7588376663361902483, guid: 73ab56de058af21389c312279181f856, type: 3}
m_PrefabInstance: {fileID: 383038820} m_PrefabInstance: {fileID: 383038820}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!114 &454666965 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3196322292278199376, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
m_PrefabInstance: {fileID: 6345872851367721384}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a6214f498273bf702b0ad56b756b4e93, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &546969762 --- !u!1001 &546969762
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -436,6 +447,79 @@ Transform:
m_CorrespondingSourceObject: {fileID: 7588376663361902483, guid: 73ab56de058af21389c312279181f856, type: 3} m_CorrespondingSourceObject: {fileID: 7588376663361902483, guid: 73ab56de058af21389c312279181f856, type: 3}
m_PrefabInstance: {fileID: 546969762} m_PrefabInstance: {fileID: 546969762}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &585045537
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 3221660762140721390, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_Name
value: Menu
objectReference: {fileID: 0}
- target: {fileID: 5313449993149091347, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: shipUi
value:
objectReference: {fileID: 1292078235}
- target: {fileID: 5313449993149091347, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: timingDoc
value:
objectReference: {fileID: 1292078237}
- target: {fileID: 5313449993149091347, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: shipControls
value:
objectReference: {fileID: 1972710421}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9074617566735061565, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ebed5434f18ca13e38d2d7bfcc18d6c3, type: 3}
--- !u!1001 &646057803 --- !u!1001 &646057803
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1021,6 +1105,28 @@ Transform:
m_CorrespondingSourceObject: {fileID: 7588376663361902483, guid: 73ab56de058af21389c312279181f856, type: 3} m_CorrespondingSourceObject: {fileID: 7588376663361902483, guid: 73ab56de058af21389c312279181f856, type: 3}
m_PrefabInstance: {fileID: 1287343202} m_PrefabInstance: {fileID: 1287343202}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!114 &1292078235 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5975136821837370545, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
m_PrefabInstance: {fileID: 6345872851367721384}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 14d590d5e541e871cb4b472e9e009128, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1292078237 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 957429026670911964, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
m_PrefabInstance: {fileID: 6345872851367721384}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1297026289 --- !u!1001 &1297026289
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1819,6 +1925,17 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2080261968 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1367906234716419496, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
m_PrefabInstance: {fileID: 6345872851367721384}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a6214f498273bf702b0ad56b756b4e93, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &2096232366 --- !u!1001 &2096232366
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2183,6 +2300,10 @@ PrefabInstance:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 1367906234716419496, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
propertyPath: sector
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2603084029878042569, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3} - target: {fileID: 2603084029878042569, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: Timing value: Timing
@@ -2191,6 +2312,10 @@ PrefabInstance:
propertyPath: m_IsActive propertyPath: m_IsActive
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3196322292278199376, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
propertyPath: sector
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4743817676494260426, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3} - target: {fileID: 4743817676494260426, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 4 value: 4
@@ -2247,8 +2372,22 @@ PrefabInstance:
propertyPath: m_Enabled propertyPath: m_Enabled
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8438506523596255020, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
propertyPath: sectors.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 8438506523596255020, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
propertyPath: sectors.Array.data[0]
value:
objectReference: {fileID: 2080261968}
- target: {fileID: 8438506523596255020, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
propertyPath: sectors.Array.data[1]
value:
objectReference: {fileID: 454666965}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects:
- {fileID: 968610525847117003, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
- {fileID: 711392991746672853, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3} m_SourcePrefab: {fileID: 100100000, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3}
+83 -30
View File
@@ -4,6 +4,7 @@ using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using UnityEngine.SceneManagement;
public enum SectorColour { public enum SectorColour {
Green, Green,
@@ -12,31 +13,18 @@ public enum SectorColour {
Yellow, Yellow,
} }
public readonly struct SectorTime { [Serializable]
public SectorTime(int i, double t) { public struct SectorTime {
Sector = i; public int Sector;
Seconds = t; public double Seconds;
Colour = SectorColour.White;
}
public int Sector { get; }
public double Seconds { get; }
public SectorColour Colour { get; }
public override string ToString() => $"{Seconds:0.000}"; public override string ToString() => $"{Seconds:0.000}";
// public string ColourClass() => Colour switch {
// SectorColour.Green => "green",
// SectorColour.Purple => "purple",
// SectorColour.White => "white",
// SectorColour.Yellow => "yellow",
// _ => throw new Exception("unknown colour"),
// };
} }
[Serializable]
public struct Lap { public struct Lap {
public int Number { get; set; } public string Map;
public List<SectorTime> Sectors { get; set; } public int Number;
public List<SectorTime> Sectors;
// 0:1:39 // 0:1:39
public override string ToString() { public override string ToString() {
@@ -48,6 +36,45 @@ public struct Lap {
} }
} }
static class LapStorageService {
static Dictionary<string, LapJSON> lapsByMap;
static string lapStoragePath = Path.Combine(Application.persistentDataPath, "lapStorage.json");
static void GetPlayerLaps() {
// read json
// assign it to lapStorage
}
// laps.count
static int NumberOfCompletions() {}
// finds your PB in all completions
static int Rank() {}
// open json
public static void PersistLap(Lap lap) {
bool found = lapsByMap.TryGetValue(lap.Map, out var lapJson);
if (!found)
lapJson = new LapJSON { Map = lap.Map, Laps = new List<Lap>() };
LapJson.Laps.Add(lap);
lapsByMap[lap.Map] = lapJson;
LapStorage lapStorage = new LapStorage { Laps = lapsByMap.Values.ToList() };
File.WriteAllText(lapStoragePath, JsonUtility.ToJson(lapStorage));
}
}
[Serializable]
public class LapJSON {
public string Map;
public List<Lap> Laps;
}
public class LapStorage {
public List<LapJSON> Laps;
}
public class Timing: MonoBehaviour { public class Timing: MonoBehaviour {
[SerializeField] [SerializeField]
public List<Lap> lapTimes; public List<Lap> lapTimes;
@@ -61,13 +88,23 @@ public class Timing: MonoBehaviour {
double lapStart; double lapStart;
public Sector[] sectors; public Sector[] sectors;
public LapStorage lapStorage;
string mapName;
void Awake() { void Awake() {
lapTimes = new(); lapTimes = new();
sectorTimes = new List<SectorTime>(); sectorTimes = new List<SectorTime>();
sectorStart = 0.0; sectorStart = 0.0;
sectorTime = 0.0; sectorTime = 0.0;
sectors = GetComponentsInChildren<Sector>().OrderBy(s => s.sector).ToArray(); sectors = GetComponentsInChildren<Sector>().OrderBy(s => s.sector).ToArray();
// set map name
Scene scene = SceneManager.GetActiveScene();
mapName = scene.name;
Debug.Log("Track Sector Count - " + sectors.Length); Debug.Log("Track Sector Count - " + sectors.Length);
Persist();
} }
void Update() { void Update() {
@@ -96,8 +133,6 @@ public class Timing: MonoBehaviour {
sectorTime = 0; sectorTime = 0;
lapTime = 0; lapTime = 0;
Debug.Log("Timer Stopped"); Debug.Log("Timer Stopped");
EndLap();
} }
public void NextSector(int sector) { public void NextSector(int sector) {
@@ -119,11 +154,12 @@ public class Timing: MonoBehaviour {
double sTime = Time.timeAsDouble - sectorStart; double sTime = Time.timeAsDouble - sectorStart;
SectorTime s = new SectorTime(sector, sTime); SectorTime s = new SectorTime { Sector = sector, Seconds = sTime };
sectorTimes.Add(s); sectorTimes.Add(s);
sectorStart = Time.timeAsDouble; sectorStart = Time.timeAsDouble;
Debug.Log($"{sectorTimes.Count} / {sectors.Length}");
if (sectorTimes.Count == sectors.Length) { if (sectorTimes.Count == sectors.Length) {
EndLap(); EndLap();
NextLap(); NextLap();
@@ -141,11 +177,12 @@ public class Timing: MonoBehaviour {
if (sectorTimes == null) if (sectorTimes == null)
Awake(); Awake();
if (sectorTimes.Count > 0) { Debug.Log($"Ending lap Sectors={sectorTimes.Count} Name={mapName} Lap={lapTimes.Count}");
Lap l = new Lap { Number = lapTimes.Count, Sectors = sectorTimes };
Debug.Log($"EndLap {l}"); Lap l = new Lap { Map = mapName, Number = lapTimes.Count, Sectors = sectorTimes };
lapTimes.Add(l); Debug.Log($"EndLap {l}");
} lapTimes.Add(l);
Persist();
} }
public SectorColour GetSectorColour(SectorTime s) { public SectorColour GetSectorColour(SectorTime s) {
@@ -160,5 +197,21 @@ public class Timing: MonoBehaviour {
false => SectorColour.Yellow, false => SectorColour.Yellow,
}; };
} }
void Load() {
try {
string json = File.ReadAllText(lapStoragePath);
JsonUtility.FromJsonOverwrite(json, lapStorage);
} catch {
// file doesn't exist yet
return Persist();
}
}
void Persist() {
LapJSON lapJson = new LapJSON { Map = mapName, Laps = lapTimes };
string lapJsonStr = JsonUtility.ToJson(lapJson);
Debug.Log($"Lap JSON {lapJsonStr}");
}
} }
-1
View File
@@ -38,7 +38,6 @@ public class MenuUi : MonoBehaviour {
void SetupExit() { void SetupExit() {
exit = uiDocument.rootVisualElement.Q<Button>("exit"); exit = uiDocument.rootVisualElement.Q<Button>("exit");
Debug.Log(exit.ToString());
exit.clicked += Exit; exit.clicked += Exit;
} }