Exemple #1
0
        public static ClickableTextSpec FromX3dParseNode(X3DParse.Node node)
        {
            ClickableTextSpec spec = new ClickableTextSpec();

            if (node != null)
            {
                foreach (var child in node.Children.FindAll(x => x.NodeType == X3DParse.NodeType.Attribute))
                {
                    string name = child.Name.ToLower();
                    switch (name)
                    {
                    case "text":
                        spec.Text = child.Value;
                        break;

                    case "slm:href":
                    case "href":
                        spec.Href = child.Value;
                        break;

                    case "slm:tooltip":
                    case "tooltip":
                        spec.Tooltip = child.Value;
                        break;

                    case "slm:target":
                    case "target":
                        Target t = Target._blank;
                        Statics.TryGetTarget(child.Value, out t);
                        spec.Target = t;
                        break;
                    }
                }
            }
            return(spec);
        }
Exemple #2
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));
            }
            // }
        }