Exemple #1
0
 public string GetUrl(string url)
 {
     if (url.StartsWith("http://") || url.StartsWith("https://") || url.StartsWith("file://"))
     {
         return(url);
     }
     if (url.Contains("."))
     {
         string tbaseUrl = BaseUrl;
         while (url.StartsWith("../"))
         {
             tbaseUrl = tbaseUrl.Substring(0, tbaseUrl.LastIndexOf("/"));
             url      = url.Substring(3);
         }
         return(tbaseUrl + "/" + url);
     }
     if (AtHome && !url.Contains("?"))
     {
         //url is search term:
         return(Statics.AddUrlProperty(GetHomeUrl(), "s", url));
     }
     else
     {
         return(GetStrippedUrl(FullSceneUrl) + url);
     }
 }
Exemple #2
0
 string CheckImmersiveController(string url, string tagName, Transform controllerT)
 {
     if (controllerT != null && controllerT.gameObject.activeSelf)
     {
         var pl = Slam.Instance.ScenePosition(controllerT.position);
         var rl = controllerT.rotation;
         url = Statics.AddUrlProperty(url, tagName + "p", WWW.EscapeURL(ClearValue(pl.Vector3ToString())));
         url = Statics.AddUrlProperty(url, tagName + "r", WWW.EscapeURL(ClearValue(rl.QuaternionToString())));
     }
     return(url);
 }
Exemple #3
0
        public string GetHomeUrl(bool addPaging = true)
        {
            var url = HomeUrl;

            if (string.IsNullOrEmpty(HomeUrl))
            {
                url = GetBaseUrl() + Homepage;
            }
            if (addPaging && !string.IsNullOrEmpty(HomePagePage))
            {
                url = Statics.AddUrlProperty(url, "p", HomePagePage);
                //url += "?p=" + HomePagePage;
            }
            return(url);
        }
Exemple #4
0
//        public IEnumerator Check()
        public void Check()
        {
            //while (true)
            //{
            //    yield return new WaitForSeconds(waitTime);
            if (!checking && AvatarOn && !string.IsNullOrEmpty(Slam.Instance.UrlHandler.CurrentPageUrl))// && !Slam.Instance.UrlHandler.SingleUser)//
            {
                checking = true;
                string url = null;
                try
                {
                    string avId  = Slam.Instance.DeviceManager.UserGuid;
                    string nickN = CheckNullOrEmptyValue(Slam.Instance.NickName);
                    // Vector3 pos = Slam.Instance.SceneGO.transform.position - Camera.main.transform.position;// - 1.625F*Vector3.up;
                    Vector3    pos      = Slam.Instance.ScenePosition(Camera.main.transform.position);
                    Quaternion rot      = Camera.main.transform.rotation;
                    string     avNo     = CheckNullOrEmptyValue(Slam.Instance.AvatarNo);
                    string     dissGuid = CheckNullOrEmptyValue(Slam.Instance.DissonanceGuid);

                    url = getBaseCommunicatorUrl();
                    //todo: add own properties
                    var roomUrl = Slam.Instance.UrlHandler.CurrentPageUrl;
                    if (Slam.Instance.UrlHandler.SingleUser)
                    {
                        roomUrl = Statics.AddUrlProperty(roomUrl, "su", avId);
                    }
                    else
                    {
                        roomUrl = Slam.Instance.UrlHandler.GetRoomFromUrl(roomUrl);
                    }
                    string room = WWW.EscapeURL(roomUrl);

                    string prop = room.Trim() + "|" + avId + "|" + ClearValue(pos.Vector3ToString() + "|" + ClearValue(rot.QuaternionToString()));
                    prop += "|" + nickN + "|" + avNo + "|" + dissGuid;
                    string action     = "";
                    string actionTime = "";
                    if (Slam.Instance.Actions.Count > 0)
                    {
                        action     = Slam.Instance.Actions.Peek().GoName;
                        actionTime = Slam.Instance.Actions.Peek().SceneTime.ToString();
                    }
                    prop += "|" + CheckNullOrEmptyValue(action) + "|" + actionTime;

                    url = Statics.AddUrlProperty(url, "u", WWW.EscapeURL(prop));
                    if (Slam.Instance.IsImmersive())
                    {
                        url = CheckImmersiveController(url, "lh", Slam.Instance.LeftController);
                        url = CheckImmersiveController(url, "rh", Slam.Instance.RightController);
                    }
                    if (Slam.Instance.UrlHandler.SingleUser)
                    {
                        url = Statics.AddUrlProperty(url, "s", "1");
                    }
                    if (true || Slam.Instance.IsHoloLens())
                    {
                        var ext = Slam.Instance.GetTypedTextForExternalKeyboard();
                        if (ext != null)
                        {
                            url = Statics.AddUrlProperty(url, "kb", WWW.EscapeURL(ext));
                            url = Statics.AddUrlProperty(url, "g", Slam.Instance.DeviceManager.UserGuid);
                        }
                    }
                    if (Slam.Instance.communityPosts != null)
                    {
                        url = Statics.AddUrlProperty(url, "p", WWW.EscapeURL(Slam.Instance.postsPageno.ToString()));
                        url = Statics.AddUrlProperty(url, "lmg", WWW.EscapeURL(Slam.Instance.latestPostGuid));
                        if (!string.IsNullOrEmpty(Slam.Instance.CommunityInput))
                        {
                            url = Statics.AddUrlProperty(url, "ci", WWW.EscapeURL(Slam.Instance.CommunityInput));
                            Slam.Instance.CommunityInput = null;
                        }
                    }
                }
                catch (System.Exception x)
                {
                    checking = false;
                    return;
                }
                StartCoroutine(GetXML(url));
            }
            // }
        }