Exemplo n.º 1
0
 void Start()
 {
     if (BrowserTexture == null)
     {
         BrowserTexture = GetComponent <CollabBrowserTexture>();
     }
 }
Exemplo n.º 2
0
    void Awake()
    {
        browserTexture = GetComponent <CollabBrowserTexture>();
        browserTexture.ShowMouseRepresentation = true;
        browserTexture.enableScrollWheel       = enableScrollWheel;
        browserTexture.allowURLBroadcast       = false;
        browserTexture.AddLoadCompleteEventListener(OnLoadComplete);
        browserTexture.ClickBlocked += OnClickBlocked;

        if (browserTexture.id == CollabBrowserId.NONE)
        {
            browserTexture.id = CollabBrowserId.SLIDEPRESENT;
        }

        if (CommunicationManager.redirectVideo)
        {
            browserTexture.redirectLoadingURL.Add("www.youtube.com", RedirectHelper.HandleYouTube);
            browserTexture.redirectLoadingURL.Add("vimeo.com", RedirectHelper.HandleVimeo);
        }

        WebPanel webPanel = gameObject.AddComponent <WebPanel>();

        webPanel.goToActivateOnFocus = goToActivateOnFocus;
        if (browserTexture.KeyInputEnabled)
        {
            webPanel.allowKeyInputOnZoom = true;
        }

        urlController                = gameObject.AddComponent <RoomVariableUrlController>();
        urlController.RoomVarName    = "purl";
        urlController.BrowserTexture = browserTexture;
    }
Exemplo n.º 3
0
    void InitBrowserTexture()
    {
        bTex = GetComponent <CollabBrowserTexture>();
        bTex.AddLoadCompleteEventListener(OnLoadComplete);
        if (bTex.id == CollabBrowserId.NONE)
        {
            bTex.id = CollabBrowserId.TEAMWEB + id;
        }

        if (GameManager.Inst.ServerConfig == "LocalTest" && id == 6)
        {
            VDebug.LogError("UCI Hack for id 6 -- making id slide presenter for backwards compatiblity");
            bTex.id = CollabBrowserId.SLIDEPRESENT;
            return;
        }

        if (CommunicationManager.redirectVideo)
        {
            bTex.redirectLoadingURL.Add("www.youtube.com", RedirectHelper.HandleYouTube);
            bTex.redirectLoadingURL.Add("vimeo.com", RedirectHelper.HandleVimeo);
        }

        // lock down team room screens, open them up on the guilayer side.
        if (GameManager.Inst.ServerConfig != "UCI")
        {
            bTex.minWriteAccessType = PlayerType.LEADER;
        }
    }
Exemplo n.º 4
0
 // sets the marker position, not the component transform
 public void SetPosition(float textureX, float textureY)
 {
     Init();
     SetVisibility(true);
     mouseVisual.transform.position = TranformBrowserTextureCoordinatesToWorldSpace(textureX, textureY);
     if (replayMode && browserId != -1 && (mouseDown || lastMouseDown))
     {
         Event dragEvent = new Event();
         if (mouseDown && lastMouseDown != mouseDown)
         {
             dragEvent.type = EventType.MouseDown;
         }
         else if (lastMouseDown != mouseDown)
         {
             dragEvent.type = EventType.MouseUp;
         }
         else
         {
             dragEvent.type = EventType.MouseDrag;
         }
         CollabBrowserTexture browser = CollabBrowserTexture.GetAll()[browserId];
         browser.HandleBrowserEvent(dragEvent, (int)((0.5f - textureX) * browser.width), (int)((textureY + 0.5f) * browser.height));
     }
     lastMouseDown = mouseDown;
 }
Exemplo n.º 5
0
    public static void HitDismissForGoogleDocOutOfDateWarning(CollabBrowserTexture bTex)
    {
        // click dismiss button for out of date browser
        string cmd = "var elemList = document.getElementsByClassName(\"docs-butterbar-link\"); if (elemList != null && elemList.length > 0 && elemList[0].parentNode != null && (elemList[0].parentNode.textContent.indexOf(\"out of date\") != -1 || elemList[0].parentNode.textContent.indexOf(\"supported\") != -1) && elemList[0].parentNode.parentNode != null) { elemList[0].parentNode.parentNode.removeChild(elemList[0].parentNode); }";

        bTex.ExecuteJavaScript(cmd);
    }
Exemplo n.º 6
0
    void Start()
    {
        int teamID = CommunicationManager.CurrentTeamID;

        if (useScaleForPixelDimensions)
        {
            pixelHeight = PanelHelpers.GetPxHeightFromTransform(this.transform, pixelWidth);
        }
        browserTexture = gameObject.AddComponent <CollabBrowserTexture>();
        browserTexture.useTransparentMaterial = false;
        browserTexture.Width      = pixelWidth;
        browserTexture.Height     = pixelHeight;
        browserTexture.id         = CollabBrowserId.TEAMNOTES;
        browserTexture.InitialURL = GetNotesURL(teamID);
        browserTexture.ShowMouseRepresentation = (GetComponent <Billboard>() == null || !GetComponent <Billboard>().enabled); // sphere's don't currently move with the billboard controlled orientation
        browserTexture.FocusChange            += OnFocusChange;
        browserTexture.AddLoadCompleteEventListener(OnLoadComplete);
        if (activeOnFocusObj != null)
        {
            activeOnFocusObj.SetActive(false); // initialized assuming screen doesn't have focus.
        }
        // shouldn't need these, but in case user puts video url in notes panel.
        if (CommunicationManager.redirectVideo)
        {
            browserTexture.redirectLoadingURL.Add("www.youtube.com", RedirectHelper.HandleYouTube);
            browserTexture.redirectLoadingURL.Add("vimeo.com", RedirectHelper.HandleVimeo);
        }

        WebPanel webPanel = gameObject.AddComponent <WebPanel>();

        webPanel.focusGainEngagesSnapCam      = true;
        webPanel.focusCameraOnInputFieldClick = false; // already handled on focus
    }
Exemplo n.º 7
0
    public static void MinimizeGoogleDocMenus(CollabBrowserTexture bTex)
    {
        string  cmd  = "var elem = document.getElementById(\"viewModeButton\"); if( elem != null ){var attr = elem.getAttribute(\"data-tooltip\"); if(attr != null && attr.indexOf(\"Hide\") != -1){elem.getBoundingClientRect();}}";
        JSValue rect = bTex.ExecuteJavaScriptWithResult(cmd);

        if (rect != null && rect.Type != JSValueType.Null)
        {
            bTex.ClickOnTopCenterOfObject(rect.GetObject());
        }
    }
Exemplo n.º 8
0
    public Vector3 TranformBrowserTextureCoordinatesToWorldSpace(int textureX, int textureY)
    {
        CollabBrowserTexture browser = CollabBrowserTexture.GetAll()[browserId];

        if (browser != null)
        {
            return(browser.transform.TransformPoint(new Vector3(((float)textureX / 255f) - 0.5f, ((float)(textureY - 0.5f) / 255f) - 0.5f, 0f)));
        }
        return(Vector3.zero);
    }
Exemplo n.º 9
0
    public bool AnyKeyInputBrowsersFocused()
    {
        bool browserFocus = false;

        foreach (KeyValuePair <int, CollabBrowserTexture> cbt in CollabBrowserTexture.GetAll())
        {
            browserFocus |= (cbt.Value.KeyInputEnabled && cbt.Value.Focused);
        }
        return(browserFocus);
    }
Exemplo n.º 10
0
    public Vector3 TranformBrowserTextureCoordinatesToWorldSpace(float textureX, float textureY)
    {
        CollabBrowserTexture browser = CollabBrowserTexture.GetAll()[browserId];

        if (browser != null)
        {
            return(browser.transform.TransformPoint(new Vector3(textureX, textureY, 0f)));
        }
        return(Vector3.zero);
    }
Exemplo n.º 11
0
    private void OnBrowserLoadComplete(System.Object sender, System.EventArgs args)
    {
        CollabBrowserTexture bTexture = sender as CollabBrowserTexture;

        if (bTexture != null)
        {
            bTexture.ReplaceClass("lightbox", "");
            bTexture.AddURLChangeRequestEventListener(OnURLChangeRequest);
        }
    }
Exemplo n.º 12
0
 public void UnfocusKeyInputBrowserPanels()
 {
     foreach (KeyValuePair <int, CollabBrowserTexture> cbt in CollabBrowserTexture.GetAll())
     {
         if (cbt.Value.KeyInputEnabled && cbt.Value.Focused)
         {
             cbt.Value.Unfocus();
         }
     }
 }
Exemplo n.º 13
0
 void Start()
 {
     if (browserTexture == null)
     {
         BrowserTexture = gameObject.GetComponent <CollabBrowserTexture>();
     }
     MainCameraController.Inst.ChangeCameraType += OnChangeCameraType;
     if (goToActivateOnFocus != null)
     {
         goToActivateOnFocus.SetActive(false);
     }
 }
Exemplo n.º 14
0
 void Start()
 {
     browserTexture = overlayGO.AddComponent <CollabBrowserTexture>();
     browserTexture.useCollabFeatures      = browserId != -1; // true let's us use the webpanel command
     browserTexture.Width                  = width;
     browserTexture.Height                 = height;
     browserTexture.useTransparentMaterial = useTransparentMaterial;
     browserTexture.id = browserId;
     if (initUrl != "")
     {
         browserTexture.InitialURL = initUrl;
     }
     browserTexture.AddLoadCompleteEventListener(OnWebViewLoaded);
 }
Exemplo n.º 15
0
    public void SendGuiLayerPanelSelection(JSValue[] args)
    {
        int id = args.Length > 1 ? args[1].ToInteger() : -1;
        CollabBrowserTexture browserTexture = null;

        if (CollabBrowserTexture.GetAll().TryGetValue(id, out browserTexture))
        {
            string cmd = "webPanelSelection(" + id + ", \"" + browserTexture.GetSelectedText() + "\");";
            ExecuteJavascript(cmd);
        }
        else
        {
            Debug.LogError("Could not find browser texture " + id);
        }
    }
Exemplo n.º 16
0
    public static void AutoPopulateGoogleForm(CollabBrowserTexture bTex, Dictionary <string, string> labelToValue)
    {
        string cmd = "";

        // build javascript associative map
        cmd += "var vals = " + DictionaryToJSON(labelToValue);
        cmd += @"var elems = document.getElementsByClassName(""ss-q-short"");
                for(var i = 0; i < elems.length; ++i){ 
	                var label = elems[i].getAttribute(""aria-label"").trim(); 
	                if( vals.hasOwnProperty(label) )
	                {
		                elems[i].value = vals[label];
	                }
                }";
        bTex.ExecuteJavaScript(cmd);
    }
Exemplo n.º 17
0
    public void Sit()
    {
        if (!isSitting)
        {
            prevNavMode = player.playerController.navMode;
            player.playerController.navMode = PlayerController.NavMode.locked;
            player.gameObject.GetComponent <AnimatorHelper>().StartAnim("Sit", true);
            if (player.IsLocal)
            {
                UpdatePlayerServerVariable(true);
            }
        }

#if UNITY_STANDALONE_OSX
        bool controlDown = (Input.GetKey(KeyCode.LeftApple) || Input.GetKey(KeyCode.RightApple));
#else
        bool controlDown = (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl));
#endif

        if (player.IsLocal && !controlDown)
        {
            MainCameraController.Inst.cameraType = CameraType.FIRSTPERSON;
        }

        if (!isSitting && GameGUI.Inst.guiLayer != null)
        {
            GameGUI.Inst.guiLayer.SendGuiLayerSitStart();
        }

        if (GameManager.Inst.LevelLoaded == GameManager.Level.OFFICE)
        {
            foreach (KeyValuePair <int, CollabBrowserTexture> cbt in CollabBrowserTexture.GetAll())
            {
                if (cbt.Key >= CollabBrowserId.TEAMWEB)
                {
                    GameGUI.Inst.presenterToolCollabBrowser = cbt.Value;
                }
            }
        }

        isSitting = true;
    }
Exemplo n.º 18
0
    public static PlaneMesh GetPlane(int pxWidth, int pxHeight, string planeGOName = "PlaneMesh", bool addBrowser = false, string initialURL = "")
    {
        float      worldWidth  = metersPerPixel * pxWidth;
        float      worldHeight = metersPerPixel * pxHeight;
        GameObject planeMeshGO = CreatePlane(worldWidth, worldHeight, planeGOName);
        PlaneMesh  newPlane    = new PlaneMesh(planeMeshGO, worldWidth, worldHeight);

        if (planeMeshGO == null)
        {
            Debug.LogError("Public Browser failed to instantiate");
        }
        if (addBrowser)
        {
            CollabBrowserTexture bTex = planeMeshGO.AddComponent <CollabBrowserTexture>();
            bTex.Width      = pxWidth;
            bTex.Height     = pxHeight;
            bTex.InitialURL = initialURL;
        }
        return(newPlane);
    }
Exemplo n.º 19
0
    private bool gotMouseDown = false; // make sure we get the down and up for a refresh.

    void OnGUI()
    {
        if (screenToRefresh != null && Event.current != null && gotMouseDown && Event.current.type == EventType.MouseUp && MouseHelpers.GetCurrentGameObjectHit() == gameObject)
        {
            gotMouseDown = false;
            if (browserTexture == null)
            {
                browserTexture = screenToRefresh.GetComponent <CollabBrowserTexture>();
            }
            if (browserTexture != null)
            {
                browserTexture.RefreshWebView();
            }
            SoundManager.Inst.PlayClick();
        }
        if (Event.current != null && Event.current.type == EventType.MouseDown)
        {
            gotMouseDown = (MouseHelpers.GetCurrentGameObjectHit() == gameObject);
        }
    }
Exemplo n.º 20
0
    void OnGUI()
    {
        if (screenToSnapTo != null && Event.current != null && Event.current.type == EventType.MouseUp && MouseHelpers.GetCurrentGameObjectHit() == gameObject)
        {
            if (browserTexture == null)
            {
                browserTexture = screenToSnapTo.GetComponent <CollabBrowserTexture>();
            }
            if (browserTexture != null)
            {
                Event.current.Use();
                browserTexture.ToggleSnapCameraToObject();
                if (MainCameraController.Inst.cameraType == CameraType.SNAPCAM)
                {
                    browserTexture.Focus();
                }
            }

            SoundManager.Inst.PlayClick();
        }
    }
Exemplo n.º 21
0
    public virtual void Initialize()
    {
        MeshFilter mf = GetComponent <MeshFilter>();

        if (mf != null)
        {
            MeshCollider mc = GetComponent <MeshCollider>();
            if (mc == null)
            {
                mc            = gameObject.AddComponent <MeshCollider>();
                mc.sharedMesh = mf.mesh;
            }
            if (useScaleForPixelDimensions)
            {
                pixelHeight = PanelHelpers.GetPxHeightFromTransform(this.transform, pixelWidth);
            }
            bTex                 = gameObject.AddComponent <CollabBrowserTexture>();
            bTex.Width           = pixelWidth;
            bTex.Height          = pixelHeight;
            bTex.id              = bssId;
            bTex.InitialURL      = url;
            bTex.KeyInputEnabled = false;
            bTex.blacklistRequestURLFragments.AddRange(blacklistRequestURLFragments);
            bTex.requestReplacements = requestReplacements;
            bTex.LoadingTexture      = refreshTex;
            bTex.FocusChange        += OnFocusChange;
        }
        else
        {
            PlaneMesh bPlane = PlaneMeshFactory.GetPlane(pixelWidth, pixelHeight, gameObject.name + "-bplane", true, url);
            bTex = bPlane.go.GetComponent <CollabBrowserTexture>();
        }
        bTex.AllowURLChanges = false;
        bTex.AddLoadCompleteEventListener(OnLoadCompleted);

        // web panel for focus control
        WebPanel webPanel = gameObject.AddComponent <WebPanel>();

        webPanel.focusCameraOnInputFieldClick = false; // not currently needed for bizsim panels
    }
Exemplo n.º 22
0
    public void OnObjectMessage(int userID, ISFSObject msgObj)
    {
        //if player is stealth, don't show a mouse sphere to others
        if (GameManager.Inst.playerManager != null && GameManager.Inst.playerManager.GetPlayer(userID) != null && GameManager.Inst.playerManager.GetPlayer(userID).Type == PlayerType.STEALTH)
        {
            return;
        }
        // Light-bandwidth mouse browers index, horizontal, vertical.
        else if (msgObj.ContainsKey("mpx"))
        {
            PlayerMouseVisual visual = GetVisual(userID);
            if (visual == null)
            {
                return;
            }

            Sfs2X.Util.ByteArray mouseBytes = msgObj.GetByteArray("mpx");

            int mouseBrowserID     = mouseBytes.ReadByte();
            int mouseBrowserCoordX = mouseBytes.ReadByte();
            int mouseBrowserCoordY = mouseBytes.ReadByte();
            visual.mouseDown = mouseBytes.ReadBool();
            visual.browserId = mouseBrowserID;

            CollabBrowserTexture mouseBrowser = CollabBrowserTexture.GetAll()[mouseBrowserID];
            if (mouseBrowser)
            {
                visual.SetPosition(mouseBrowserCoordX, mouseBrowserCoordY);
                visual.textureScaleMult = Mathf.Min(mouseBrowser.transform.lossyScale.x, mouseBrowser.transform.lossyScale.y) * 0.1f;
            }
        }
        else if (msgObj.ContainsKey("mp"))
        {
            PlayerMouseVisual visual = GetVisual(userID);
            if (visual == null)
            {
                return;
            }

            Sfs2X.Util.ByteArray mouseBytes = msgObj.GetByteArray("mp");

            int   mouseBrowserID     = mouseBytes.ReadByte();
            float mouseBrowserCoordX = mouseBytes.ReadFloat();
            float mouseBrowserCoordY = mouseBytes.ReadFloat();
            visual.mouseDown = mouseBytes.ReadBool();
            visual.browserId = mouseBrowserID;

            CollabBrowserTexture mouseBrowser = CollabBrowserTexture.GetAll()[mouseBrowserID];
            if (mouseBrowser)
            {
                visual.SetPosition(mouseBrowserCoordX, mouseBrowserCoordY);
                visual.textureScaleMult = Mathf.Min(mouseBrowser.transform.lossyScale.x, mouseBrowser.transform.lossyScale.y) * 0.1f;
            }
        }
        else if (msgObj.ContainsKey("me"))
        {
            PlayerMouseVisual visual = GetVisual(userID);
            if (visual == null)
            {
                return;
            }

            visual.SetVisibility(false);
        }
    }
Exemplo n.º 23
0
    public static void EnterTwiddlaUserName(CollabBrowserTexture bTex, string name)
    {
        string cmd = "var gn = document.getElementById(\"guestName\"); if(gn != null){gn.value = \"" + name + "\";gn.focus();}";

        bTex.ExecuteJavaScript(cmd);
    }
Exemplo n.º 24
0
    public static void CloseTwiddlaSideNav(CollabBrowserTexture bTex)
    {
        string cmd = "if(slideNavSingleton != null){slideNavSingleton.slideClosed();}";

        bTex.ExecuteJavaScript(cmd);
    }
Exemplo n.º 25
0
 public WebCallbackHandler(CollabBrowserTexture bTex_)
 {
     bTex = bTex_;
     bTex.AddLoadCompleteEventListener(OnLoadComplete);
 }
Exemplo n.º 26
0
 void OnDestroy()
 {
     mInstance = null;
     CollabBrowserTexture.GetAll().Remove(CollabBrowserId.PRIVATEBROWSER);
 }