|
@@ -14,7 +14,6 @@ public class PlayerController : MonoBehaviour
|
|
public static PlayerController instance;
|
|
public static PlayerController instance;
|
|
public Dictionary<uint, List<Structure>> Workers = new Dictionary<uint, List<Structure>>();
|
|
public Dictionary<uint, List<Structure>> Workers = new Dictionary<uint, List<Structure>>();
|
|
public List<Structure> TestStructures = new List<Structure>();
|
|
public List<Structure> TestStructures = new List<Structure>();
|
|
- //public List<Beacon> Beacons = new List<Beacon>();
|
|
|
|
|
|
|
|
public GameObject WorkersList; // scroll content
|
|
public GameObject WorkersList; // scroll content
|
|
|
|
|
|
@@ -27,17 +26,13 @@ public class PlayerController : MonoBehaviour
|
|
public GameObject EndSec;
|
|
public GameObject EndSec;
|
|
public GameObject StartStopButton;
|
|
public GameObject StartStopButton;
|
|
public LocationZones locationZones;
|
|
public LocationZones locationZones;
|
|
- //public GameObject ErrorDialog;
|
|
|
|
public Dropdown DropdownMode;
|
|
public Dropdown DropdownMode;
|
|
public Toggle ToggleLine;
|
|
public Toggle ToggleLine;
|
|
public Toggle ToggleDisappearance;
|
|
public Toggle ToggleDisappearance;
|
|
|
|
|
|
public GameObject DatePicker;
|
|
public GameObject DatePicker;
|
|
Camera camera;
|
|
Camera camera;
|
|
- //public Toggle projection;
|
|
|
|
|
|
|
|
-
|
|
|
|
- //public GameObject LocationGameObject;
|
|
|
|
public GameObject UserInfo;
|
|
public GameObject UserInfo;
|
|
|
|
|
|
public GameObject Editor;
|
|
public GameObject Editor;
|
|
@@ -48,7 +43,6 @@ public class PlayerController : MonoBehaviour
|
|
public enum Mode { RealTime = 0, History = 1, Stop = 2 };
|
|
public enum Mode { RealTime = 0, History = 1, Stop = 2 };
|
|
public static Mode active_mode = Mode.Stop;
|
|
public static Mode active_mode = Mode.Stop;
|
|
int mode = 0;
|
|
int mode = 0;
|
|
- //public GameObject Time;
|
|
|
|
|
|
|
|
Client client;
|
|
Client client;
|
|
CompanyController company;
|
|
CompanyController company;
|
|
@@ -60,9 +54,7 @@ public class PlayerController : MonoBehaviour
|
|
Dictionary<uint, MarkerMoving> moving = new Dictionary<uint, MarkerMoving>(); // флаги начала движения
|
|
Dictionary<uint, MarkerMoving> moving = new Dictionary<uint, MarkerMoving>(); // флаги начала движения
|
|
|
|
|
|
const float INTERPOLATION_PERIOD = 0.1f;
|
|
const float INTERPOLATION_PERIOD = 0.1f;
|
|
- //float time_realtime = 0;
|
|
|
|
float time_draw = 0;
|
|
float time_draw = 0;
|
|
- //public List<User> users = new List<User>();
|
|
|
|
public bool users_load = false;
|
|
public bool users_load = false;
|
|
public bool beacons_load = false;
|
|
public bool beacons_load = false;
|
|
|
|
|
|
@@ -82,36 +74,21 @@ public class PlayerController : MonoBehaviour
|
|
company = CompanyController.instance;
|
|
company = CompanyController.instance;
|
|
editor = Editor.GetComponent<EditorController>();
|
|
editor = Editor.GetComponent<EditorController>();
|
|
camera = Camera.main;
|
|
camera = Camera.main;
|
|
- users = new Dictionary<uint, User>();
|
|
|
|
|
|
+ //users = new Dictionary<uint, User>();
|
|
|
|
|
|
Date = DatePicker.GetComponent<DateTimePicker>();
|
|
Date = DatePicker.GetComponent<DateTimePicker>();
|
|
- //locations.Add(new Location { id = 1, name = "1 Братск" });
|
|
|
|
- //locations.Add(new Location { id = 22, name = "22 Офис Ижевск" });
|
|
|
|
- //locations.Add(new Location { id = 25, name = "25" });
|
|
|
|
- //locations.Add(new Location { id = 26, name = "26 Братское (вагрант)" });
|
|
|
|
- //foreach (var l in locations)
|
|
|
|
- // DropdownLocation.options.Add(new Dropdown.OptionData(l.name));
|
|
|
|
-
|
|
|
|
- //for (int i = 0; i < Locations.transform.childCount; i++)
|
|
|
|
- // maps.Add(Locations.transform.GetChild(i).gameObject);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//Client.LocationsRequest();
|
|
//Client.LocationsRequest();
|
|
|
|
|
|
var broadcast_stop = UserInfo.transform.GetChild(1).GetChild(1).GetComponent<Button>();
|
|
var broadcast_stop = UserInfo.transform.GetChild(1).GetChild(1).GetComponent<Button>();
|
|
broadcast_stop.onClick.AddListener(() => BroadcastStop());
|
|
broadcast_stop.onClick.AddListener(() => BroadcastStop());
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
// Update is called once per frame
|
|
// Update is called once per frame
|
|
void Update()
|
|
void Update()
|
|
{
|
|
{
|
|
if (DropdownMode.value != mode)
|
|
if (DropdownMode.value != mode)
|
|
СhangeMode();
|
|
СhangeMode();
|
|
|
|
|
|
-
|
|
|
|
time_draw += Time.deltaTime;
|
|
time_draw += Time.deltaTime;
|
|
if (time_draw >= INTERPOLATION_PERIOD)
|
|
if (time_draw >= INTERPOLATION_PERIOD)
|
|
{
|
|
{
|
|
@@ -119,63 +96,37 @@ public class PlayerController : MonoBehaviour
|
|
time_draw -= INTERPOLATION_PERIOD;
|
|
time_draw -= INTERPOLATION_PERIOD;
|
|
}
|
|
}
|
|
|
|
|
|
- //if (active_mode == Mode.RealTime && !starting)
|
|
|
|
- //{
|
|
|
|
- // foreach (var m in markers)
|
|
|
|
- // {
|
|
|
|
- // if (m.toggle.isOn)
|
|
|
|
- // {
|
|
|
|
- // Debug.LogWarning($"send {m.acc_id}");
|
|
|
|
- // var index = company.locations_index[company.active_location];
|
|
|
|
- // client.CoordinatesRequest(0, 0, 1, company.locations[index].id, m.acc_id);
|
|
|
|
- // //end_send[m.acc_id] = false;
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // starting = true;
|
|
|
|
- //}\\\\\
|
|
|
|
-
|
|
|
|
- if (ToggleLine.isOn)
|
|
|
|
- {
|
|
|
|
- foreach (var u in users)
|
|
|
|
- u.Value.marker_line.gameObject.SetActive(true);
|
|
|
|
- ToggleDisappearance.interactable = true;
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
|
|
+ if (users != null)
|
|
{
|
|
{
|
|
- foreach (var u in users)
|
|
|
|
|
|
+ if (ToggleLine.isOn)
|
|
{
|
|
{
|
|
- u.Value.marker_line.gameObject.SetActive(false);
|
|
|
|
- u.Value.marker_line.positionCount = 0;
|
|
|
|
|
|
+ foreach (var u in users)
|
|
|
|
+ u.Value.marker_line.gameObject.SetActive(true);
|
|
|
|
+ ToggleDisappearance.interactable = true;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ foreach (var u in users)
|
|
|
|
+ {
|
|
|
|
+ u.Value.marker_line.gameObject.SetActive(false);
|
|
|
|
+ u.Value.marker_line.positionCount = 0;
|
|
|
|
+ }
|
|
|
|
+ ToggleDisappearance.interactable = false;
|
|
}
|
|
}
|
|
- ToggleDisappearance.interactable = false;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- if (users_load)
|
|
|
|
- {
|
|
|
|
- users_load = false;
|
|
|
|
- foreach (var u in users.OrderBy(u => u.Value.id))
|
|
|
|
|
|
+ if (users_load)
|
|
{
|
|
{
|
|
- //u.Value.WorkerMarker(u.Value, Color.green, WorkersList, BroadcastStart);
|
|
|
|
- //u.Value.toggle_user.transform.SetParent(WorkersList.transform);
|
|
|
|
- u.Value.SetParam(BroadcastStart);
|
|
|
|
|
|
+ users_load = false;
|
|
|
|
+ foreach (var u in users.OrderBy(u => u.Value.id))
|
|
|
|
+ {
|
|
|
|
+ u.Value.SetParam(BroadcastStart);
|
|
|
|
|
|
- if (DropdownMode.value == 0) u.Value.toggle_user.SetActive(u.Value.online);
|
|
|
|
- else u.Value.toggle_user.SetActive(true);
|
|
|
|
|
|
+ if (DropdownMode.value == 0) u.Value.toggle_user.SetActive(u.Value.online);
|
|
|
|
+ else u.Value.toggle_user.SetActive(true);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- //LoadMaps(DropdownLocation, Locations);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //if (locations.Any() && AuthorizationController.success)
|
|
|
|
- //{
|
|
|
|
- // active_location = DropdownLocation.value;
|
|
|
|
- // LoadLocation(locations[active_location]);
|
|
|
|
- //}
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Смена положения маркера
|
|
/// Смена положения маркера
|
|
@@ -207,8 +158,6 @@ public class PlayerController : MonoBehaviour
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Запуск отрисовки
|
|
/// Запуск отрисовки
|
|
/// </summary>
|
|
/// </summary>
|
|
@@ -270,8 +219,6 @@ public class PlayerController : MonoBehaviour
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
public void StopProgress()
|
|
public void StopProgress()
|
|
{
|
|
{
|
|
StartStopButton.transform.GetChild(0).GetComponent<Text>().text = "Отобразить";
|
|
StartStopButton.transform.GetChild(0).GetComponent<Text>().text = "Отобразить";
|
|
@@ -371,17 +318,17 @@ public class PlayerController : MonoBehaviour
|
|
/// Отображение маяков
|
|
/// Отображение маяков
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="b"></param>
|
|
/// <param name="b"></param>
|
|
- public static 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}";
|
|
|
|
- beacon.GetComponent<BeaconController>().info = false;
|
|
|
|
- beacon.transform.SetParent(GameObject.Find("Beacons").transform);
|
|
|
|
- beacon.transform.GetChild(0).GetChild(0).GetChild(0).GetComponent<Text>().text = $"{b.id}\nuuid={b.uuid}\nmajor={b.major}\nminor={b.minor}";
|
|
|
|
-
|
|
|
|
- b.beacon = beacon;
|
|
|
|
- }
|
|
|
|
|
|
+ //public static 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}";
|
|
|
|
+ // beacon.GetComponent<BeaconController>().info = false;
|
|
|
|
+ // beacon.transform.SetParent(GameObject.Find("Beacons").transform);
|
|
|
|
+ // beacon.transform.GetChild(0).GetChild(0).GetChild(0).GetComponent<Text>().text = $"{b.id}\nuuid={b.uuid}\nmajor={b.major}\nminor={b.minor}";
|
|
|
|
+
|
|
|
|
+ // b.beacon = beacon;
|
|
|
|
+ //}
|
|
|
|
|
|
void OnGUI()
|
|
void OnGUI()
|
|
{
|
|
{
|
|
@@ -455,19 +402,6 @@ public class PlayerController : MonoBehaviour
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
|
- /// Загрузка объектов локации
|
|
|
|
- /// </summary>
|
|
|
|
- /// <param name="location"></param>
|
|
|
|
- //public void LoadLocation(Location location)
|
|
|
|
- //{
|
|
|
|
- // print("PlayerController.LoadLocation");
|
|
|
|
- // if (load_location_elements.ContainsKey(location.id))
|
|
|
|
- // {
|
|
|
|
- // location.Load();
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
-
|
|
|
|
public void BroadcastStart(uint id)
|
|
public void BroadcastStart(uint id)
|
|
{
|
|
{
|
|
if (user_broadcast.HasValue)
|
|
if (user_broadcast.HasValue)
|
|
@@ -482,7 +416,7 @@ public class PlayerController : MonoBehaviour
|
|
client.ImageStreamStartSend(id);
|
|
client.ImageStreamStartSend(id);
|
|
user_broadcast = id;
|
|
user_broadcast = id;
|
|
var name = UserInfo.transform.GetChild(1).GetChild(0).GetComponent<Text>();
|
|
var name = UserInfo.transform.GetChild(1).GetChild(0).GetComponent<Text>();
|
|
- name.text = $"{id} {users[id].name}";
|
|
|
|
|
|
+ name.text = $"{id} {users[id].name_user}";
|
|
name.GetComponent<RectTransform>().sizeDelta = new Vector2(name.preferredWidth, 30);
|
|
name.GetComponent<RectTransform>().sizeDelta = new Vector2(name.preferredWidth, 30);
|
|
|
|
|
|
var camera_button = users[id].toggle_user.transform.GetChild(1).GetComponent<Button>();
|
|
var camera_button = users[id].toggle_user.transform.GetChild(1).GetComponent<Button>();
|