|
@@ -12,6 +12,7 @@ public class WorkerController : MonoBehaviour
|
|
|
{
|
|
|
public static Dictionary<uint, List<Structure>> Workers = new Dictionary<uint, List<Structure>>();
|
|
|
public static List<Structure> TestStructures = new List<Structure>();
|
|
|
+ public static List<Beacon> Beacons = new List<Beacon>();
|
|
|
|
|
|
public GameObject WorkersList; // scroll content
|
|
|
public Dropdown DropdownCompany;
|
|
@@ -37,8 +38,6 @@ public class WorkerController : MonoBehaviour
|
|
|
public Camera camera;
|
|
|
public Toggle projection;
|
|
|
|
|
|
- InputField inputField_date_text;
|
|
|
-
|
|
|
enum Mode { RealTime = 0, History = 1, Stop = 2 };
|
|
|
Mode active_mode = Mode.Stop;
|
|
|
int mode = 0;
|
|
@@ -59,6 +58,7 @@ public class WorkerController : MonoBehaviour
|
|
|
float time_draw = 0;
|
|
|
public static List<User> users = new List<User>();
|
|
|
public static bool users_load = false;
|
|
|
+ public static bool beacons_load = false;
|
|
|
uint location_id = 1;
|
|
|
|
|
|
//List<bool> StartStop = new List<bool>();
|
|
@@ -67,28 +67,8 @@ public class WorkerController : MonoBehaviour
|
|
|
void Start()
|
|
|
{
|
|
|
DebugHelper.ActivateConsole();
|
|
|
- //WorkerMarker(4, Color.red);
|
|
|
- //WorkerMarker(356, Color.green);
|
|
|
-
|
|
|
- inputField_date_text = inputField_date.transform.GetComponent<InputField>();
|
|
|
- //Year = DatePicker.transform.GetChild(0).GetComponent<Dropdown>();
|
|
|
- //Month = DatePicker.transform.GetChild(1).GetComponent<Dropdown>();
|
|
|
- //Day = DatePicker.transform.GetChild(2).GetComponent<Dropdown>();
|
|
|
|
|
|
Date = DatePicker.GetComponent<DateTimePicker>();
|
|
|
-
|
|
|
- //foreach (var s in structures.Select(s => s.acc_id).Distinct())
|
|
|
- // WorkerMarker(s, UnityEngine.Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f));
|
|
|
-
|
|
|
- //foreach (var s in structures.Select(s => s.ts.Date).Distinct())
|
|
|
- //{
|
|
|
- // dates.Add(s);
|
|
|
- // DropdownData.options.Add(new Dropdown.OptionData(s.ToString("dd.MM.yyyy")));
|
|
|
- //}
|
|
|
-
|
|
|
- //foreach (var s in structures.Select(s => s.location_id).Distinct())
|
|
|
- //{
|
|
|
- // locations.Add(s);
|
|
|
DropdownLocation.options.Add(new Dropdown.OptionData("1 Братск"));
|
|
|
DropdownLocation.options.Add(new Dropdown.OptionData("22 Офис Ижевск"));
|
|
|
DropdownLocation.options.Add(new Dropdown.OptionData("25"));
|
|
@@ -100,7 +80,7 @@ public class WorkerController : MonoBehaviour
|
|
|
}
|
|
|
|
|
|
int active_location = 0;
|
|
|
- int active_company = 0;
|
|
|
+ public static int active_company = 0;
|
|
|
// Update is called once per frame
|
|
|
void Update()
|
|
|
{
|
|
@@ -113,15 +93,11 @@ public class WorkerController : MonoBehaviour
|
|
|
switch (DropdownMode.value)
|
|
|
{
|
|
|
case 0:
|
|
|
- //history_start = false;
|
|
|
- //////inputField_date.gameObject.SetActive(false);
|
|
|
DatePicker.SetActive(false);
|
|
|
TimeStart.SetActive(false);
|
|
|
TimeEnd.SetActive(false);
|
|
|
break;
|
|
|
case 1:
|
|
|
- //real_time = false;
|
|
|
- //////inputField_date.gameObject.SetActive(true);
|
|
|
DatePicker.SetActive(true);
|
|
|
TimeStart.SetActive(true);
|
|
|
TimeEnd.SetActive(true);
|
|
@@ -150,18 +126,18 @@ public class WorkerController : MonoBehaviour
|
|
|
switch (DropdownLocation.value)
|
|
|
{
|
|
|
case 0:
|
|
|
- //inputField_location.text = "1";
|
|
|
location_id = 1;
|
|
|
break;
|
|
|
case 1:
|
|
|
- //inputField_location.text = "22";
|
|
|
location_id = 22;
|
|
|
break;
|
|
|
case 2:
|
|
|
- //inputField_location.text = "25";
|
|
|
location_id = 25;
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
+ Beacons = new List<Beacon>();
|
|
|
+ client.BeaconsRequest((uint) active_location);
|
|
|
}
|
|
|
|
|
|
foreach (var m in markers)
|
|
@@ -234,9 +210,16 @@ public class WorkerController : MonoBehaviour
|
|
|
|
|
|
if (users_load)
|
|
|
{
|
|
|
- foreach(var u in users.OrderBy(u => u.id))
|
|
|
- WorkerMarker(u, Color.green);
|
|
|
users_load = false;
|
|
|
+ foreach (var u in users.OrderBy(u => u.id))
|
|
|
+ WorkerMarker(u, Color.green);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (beacons_load)
|
|
|
+ {
|
|
|
+ beacons_load = false;
|
|
|
+ foreach (var b in Beacons)
|
|
|
+ AddBeacon(b);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -452,6 +435,14 @@ public class WorkerController : MonoBehaviour
|
|
|
moving[m.acc_id].step = step;
|
|
|
}
|
|
|
|
|
|
+ public void AddBeacon(Beacon b)
|
|
|
+ {
|
|
|
+ var beacon = Instantiate(Resources.Load("GameObjects/Beacon", typeof(GameObject))) as GameObject;
|
|
|
+ beacon.transform.position = new Vector3(b.x, 0.5f, b.y);
|
|
|
+ beacon.name = $"BeaconButton_{b.id}";
|
|
|
+ b.beacon = beacon;
|
|
|
+ }
|
|
|
+
|
|
|
public void OpenEditor()
|
|
|
{
|
|
|
SceneManager.LoadScene("Scenes/Editor2D");
|