Просмотр исходного кода

Camera fix, big users list, resize ground fix

Виктор Шейко 4 лет назад
Родитель
Сommit
75ba66d1b3

+ 26 - 14
Assets/Scripts/Controllers/CameraController.cs

@@ -23,12 +23,13 @@ public class CameraController : MonoBehaviour
 
     public Transform target;
     public GameObject location;
-    
+
+    public Toggle Toggle_projection;
+
     void Start()
     {      
         targetPosition = transform.position;
 
-
         yaw = transform.eulerAngles.y;
         pitch = transform.eulerAngles.x;
 
@@ -40,17 +41,19 @@ public class CameraController : MonoBehaviour
         if (!EventSystem.current.IsPointerOverGameObject())
         {
             switch (axes)
-        {
-            case RotationAxes.Mouse:
-                //MouseCommands();
-
-                MovementMouse();
-                break;
-            case RotationAxes.TrackMarker:
-                TrackMarker();
-                break;
-        }
+            {
+                case RotationAxes.Mouse:
+                    //MouseCommands();
+
+                    MovementMouse();
+                    break;
+                case RotationAxes.TrackMarker:
+                    TrackMarker();
+                    break;
+            }
         }
+
+        Camera.main.orthographic = Toggle_projection.isOn;
     }  
 
     void ShowAndUnlockCursor()
@@ -196,8 +199,17 @@ public class CameraController : MonoBehaviour
             transform.Translate(-Input.GetAxisRaw("Mouse X") * dragSpeed, -Input.GetAxisRaw("Mouse Y") * dragSpeed, 0);
         }
 
-        //Zoom in and out with Mouse Wheel
-        transform.Translate(0, 0, Input.GetAxis("Mouse ScrollWheel") * zoomSpeed, Space.Self);
+        if (Toggle_projection.isOn)
+        {
+            if (Input.GetAxis("Mouse ScrollWheel") < 0)
+            {
+                if (Camera.main.orthographicSize > 1) Camera.main.orthographicSize--;
+            }
+            if (Input.GetAxis("Mouse ScrollWheel") > 0) Camera.main.orthographicSize++;
+        }
+        else
+            //Zoom in and out with Mouse Wheel
+            transform.Translate(0, 0, Input.GetAxis("Mouse ScrollWheel") * zoomSpeed, Space.Self);
 
         if (Input.GetKey(KeyCode.LeftArrow))
             //targetPosition -= transform.right * movementSpeed;

+ 1 - 0
Assets/Scripts/Controllers/CompanyController.cs

@@ -25,6 +25,7 @@ public class CompanyController : MonoBehaviour
     public List<uint> locations_index; // сопоставление id с dropdown
                                        //public List<Marker> markers;
     public LocationZones LocationZones;
+    public GameObject UsersView;
 
     PlayerController player;
     EditorController editor;

+ 4 - 11
Assets/Scripts/Controllers/EditorController.cs

@@ -23,7 +23,6 @@ public class EditorController : MonoBehaviour
     public GameObject ButtonMode;
     public GameObject EditorTools;
     public Toggle ToggleScalePanel;
-    public Toggle projection;
 
     public Dropdown DropdownLocation;
     public Transform Locations;
@@ -99,18 +98,12 @@ public class EditorController : MonoBehaviour
         }       
     }
 
-   
+
     // Update is called once per frame
     void Update()
-    {        
-        if (projection.isOn)
-        {
-            Camera.main.orthographic = true;
-        }
-        else
-        {
-            Camera.main.orthographic = false;
-        }
+    {
+        var l = company.locations[company.locations_index[company.active_location]];
+        l.plane.GetComponent<TouchScript>().Resize = ToggleScalePanel.isOn;
     }
 
     string texture_url = "";

+ 3 - 1
Assets/Scripts/Controllers/ModeController.cs

@@ -69,6 +69,7 @@ public class ModeController : MonoBehaviour
         foreach (var b in l.beacons)
             b.beacon.GetComponent<BeaconController>().mode = BeaconController.Mode.Player;
         company.LocationZones.gameObject.SetActive(true);
+        company.UsersView.SetActive(true);
         l.plane.GetComponent<TouchScript>().Resize = false;
 
         var edit = Editor.GetComponent<EditorController>();
@@ -142,7 +143,8 @@ public class ModeController : MonoBehaviour
         foreach (var b in l.beacons)
             b.beacon.GetComponent<BeaconController>().mode = BeaconController.Mode.Editor;
         company.LocationZones.gameObject.SetActive(false);
-        l.plane.GetComponent<TouchScript>().Resize = true;
+        company.UsersView.SetActive(false);
+        //l.plane.GetComponent<TouchScript>().Resize = false;
 
         //item = new Dropdown.OptionData("Новая локация");
         //maps.GetComponent<Dropdown>().options.Add(item);

+ 26 - 31
Assets/Scripts/Controllers/PlayerController.cs

@@ -34,7 +34,7 @@ public class PlayerController : MonoBehaviour
 
     public GameObject DatePicker;
     Camera camera;
-    public Toggle projection;
+    //public Toggle projection;
 
 
     //public GameObject LocationGameObject;
@@ -150,15 +150,6 @@ public class PlayerController : MonoBehaviour
             ToggleDisappearance.interactable = false;
         }
 
-        if (projection.isOn)
-        {
-            camera.orthographic = true;
-        }
-        else
-        {
-            camera.orthographic = false;
-        }
-
         if (users_load)
         {
             users_load = false;
@@ -427,34 +418,38 @@ public class PlayerController : MonoBehaviour
     /// </summary>
     public void MarkerMove()
     {
+        if(users != null)
         foreach (var u in users)
         {
-            if (u.Value.marker.activeSelf != u.Value.toggle.isOn) u.Value.marker.SetActive(u.Value.toggle.isOn);
-
-            if (active_mode == Mode.RealTime && u.Value.toggle.isOn && !Workers.ContainsKey(u.Value.id))
+            if (u.Value != null)
             {
-                Debug.LogWarning($"send coord user {u.Value.id}");                
-                var index = company.locations_index[company.active_location];
-                client.CoordinatesRequest(0, 0, 1, company.locations[index].id, u.Value.id);
+                if (u.Value.marker.activeSelf != u.Value.toggle.isOn) u.Value.marker.SetActive(u.Value.toggle.isOn);
 
-                u.Value.toggle_user.SetActive(u.Value.online);
-            }
+                if (active_mode == Mode.RealTime && u.Value.toggle.isOn && !Workers.ContainsKey(u.Value.id))
+                {
+                    Debug.LogWarning($"send coord user {u.Value.id}");
+                    var index = company.locations_index[company.active_location];
+                    client.CoordinatesRequest(0, 0, 1, company.locations[index].id, u.Value.id);
 
-            if (u.Value.toggle.isOn && Workers.ContainsKey(u.Value.id) && active_mode != Mode.Stop/*&& starting*/ /*&& end_send[m.value.acc_id]*/)
-            {              
-                StartingAccPositiong(u.Value);
+                    u.Value.toggle_user.SetActive(u.Value.online);
+                }
 
-                if (active_mode == Mode.History && !Workers.Any())
+                if (u.Value.toggle.isOn && Workers.ContainsKey(u.Value.id) && active_mode != Mode.Stop/*&& starting*/ /*&& end_send[m.value.acc_id]*/)
                 {
-                    //var temp = Workers.Values.Max(v => v.Count);
-                    //if (m.i == temp - 1 && moving[moving.Keys.Last()].step >= 1f)
-                    //{
-                    StopProgress();
-                    //}
-                    //if (active_mode == Mode.RealTime && moving[moving.Keys.Last()].index == 1)
-                    //{
-                    //    starting = false;
-                    //}
+                    StartingAccPositiong(u.Value);
+
+                    if (active_mode == Mode.History && !Workers.Any())
+                    {
+                        //var temp = Workers.Values.Max(v => v.Count);
+                        //if (m.i == temp - 1 && moving[moving.Keys.Last()].step >= 1f)
+                        //{
+                        StopProgress();
+                        //}
+                        //if (active_mode == Mode.RealTime && moving[moving.Keys.Last()].index == 1)
+                        //{
+                        //    starting = false;
+                        //}
+                    }
                 }
             }
         }