Added csv import
This commit is contained in:
parent
9b0fc4404c
commit
896f510068
8
Assets/Data.meta
Normal file
8
Assets/Data.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ebd423cd64b7acae3878ad5c292ec91c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
141
Assets/Data/v1.csv
Normal file
141
Assets/Data/v1.csv
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
parkowanie,gabaryt,odz,doz,odr,dor
|
||||||
|
P,Duży,9,15,8:45,13:20
|
||||||
|
T,Duży,8,10,7:53,10:01
|
||||||
|
,Duży,9,13,8:53,14:02
|
||||||
|
P,Duży,8,16,7:45,16:10
|
||||||
|
,Duży,9,16,9:30,14
|
||||||
|
P,Duży,11,14,12,14:10
|
||||||
|
P,Duży,10,15,9:50,13:10
|
||||||
|
P,Duży,9,15,9:20,14:50
|
||||||
|
,Duży,9,17,9,17:04
|
||||||
|
,Duży,12,17,12:50,17:02
|
||||||
|
,Duży,9,17,9,16:58
|
||||||
|
P,Duży,10,15,9:50,13:30
|
||||||
|
,Duży,9,14,9:30,14:10
|
||||||
|
,Duży,8,16,7:56,17:12
|
||||||
|
,Duży,9,15,10,12:30
|
||||||
|
,Duży,8,16,7:50,17:05
|
||||||
|
P,Mały,7,15,6:40,14:50
|
||||||
|
,Średni,7,15,7:05,15:14
|
||||||
|
,Duży,10,16,10:49,15:58
|
||||||
|
P,Średni,8,16,8:49,15:04
|
||||||
|
,Średni,9,17,9:23,16:59
|
||||||
|
P,Duży,8,16,7:49,16:05
|
||||||
|
T,Średni,7:30,15:30,7:27,15:36
|
||||||
|
T,Duży,8,16,8:10,15:50
|
||||||
|
P,Duży,7:30,15:30,7:53,15:37
|
||||||
|
,Duży,8,16,7:53,16:01
|
||||||
|
T,Średni,7:30,15:30,7:35,15:30
|
||||||
|
,Duży,8,16,7:53,16:40
|
||||||
|
P,Średni,8,16,7:57,16:01
|
||||||
|
,Średni,8,16,7:45,16:10
|
||||||
|
T,Duży,11,16,11:18,16:13
|
||||||
|
,Duży,10,16,10:05,16:08
|
||||||
|
,Duży,7,15,7,15:10
|
||||||
|
P,Mały,6,14,6:05,13:55
|
||||||
|
,Mały,8,16,7:45,16:10
|
||||||
|
P,Średni,8,16,7:50,16:15
|
||||||
|
,Duży,8,16,8:03,16:10
|
||||||
|
,Średni,8,10,8,9:58
|
||||||
|
,Średni,7:30,12:30,7:25,12:32
|
||||||
|
T,Duży,8,12,8:02,12:05
|
||||||
|
,Średni,7:30,13:30,7:28,13:40
|
||||||
|
T,Średni,7:30,15:30,7:15,15:17
|
||||||
|
,Mały,8,16,7:45,16:10
|
||||||
|
P,Średni,7,7,6:58,7:10
|
||||||
|
P,Duży,8,16,7:57,15:58
|
||||||
|
,Średni,6,14,6:05,14:10
|
||||||
|
,Średni,6,14,6:01,14:03
|
||||||
|
,Mały,6:30,14:30,6:32,14:34
|
||||||
|
P,Średni,7,15,6:57,15
|
||||||
|
P,Duży,8,16,7:45,16:10
|
||||||
|
,Średni,8,16,8:02,15:59
|
||||||
|
,Średni,8:30,16:30,8:21,16:27
|
||||||
|
P,Mały,9,17,9:02,17:10
|
||||||
|
,Średni,9,17,8:57,16:58
|
||||||
|
,Średni,8,16,8:04,16:12
|
||||||
|
,Mały,8,16,7:52,15:57
|
||||||
|
T,Średni,7,15,7:08,15:14
|
||||||
|
,Średni,7:30,15:30,7:31,15:39
|
||||||
|
,Duży,8,16,7:56,15:57
|
||||||
|
,Mały,8,16,7:50,15:59
|
||||||
|
P,Średni,8:30,16:30,8:27,16:34
|
||||||
|
,Mały,7,15,6:57,15:05
|
||||||
|
,Średni,8,16,8:02,15:59
|
||||||
|
T,Średni,7,15,6:54,15:01
|
||||||
|
,Mały,8,16,7:49,15:58
|
||||||
|
,Średni,8,16,8,15:58
|
||||||
|
,Duży,8:30,16:30,8:25,16:32
|
||||||
|
T,Średni,8,16,8:04,16:10
|
||||||
|
,Średni,7,15,6:58,15:03
|
||||||
|
,Średni,7:30,15:30,7:29,15:40
|
||||||
|
,Mały,7:30,3:30,7:28,12:33
|
||||||
|
P,Średni,7,15,7:57,14:59
|
||||||
|
P,Mały,7,13,0:00,0:00
|
||||||
|
,Duży,8,16,8:04,15:59
|
||||||
|
,Średni,7:30,15:30,7:25,15:35
|
||||||
|
P,Mały,8,16,8:02,15:58
|
||||||
|
,Duży,7:30,15:30,7:28,15:34
|
||||||
|
,Średni,8,16,7:53,16:01
|
||||||
|
,Średni,7,12,6:58,12:05
|
||||||
|
,Mały,8,13,7:56,13:59
|
||||||
|
,Mały,7:30,12,7:24,12:28
|
||||||
|
,Średni,8,14,8:01,14:07
|
||||||
|
T,Duży,8,13,8:10,13:12
|
||||||
|
,Średni,7:30,15:30,7:22,15:20
|
||||||
|
P,Średni,8,16,7:49,15:58
|
||||||
|
,Mały,8,16,7:45,16:10
|
||||||
|
,Średni,7:30,15:30,7:31,15:35
|
||||||
|
,Duży,7,15,6:57,15:01
|
||||||
|
T,Średni,7,15,7:08,1:15
|
||||||
|
,Mały,7:30,15:30,7:25,15:28
|
||||||
|
,Duży,8,16,7:53,16:01
|
||||||
|
P,Średni,8,16,7:56,15:58
|
||||||
|
,Średni,7,15,6:56,15:03
|
||||||
|
T,Mały,7,15,7,15:05
|
||||||
|
,Średni,8,16,7:56,16:58
|
||||||
|
P,Średni,7,15,6:57,14:59
|
||||||
|
,Średni,7,15,6:55,14:58
|
||||||
|
,Duży,8,16,8:02,16:07
|
||||||
|
T,Średni,8,16,7:56,16:05
|
||||||
|
,Średni,7,15,6:58,15:03
|
||||||
|
,Duży,8,16,8,16:05
|
||||||
|
,Mały,8,16,8:04,15:58
|
||||||
|
,Średni,7:30,15:30,7:34,15:40
|
||||||
|
P,Średni,8,16,7:53,16:01
|
||||||
|
,Średni,8,13,7:49,13:02
|
||||||
|
,Średni,7,15,6:58,15:04
|
||||||
|
,Średni,7,15,7:08,15:05
|
||||||
|
P,Średni,8,16,7:58,16:05
|
||||||
|
,Średni,7,15,7:04,15:11
|
||||||
|
P,Średni,6:30,14:30,6:25,14:29
|
||||||
|
P,Średni,9,17,8:49,17:05
|
||||||
|
,Średni,9,17,8:55,17:01
|
||||||
|
P,Duży,7,15,6:58,15:10
|
||||||
|
,Duży,7:30,15:30,7:25,15:31
|
||||||
|
,Średni,7:30,11:30,7:27,11:32
|
||||||
|
T,Średni,8,16,7:56,16
|
||||||
|
,Średni,8,16,8:02,16:05
|
||||||
|
,Średni,7:30,15:30,7:36,15:40
|
||||||
|
,Średni,8,16,8:04,16:07
|
||||||
|
P,Średni,8,9,7:59,9:09
|
||||||
|
,Średni,7:15,15:15,7:10,15:18
|
||||||
|
T,Duży,8,16,7:49,15:51
|
||||||
|
,Średni,8,16,8:04,16:11
|
||||||
|
P,Średni,8,16,8:02,16:03
|
||||||
|
,Średni,7,15,7:01,15:07
|
||||||
|
,Duży,7:30,15:30,7:25,15:25
|
||||||
|
P,Średni,7,15,7:08,15:15
|
||||||
|
,Średni,8,16,7:45,16:10
|
||||||
|
,Średni,8,16,7:49,15:59
|
||||||
|
,Średni,8,16,7:45,16:10
|
||||||
|
T,Duży,7,15,7:07,15:20
|
||||||
|
,Średni,7,15,7:02,15:11
|
||||||
|
,Średni,8,16,8:06,15:49
|
||||||
|
P,Średni,7,15,7:24,16:40
|
||||||
|
,Średni,8,16,8:02,16:05
|
||||||
|
,Duży,8,16,8:05,16:01
|
||||||
|
T,Średni,7,15,7:13,15:13
|
||||||
|
,Średni,8,16,7:36,16:00
|
||||||
|
T,Średni,7,15,6:55,15:11
|
||||||
|
,Średni,9,17,9:09,17:14
|
|
7
Assets/Data/v1.csv.meta
Normal file
7
Assets/Data/v1.csv.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2a81d8f8e525426368b25d72c55db710
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
49
Assets/Scripts/DataImporter.cs
Normal file
49
Assets/Scripts/DataImporter.cs
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class DataImporter
|
||||||
|
{
|
||||||
|
public static List<Driver> Drivers = new List<Driver>();
|
||||||
|
|
||||||
|
public static void ReadFile(string path)
|
||||||
|
{
|
||||||
|
string fileData = System.IO.File.ReadAllText(path);
|
||||||
|
String[] lines = fileData.Split("\n"[0]);
|
||||||
|
int counter = 0;
|
||||||
|
foreach (string line in lines)
|
||||||
|
{
|
||||||
|
if (counter == 0)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String[] lineData = (line.Trim()).Split(',');
|
||||||
|
ParkingPreference preference = (lineData[0] == "" ? ParkingPreference.Any : (lineData[0] == "P" ? ParkingPreference.Front : ParkingPreference.Back));
|
||||||
|
Size size;
|
||||||
|
switch (lineData[1])
|
||||||
|
{
|
||||||
|
case "Mały":
|
||||||
|
size = Size.A;
|
||||||
|
break;
|
||||||
|
case "Średni":
|
||||||
|
size = Size.B;
|
||||||
|
break;
|
||||||
|
case "Duży":
|
||||||
|
size = Size.C;
|
||||||
|
break;
|
||||||
|
case "Max":
|
||||||
|
size = Size.D;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
size = Size.A;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Drivers.Add(new(size, counter, preference));
|
||||||
|
// float.TryParse(lineData[0], x);
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Scripts/DataImporter.cs.meta
Normal file
3
Assets/Scripts/DataImporter.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5e2f429284ba4230af09fa2b4ffa4e69
|
||||||
|
timeCreated: 1661443751
|
31
Assets/Scripts/Driver.cs
Normal file
31
Assets/Scripts/Driver.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using Unity.Burst.Intrinsics;
|
||||||
|
using Unity.VisualScripting;
|
||||||
|
|
||||||
|
public class Driver
|
||||||
|
{
|
||||||
|
public Size Size = Size.A;
|
||||||
|
public int Priority = 0;
|
||||||
|
public ParkingPreference ParkingPreference = ParkingPreference.Any;
|
||||||
|
|
||||||
|
public Driver(Size size, int priority, ParkingPreference parkingPreference)
|
||||||
|
{
|
||||||
|
this.Size = size;
|
||||||
|
this.Priority = priority;
|
||||||
|
this.ParkingPreference = parkingPreference;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Size {
|
||||||
|
A = 0,
|
||||||
|
B = 1,
|
||||||
|
C = 2,
|
||||||
|
D = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum ParkingPreference {
|
||||||
|
Any = 0,
|
||||||
|
Front = 1,
|
||||||
|
Back = 2,
|
||||||
|
}
|
3
Assets/Scripts/Driver.cs.meta
Normal file
3
Assets/Scripts/Driver.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 66728e0eba7c41d1a27ed4a98bc31d91
|
||||||
|
timeCreated: 1661444543
|
@ -11,6 +11,9 @@ public class ParkingManager : MonoBehaviour
|
|||||||
[SerializeField] private int stepTime = 15;
|
[SerializeField] private int stepTime = 15;
|
||||||
[SerializeField] private TextMeshProUGUI timeText;
|
[SerializeField] private TextMeshProUGUI timeText;
|
||||||
|
|
||||||
|
private float _spotWidth = 2.25f;
|
||||||
|
private float[] _spotHeights = {3.5f, 4f, 5f, 7.5f};
|
||||||
|
|
||||||
private TimeSpan _currentTime = TimeSpan.FromHours(8);
|
private TimeSpan _currentTime = TimeSpan.FromHours(8);
|
||||||
|
|
||||||
public void AdvanceTime()
|
public void AdvanceTime()
|
||||||
@ -23,6 +26,8 @@ public class ParkingManager : MonoBehaviour
|
|||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
timeText.text = _currentTime.ToString();
|
timeText.text = _currentTime.ToString();
|
||||||
|
DataImporter.ReadFile("Assets/Data/v1.csv");
|
||||||
|
Debug.Log(DataImporter.Drivers);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
Loading…
Reference in New Issue
Block a user