private void Start()
    {
        using (HttpClient client = new HttpClient())
        {
            var httpResponseMessage =
                client.GetAsync("https://hiw-communities.azurewebsites.net" + endpoint + (byUser ? FileAndNetworkUtils.currentUser.id : FileAndNetworkUtils.currentUser.communityId.ToString())).Result;
            if (httpResponseMessage.IsSuccessStatusCode)
            {
                string res = httpResponseMessage.Content.ReadAsStringAsync().Result;
                Debug.Log(res);
                _resultData = JsonUtility.FromJson <ResultData <AnchorDTO> >(res);


                foreach (var tag in _resultData.data)
                {
                    Debug.Log("TAG USER : "******"/api/UsersAPI/" + tag.userId).nickName);

                    User tagUser = FileAndNetworkUtils.getObjectFromApi <User>("/api/UsersAPI/" + tag.userId);

                    GameObject go = Instantiate(template, transform);
                    if (byUser)
                    {
                        go.transform.Find("UserLabel").GetComponent <Text>().text = "Times checked :";
                        go.transform.Find("UserText").GetComponent <Text>().text  = "11";
                    }
                    else
                    {
                        go.transform.Find("UserText").GetComponent <Text>().text = tagUser.nickName;
                    }
                    go.transform.Find("DateText").GetComponent <Text>().text = tag.creationDate;

                    if (displayLocation)
                    {
                        Community tagCommu = FileAndNetworkUtils.getObjectFromApi <Community>("/api/CommunitiesAPI/" + tagUser.communityId);
                        go.transform.Find("LocationText").GetComponent <Text>().text = tagCommu.address;
                    }
                    else
                    {
                        go.transform.Find("LocationLabel").gameObject.SetActive(false);
                        go.transform.Find("LocationText").gameObject.SetActive(false);
                    }

                    tag.pictureUrl = "https://i.pinimg.com/originals/20/79/03/2079033abc8314be554f9d24f562a199.jpg";

                    if (!string.IsNullOrEmpty(tag.pictureUrl))
                    {
                        go.GetComponent <ImageToTag>().SetImage(tag.pictureUrl);
                    }

                    go.GetComponent <Button>().onClick.AddListener(delegate() { ItemClicked(tag.identifier); });
                }

                UpdateText(_resultData.data.Length);
            }
            else
            {
                Debug.Log("Error request");
            }
        }
    }
Ejemplo n.º 2
0
    public GameObject GetModelFromModelID(string modelID)
    {
        //TO DO : get model from api
        Debug.Log("MODEL ID : " + modelID);
        Debug.Log(modelID);
        switch (modelID)
        {
        case "visit-card":
            return(businessCardPrefab);

        case "community":
            int    communityId = gameObject.GetComponent <AzureSpatialTest>().currentUser.communityId;
            string community   = FileAndNetworkUtils.getObjectFromApi <Community>("/api/CommunitiesAPI/" + communityId)
                                 .name;
            Debug.Log("Community : " + community);
            if (community.Equals("none"))
            {
                return(null);
            }
            return(Resources.Load <GameObject>("Prefabs/Models/Communities/" + community));

        default:
            return(Resources.Load <GameObject>("Prefabs/Models/Others/" + modelID));
        }
    }
 public void ShowPopup(string anchorId)
 {
     this.gameObject.transform.localScale = new Vector3(1, 1, 1);
     anchor          = FileAndNetworkUtils.getObjectFromApi <AnchorDTO>("/api/AnchorsAPI/" + anchorId);
     AnchorText.text = anchor.identifier;
     UserText.text   = "Placed by " + anchor.user.nickName;
 }
Ejemplo n.º 4
0
    void Start()
    {
        _uiHandler = this.GetComponent <UIHandlerScript>();

        StartCoroutine(StartLocation());
        currentUser = FileAndNetworkUtils.getCurrentUser();

        /*Debug.Log("CURRENT USER : "******"CURRENT USER JOB : " + currentUser.mission);
         * Debug.Log("CURRENT USER ID : " + currentUser.id);
         *
         * saveButton = XRUXPicker.Instance.GetDemoButton();*/

        feedbackBox = XRUXPicker.Instance.GetFeedbackText();

        ReferencePointCreator = FindObjectOfType <ReferencePointCreator>();
        ReferencePointCreator.OnObjectPlacement += ReferencePointCreator_OnObjectPlacement;

        feedbackBox.text = "Starting Session";
        if (ARSession.state == ARSessionState.SessionTracking)
        {
            var startAzureSession = StartAzureSession();
        }
        else
        {
            ARSession.stateChanged += ARSession_stateChanged;
        }
    }
Ejemplo n.º 5
0
    public GameObject SpawnAnchoredObject(string AnchorId, Vector3 position, Quaternion rotation)
    {
        HttpWebRequest  request      = (HttpWebRequest)WebRequest.Create(ApiURL + "/api/AnchorsAPI/" + AnchorId);
        HttpWebResponse response     = (HttpWebResponse)request.GetResponse();
        StreamReader    reader       = new StreamReader(response.GetResponseStream());
        string          jsonResponse = reader.ReadToEnd();
        Anchor          anchorFound  = JsonUtility.FromJson <Anchor>(jsonResponse);

        Debug.Log("JSON RESPONSE : " + jsonResponse);
        Debug.Log("JSON RESPONSE USER : "******"visit-card"))
        {
            anchorFound.user = FileAndNetworkUtils.getObjectFromApi <User>("/api/UsersAPI/" + anchorFound.userId);
            Debug.Log("visit card user : " + anchorFound.user.nickName);
            spawnedObject.GetComponent <BusinessCardScript>().UpdateInfos(
                anchorFound.user.nickName,
                anchorFound.user.mission,
                anchorFound.user.email,
                anchorFound.user.phoneNumber,
                anchorFound.user.socialMedia);
        }
        spawnedObject.AddComponent <AnchorInterraction>();
        spawnedObject.GetComponent <AnchorInterraction>().SetAnchorId(anchorFound.identifier);

        return(spawnedObject);
    }
 void Start()
 {
     Permission.RequestUserPermission(Permission.FineLocation);
     validateButton.interactable = false;
     if (FileAndNetworkUtils.getCurrentUser() != null)
     {
         SceneManager.LoadScene("AzureSpatialAnchorsBasicDemo", LoadSceneMode.Single); //AzureSpatialAnchorsBasicDemo
     }
 }
    public void OnSendButtonClicked()
    {
        var anchorInterraction = new TagInterraction {
            userId = anchor.user.id, anchorIdentifier = anchor.identifier, message = MessageInputField.text
        };

        FileAndNetworkUtils.postObjectToApi("/api/InteractionsAPI", anchorInterraction);
        ClosePopup();
        this.GetComponent <Animator>().SetTrigger("ToPage1");
    }
 private void DisplayCommunityPage()
 {
     CommunityPanel.SetActive(true);
     NoCommunityPanel.SetActive(false);
     _community = FileAndNetworkUtils.getObjectFromApi <Community>("/api/CommunitiesAPI/" + FileAndNetworkUtils.currentUser.communityId);
     Debug.Log("URL : " + _community.pictureUrl);
     StartCoroutine(DownloadImage(_community.pictureUrl));
     NameText.text    = _community.name;
     AddressText.text = _community.address;
 }
    private void onDeepLinkActivated(string url)
    {
        // Update DeepLink Manager global variable, so URL can be accessed from anywhere.
        deeplinkURL = url;

// Decode the URL to determine action.
// In this example, the app expects a link formatted like this:
// unitydl://mylink?scene1
        string[] splittedURL = url.Split('?');
        if (splittedURL.Length <= 1)
        {
            return;
        }
        FileAndNetworkUtils.SaveUser(splittedURL[1]);
        SceneManager.LoadScene("AzureSpatialAnchorsBasicDemo", LoadSceneMode.Single); //AzureSpatialAnchorsBasicDemo
    }
    public async void OnButtonSelected()
    {
        clearErrors();

        Debug.Log($"nickname = [{nickname.text}]");
        Debug.Log($"email = [{email.text}]");
        Debug.Log($"phone = [{phone.text}]");
        Debug.Log($"mission = [{mission.text}]");
        Debug.Log($"function = [{function.text}]");
        Debug.Log($"function = [{password.text}]");

        using (HttpClient client = new HttpClient())
        {
            User user = new User(
                this.nickname.text,
                this.email.text,
                this.phone.text,
                "social",
                this.function.text,
                this.mission.text,
                this.password.text);

            string jsonString = JsonUtility.ToJson(user);

            HttpContent httpContent = new StringContent(jsonString, Encoding.UTF8, "application/json");
            Debug.Log("MESSAGE : " + jsonString);
            HttpResponseMessage httpResponseMessage = client.PostAsync($"{config.apiBaseUrl}/api/UsersAPI", httpContent).Result;
            if (httpResponseMessage.IsSuccessStatusCode)
            {
                HttpContent content  = httpResponseMessage.Content;
                string      response = content.ReadAsStringAsync().Result;
                //todo: register to local storage + send to next page
                Debug.Log(response);
                User savedUser = JsonUtility.FromJson <User>(response);
                Debug.Log("USER TO SAVE : " + savedUser.id);
                FileAndNetworkUtils.SaveUser(savedUser.id);
                SceneManager.LoadScene("AzureSpatialAnchorsBasicDemo", LoadSceneMode.Single); //AzureSpatialAnchorsBasicDemo
            }
            else
            {
                //todo: show user error
            }
        }
    }
    public void DisplayInterractions(List <TagInterraction> tagInterractions)
    {
        foreach (var interraction in tagInterractions)
        {
            Debug.Log("INTERRACTION USER : "******"/api/UsersAPI/" + interraction.userId).nickName);

            User interractUser = FileAndNetworkUtils.getObjectFromApi <User>("/api/UsersAPI/" + interraction.userId);

            GameObject go = Instantiate(template, transform);
            go.transform.Find("UserText").GetComponent <TMP_Text>().text    = interractUser.nickName;
            go.transform.Find("DateText").GetComponent <TMP_Text>().text    = interraction.creationDate;
            go.transform.Find("MessageText").GetComponent <TMP_Text>().text = interraction.message;

            if (!string.IsNullOrEmpty(interraction.pictureUrl))
            {
                go.GetComponent <ImageToTag>().SetImage(interraction.pictureUrl);
            }
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        AnchorDTO tag = FileAndNetworkUtils.getObjectFromApi <AnchorDTO>("/api/AnchorsAPI/" + CrossSceneInfoStatic.TagForTagDetails);

        tag.user = FileAndNetworkUtils.getObjectFromApi <User>("/api/UsersAPI/" + tag.userId);

        UserText.text = "Placed by " + tag.user.nickName;
        IdText.text   = tag.identifier;

        tag.pictureUrl = "https://i.pinimg.com/originals/20/79/03/2079033abc8314be554f9d24f562a199.jpg";


        if (!string.IsNullOrEmpty(tag.pictureUrl))
        {
            this.GetComponent <ImageToTag>().SetImage(tag.pictureUrl);
        }

        _tagInterractions.DisplayInterractions(tag.interactions);
    }
    void Start()
    {
        User user = FileAndNetworkUtils.currentUser;

        if (user.communityId != -1)
        {
            communityText.text = FileAndNetworkUtils.getObjectFromApi <Community>("/api/CommunitiesAPI/" + user.communityId).name;
        }
        else
        {
            communityText.text = "None yet";
        }
        Debug.Log("USER INFOS : ");
        Debug.Log(user.nickName);
        Debug.Log(user.community);
        Debug.Log(user.email);
        nameText.text       = user.nickName;
        emailText.text      = user.email;
        phoneText.text      = user.phoneNumber;
        socialsText.text    = user.socialMedia;
        enterpriseText.text = user.enterprise;
        missionText.text    = user.mission;
    }
 public void OnLogoutButtonClicked()
 {
     FileAndNetworkUtils.DeleteCurrentUser();
     SceneManager.LoadScene("Register");
 }