Esempio n. 1
0
 private void ShowHideUplinks()
 {
     foreach (Transform wan in panel.transform)
     {
         WanMarker wanmarker = wan.GetComponent <WanMarker>();
         wanmarker.uplinks.SetActive(_showUplinks);
     }
 }
Esempio n. 2
0
 public void UpdateWans(bool forceRefresh)
 {
     panel.SetActive(true);
     DestroyWans();
     // Get WANs from SteelConnect API
     _dataManager.GetWans(forceRefresh)
     .Then(wans => wans.ForEach(wan => {
         _wans.Add(wan);
     }))
     .Then(() =>
           // Get uplinks from SteelConnect API
           _dataManager.GetUplinks(forceRefresh)
           .Then(uplinks => uplinks.ForEach(uplink => {
         this.uplinks[uplink.id] = uplink;
     })))
     .Then(() => {
         // Create WAN gameObjects
         bool nameTextOnTop = true;
         foreach (Wan wan in _wans)
         {
             GameObject newWanMarkerObject = Instantiate(wanPrefab, panel.transform);
             WanMarker newWanMarker        = newWanMarkerObject.GetComponent <WanMarker>();
             newWanMarker.wan = wan;
             // Alternate WAN name Y position
             if (nameTextOnTop)
             {
                 newWanMarker.text.transform.localPosition = new Vector3(_nameTextXPosition, _nameTextOnTopYPosition, _nameTextZPosition);
             }
             nameTextOnTop = !nameTextOnTop;
             Debug.Log($"Created {wan.id}");
             // Create Uplink Marker Objects for each WAN
             foreach (string uplinkID in wan.uplinks)
             {
                 GameObject newUplinkMarkerObject = Instantiate(uplinkPrefab, newWanMarker.uplinks.transform);
                 UplinkMarker newUplinkMarker     = newUplinkMarkerObject.GetComponent <UplinkMarker>();
                 newUplinkMarker.uplink           = uplinks[uplinkID];
                 newUplinkMarker.wan = newWanMarkerObject;
                 string uplinkSiteID = newUplinkMarker.uplink.site;
                 if (_stateManager.currentSiteMarkers.ContainsKey(uplinkSiteID))
                 {
                     newUplinkMarker.site = _stateManager.currentSiteMarkers[uplinkSiteID].gameObject;
                 }
                 else
                 {
                     Debug.LogError($"Site does not exist: {uplinkSiteID}");
                 }
             }
         }
         ShowHideUplinks();
     });
 }
Esempio n. 3
0
    void Start()
    {
        _wanObject = transform.parent.gameObject;
        WanMarker wanMarker = _wanObject.GetComponent <WanMarker>();
        Wan       wan       = wanMarker.wan;
        string    text      = $"Id: {wan.id}\n" +
                              $"Name: {wan.name}\n" +
                              $"Longname: {wan.longname}\n" +
                              $"Org: {wan.org}\n";
        TextMesh textMesh = GetComponent <TextMesh>();

        textMesh.text = text;

        _camera = Camera.main;
    }