Browse Source

Beacons information

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

+ 311 - 1
Assets/Resources/GameObjects/Beacon.prefab

@@ -1,5 +1,82 @@
 %YAML 1.1
 %TAG !u! tag:unity3d.com,2011:
+--- !u!1 &1097772062664421626
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 922849818426430000}
+  - component: {fileID: 6307869673177798183}
+  - component: {fileID: 8031700937555987582}
+  m_Layer: 5
+  m_Name: Text
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &922849818426430000
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1097772062664421626}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children: []
+  m_Father: {fileID: 2602579708853897968}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 120, y: 75}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &6307869673177798183
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1097772062664421626}
+  m_CullTransparentMesh: 0
+--- !u!114 &8031700937555987582
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1097772062664421626}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Material: {fileID: 0}
+  m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
+  m_RaycastTarget: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_FontData:
+    m_Font: {fileID: 12800000, guid: 74d3785fa719d15429525fe4a1584744, type: 3}
+    m_FontSize: 10
+    m_FontStyle: 0
+    m_BestFit: 0
+    m_MinSize: 1
+    m_MaxSize: 40
+    m_Alignment: 4
+    m_AlignByGeometry: 0
+    m_RichText: 1
+    m_HorizontalOverflow: 0
+    m_VerticalOverflow: 0
+    m_LineSpacing: 1
+  m_Text: New Text
 --- !u!1 &2242877738869790936
 GameObject:
   m_ObjectHideFlags: 0
@@ -13,6 +90,7 @@ GameObject:
   - component: {fileID: 1484049918328760319}
   - component: {fileID: 4259244396455922672}
   - component: {fileID: 4182038595796904783}
+  - component: {fileID: -3562534023566770947}
   m_Layer: 0
   m_Name: Beacon
   m_TagString: Untagged
@@ -30,7 +108,8 @@ Transform:
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0.5, z: 0}
   m_LocalScale: {x: 0.25, y: 0.25, z: 0.25}
-  m_Children: []
+  m_Children:
+  - {fileID: 5240159292984646161}
   m_Father: {fileID: 0}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -109,3 +188,234 @@ MonoBehaviour:
   Height: 0.5
   Rounding: 1
   move: 1
+  info: 0
+--- !u!114 &-3562534023566770947
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2242877738869790936}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  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:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 5240159292984646161}
+  - component: {fileID: 9088830829542173484}
+  - component: {fileID: 1442340864648898204}
+  - component: {fileID: 881192935076665710}
+  m_Layer: 5
+  m_Name: Canvas
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &5240159292984646161
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7008440185145172815}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 0, y: 0, z: 0}
+  m_Children:
+  - {fileID: 2602579708853897968}
+  m_Father: {fileID: 5520547584999287479}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0, y: 0}
+--- !u!223 &9088830829542173484
+Canvas:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7008440185145172815}
+  m_Enabled: 1
+  serializedVersion: 3
+  m_RenderMode: 0
+  m_Camera: {fileID: 0}
+  m_PlaneDistance: 100
+  m_PixelPerfect: 0
+  m_ReceivesEvents: 1
+  m_OverrideSorting: 0
+  m_OverridePixelPerfect: 0
+  m_SortingBucketNormalizedSize: 0
+  m_AdditionalShaderChannelsFlag: 0
+  m_SortingLayerID: 0
+  m_SortingOrder: 0
+  m_TargetDisplay: 0
+--- !u!114 &1442340864648898204
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7008440185145172815}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_UiScaleMode: 0
+  m_ReferencePixelsPerUnit: 100
+  m_ScaleFactor: 1
+  m_ReferenceResolution: {x: 800, y: 600}
+  m_ScreenMatchMode: 0
+  m_MatchWidthOrHeight: 0
+  m_PhysicalUnit: 3
+  m_FallbackScreenDPI: 96
+  m_DefaultSpriteDPI: 96
+  m_DynamicPixelsPerUnit: 1
+--- !u!114 &881192935076665710
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7008440185145172815}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_IgnoreReversedGraphics: 1
+  m_BlockingObjects: 0
+  m_BlockingMask:
+    serializedVersion: 2
+    m_Bits: 4294967295
+--- !u!1 &8407972884361764677
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 2602579708853897968}
+  - component: {fileID: 5275199267222535772}
+  - component: {fileID: 2250501251131972651}
+  - component: {fileID: 4301810585103827227}
+  - component: {fileID: 3227376943957739981}
+  m_Layer: 5
+  m_Name: Panel
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &2602579708853897968
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8407972884361764677}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_Children:
+  - {fileID: 922849818426430000}
+  m_Father: {fileID: 5240159292984646161}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 1, y: 1}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &5275199267222535772
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8407972884361764677}
+  m_CullTransparentMesh: 0
+--- !u!114 &2250501251131972651
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8407972884361764677}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Material: {fileID: 0}
+  m_Color: {r: 1, g: 1, b: 1, a: 0.392}
+  m_RaycastTarget: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
+  m_Type: 1
+  m_PreserveAspect: 0
+  m_FillCenter: 1
+  m_FillMethod: 4
+  m_FillAmount: 1
+  m_FillClockwise: 1
+  m_FillOrigin: 0
+  m_UseSpriteMesh: 0
+  m_PixelsPerUnitMultiplier: 1
+--- !u!114 &4301810585103827227
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8407972884361764677}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Padding:
+    m_Left: 2
+    m_Right: 2
+    m_Top: 2
+    m_Bottom: 2
+  m_ChildAlignment: 4
+  m_Spacing: 0
+  m_ChildForceExpandWidth: 1
+  m_ChildForceExpandHeight: 1
+  m_ChildControlWidth: 0
+  m_ChildControlHeight: 0
+  m_ChildScaleWidth: 0
+  m_ChildScaleHeight: 0
+--- !u!114 &3227376943957739981
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8407972884361764677}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_HorizontalFit: 2
+  m_VerticalFit: 2

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

@@ -32,6 +32,7 @@ public class AuthorizationController : MonoBehaviour
         {//SceneManager.LoadScene("Location");
             transform.gameObject.SetActive(false);
             client.SendGetUsers((uint)WorkerController.active_company + 1);
+            client.BeaconsRequest((uint)WorkerController.active_location);
         }
         if(error) Error.SetActive(true);
     }

+ 6 - 0
Assets/Scripts/Controllers/BeaconController.cs

@@ -8,6 +8,7 @@ public class BeaconController : MonoBehaviour
     public float Height = 0.5f;
     public int Rounding = 1;
     public bool move = false;
+    public bool info = false;
 
     private Vector3 screenPoint;
     private Vector3 offset;
@@ -23,10 +24,15 @@ public class BeaconController : MonoBehaviour
     // Update is called once per frame
     void Update()
     {
+        if (info != transform.GetChild(0).gameObject.activeSelf)
+        {
+            transform.GetChild(0).gameObject.SetActive(info);
+        }
     }
 
     void OnMouseDown()
     {
+        info = !info;
         //Debug.Log(StagesEditorController.indexCursor);
         if (move)
         {

+ 9 - 3
Assets/Scripts/Controllers/LabelObjectScript.cs

@@ -12,6 +12,7 @@ public class LabelObjectScript : MonoBehaviour
     public GameObject target;
     public RectTransform canvasRect;
     public GameObject text;
+    public bool TrackMarker = true;
     // Start is called before the first frame update
     void Start()
     {
@@ -38,14 +39,19 @@ public class LabelObjectScript : MonoBehaviour
 
         // Set
         //markerRtra.localPosition = canvasPos;
-        text.transform.localPosition = canvasPos;
+        if(TrackMarker) text.transform.localPosition = canvasPos;
+        else text.transform.parent.transform.localPosition = canvasPos;
+        
 
     }
 
     CameraController cameraController;
     void OnMouseDown()
     {
-        cameraController.target = transform;
-        cameraController.axes = CameraController.RotationAxes.TrackMarker;
+        if (TrackMarker)
+        {
+            cameraController.target = transform;
+            cameraController.axes = CameraController.RotationAxes.TrackMarker;
+        }
     }
 }

+ 13 - 3
Assets/Scripts/Controllers/WorkerController.cs

@@ -79,7 +79,7 @@ public class WorkerController : MonoBehaviour
         //}
     }
 
-    int active_location = 0;
+    public static int active_location = 0;
     public static int active_company = 0;
     // Update is called once per frame
     void Update()
@@ -135,7 +135,12 @@ public class WorkerController : MonoBehaviour
                     location_id = 25;
                     break;
             }
-            
+
+            foreach (var b in Beacons)
+            {
+                Destroy(b.beacon);
+                Destroy(b.button);
+            }
             Beacons = new List<Beacon>();
             client.BeaconsRequest((uint) active_location);
         }
@@ -438,8 +443,13 @@ public class WorkerController : MonoBehaviour
     public void AddBeacon(Beacon b)
     {
         var beacon = Instantiate(Resources.Load("GameObjects/Beacon", typeof(GameObject))) as GameObject;
-        beacon.transform.position = new Vector3(b.x, 0.5f, b.y);
+        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;
+        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}";
+      
         b.beacon = beacon;
     }
 

+ 2 - 1
Assets/Scripts/Net/Client.cs

@@ -295,6 +295,7 @@ public class Client : MonoBehaviour
         //var te = DateTime.Now.Ticks;
         //CoordinatesRequest(ts, te, 1, 1);
         SendGetUsers(1);
+        
     }
 
     #region system functions
@@ -805,7 +806,7 @@ public class Client : MonoBehaviour
             //print($"user received id {id} lenname {lenname} name {name}");
             WorkerController.users.Add(new User { id = id, name = name });
         }
-        WorkerController.users_load = true;
+        WorkerController.users_load = true;        
     }
 
     public void BeaconsReceive(byte[] bytedata)