Added filepath panel
This commit is contained in:
parent
0fab824709
commit
3270cc0b10
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Parking
|
namespace Parking
|
||||||
{
|
{
|
||||||
@ -9,8 +10,10 @@ namespace Parking
|
|||||||
{
|
{
|
||||||
public static List<Driver> Drivers = new();
|
public static List<Driver> Drivers = new();
|
||||||
|
|
||||||
public static void ReadFile(string path)
|
public static bool ReadFile(string path)
|
||||||
{
|
{
|
||||||
|
if (!File.Exists(path))
|
||||||
|
return false;
|
||||||
string fileData = File.ReadAllText(path);
|
string fileData = File.ReadAllText(path);
|
||||||
string[] lines = fileData.Split("\n"[0]);
|
string[] lines = fileData.Split("\n"[0]);
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
@ -70,6 +73,7 @@ namespace Parking
|
|||||||
|
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,6 +21,9 @@ namespace Parking
|
|||||||
[SerializeField] private TextMeshProUGUI timeText;
|
[SerializeField] private TextMeshProUGUI timeText;
|
||||||
[SerializeField] public TextMeshProUGUI countsText;
|
[SerializeField] public TextMeshProUGUI countsText;
|
||||||
[SerializeField] public TextMeshProUGUI rejectedText;
|
[SerializeField] public TextMeshProUGUI rejectedText;
|
||||||
|
[SerializeField] public TextMeshProUGUI pathText;
|
||||||
|
[SerializeField] public GameObject startPanel;
|
||||||
|
[SerializeField] public GameObject notFoundPanel;
|
||||||
[SerializeField] public GameObject spotPrefabA;
|
[SerializeField] public GameObject spotPrefabA;
|
||||||
[SerializeField] public GameObject spotPrefabB;
|
[SerializeField] public GameObject spotPrefabB;
|
||||||
[SerializeField] public GameObject spotPrefabC;
|
[SerializeField] public GameObject spotPrefabC;
|
||||||
@ -50,12 +53,25 @@ namespace Parking
|
|||||||
{
|
{
|
||||||
_spotPrefabs = new List<GameObject> {spotPrefabA, spotPrefabB, spotPrefabC, spotPrefabD};
|
_spotPrefabs = new List<GameObject> {spotPrefabA, spotPrefabB, spotPrefabC, spotPrefabD};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReadDataButtonClick()
|
||||||
|
{
|
||||||
|
if (!DataImporter.ReadFile(pathText.text.Replace("\u200B", ""))) {
|
||||||
|
notFoundPanel.SetActive(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InitiateManager();
|
||||||
|
startPanel.SetActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitiateManager()
|
||||||
|
{
|
||||||
timeText.text = _currentTime.ToString();
|
timeText.text = _currentTime.ToString();
|
||||||
rejectedText.text = $"Małe: {_rejectedDrivers[0]} Średnie: {_rejectedDrivers[1]} " +
|
rejectedText.text = $"Małe: {_rejectedDrivers[0]} Średnie: {_rejectedDrivers[1]} " +
|
||||||
$"Duże: {_rejectedDrivers[2]}";
|
$"Duże: {_rejectedDrivers[2]}";
|
||||||
GenerateEmergencyPlan();
|
GenerateEmergencyPlan();
|
||||||
|
|
||||||
DataImporter.ReadFile("Assets/Data/Tablica4.csv");
|
|
||||||
InitialConfigurationGenerator generator = new();
|
InitialConfigurationGenerator generator = new();
|
||||||
_initialSolution = generator.FindSolution();
|
_initialSolution = generator.FindSolution();
|
||||||
ArrangeSpots(_initialSolution);
|
ArrangeSpots(_initialSolution);
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user