// Loads initial scale of LC's child objects to a value that is used when scaling LCs with the scale sliders.
 void SetScalePresets(LocationContainer container)
 {
     centralSpriteScale   = container.centralSprite.gameObject.transform.localScale.x;
     highlightSpriteScale = container.highlightSprite.gameObject.transform.localScale.x;
     selectionSpriteScale = container.selectionSprite.gameObject.transform.localScale.x;
     subSpriteScale       = container.subIconSprite.gameObject.transform.localScale.x;
 }
Пример #2
0
    public void ShiftUp()
    {
        bool              hasSelected = false;
        float             absDistance;
        float             closestDistance = 9999f;
        LocationContainer selectedCont    = ContainerController.Instance.GetContainerFromLocation(LocationController.Instance.GetSelectedLocation());
        LocationContainer newSelectedCont = null;

        foreach (LocationContainer listedContainer in ContainerController.Instance.locationContainerList)
        {
            absDistance = Vector3.Distance(selectedCont.transform.localPosition, listedContainer.transform.localPosition);
            if (listedContainer.transform.localPosition.y > selectedCont.transform.localPosition.y && absDistance < closestDistance)
            {
                closestDistance = absDistance;
                newSelectedCont = listedContainer;
                hasSelected     = true;
            }
        }

        if (hasSelected == true)
        {
            LocationController.Instance.SetSelectedLocation(newSelectedCont.GetContainedLocation());
            ContainerController.Instance.ShiftSelectedContainer(newSelectedCont);
        }
    }
 void ShowTooltip(LocationContainer cont)
 {
     tooltipPanel.transform.localPosition = new Vector3(cont.gameObject.transform.position.x + 5.5f, cont.gameObject.transform.position.y - 1.6f, 0);
     tooltipPanel.SetActive(true);
     tooltipTitle.text = cont.GetContainedLocation().elementID;
     tooltipText.text  = cont.GetContainedLocation().description;
 }
Пример #4
0
 internal static void Update_LocationContainer_Locations(LocationContainer locationContainer, AddressAndLocationCollection localCollection, AddressAndLocationCollection masterCollection)
 {
     localCollection.CollectionContent = masterCollection.CollectionContent;
     if (localCollection.OrderFilterIDList == null)
     {
         localCollection.OrderFilterIDList = new List <string>();
     }
 }
Пример #5
0
    public void CenterCameraOnSelectedLocation()
    {
        // Called from Places - Lookup search, or the locate button in Explore Screen.
        // Setting camera to size 25 because size alters correct positioning and math is hard
        mainCamera.orthographicSize = 25f;
        LocationContainer cont   = ContainerController.Instance.GetContainerFromLocation(LocationController.Instance.GetSelectedLocation());
        Vector3           newvec = new Vector3(cont.transform.localPosition.x - 3f, cont.transform.localPosition.y + 15f, 0);

        mainCamera.transform.localPosition = new Vector3(newvec.x, newvec.y, -10);
    }
 // Selecting the nearest LC in an N,E,S or W direction from the ExploreScreen
 public void ShiftSelectedContainer(LocationContainer cont)
 {
     if (selectedContainer != null)
     {
         selectedContainer.RemoveSelectHighlight();
     }
     selectedContainer = cont;
     selectedContainer.SelectHighlight();
     LocationController.Instance.SetSelectedLocation(selectedContainer.GetContainedLocation());
     UIController.Instance.RefreshUI();
 }
Пример #7
0
        public async Task CanSendReferencesRequestAsync()
        {
            string scriptPath = NewTestFile(@"
function CanSendReferencesRequest {

}

CanSendReferencesRequest
");

            LocationContainer locations = await PsesLanguageClient
                                          .SendRequest <ReferenceParams>(
                "textDocument/references",
                new ReferenceParams
            {
                TextDocument = new TextDocumentIdentifier
                {
                    Uri = new Uri(scriptPath)
                },
                Position = new Position
                {
                    Line      = 5,
                    Character = 0
                },
                Context = new ReferenceContext
                {
                    IncludeDeclaration = false
                }
            })
                                          .Returning <LocationContainer>(CancellationToken.None).ConfigureAwait(false);

            Assert.Collection(locations,
                              location1 =>
            {
                Range range = location1.Range;
                Assert.Equal(1, range.Start.Line);
                Assert.Equal(9, range.Start.Character);
                Assert.Equal(1, range.End.Line);
                Assert.Equal(33, range.End.Character);
            },
                              location2 =>
            {
                Range range = location2.Range;
                Assert.Equal(5, range.Start.Line);
                Assert.Equal(0, range.Start.Character);
                Assert.Equal(5, range.End.Line);
                Assert.Equal(24, range.End.Character);
            });
        }
 // Called from LC's box collider on enter and exit
 public void SetHoveredContainer(LocationContainer cont)
 {
     hoveredContainer = cont;
     if (cont == null) // exit hover
     {
         hoveringLocationContainer = false;
         HideTooltip();
     }
     else
     {
         hoveringLocationContainer = true;
         if (showTooltipOnHover == true)
         {
             ShowTooltip(cont);
         }
     }
 }
Пример #9
0
        public override Task <LocationContainer> Handle(ReferenceParams request, CancellationToken cancellationToken)
        {
            var port = Workspace.GetPortAt(request.TextDocument.Uri, request.Position.ToLocation());

            if (port == null)
            {
                return(Task.FromResult(LocationContainer.From(Array.Empty <Location>())));
            }

            var refs = Workspace.FindReferencesTo(request.TextDocument.Uri, port);

            return(Task.FromResult(LocationContainer.From(refs.Select(o => new Location
            {
                Range = o.Span.ToRange(),
                Uri = request.TextDocument.Uri
            }))));
        }
 public void ClickContainer(LocationContainer cont)
 {
     if (UIController.Instance.IsContentInteractionAllowed() == true)
     {
         if (cont == selectedContainer && UIController.Instance.worldUI.explorePanelActive == true)
         {
             UIController.Instance.worldUI.CloseExplorePanel();
         }
         else
         {
             if (selectedContainer != null)
             {
                 selectedContainer.RemoveSelectHighlight();
             }
             selectedContainer = cont;
             selectedContainer.SelectHighlight();
             LocationController.Instance.SetSelectedLocation(selectedContainer.GetContainedLocation());
             UIController.Instance.worldUI.OpenExplorePanel();
         }
     }
 }
Пример #11
0
        void ReleaseDesignerOutlets()
        {
            if (GroupsButton != null)
            {
                GroupsButton.Dispose();
                GroupsButton = null;
            }

            if (GroupsButton != null)
            {
                GroupsButton.Dispose();
                GroupsButton = null;
            }

            if (LocationContainer != null)
            {
                LocationContainer.Dispose();
                LocationContainer = null;
            }

            if (LocationsButton != null)
            {
                LocationsButton.Dispose();
                LocationsButton = null;
            }

            if (LocationsButton != null)
            {
                LocationsButton.Dispose();
                LocationsButton = null;
            }

            if (SearchView != null)
            {
                SearchView.Dispose();
                SearchView = null;
            }
        }
        public virtual LocationDataObject Save(
            LocationContainer theDataObjectToSave,
            LambdaExpression securityFilterExpression = null,
            List <string> includes = null,
            bool skipSecurity      = false,
            Parameters parameters  = null)
        {
            var uri     = new Uri(_serviceUrl);
            var request = WebRequest.Create(uri);

            request.ContentType = "application/x-www-form-urlencoded";
            request.Method      = "POST";
            request.Timeout     = GetRequestTimeout(parameters);

            using (var stream = request.GetRequestStream())
            {
                string objectToSaveAsString = JsonConvert.SerializeObject(theDataObjectToSave, JsonSerializerSettings);

                var byteArray = Encoding.UTF8.GetBytes("entity=" + HttpUtility.UrlEncode(objectToSaveAsString));
                stream.Write(byteArray, 0, byteArray.Length);

                if (includes != null && includes.Any())
                {
                    byteArray = Encoding.UTF8.GetBytes("&include=" + HttpUtility.UrlEncode(String.Join(",", includes)));
                    stream.Write(byteArray, 0, byteArray.Length);
                }

                // get user token for currently authenticated user if any
                var userToken = UserIdentity.UserToken;

                if (!String.IsNullOrEmpty(userToken))
                {
                    byteArray = Encoding.UTF8.GetBytes("&_user_token=" + userToken);
                    stream.Write(byteArray, 0, byteArray.Length);
                }

                // Add custom query params
                WriteQueryParams(stream);

                try
                {
                    using (var response = request.GetResponse())
                    {
                        if (response == null)
                        {
                            throw new PulpException("Unable to get the response from " + uri.ToString());
                        }

                        using (var responseStream = response.GetResponseStream())
                        {
                            if (responseStream == null)
                            {
                                throw new PulpException("Unable to get the response stream from " + uri.ToString());
                            }

                            var sr        = new StreamReader(responseStream);
                            var container = JsonConvert.DeserializeObject <LocationContainer>(sr.ReadToEnd(), JsonSerializerSettings);

                            if (container == null)
                            {
                                if (theDataObjectToSave.ExtractLocation().IsMarkedForDeletion)
                                {
                                    return(null);
                                }
                                else
                                {
                                    throw new GOServerException("No Location in the response to SDK DataProvider Save(). Not expecting a null response here!");
                                }
                            }
                            else
                            {
                                container.ObjectsDataSet.EnsureInitialized();
                                container.ObjectsDataSet.ReconstructIndexes();

                                response.Close();
                                return(container.ExtractLocation());
                            }
                        }
                    }
                }
                catch (WebException we)
                {
                    // See if we can decode GOServerException
                    var error = GOServerException.FromWebResponse(we);

                    if (error != null)
                    {
                        throw error;
                    }

                    throw;
                }
            }
        }
 internal static void Update_LocationContainer_Locations(LocationContainer locationContainer, AddressAndLocationCollection localCollection, AddressAndLocationCollection masterCollection)
 {
     localCollection.CollectionContent = masterCollection.CollectionContent;
     if (localCollection.OrderFilterIDList == null)
         localCollection.OrderFilterIDList = new List<string>();
 }
Пример #14
0
 private bool canDeleteLocation(LocationContainer arg)
 {
     return(true);
 }
Пример #15
0
 private void deleteLocationExecute(LocationContainer obj)
 {
     Locations.Remove(obj.Location);
 }