|
@@ -57,7 +57,7 @@ public class CompanyController : MonoBehaviour
|
|
if (active_location != DropdownLocation.value && AuthorizationController.success && locations.Any())
|
|
if (active_location != DropdownLocation.value && AuthorizationController.success && locations.Any())
|
|
ChangeLocation();
|
|
ChangeLocation();
|
|
|
|
|
|
- if (active_location >= 0 && locations_index.Count > active_location)
|
|
|
|
|
|
+ if (active_location >= 0 && locations_index.Any())
|
|
if (AuthorizationController.success && load_location_elements.ContainsKey(locations_index[active_location]))
|
|
if (AuthorizationController.success && load_location_elements.ContainsKey(locations_index[active_location]))
|
|
{
|
|
{
|
|
if (load_location_elements[locations_index[active_location]].location)
|
|
if (load_location_elements[locations_index[active_location]].location)
|
|
@@ -70,6 +70,8 @@ public class CompanyController : MonoBehaviour
|
|
ZonesOnOff();
|
|
ZonesOnOff();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
if (load_location)
|
|
if (load_location)
|
|
{
|
|
{
|
|
load_location = false;
|
|
load_location = false;
|
|
@@ -86,6 +88,17 @@ public class CompanyController : MonoBehaviour
|
|
load_location_elements[l.Key].location = true;
|
|
load_location_elements[l.Key].location = true;
|
|
l.Value.Load();
|
|
l.Value.Load();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (ModeController.editor && editor.newLocation != null)
|
|
|
|
+ {
|
|
|
|
+ var l = editor.newLocation;
|
|
|
|
+ //l.location.transform.SetParent(Locations.transform);
|
|
|
|
+ l.location.transform.SetSiblingIndex(Locations.transform.childCount - 1);
|
|
|
|
+ l.location.SetActive(false);
|
|
|
|
+ DropdownLocation.options.Add(new Dropdown.OptionData($"Новая локация"));
|
|
|
|
+ locations_index.Add(l.id);
|
|
|
|
+ locations[l.id] = l;
|
|
|
|
+ }
|
|
DropdownLocation.value = 0;
|
|
DropdownLocation.value = 0;
|
|
DropdownLocation.RefreshShownValue();
|
|
DropdownLocation.RefreshShownValue();
|
|
active_location = DropdownLocation.value;
|
|
active_location = DropdownLocation.value;
|
|
@@ -107,34 +120,47 @@ public class CompanyController : MonoBehaviour
|
|
/// </summary>
|
|
/// </summary>
|
|
public void ChangeCompany()
|
|
public void ChangeCompany()
|
|
{
|
|
{
|
|
- active_company = DropdownCompany.value;
|
|
|
|
- //DropdownLocation.value = 0;
|
|
|
|
|
|
+ foreach (var l in locations)
|
|
|
|
+ {
|
|
|
|
+ if (l.Value.id < (uint)int.MaxValue)
|
|
|
|
+ {
|
|
|
|
+ Destroy(l.Value.location);
|
|
|
|
+ foreach (var b in l.Value.beacons)
|
|
|
|
+ Destroy(b.panel_button);
|
|
|
|
+ foreach (var z in l.Value.zones)
|
|
|
|
+ Destroy(z.buttons);
|
|
|
|
+ load_location_elements.Remove(l.Value.id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- for (var i = Locations.transform.childCount - 1; i >= 0; i--)
|
|
|
|
- Destroy(Locations.transform.GetChild(i).gameObject);
|
|
|
|
- load_location_elements.Clear();
|
|
|
|
|
|
+
|
|
|
|
|
|
- Client.instance.company_id = (uint)(active_company + 1);
|
|
|
|
|
|
+active_company = DropdownCompany.value;
|
|
|
|
+ Client.instance.company_id = (uint)(active_company + 1);
|
|
|
|
+ if (player.markers != null)
|
|
|
|
+ foreach (var m in player.markers)
|
|
|
|
+ {
|
|
|
|
+ Destroy(m.marker.gameObject);
|
|
|
|
+ Destroy(m.marker_line.gameObject);
|
|
|
|
+ Destroy(m.toggle_user);
|
|
|
|
+ }
|
|
Client.instance.SendGetUsers();
|
|
Client.instance.SendGetUsers();
|
|
- if(player.markers != null)
|
|
|
|
- foreach (var m in player.markers)
|
|
|
|
- {
|
|
|
|
- Destroy(m.marker.gameObject);
|
|
|
|
- Destroy(m.marker_line.gameObject);
|
|
|
|
- Destroy(m.toggle_user);
|
|
|
|
- }
|
|
|
|
player.markers = new List<Marker>();
|
|
player.markers = new List<Marker>();
|
|
Location.LocationsRequest(0);
|
|
Location.LocationsRequest(0);
|
|
}
|
|
}
|
|
|
|
|
|
- float sizex = 0;
|
|
|
|
|
|
+ float sizex = 0;
|
|
float sizey = 0;
|
|
float sizey = 0;
|
|
public void ChangeLocation()
|
|
public void ChangeLocation()
|
|
{
|
|
{
|
|
Debug.Log("PlayerController locations count " + locations.Count + " active " + active_location);
|
|
Debug.Log("PlayerController locations count " + locations.Count + " active " + active_location);
|
|
- if (active_location >= 0) locations[locations_index[active_location]].location.SetActive(false);
|
|
|
|
|
|
+ if (active_location >= 0)
|
|
|
|
+ locations[locations_index[active_location]].LocationActive(false);
|
|
|
|
+
|
|
active_location = DropdownLocation.value;
|
|
active_location = DropdownLocation.value;
|
|
var l = locations[locations_index[active_location]];
|
|
var l = locations[locations_index[active_location]];
|
|
|
|
+ l.LocationActive(true);
|
|
|
|
+
|
|
if (!l.texture_url.Equals("")) StartCoroutine(SendingFormController.LoadImage(l.texture_url, l.plane, l.plane.transform.position, l.plane.transform.localScale));
|
|
if (!l.texture_url.Equals("")) StartCoroutine(SendingFormController.LoadImage(l.texture_url, l.plane, l.plane.transform.position, l.plane.transform.localScale));
|
|
|
|
|
|
editor.Name.text = l.name;
|
|
editor.Name.text = l.name;
|
|
@@ -151,9 +177,7 @@ public class CompanyController : MonoBehaviour
|
|
editor.SizeY.text = $"{l.plane.transform.localScale.z}";
|
|
editor.SizeY.text = $"{l.plane.transform.localScale.z}";
|
|
sizey = l.plane.transform.localScale.z;
|
|
sizey = l.plane.transform.localScale.z;
|
|
}
|
|
}
|
|
-
|
|
|
|
- l.location.SetActive(true);
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
public void LocationContents(Location location)
|
|
public void LocationContents(Location location)
|
|
{
|
|
{
|
|
@@ -169,7 +193,9 @@ public class CompanyController : MonoBehaviour
|
|
var walls = location.location.transform.GetChild(1);
|
|
var walls = location.location.transform.GetChild(1);
|
|
foreach (var w in location.walls)
|
|
foreach (var w in location.walls)
|
|
{
|
|
{
|
|
- var wall = WallCreate.AddWall(this, new Vector3(w.start_width, WallCreate.WallHeight / 2, w.start_height), new Vector3(w.end_width, WallCreate.WallHeight, w.end_height));
|
|
|
|
|
|
+ var wall = WallCreate.AddWall(this,
|
|
|
|
+ new Vector3(w.start_width, WallCreate.WallHeight / 2, w.start_height),
|
|
|
|
+ new Vector3(Mathf.Abs(w.end_width), WallCreate.WallHeight, Mathf.Abs(w.end_height)));
|
|
wall.transform.SetParent(walls.transform);
|
|
wall.transform.SetParent(walls.transform);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -179,8 +205,9 @@ public class CompanyController : MonoBehaviour
|
|
//var beacons = location.Beacons ?? new GameObject();
|
|
//var beacons = location.Beacons ?? new GameObject();
|
|
//beacons.name = "Beacons";
|
|
//beacons.name = "Beacons";
|
|
//beacons.transform.SetParent(location.location.transform);
|
|
//beacons.transform.SetParent(location.location.transform);
|
|
-
|
|
|
|
- foreach (var b in location.beacons) {
|
|
|
|
|
|
+
|
|
|
|
+ foreach (var b in location.beacons)
|
|
|
|
+ {
|
|
editor.AddBeacon(this, b);
|
|
editor.AddBeacon(this, b);
|
|
if (ModeController.editor == true) b.beacon.GetComponent<BeaconController>().mode = BeaconController.Mode.Editor;
|
|
if (ModeController.editor == true) b.beacon.GetComponent<BeaconController>().mode = BeaconController.Mode.Editor;
|
|
}
|
|
}
|
|
@@ -191,8 +218,9 @@ public class CompanyController : MonoBehaviour
|
|
load_location_elements[location.id].zones = false;
|
|
load_location_elements[location.id].zones = false;
|
|
//var zones = location.Zones ?? new GameObject();
|
|
//var zones = location.Zones ?? new GameObject();
|
|
//zones.name = "Zones";
|
|
//zones.name = "Zones";
|
|
- //zones.transform.SetParent(location.location.transform);
|
|
|
|
|
|
+ //zones.transform.SetParent(location.location.transform);
|
|
|
|
|
|
|
|
+
|
|
foreach (var z in location.zones)
|
|
foreach (var z in location.zones)
|
|
z.go = WallCreate.AddZone(Dialog, this, ZonesScroll, z);
|
|
z.go = WallCreate.AddZone(Dialog, this, ZonesScroll, z);
|
|
}
|
|
}
|