瀏覽代碼

editor fix

Виктор Шейко 4 年之前
父節點
當前提交
758ed2b8be

+ 3 - 4
Assets/Resources/GameObjects/Beacon.prefab

@@ -187,8 +187,10 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   Height: 0.5
   Rounding: 1
-  move: 1
   info: 0
+  mode: 0
+  text_info: 
+  id: 
 --- !u!114 &-3562534023566770947
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -201,9 +203,6 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 1c326e463ba46454989a233481ddeb0b, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  target: {fileID: 2242877738869790936}
-  canvasRect: {fileID: 5240159292984646161}
-  text: {fileID: 1097772062664421626}
   TrackMarker: 0
 --- !u!1 &7008440185145172815
 GameObject:

+ 0 - 93
Assets/Resources/GameObjects/Panel.prefab

@@ -1,93 +0,0 @@
-%YAML 1.1
-%TAG !u! tag:unity3d.com,2011:
---- !u!1 &36757174503374697
-GameObject:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  serializedVersion: 6
-  m_Component:
-  - component: {fileID: 7906458790742841255}
-  - component: {fileID: 5897701526717150767}
-  - component: {fileID: 3264519620767698349}
-  - component: {fileID: 1237170118825993199}
-  m_Layer: 0
-  m_Name: Panel
-  m_TagString: Untagged
-  m_Icon: {fileID: 0}
-  m_NavMeshLayer: 0
-  m_StaticEditorFlags: 0
-  m_IsActive: 1
---- !u!4 &7906458790742841255
-Transform:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 36757174503374697}
-  m_LocalRotation: {x: 0, y: -0.70710677, z: 0.70710677, w: 0}
-  m_LocalPosition: {x: 0, y: 0, z: -0.5}
-  m_LocalScale: {x: 1, y: 0.01, z: 1}
-  m_Children: []
-  m_Father: {fileID: 0}
-  m_RootOrder: 0
-  m_LocalEulerAnglesHint: {x: 90, y: -90, z: 90}
---- !u!33 &5897701526717150767
-MeshFilter:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 36757174503374697}
-  m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
---- !u!23 &3264519620767698349
-MeshRenderer:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 36757174503374697}
-  m_Enabled: 1
-  m_CastShadows: 1
-  m_ReceiveShadows: 1
-  m_DynamicOccludee: 1
-  m_MotionVectors: 1
-  m_LightProbeUsage: 1
-  m_ReflectionProbeUsage: 1
-  m_RenderingLayerMask: 1
-  m_RendererPriority: 0
-  m_Materials:
-  - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
-  m_StaticBatchInfo:
-    firstSubMesh: 0
-    subMeshCount: 0
-  m_StaticBatchRoot: {fileID: 0}
-  m_ProbeAnchor: {fileID: 0}
-  m_LightProbeVolumeOverride: {fileID: 0}
-  m_ScaleInLightmap: 1
-  m_PreserveUVs: 0
-  m_IgnoreNormalsForChartDetection: 0
-  m_ImportantGI: 0
-  m_StitchLightmapSeams: 0
-  m_SelectedEditorRenderState: 3
-  m_MinimumChartSize: 4
-  m_AutoUVMaxDistance: 0.5
-  m_AutoUVMaxAngle: 89
-  m_LightmapParameters: {fileID: 0}
-  m_SortingLayerID: 0
-  m_SortingLayer: 0
-  m_SortingOrder: 0
---- !u!65 &1237170118825993199
-BoxCollider:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 36757174503374697}
-  m_Material: {fileID: 0}
-  m_IsTrigger: 0
-  m_Enabled: 1
-  serializedVersion: 2
-  m_Size: {x: 1, y: 1, z: 1}
-  m_Center: {x: 0, y: 0, z: 0}

+ 0 - 7
Assets/Resources/GameObjects/Panel.prefab.meta

@@ -1,7 +0,0 @@
-fileFormatVersion: 2
-guid: e8950d1009ff3fc4697b92c6c4212a24
-PrefabImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 50 - 18
Assets/Resources/GameObjects/Plane.prefab

@@ -1,6 +1,6 @@
 %YAML 1.1
 %TAG !u! tag:unity3d.com,2011:
---- !u!1 &7655566425490613362
+--- !u!1 &5560571744208443400
 GameObject:
   m_ObjectHideFlags: 0
   m_CorrespondingSourceObject: {fileID: 0}
@@ -8,10 +8,12 @@ GameObject:
   m_PrefabAsset: {fileID: 0}
   serializedVersion: 6
   m_Component:
-  - component: {fileID: 7655566425490613358}
-  - component: {fileID: 7655566425490613359}
-  - component: {fileID: 7655566425490613360}
-  - component: {fileID: 7655566425490613361}
+  - component: {fileID: 5560571744208443638}
+  - component: {fileID: 5560571744208443637}
+  - component: {fileID: 5560571744208443636}
+  - component: {fileID: 5560571744208443403}
+  - component: {fileID: 5560571744208443401}
+  - component: {fileID: 5560571744208443402}
   m_Layer: 0
   m_Name: Plane
   m_TagString: Untagged
@@ -19,35 +21,35 @@ GameObject:
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
   m_IsActive: 1
---- !u!4 &7655566425490613358
+--- !u!4 &5560571744208443638
 Transform:
   m_ObjectHideFlags: 0
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 7655566425490613362}
+  m_GameObject: {fileID: 5560571744208443400}
   m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
-  m_LocalPosition: {x: 5.64, y: 0, z: 4.29}
-  m_LocalScale: {x: 1.129, y: 1, z: 0.859}
+  m_LocalPosition: {x: 5, y: 0, z: 5}
+  m_LocalScale: {x: 1, y: 1, z: 1}
   m_Children: []
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
---- !u!33 &7655566425490613359
+--- !u!33 &5560571744208443637
 MeshFilter:
   m_ObjectHideFlags: 0
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 7655566425490613362}
+  m_GameObject: {fileID: 5560571744208443400}
   m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
---- !u!23 &7655566425490613360
+--- !u!23 &5560571744208443636
 MeshRenderer:
   m_ObjectHideFlags: 0
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 7655566425490613362}
+  m_GameObject: {fileID: 5560571744208443400}
   m_Enabled: 1
   m_CastShadows: 1
   m_ReceiveShadows: 1
@@ -55,10 +57,11 @@ MeshRenderer:
   m_MotionVectors: 1
   m_LightProbeUsage: 1
   m_ReflectionProbeUsage: 1
+  m_RayTracingMode: 2
   m_RenderingLayerMask: 1
   m_RendererPriority: 0
   m_Materials:
-  - {fileID: 2100000, guid: d6812fe4e24a09e4880906a56ee912fd, type: 2}
+  - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
   m_StaticBatchInfo:
     firstSubMesh: 0
     subMeshCount: 0
@@ -66,6 +69,7 @@ MeshRenderer:
   m_ProbeAnchor: {fileID: 0}
   m_LightProbeVolumeOverride: {fileID: 0}
   m_ScaleInLightmap: 1
+  m_ReceiveGI: 1
   m_PreserveUVs: 0
   m_IgnoreNormalsForChartDetection: 0
   m_ImportantGI: 0
@@ -78,17 +82,45 @@ MeshRenderer:
   m_SortingLayerID: 0
   m_SortingLayer: 0
   m_SortingOrder: 0
---- !u!64 &7655566425490613361
+--- !u!64 &5560571744208443403
 MeshCollider:
   m_ObjectHideFlags: 0
   m_CorrespondingSourceObject: {fileID: 0}
   m_PrefabInstance: {fileID: 0}
   m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 7655566425490613362}
+  m_GameObject: {fileID: 5560571744208443400}
   m_Material: {fileID: 0}
   m_IsTrigger: 0
   m_Enabled: 1
-  serializedVersion: 3
+  serializedVersion: 4
   m_Convex: 0
-  m_CookingOptions: 14
+  m_CookingOptions: 30
   m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!114 &5560571744208443401
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 5560571744208443400}
+  m_Enabled: 0
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 0febc06224d0d394db577c9bc070104a, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+--- !u!114 &5560571744208443402
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 5560571744208443400}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 8b779eb081cbdad4fa144fa9769068cb, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  activeScript: 1
+  horizontalSpeed: 1
+  verticalSpeed: 1
+  panel: {fileID: 5560571744208443400}

文件差異過大導致無法顯示
+ 2447 - 319
Assets/Scenes/Player.unity


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

@@ -41,7 +41,9 @@ public class AuthorizationController : MonoBehaviour
         {//SceneManager.LoadScene("Location");
             transform.gameObject.SetActive(false);
             client.SendGetUsers((uint)PlayerController.active_company + 1);
-            client.BeaconsRequest((uint)PlayerController.locations[PlayerController.active_location].id);
+           
+            if (ModeController.editor == true && PlayerController.active_location != PlayerController.locations.Count) client.BeaconsRequest((uint)PlayerController.locations[PlayerController.active_location].id);
+            if (ModeController.editor == false) client.BeaconsRequest((uint)PlayerController.locations[PlayerController.active_location].id);
         }
         if(error) Error.SetActive(true);
     }

+ 31 - 7
Assets/Scripts/Controllers/BeaconController.cs

@@ -2,6 +2,7 @@
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
+using UnityEngine.UI;
 
 /// <summary>
 /// Размещение маяков
@@ -11,10 +12,14 @@ public class BeaconController : MonoBehaviour
 {
     public float Height = 0.5f;
     public int Rounding = 1;
-    public bool move = false;
+    //public bool move = false;
     public bool info = false; // вывод таблицы с информацией 
     public enum Mode { Player, Editor};
     public Mode mode = Mode.Player;
+    public string text_info;
+    public string id;
+    Text text;
+    GameObject canvas;
 
     private Vector3 screenPoint;
     private Vector3 offset;
@@ -24,15 +29,18 @@ public class BeaconController : MonoBehaviour
     // Start is called before the first frame update
     void Start()
     {
-        transform.GetChild(0).gameObject.SetActive(info);
+        text = transform.GetChild(0).GetChild(0).GetChild(0).GetComponent<Text>();
+        text.text = text_info;    
+        canvas = transform.GetChild(0).gameObject;
+        canvas.SetActive(info);          
     }
 
     // Update is called once per frame
     void Update()
     {
-        if (info != transform.GetChild(0).gameObject.activeSelf && mode == Mode.Player)
+        if (info != transform.GetChild(0).gameObject.activeSelf)
         {
-            transform.GetChild(0).gameObject.SetActive(info);
+            canvas.SetActive(info);
         }
     }
 
@@ -40,17 +48,20 @@ public class BeaconController : MonoBehaviour
     {
         if(mode == Mode.Player) info = !info;
         //Debug.Log(StagesEditorController.indexCursor);
-        if (move)
+        if (mode == Mode.Editor)
         {
             screenPoint = Camera.main.WorldToScreenPoint(gameObject.transform.position);
             offset = gameObject.transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z));
-        }
+            info = true;
+            text.gameObject.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 100);
+            text.gameObject.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 15);
+        }        
     }
 
     // Перемещение
     void OnMouseDrag()
     {
-        if (move)
+        if (mode == Mode.Editor)
         {
             curScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
             curPosition = Camera.main.ScreenToWorldPoint(curScreenPoint) + offset;
@@ -58,6 +69,19 @@ public class BeaconController : MonoBehaviour
             var x =(float) Math.Round(curPosition.x, Rounding);
             var z = (float)Math.Round(curPosition.z, Rounding);
             transform.position = new Vector3(x, Height, z);
+            text.text = $"id={id} x={x} y={z}";
+            canvas.transform.GetChild(0).transform.position = new Vector3(Input.mousePosition.x, Input.mousePosition.y+20, screenPoint.z);
+        }
+    }
+
+    private void OnMouseUp()
+    {
+        if (mode == Mode.Editor)
+        {
+            info = false;
+            text.text = text_info;
+            text.gameObject.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 120);
+            text.gameObject.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 75);
         }
     }
 }

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

@@ -1,6 +1,7 @@
 using System.Collections;
 using System.Collections.Generic;
 using System.Globalization;
+using System.Linq;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 using UnityEngine.UI;
@@ -21,19 +22,28 @@ public class EditorController : MonoBehaviour
     public Toggle ToggleScalePanel;
     public Toggle projection;
     public GameObject Grid;
+    public Dropdown DropdownLocation;
+    public Transform Locations;
+    public Button ButtonAddBeacon;
 
     public List<Beacon> Beacons = new List<Beacon>();
 
     PlayerController player;
     ModeController mode;
     ToolsController tools;
+    Client client;
 
     // Start is called before the first frame update
     void Start()
     {
+        client = Client.instance;
         player = GameObject.Find("Canvas").transform.GetChild(2).GetComponent<PlayerController>();
         mode = GameObject.Find("ButtonMode").GetComponent<ModeController>();
         tools = GameObject.Find("EditorTools").GetComponent<ToolsController>();
+
+        ButtonAddBeacon.onClick.AddListener(() => {
+            AddBeacon();
+        });
     }
 
     // Update is called once per frame
@@ -52,6 +62,9 @@ public class EditorController : MonoBehaviour
         {
             Camera.main.orthographic = false;
         }
+
+
+        PlayerController.LoadMaps(client, DropdownLocation, Locations.gameObject);
     }
 
     public void UpdatePanel()
@@ -78,13 +91,12 @@ public class EditorController : MonoBehaviour
         var l = new Location { id = PlayerController.locations.Count, name = Name.text };
         PlayerController.locations.Add(l);
         player.DropdownLocation.options.Add(new Dropdown.OptionData(l.name));
-        var locations = GameObject.Find("Locations").gameObject;
+       
         var location = new GameObject();
         location.name = l.name;
-        location.transform.SetParent(locations.transform);
+        location.transform.SetParent(Locations);
         foreach (var w in WallCreate.Walls)
             w.transform.SetParent(location.transform);
-        player.maps.Add(location);
     }
 
     public void Back()
@@ -93,27 +105,48 @@ public class EditorController : MonoBehaviour
         mode.Switch();
     }
 
-    public void AddBeacon()
+    public void AddBeacon(Beacon b = null)
     {
-        PanelBeaconEdit.SetActive(true);
-        PanelBeaconEdit.transform.GetChild(0).GetComponent<Text>().text = $"Маяк_{Beacons.Count}";
+        //PanelBeaconEdit.SetActive(true);
+        
         var beacon = Instantiate(Resources.Load("GameObjects/Beacon", typeof(GameObject))) as GameObject;
-        beacon.GetComponent<BeaconController>().mode = BeaconController.Mode.Editor;
+        if(ModeController.editor) beacon.GetComponent<BeaconController>().mode = BeaconController.Mode.Editor;
+        
+        beacon.name = $"Beacon_{b?.id.ToString() ?? Beacons.Count.ToString()}";
+        if (b != null)
+        {           
+            beacon.transform.position = new Vector3(b.x / 100, 0.5f, b.y / 100);
+            //beacon.transform.GetChild(0).GetChild(0).GetChild(0).GetComponent<Text>().text 
+            beacon.GetComponent<BeaconController>().text_info= $"{b.id}\nuuid={b.uuid}\nmajor={b.major}\nminor={b.minor}";
+            beacon.GetComponent<BeaconController>().id = $"{b.id}";
+        }
+        beacon.transform.SetParent(GameObject.Find("Beacons").transform);          
+        var name_beacon = $"Маяк {b?.id.ToString() ?? Beacons.Count.ToString()}";
+        PanelBeaconEdit.transform.GetChild(0).GetComponent<Text>().text = name_beacon;
         var panel_button = Instantiate(Resources.Load("GameObjects/Panel_Beacon", typeof(GameObject))) as GameObject;
         panel_button.transform.SetParent(BeaconsContent.transform);
+        panel_button.name = $"Beacon_{b?.id.ToString() ?? Beacons.Count.ToString()}";
         var button = panel_button.transform.GetChild(0).GetComponent<Button>();      
         button.name = $"BeaconButton_{Beacons.Count}";
         
-        button.transform.GetChild(0).GetComponent<Text>().text = $"Маяк_{Beacons.Count}";
+        button.transform.GetChild(0).GetComponent<Text>().text = name_beacon;
 
-        var b = new Beacon { };
+        //var b = new Beacon { };
 
         button.onClick.AddListener(() =>
         {
             PanelBeaconEdit.SetActive(true);
+            PanelBeaconEdit.transform.GetChild(0).GetComponent<Text>().text = name_beacon;
+            if (b != null)
+            {
+                PanelBeaconEdit.transform.GetChild(1).GetComponent<InputField>().text = b.uuid;
+                PanelBeaconEdit.transform.GetChild(2).GetComponent<InputField>().text = $"{b.major}";
+                PanelBeaconEdit.transform.GetChild(3).GetComponent<InputField>().text = $"{b.major}";
+            }
         });
         //var text = PanelBeaconEdit.transform.GetChild(0).GetComponent<Text>().text = "";
         //var uuid = PanelBeaconEdit.transform.GetChild(1).GetComponent<InputField>().text = "";
+        if (b == null) b = new Beacon();
         var button_ok = PanelBeaconEdit.transform.GetChild(5).transform.GetChild(0).GetComponent<Button>();
         button_ok.onClick.AddListener(() =>
         {
@@ -138,9 +171,9 @@ public class EditorController : MonoBehaviour
             if (PanelBeaconEdit.activeSelf) PanelBeaconEdit.SetActive(false);
         });
 
-        b.id = (uint)Beacons.Count;
+        //b.id = (uint)Beacons.Count;
         b.beacon = beacon;
-        b.button = button;
+        b.panel_button = panel_button;
 
         Beacons.Add(b);
     }

+ 45 - 15
Assets/Scripts/Controllers/ModeController.cs

@@ -19,21 +19,24 @@ public class ModeController : MonoBehaviour
     public GameObject Beacons;
     public GameObject Walls;
 
-    // Editor
-    //Client client = new Client();
-    PlayerController player;
+    Transform maps;
 
-    public bool editor = false;
+    public static bool editor = false;
     Button button;
 
+    Dropdown.OptionData item;
+
     // Start is called before the first frame update
     void Start()
     {
-        player = GameObject.Find("Player").GetComponent<PlayerController>();
         button = gameObject.GetComponent<Button>();
         button.onClick.AddListener(() => {
             Switch();
         });
+
+        if (editor) EditorMode();
+
+        maps = Player.transform.Find("Dropdown_maps");
     }
 
     // Update is called once per frame
@@ -50,7 +53,7 @@ public class ModeController : MonoBehaviour
 
         if (editor)
         {
-            player.StopProgress();
+            Player.GetComponent<PlayerController>().StopProgress();
             EditorMode();
         }
         else PlayerMode();
@@ -59,9 +62,9 @@ public class ModeController : MonoBehaviour
     void PlayerMode()
     {
         Player.SetActive(true);
-        Locations.SetActive(true);
+        //Locations.SetActive(true);
         Markers.SetActive(true);
-        Beacons.SetActive(true);
+        //Beacons.SetActive(true);
         Editor.SetActive(false);
         EditorTools.SetActive(false);
         Plane.SetActive(false);
@@ -70,24 +73,51 @@ public class ModeController : MonoBehaviour
 
         Destroy(GameObject.Find("SizeX"));
         Destroy(GameObject.Find("SizeY"));
-        //PlayerController.markers = new List<Marker>();
-        //client.SendGetUsers((uint)PlayerController.active_company + 1);
 
-        //PlayerController.Beacons = new List<Beacon>(); 
-        //client.BeaconsRequest((uint)PlayerController.locations[DropdownLocation.value].id);
-    }
+        maps.transform.SetParent(Player.transform);
+        maps.transform.SetSiblingIndex(1);
+        maps.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 200);
+        if(item != null)maps.GetComponent<Dropdown>().options.Remove(item);
+        maps.GetComponent<Dropdown>().value = 0;
+
+        for (int i = 0; i < Beacons.transform.childCount; i++)
+        {
+            Beacons.transform.GetChild(i).GetComponent<BeaconController>().mode = BeaconController.Mode.Player;
+            Beacons.transform.GetChild(i).GetComponent<LabelObjectScript>().enabled = true;
+        }
+        
+            //PlayerController.markers = new List<Marker>();
+            //client.SendGetUsers((uint)PlayerController.active_company + 1);
+
+            //PlayerController.Beacons = new List<Beacon>(); 
+            //client.BeaconsRequest((uint)PlayerController.locations[DropdownLocation.value].id);
+        }
 
     void EditorMode()
     {
         Player.SetActive(false);
-        Locations.SetActive(false);
+        //Locations.SetActive(false);
         Markers.SetActive(false);
-        Beacons.SetActive(false);
+        //Beacons.SetActive(false);
         Editor.SetActive(true);
         EditorTools.SetActive(true); 
         Plane.SetActive(true);
         Grid.SetActive(true);
         Walls.SetActive(true);
+        
+        maps.transform.SetParent(Editor.transform);
+        maps.transform.SetSiblingIndex(0);
+        maps.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 190);
+        item = new Dropdown.OptionData("Новая локация");
+        maps.GetComponent<Dropdown>().options.Add(item);
+
+        for (int i = 0; i < Beacons.transform.childCount; i++)
+        { 
+            Beacons.transform.GetChild(i).GetComponent<BeaconController>().info = false;
+            Beacons.transform.GetChild(i).GetComponent<BeaconController>().mode = BeaconController.Mode.Editor;     
+            Beacons.transform.GetChild(i).GetComponent<LabelObjectScript>().enabled = false;                
+        }
+        
 
         //foreach (var m in PlayerController.markers)
         //{

+ 46 - 43
Assets/Scripts/Controllers/PlayerController.cs

@@ -37,27 +37,28 @@ public class PlayerController : MonoBehaviour
     public GameObject DatePicker;
     Camera camera;
     public Toggle projection;
+    public GameObject Locations;
 
     public enum Mode { RealTime = 0, History = 1, Stop = 2 };
     public static Mode active_mode = Mode.Stop;
     int mode = 0;
     //public GameObject Time;
 
-    static Client client;
+    Client client;
+    static EditorController editor;
 
     DateTimePicker Date;
 
-    public List<GameObject> maps;
+    //public List<GameObject> maps;
     static bool starting = false; // флаг остановки
     public static Dictionary<uint, bool> end_send = new Dictionary<uint, bool>(); // флаги завершения загрузки
     Dictionary<uint, MarkerMoving> moving = new Dictionary<uint, MarkerMoving>(); // флаги начала движения
     float interpolationPeriod = 0.1f;
-    float time_realtime = 0;
+    //float time_realtime = 0;
     float time_draw = 0;
     public static List<User> users = new List<User>();
     public static bool users_load = false;
     public static bool beacons_load = false;
-    uint location_id = 1;
     public static  List<Location> locations;
     public static List<Marker> markers;
 
@@ -68,6 +69,7 @@ public class PlayerController : MonoBehaviour
     {
         DebugHelper.ActivateConsole();
         client = Client.instance;
+        editor = GameObject.Find("Canvas").transform.GetChild(3).GetComponent<EditorController>();
         camera = Camera.main;
         markers = new List<Marker>();
         locations = new List<Location>();
@@ -78,6 +80,9 @@ public class PlayerController : MonoBehaviour
         locations.Add(new Location { id = 25, name = "25" });
         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);
 
         DropdownCompany.options.Add(new Dropdown.OptionData("Тайшет"));
         DropdownCompany.options.Add(new Dropdown.OptionData("Тестовая"));
@@ -124,33 +129,6 @@ public class PlayerController : MonoBehaviour
             client.SendGetUsers((uint) active_company + 1);
         }
 
-        if (active_location != DropdownLocation.value)
-        {
-            maps.ElementAt(active_location).SetActive(false);
-            maps.ElementAt(DropdownLocation.value).SetActive(true);
-            active_location = DropdownLocation.value;
-            switch (DropdownLocation.value)
-            {
-                case 0:
-                    location_id = 1;
-                    break;
-                case 1:
-                    location_id = 22;
-                    break;
-                case 2:
-                    location_id = 25;
-                    break;
-            }
-
-            foreach (var b in Beacons)
-            {
-                Destroy(b.beacon);
-                Destroy(b.button);
-            }
-            Beacons = new List<Beacon>();
-            client.BeaconsRequest((uint)locations[DropdownLocation.value].id);
-        }
-
         time_draw += Time.deltaTime;
         if (time_draw >= interpolationPeriod)
         {
@@ -191,7 +169,7 @@ public class PlayerController : MonoBehaviour
             {
                 if (m.toggle.isOn)
                 {
-                    client.CoordinatesRequest(0, 0, 1, location_id, m.acc_id);
+                    client.CoordinatesRequest(0, 0, 1, (uint)locations[active_location].id, m.acc_id);
                     end_send[m.acc_id] = false;
                 }
             }
@@ -230,12 +208,7 @@ public class PlayerController : MonoBehaviour
                 WorkerMarker(u, Color.green);
         }
 
-        if (beacons_load)
-        {
-            beacons_load = false;
-            foreach (var b in Beacons)
-                AddBeacon(b);
-        }
+        LoadMaps(client, DropdownLocation, Locations);
     }   
 
     /// <summary>
@@ -345,7 +318,7 @@ public class PlayerController : MonoBehaviour
                     {
                         if (m.toggle.isOn)
                         {
-                            client.CoordinatesRequest(time_start.Ticks, time_end.Ticks, 1, location_id, m.acc_id);
+                            client.CoordinatesRequest(time_start.Ticks, time_end.Ticks, 1, (uint)locations[active_location].id, m.acc_id);
                             end_send[m.acc_id] = false;
                         }
                     }
@@ -439,16 +412,14 @@ public class PlayerController : MonoBehaviour
     /// Отображение маяков
     /// </summary>
     /// <param name="b"></param>
-    public void AddBeacon(Beacon b)
+    public static void AddBeacon(Beacon b)
     {
         var beacon = Instantiate(Resources.Load("GameObjects/Beacon", typeof(GameObject))) as GameObject;
         beacon.transform.position = new Vector3(b.x/100, 0.5f, b.y/100);
         beacon.name = $"BeaconButton_{b.id}";
-        beacon.GetComponent<BeaconController>().move = false;
         beacon.GetComponent<BeaconController>().info = false;
         beacon.transform.SetParent(GameObject.Find("Beacons").transform);
-        var canvas = beacon.transform.GetChild(0);
-        canvas.transform.GetChild(0).transform.GetChild(0).GetComponent<Text>().text = $"{b.id}\nuuid={b.uuid}\nmajor={b.major}\nminor={b.minor}";
+        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;
     }
@@ -463,5 +434,37 @@ public class PlayerController : MonoBehaviour
         //if (Input.GetKeyDown(KeyCode.BackQuote)) 
             DebugHelper.DrawConsole();
     }
+
+    public static void LoadMaps(Client client, Dropdown DropdownLocation, GameObject Locations)
+    {
+        if (active_location != DropdownLocation.value)
+        {
+            Locations.transform.GetChild(active_location).gameObject.SetActive(false);
+            Locations.transform.GetChild(DropdownLocation.value).gameObject.SetActive(true);
+            active_location = DropdownLocation.value;
+
+            foreach (var b in Beacons)
+            {
+                Destroy(b.beacon);
+                Destroy(b.panel_button);
+            }
+            Beacons = new List<Beacon>();
+
+            if (ModeController.editor == true && DropdownLocation.value != DropdownLocation.options.Count - 1) client.BeaconsRequest((uint)locations[DropdownLocation.value].id);
+            if(ModeController.editor == false) client.BeaconsRequest((uint)locations[DropdownLocation.value].id);
+
+        }
+
+        if (beacons_load)
+        {
+            beacons_load = false;
+            foreach (var b in Beacons)
+            {
+                //if (ModeController.editor == false) AddBeacon(b);
+                //if (ModeController.editor == true) 
+                editor.AddBeacon(b);
+            }
+        }
+    }
 }
 

+ 1 - 1
Assets/Scripts/Models/Beacon.cs

@@ -16,7 +16,7 @@ public class Beacon
     public uint minor { get; set; }
     public uint major { get; set; }
     public GameObject beacon { get; set; }
-    public Button button { get; set; }
+    public GameObject panel_button { get; set; }
     public bool enabled { get; set; }    
     public byte byteEnabled { 
         get