Ejemplo n.º 1
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;
    }
Ejemplo n.º 2
0
    public void OnRoomVariablesUpdate(BaseEvent evt)
    {
        if (HandleRecordToDisk(evt))
        {
            return;
        }
        switch (GameManager.Inst.LevelLoaded)
        {
        case GameManager.Level.BIZSIM:
            BizSimManager.Inst.OnRoomVariablesUpdate(evt);
            break;

        case GameManager.Level.ORIENT:
        case GameManager.Level.TEAMROOM:
            // These are handled by RoomVariableUrlController now.
            break;

        default:
            Debug.LogError("Room variable update not handled in level: " + (int)GameManager.Inst.LevelLoaded);
            break;
        }

        RoomVariableUrlController.HandleRoomVariableUpdate(evt);
        RoomVariableToEnable.HandleRoomVariableUpdate(evt);
    }
Ejemplo n.º 3
0
    public static void HandleRoomVariableUpdate(UserVariable userVar)
    {
        RoomVariableUrlController controller = null;

        if (allRmVarControllers.TryGetValue(userVar.Name, out controller))
        {
            controller.SetNewURL(userVar.GetStringValue(), false);
        }
    }
Ejemplo n.º 4
0
    public static void HandleRoomVariableUpdate(BaseEvent evt)
    {
        Room room = (Room)evt.Params["room"];
        RoomVariableUrlController controller = null;

        ArrayList changedVars = (ArrayList)evt.Params["changedVars"];

        foreach (string varName in changedVars)
        {
            if (allRmVarControllers.TryGetValue(varName, out controller))
            {
                controller.SetNewURL(room.GetVariable(varName).GetStringValue(), false);
            }
        }
    }
Ejemplo n.º 5
0
    void HandleRoomVariableUpdate(UserVariable userVar)
    {
        switch (GameManager.Inst.LevelLoaded)
        {
        case GameManager.Level.ORIENT:
        case GameManager.Level.TEAMROOM:
            RoomVariableUrlController.HandleRoomVariableUpdate(userVar);
            break;

        default:
            Debug.LogError("Room variable update not handled for level: " + (int)GameManager.Inst.LevelLoaded);
            break;
        }
        RoomVariableToEnable.HandleRoomVariableUpdate(userVar);
    }
Ejemplo n.º 6
0
    void Awake()
    {
        // hack to deal with notes screen replacement -- fix me please
        if (GameManager.Inst.LevelLoaded == GameManager.Level.TEAMROOM)
        {
            if (id == 5 && CommunicationManager.parseScreens.Contains(CollabBrowserId.TEAMNOTES))
            {
                gameObject.SetActive(false);
                return;
            }
        }

        if (GameManager.Inst.LevelLoaded == GameManager.Level.TEAMROOM && CommunicationManager.parseScreens.Contains(id))
        {
            parseDBControlled = true;
        }


        if (parseDBControlled)
        {
            string url = "";
            if (GetURLFromParse(ref url))
            {
                InitBrowserTexture();
                SetToURL(url);
            }
            else
            {
                gameObject.SetActive(false);
            }
        }
        else
        {
            InitBrowserTexture();

            RoomVariableUrlController controller = gameObject.AddComponent <RoomVariableUrlController>();
            controller.RoomVarName    = (rmVarOverride == "") ? ("url" + id) : rmVarOverride;
            controller.BrowserTexture = bTex;
        }

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

        wp.allowKeyInputOnZoom = true;
        wp.goToActivateOnFocus = goToActivateOnFocus;

        screens.Add(this);
    }
Ejemplo n.º 7
0
    void OnLevelWasLoaded(int level)
    {
        IsLoadingLevel = false;
        if (LevelLoaded != Level.CONNECT)
        {
            playerManager.OnLevelWasLoaded_(level); // make sure players are created before level managers are initialized.
        }
        switch (LevelLoaded)
        {
        case Level.CONNECT:
        case Level.CAMPUS:
        case Level.MINICAMPUS:
            break;

        case Level.INVPATH:
            //InvisiblePathManager.Inst.OnRoomJoin(RoomJoinEvt);
            break;

        case Level.ORIENT:
            OrientationManager.Inst.OnRoomJoin(RoomJoinEvt);
            break;

        case Level.BIZSIM:
            BizSimManager.Inst.OnRoomJoin(RoomJoinEvt);
            break;

        case Level.AVATARSELECT:
            AvatarSelectionManager.Inst.Touch();
            break;

        case Level.NAVTUTORIAL:
            //TutorialManager.Inst.Touch();
            break;

        case Level.TEAMROOM:
            TeamRoomManager.Inst.Touch();
            break;

        case Level.CMDROOM:
            //CmdRoomManager.Inst.Touch();
            break;

        case Level.MOTION_TEST:
            TunnelGameManager.Inst.Touch();
            break;

        case Level.SCALE_GAME:
            ScaleGameManager.Inst.Touch();
            break;

        default:
            Debug.LogError("Unknown Level Loaded");
            break;
        }

        RoomVariableUrlController.HandleRoomJoin(RoomJoinEvt);
        RoomVariableToEnable.HandleRoomJoin(RoomJoinEvt);

        UpdateLevelInGuiLayer();

        // server doesn't need to know each room change at this point.
        //if( LevelLoaded != Level.AVATARSELECT )
        //    CommunicationManager.CurrentUserProfile.UpdateProfile("room", level.ToString());

        ConsoleInterpreter.Inst.Touch(); // preload console instance
        RoomJoinEvt = null;
    }
Ejemplo n.º 8
0
    // Shows the active collabBrowser in the corner of the screen.
    void DrawPresenterTool()
    {
        GUI.color = Color.white;

        if (presenterToolCollabBrowser == null)
        {
            return;
        }

        // Pull texture from collabBrowserTexture
        Texture2D presenterToolTexture = presenterToolCollabBrowser.GetTexture();

        Rect presenterToolRect = GetPresenterToolRect(presenterToolTexture);

        // Get position of mouse relative to presenter tool.
        Vector2 mouseLocalPos = Vector2.zero;

        mouseLocalPos.x = (Input.mousePosition.x - presenterToolRect.x) / presenterToolRect.width;
        mouseLocalPos.y = ((Screen.height - presenterToolRect.y) - Input.mousePosition.y) / presenterToolRect.height;

        // Detect if mouse is in presenter tool.
        mouseInPresenterTool = mouseLocalPos.x >= 0f && mouseLocalPos.x <= 1f && mouseLocalPos.y >= 0f && mouseLocalPos.y <= 1f;

        if (mouseInPresenterTool)
        {
            presenterToolCollabBrowser.InjectMousePosition(new Vector2(-mouseLocalPos.x + 0.5f, -mouseLocalPos.y + 0.5f), true, Input.GetMouseButton(0));
            PlayerController.ClickToMoveInterrupt();
        }

        GUI.DrawTexture(presenterToolRect, presenterToolTexture);

        if (showPresentToolButtons)
        {
            presentToolResizeButton.SetPosition(VirCustomButton.Corner.bottomRight, (int)presenterToolRect.x, (int)presenterToolRect.y);
            presentToolResizeButton.Draw();
        }

        // Scale to 0 'minimizes' the presenter tool.
        if (presentToolScale > 0)
        {
            // Close button only shows if the presenter is open.
            if (showPresentToolButtons)
            {
                presentToolCloseButton.SetPosition(VirCustomButton.Corner.topRight, (int)presenterToolRect.x, (int)presenterToolRect.y);
                presentToolCloseButton.Draw();
            }

            // URL entry field
            if (GameGUI.Inst.IsVisible(GUIVis.PRESENTERINPUT) && GameManager.Inst.LocalPlayerType >= PlayerType.LEADER)
            {
                Rect presenterURLRect = new Rect(presenterToolRect.x + 5, presenterToolRect.y - 35, presenterToolRect.width - 5, 30);
                DrawConsoleGUIBar(presenterURLRect);
                Rect presenterURLTextRect = new Rect(presenterURLRect.x + 5, presenterURLRect.y + 3, presenterURLRect.width, presenterURLRect.height);

                // by default tab puts focus on unity text fields, disabling that here.
                if (!((Event.current.keyCode == KeyCode.Tab || Event.current.character == '\t') && FocusManager.Inst.AnyKeyInputBrowsersFocused()))
                {
                    GUI.SetNextControlName("presenterInput");
                    presenterURL = GUI.TextField(presenterURLTextRect, presenterURL);
                }

                Rect presenterURLTooltipRect = new Rect(presenterURLRect.x, presenterURLRect.y - 20, presenterURLRect.width, presenterURLRect.height);
                GUI.Label(presenterURLTooltipRect, "Enter URL:");

                Event e = Event.current;

                // Enter a URL
                if (GUI.GetNameOfFocusedControl().Equals("presenterInput") && (e.isKey) && (e.keyCode == KeyCode.Return))
                {
                    presenterURL = WebStringHelpers.AppendHTTP(presenterURL);
                    RoomVariableUrlController controller = presenterToolCollabBrowser.GetComponent <RoomVariableUrlController>();
                    if (controller != null)
                    {
                        controller.SetNewURL(presenterURL, true);
                    }
                    else
                    {
                        GameGUI.Inst.WriteToConsoleLog("Web panel does not have an associated room variable, url change is only local");
                        presenterToolCollabBrowser.GoToURL(presenterURL);
                    }
                }
            }
        }

        float previousScale = presentToolScale;

        // Resize based on mouse position.
        if (presentToolResizeButton.IsDragged())
        {
            presentToolScale = Mathf.Max(Mathf.Clamp((((presenterToolRect.x + presenterToolRect.width) - (Input.mousePosition.x + (presentToolResizeButton.width * 0.5f))) / presenterToolTexture.width), 0.3f, 1f),
                                         Mathf.Clamp((((presenterToolRect.y + presenterToolRect.height) - ((Screen.height - Input.mousePosition.y) + (presentToolResizeButton.height * 0.5f))) / presenterToolTexture.height), 0.3f, 1f));
        }

        // Tool is minimized.
        if (presentToolCloseButton.IsClicked())
        {
            presentToolScale = 0f;
            presentToolCloseButton.Close();
        }

        if (GameGUI.Inst.guiLayer != null && sendGuiPresentToolUpdates && (forceSendNextGuiPresentToolRect || (previousScale != presentToolScale)))
        {
            GameGUI.Inst.guiLayer.SendGuiLayerPresenterToolInfo(GetPresenterToolRect(presenterToolTexture));
        }
        forceSendNextGuiPresentToolRect = false;

        // Handle actions
        if (!presentToolResizeButton.IsDragged() && mouseInPresenterTool)
        {
            Event e = Event.current;
            if ((e.type != EventType.ScrollWheel) || (presenterToolCollabBrowser.enableScrollWheel))
            {
                presenterToolCollabBrowser.HandleBrowserEvent(e, (int)(mouseLocalPos.x * presenterToolCollabBrowser.width), (int)((1 - mouseLocalPos.y) * presenterToolCollabBrowser.height));
            }
        }
    }