Rimmon 4 rokov pred
rodič
commit
c62b1f5c69
1 zmenil súbory, kde vykonal 8 pridanie a 2 odobranie
  1. 8 2
      Assets/Scripts/Models/Zone.cs

+ 8 - 2
Assets/Scripts/Models/Zone.cs

@@ -1,11 +1,11 @@
-// имя, id, координаты углов, id локации
+// имя, id, координаты углов, id локации
 using System;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class Zone
-    {
+{
     public uint id { get; set; }
     public uint location_id { get; set; }
     public string name { get; set; }
@@ -55,6 +55,8 @@ public class Zone
     public static void ReceiveFromServer(byte[] bytedata)
     {
         int read = 5;
+        var location = PlayerController.locations[PlayerController.active_company];
+        location.zones = new List<Zone>();
         while (read < bytedata.Length)
         {
             var id = BitConverter.ToUInt32(bytedata, read);
@@ -65,7 +67,11 @@ public class Zone
             var lid = BitConverter.ToUInt32(bytedata, read + 20);
             Debug.Log($"zone received id {id} x1 {x1} z1 {z1} x2 {x2} z2 {z2} location {lid}");
             read += 24;
+
+            location.zones.Add(new Zone { id = id, location_id = location.id, name = $"Зона {location.zones.Count + 1}", start_height = x1, start_width = z1, end_height = x2, end_width = z2 });
         }
+
+        PlayerController.load_location[location.id].zones = true;
     }
 
     public static void LoadByLocationId(uint locId)