Added csv import

This commit is contained in:
Dawid Pietrykowski 2022-08-25 18:38:38 +02:00
parent 9b0fc4404c
commit 896f510068
8 changed files with 247 additions and 0 deletions

8
Assets/Data.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ebd423cd64b7acae3878ad5c292ec91c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

141
Assets/Data/v1.csv Normal file
View 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
1 parkowanie gabaryt odz doz odr dor
2 P Duży 9 15 8:45 13:20
3 T Duży 8 10 7:53 10:01
4 Duży 9 13 8:53 14:02
5 P Duży 8 16 7:45 16:10
6 Duży 9 16 9:30 14
7 P Duży 11 14 12 14:10
8 P Duży 10 15 9:50 13:10
9 P Duży 9 15 9:20 14:50
10 Duży 9 17 9 17:04
11 Duży 12 17 12:50 17:02
12 Duży 9 17 9 16:58
13 P Duży 10 15 9:50 13:30
14 Duży 9 14 9:30 14:10
15 Duży 8 16 7:56 17:12
16 Duży 9 15 10 12:30
17 Duży 8 16 7:50 17:05
18 P Mały 7 15 6:40 14:50
19 Średni 7 15 7:05 15:14
20 Duży 10 16 10:49 15:58
21 P Średni 8 16 8:49 15:04
22 Średni 9 17 9:23 16:59
23 P Duży 8 16 7:49 16:05
24 T Średni 7:30 15:30 7:27 15:36
25 T Duży 8 16 8:10 15:50
26 P Duży 7:30 15:30 7:53 15:37
27 Duży 8 16 7:53 16:01
28 T Średni 7:30 15:30 7:35 15:30
29 Duży 8 16 7:53 16:40
30 P Średni 8 16 7:57 16:01
31 Średni 8 16 7:45 16:10
32 T Duży 11 16 11:18 16:13
33 Duży 10 16 10:05 16:08
34 Duży 7 15 7 15:10
35 P Mały 6 14 6:05 13:55
36 Mały 8 16 7:45 16:10
37 P Średni 8 16 7:50 16:15
38 Duży 8 16 8:03 16:10
39 Średni 8 10 8 9:58
40 Średni 7:30 12:30 7:25 12:32
41 T Duży 8 12 8:02 12:05
42 Średni 7:30 13:30 7:28 13:40
43 T Średni 7:30 15:30 7:15 15:17
44 Mały 8 16 7:45 16:10
45 P Średni 7 7 6:58 7:10
46 P Duży 8 16 7:57 15:58
47 Średni 6 14 6:05 14:10
48 Średni 6 14 6:01 14:03
49 Mały 6:30 14:30 6:32 14:34
50 P Średni 7 15 6:57 15
51 P Duży 8 16 7:45 16:10
52 Średni 8 16 8:02 15:59
53 Średni 8:30 16:30 8:21 16:27
54 P Mały 9 17 9:02 17:10
55 Średni 9 17 8:57 16:58
56 Średni 8 16 8:04 16:12
57 Mały 8 16 7:52 15:57
58 T Średni 7 15 7:08 15:14
59 Średni 7:30 15:30 7:31 15:39
60 Duży 8 16 7:56 15:57
61 Mały 8 16 7:50 15:59
62 P Średni 8:30 16:30 8:27 16:34
63 Mały 7 15 6:57 15:05
64 Średni 8 16 8:02 15:59
65 T Średni 7 15 6:54 15:01
66 Mały 8 16 7:49 15:58
67 Średni 8 16 8 15:58
68 Duży 8:30 16:30 8:25 16:32
69 T Średni 8 16 8:04 16:10
70 Średni 7 15 6:58 15:03
71 Średni 7:30 15:30 7:29 15:40
72 Mały 7:30 3:30 7:28 12:33
73 P Średni 7 15 7:57 14:59
74 P Mały 7 13 0:00 0:00
75 Duży 8 16 8:04 15:59
76 Średni 7:30 15:30 7:25 15:35
77 P Mały 8 16 8:02 15:58
78 Duży 7:30 15:30 7:28 15:34
79 Średni 8 16 7:53 16:01
80 Średni 7 12 6:58 12:05
81 Mały 8 13 7:56 13:59
82 Mały 7:30 12 7:24 12:28
83 Średni 8 14 8:01 14:07
84 T Duży 8 13 8:10 13:12
85 Średni 7:30 15:30 7:22 15:20
86 P Średni 8 16 7:49 15:58
87 Mały 8 16 7:45 16:10
88 Średni 7:30 15:30 7:31 15:35
89 Duży 7 15 6:57 15:01
90 T Średni 7 15 7:08 1:15
91 Mały 7:30 15:30 7:25 15:28
92 Duży 8 16 7:53 16:01
93 P Średni 8 16 7:56 15:58
94 Średni 7 15 6:56 15:03
95 T Mały 7 15 7 15:05
96 Średni 8 16 7:56 16:58
97 P Średni 7 15 6:57 14:59
98 Średni 7 15 6:55 14:58
99 Duży 8 16 8:02 16:07
100 T Średni 8 16 7:56 16:05
101 Średni 7 15 6:58 15:03
102 Duży 8 16 8 16:05
103 Mały 8 16 8:04 15:58
104 Średni 7:30 15:30 7:34 15:40
105 P Średni 8 16 7:53 16:01
106 Średni 8 13 7:49 13:02
107 Średni 7 15 6:58 15:04
108 Średni 7 15 7:08 15:05
109 P Średni 8 16 7:58 16:05
110 Średni 7 15 7:04 15:11
111 P Średni 6:30 14:30 6:25 14:29
112 P Średni 9 17 8:49 17:05
113 Średni 9 17 8:55 17:01
114 P Duży 7 15 6:58 15:10
115 Duży 7:30 15:30 7:25 15:31
116 Średni 7:30 11:30 7:27 11:32
117 T Średni 8 16 7:56 16
118 Średni 8 16 8:02 16:05
119 Średni 7:30 15:30 7:36 15:40
120 Średni 8 16 8:04 16:07
121 P Średni 8 9 7:59 9:09
122 Średni 7:15 15:15 7:10 15:18
123 T Duży 8 16 7:49 15:51
124 Średni 8 16 8:04 16:11
125 P Średni 8 16 8:02 16:03
126 Średni 7 15 7:01 15:07
127 Duży 7:30 15:30 7:25 15:25
128 P Średni 7 15 7:08 15:15
129 Średni 8 16 7:45 16:10
130 Średni 8 16 7:49 15:59
131 Średni 8 16 7:45 16:10
132 T Duży 7 15 7:07 15:20
133 Średni 7 15 7:02 15:11
134 Średni 8 16 8:06 15:49
135 P Średni 7 15 7:24 16:40
136 Średni 8 16 8:02 16:05
137 Duży 8 16 8:05 16:01
138 T Średni 7 15 7:13 15:13
139 Średni 8 16 7:36 16:00
140 T Średni 7 15 6:55 15:11
141 Średni 9 17 9:09 17:14

7
Assets/Data/v1.csv.meta Normal file
View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2a81d8f8e525426368b25d72c55db710
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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++;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5e2f429284ba4230af09fa2b4ffa4e69
timeCreated: 1661443751

31
Assets/Scripts/Driver.cs Normal file
View 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,
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 66728e0eba7c41d1a27ed4a98bc31d91
timeCreated: 1661444543

View File

@ -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