Browse Source

fix users 2

Виктор Шейко 4 years ago
parent
commit
f0b0bded19

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

@@ -154,6 +154,7 @@ public class CompanyController : MonoBehaviour
         User.SendGetUsers();
         User.SendGetUsers();
         //player.users = new Dictionary<uint, User>();
         //player.users = new Dictionary<uint, User>();
         //player.users = users[];
         //player.users = users[];
+        if(player.users != null)
         foreach (var u in player.users.Values) u.UserCompany();            
         foreach (var u in player.users.Values) u.UserCompany();            
         Location.LocationsRequest(0);
         Location.LocationsRequest(0);
     }
     }

+ 16 - 18
Assets/Scripts/Controllers/PlayerController.cs

@@ -56,7 +56,7 @@ public class PlayerController : MonoBehaviour
 
 
     const float INTERPOLATION_PERIOD = 0.1f;
     const float INTERPOLATION_PERIOD = 0.1f;
     float time_draw = 0;
     float time_draw = 0;
-    public bool users_load = false;
+    public bool users_load = false; // ожидание массива пользователей
     public bool beacons_load = false;
     public bool beacons_load = false;
 
 
 
 
@@ -92,30 +92,26 @@ public class PlayerController : MonoBehaviour
         if (DropdownMode.value != mode)
         if (DropdownMode.value != mode)
             СhangeMode();
             СhangeMode();
 
 
-        time_draw += Time.deltaTime;
-        if (time_draw >= INTERPOLATION_PERIOD)
+        if (active_mode != Mode.Stop)
         {
         {
-            MarkerMove();
-            time_draw -= INTERPOLATION_PERIOD;
+            time_draw += Time.deltaTime;
+            if (time_draw >= INTERPOLATION_PERIOD)
+            {
+                MarkerMove();
+                time_draw -= INTERPOLATION_PERIOD;
+            }
         }
         }
 
 
         if (users != null)
         if (users != null)
         {
         {
-            if (ToggleLine.isOn)
-            {
-                foreach (var u in users)
-                    u.Value.marker_line.gameObject.SetActive(true);
-                ToggleDisappearance.interactable = true;
-            }
-            else
+            if (users_load == false)
             {
             {
                 foreach (var u in users)
                 foreach (var u in users)
                 {
                 {
-                    u.Value.marker_line.gameObject.SetActive(false);
-                    u.Value.marker_line.positionCount = 0;
+                    u.Value.marker_line.gameObject.SetActive(ToggleLine.isOn);
+                    if (ToggleLine.isOn == false) u.Value.marker_line.positionCount = 0;
                 }
                 }
-                ToggleDisappearance.interactable = false;
-            }
+            }  
 
 
             if (users_load)
             if (users_load)
             {
             {
@@ -128,8 +124,10 @@ public class PlayerController : MonoBehaviour
                     else u.Value.toggle_user.SetActive(true);
                     else u.Value.toggle_user.SetActive(true);
                 }
                 }
             }
             }
-        }        
-    }  
+        }
+
+        ToggleDisappearance.interactable = ToggleLine.isOn;
+    }
 
 
     /// <summary>
     /// <summary>
     /// Смена положения маркера
     /// Смена положения маркера