Ejemplo n.º 1
0
 void OnGUI()
 {
     if (Event.current != null && Event.current.type == EventType.MouseUp && MouseHelpers.GetCurrentGameObjectHit() == gameObject)
     {
         objectToEnable.SetActive(!objectToEnable.activeSelf);
     }
 }
Ejemplo n.º 2
0
    void Update()
    {
        if (HUDController.paused)
        {
            return;
        }

        Vector3 dirToMouse = MouseHelpers.VecToMouse(Origin.position);

        Origin.rotation = MouseHelpers.ObjectToMouseRotation(Origin.position);


        if (Input.GetMouseButtonDown(0))
        {
            SpawnProjectileAtTarget(dirToMouse);
        }

        if (Input.GetKeyDown(weaponButton))
        {
            repairBulletSelected = !repairBulletSelected;

            if (repairBulletSelected)
            {
                ChangePillDirection(pillSpriteObject, 0);
            }
            else
            {
                ChangePillDirection(pillSpriteObject, 180);
            }
        }
    }
Ejemplo n.º 3
0
 void OnGUI()
 {
     if (Event.current != null && Event.current.type == EventType.MouseUp && MouseHelpers.GetCurrentGameObjectHit() == gameObject)
     {
         StartCoroutine(HandleMouseUpDelayed(mouseUpCheckWaitTime[0]));
         StartCoroutine(HandleMouseUpDelayed(mouseUpCheckWaitTime[1]));
     }
 }
Ejemplo n.º 4
0
 void OnGUI()
 {
     if (Event.current != null && Event.current.type == EventType.MouseDown && MouseHelpers.GetCurrentGameObjectHit() == gameObject)
     {
         dragging = true;
     }
     if (Event.current != null && Event.current.type == EventType.MouseUp)
     {
         dragging = false;
     }
 }
Ejemplo n.º 5
0
    void OnGUI()
    {
        if (Event.current != null && Event.current.type == EventType.MouseDown && MouseHelpers.GetCurrentGameObjectHit() == gameObject)
        {
            checkNextMouseUp = true;
        }

        if (Event.current != null && Event.current.type == EventType.MouseUp && checkNextMouseUp)
        {
            StartCoroutine(HandleMouseUpDelayed(waitTime[0], waitTime[1]));
            checkNextMouseUp = false;
        }
    }
Ejemplo n.º 6
0
 void OnGUI()
 {
     if (Event.current != null && Event.current.type == EventType.MouseUp && MouseHelpers.GetCurrentGameObjectHit() == gameObject && levelDestination != GameManager.Level.NONE)
     {
         if (MaxDistCheck())
         {
             Teleport();
         }
         else
         {
             InfoMessageManager.Display("Please move closer to teleport");
         }
     }
 }
Ejemplo n.º 7
0
 void OnGUI()
 {
     if (Event.current != null && Event.current.type == EventType.MouseUp)
     {
         GameObject hitObject = MouseHelpers.GetCurrentGameObjectHit();
         if (hitObject == gameObject)
         {
             Animation anim = GetComponent <Animation>();
             anim.GetComponent <Animation>()[animationToPlay].speed = (!alternateDir || clickCount % 2 == 0) ? 1 : -1;
             anim.GetComponent <Animation>()[animationToPlay].time  = (!alternateDir || clickCount % 2 == 0) ? 0 : anim.GetComponent <Animation>()[animationToPlay].length;
             anim.Play(animationToPlay);
             ++clickCount;
         }
     }
 }
Ejemplo n.º 8
0
 void OnGUI()
 {
     if (MouseHelpers.GetCurrentGameObjectHit() == gameObject && (string.IsNullOrEmpty(serverName) || serverName == GameManager.Inst.ServerConfig) && GameManager.Inst.LocalPlayer && MaxDistCheck() && (hideForCameraType == CameraType.NONE || hideForCameraType != MainCameraController.Inst.cameraType))
     {
         if (!msgShown)
         {
             InfoMessageManager.Display(message);
         }
         msgShown = true;
     }
     else
     {
         msgShown = false;
     }
 }
Ejemplo n.º 9
0
    void OnFocusChange(System.Object sender, FocusEventArgs args)
    {
        bool focused = args.Focus;

        FocusManager.Inst.UpdateFocusID(browserTexture.id, focused, browserTexture.URL, GameManager.Inst.LevelLoaded != GameManager.Level.ORIENT && (!focused || GameManager.Inst.LevelLoaded != GameManager.Level.OFFICE || !GameGUI.Inst.allowPresenterTool), browserTexture.minWriteAccessType);

        if (!focused)
        {
            GameObject hitObj = MouseHelpers.GetCurrentGameObjectHit();
            if (hitObj != null && hitObj.GetComponent <WebToolBarItem>() != null && hitObj.GetComponent <SnapToScreenOnClick>() == null)
            {
                browserTexture.Focus();
                return;
            }
        }
        if (goToActivateOnFocus != null)
        {
            goToActivateOnFocus.SetActive(focused);
            if (focused && goToActivateOnFocus.name == "screenglow")
            {
                Color         c   = new Color(0.286f, 0.32f, 1.0f, 0.5f);
                TeamWebScreen tws = GetComponent <TeamWebScreen>();
                if (tws != null && tws.IsParseControlled)
                {
                    c = new Color(0.98823529411f, 1.0f, 0.16862745098f);
                }
                if (browserTexture.minWriteAccessType > PlayerType.NORMAL && browserTexture.minWriteAccessType > GameManager.Inst.LocalPlayerType)
                {
                    c = new Color(1.0f, 0.286f, 0.286f, 0.5f);
                }

                goToActivateOnFocus.GetComponent <Renderer>().material.SetColor("_TintColor", c);
            }
        }

        bool snapCamInUse = MainCameraController.Inst.cameraType == CameraType.SNAPCAM;

        if (focusLossReleasesSnapCam && snapCamInUse && browserTexture.SnapCamOnMe && !focused)
        {
            browserTexture.ToggleSnapCameraToObject();
        }
        if (focusGainEngagesSnapCam && !snapCamInUse && focused)
        {
            browserTexture.ToggleSnapCameraToObject();
        }
        allowZoomInMsg = true;
    }
Ejemplo n.º 10
0
        public override sealed async Task RunAsync(IInteractionProvider provider)
        {
            // Click on the Speedchat Icon.
            var c = new Coordinates(122, 40);
            await MouseHelpers.DoSimpleMouseClickAsync(provider, c, VerticalScaleAlignment.Left, 100);

            int currentYNumber = 0;

            for (int i = 0; i < this.menuItems.Length; i++)
            {
                await provider.WaitAsync(300);

                currentYNumber += this.menuItems[i];
                c = new Coordinates(xWidths[i], (40 + currentYNumber * 38));
                await MouseHelpers.DoSimpleMouseClickAsync(provider, c, VerticalScaleAlignment.Left, 100);
            }
        }
Ejemplo n.º 11
0
    void OnGUI()
    {
        if (Products.Count == 0)
        {
            return;
        }

        if (Event.current != null && Event.current.type == EventType.MouseUp)
        {
            GameObject    hitObject = MouseHelpers.GetCurrentGameObjectHit();
            ProductScreen product   = (hitObject != null) ? hitObject.GetComponent <ProductScreen>() : null;
            if (product != null)
            {
                product.HandleMouseUpEvent();
            }
        }
    }
Ejemplo n.º 12
0
    void Update()
    {
        Vector3 pivotVector;

        if (followMouse)
        {
            pivotVector = MouseHelpers.VecToMouse(transform.position);
        }
        else
        {
            pivotVector = TargetToLookAt.position - transform.position;
            pivotVector.Normalize();
        }

        float angle = Mathf.Atan2(pivotVector.y, pivotVector.x) * Mathf.Rad2Deg;

        transform.rotation = Quaternion.AngleAxis(angle - 90, Vector3.forward);
    }
 public void HoverOver(int mouseSpeed = 5)
 {
     SHSpinWait.SpinUntil(() => SupportsBoundingRectangle, TimeSpan.FromSeconds(5));
     if (SupportsBoundingRectangle)
     {
         SHSpinWait.SpinUntil(() => !BoundingRectangle.IsEmpty, TimeSpan.FromSeconds(10));
         if (!BoundingRectangle.IsEmpty)
         {
             MouseHelpers.MoveTo(Centre(), mouseSpeed);
         }
         else
         {
             throw new InvalidOperationException("HoverOver bounding rectangle failed to load or is not supported (You may need an onscreen check)");
         }
     }
     else
     {
         throw new ElementNotFoundException("HoverOver bounding rectangle is not supported");
     }
 }
Ejemplo n.º 14
0
    void OnGUI()
    {
        if (Event.current != null && Event.current.type == EventType.MouseUp && MouseHelpers.GetCurrentGameObjectHit() == gameObject)
        {
            if (MaxDistCheck())
            {
                Transform playerTransform = GameManager.Inst.LocalPlayer.gameObject.transform;

                // put player in position
                float   dirMultiplier = flipDir ? -1.0f : 1.0f;
                Vector3 forwardDir    = dirMultiplier * gameObject.transform.forward;
                GameManager.Inst.playerManager.SetLocalPlayerTransform(gameObject.transform.position + (-sitSettings.DropDistance * Vector3.up) + (sitSettings.DistanceFromChair * forwardDir.normalized), Quaternion.LookRotation(forwardDir));
                GameManager.Inst.LocalPlayer.Sit();
            }
            else
            {
                InfoMessageManager.Display("Please move closer to sit");
            }
        }
    }
Ejemplo n.º 15
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);
        }
    }
Ejemplo n.º 16
0
    // end: Erik added
    #endregion

    #region Input Processing

    #region OnGUI
    private bool HandleEvent(Event e, out RaycastHit hit)
    {
        if (e.isMouse)
        {
            // We only inject mouse input that occurred in this GameObject.
            // If mouse is outside this object and the presenter tool, unfocus this object.
            if (MouseHelpers.GetCurrentGameObjectHit(out hit) != this.gameObject)
            {
                if (e.type == EventType.MouseDown)
                {
                    wasLastMouseDownObj = false;
                }
                if (e.type == EventType.MouseUp)
                {
                    webView.InjectMouseUp(Utilities.GetMouseButton());
                }

                bool isBeingControlledByPresenterTool = GameGUI.Inst.mouseInPresenterTool && GameGUI.Inst.allowPresenterTool && GameGUI.Inst.presenterToolCollabBrowser == this;
                if (e.type != EventType.mouseDown && e.type != EventType.mouseDrag && !isBeingControlledByPresenterTool && !wasLastMouseDownObj)
                {
                    Unfocus();
                }

                return(false);
            }
            else
            {
                if (e.type == EventType.MouseDown)
                {
                    wasLastMouseDownObj = true;
                }
                return(true);
            }
        }
        else
        {
            hit = new RaycastHit();
            return((e.isKey && isFocused) || ((e.type == EventType.ScrollWheel) && isScrollable && enableScrollWheel && !GameGUI.Inst.mouseInPresenterTool));
        }
    }
Ejemplo n.º 17
0
        public override sealed async Task RunAsync(IInteractionProvider provider)
        {
            // Click on the "Plant Flower" button.
            await MouseHelpers.DoSimpleMouseClickAsync(provider, new Coordinates(76, 264),
                                                       VerticalScaleAlignment.Left);

            await provider.WaitAsync(200);

            // Click on the jellybean fields.
            foreach (int jellybean in this.jellybeanCombination)
            {
                var c = new Coordinates((int)Math.Round(560 + jellybean * 60.5), 514);
                await MouseHelpers.DoSimpleMouseClickAsync(provider, c,
                                                           VerticalScaleAlignment.Center, 100);

                await provider.WaitAsync(100);
            }
            await provider.WaitAsync(100);

            // Click on the "Plant" button.
            await MouseHelpers.DoSimpleMouseClickAsync(provider, new Coordinates(975, 772));
        }
Ejemplo n.º 18
0
    } // End of Application Focus().


    void OnGUI(){
        // Allow user to click off of input fields without moving character.
        if(GUI.GetNameOfFocusedControl().Equals("consoleInput") || GUI.GetNameOfFocusedControl().Equals("presenterInput")){
            ctmiFrames = 3;
        }

        // User inputs "go to that position!"
        if(isLocalPlayer && clickToMove && (ctmiFrames == 0) && goToIndicator.activeSelf){
            if (Input.GetMouseButtonDown(0) && !GameGUI.Inst.IsMouseOverGuiLayerElement && (GameGUI.Inst.guiLayer == null || !GameGUI.Inst.guiLayer.ClickOffElementOpen) && !AnnouncementManager.Inst.IsAnnouncementDisplayed && MouseHelpers.GetCurrentGameObjectHit().GetComponent<CollabBrowserTexture>() == null) {
                followedPlayer = null;
                pathfindingDest.transform.position = goToIndicator.transform.position;
                navAgent.SetDestination(pathfindingDest.transform.position);
                pathfindingActive = true;
            }
        }
    } // End of OnGUI().
 public void Click(MouseAction buttonToPress, int mouseSpeed = 5)
 {
     HoverOver(mouseSpeed);
     Wait.UntilInputIsProcessed();
     MouseHelpers.MouseClick(buttonToPress);
 }
Ejemplo n.º 20
0
 void OnGUI()
 {
     if((objectToEnable != null) && ((MouseHelpers.GetCurrentGameObjectHit() == gameObject) != objectToEnable.activeSelf))
         objectToEnable.SetActive(!objectToEnable.activeSelf);
 }
Ejemplo n.º 21
0
    // Use this for initialization
    void Start()
    {
        htmlPanel        = this.gameObject.AddComponent(typeof(HTMLPanelGUI)) as HTMLPanelGUI;
        htmlPanel.width  = Screen.width;
        htmlPanel.height = Screen.height;
        htmlPanel.RegisterNotificationCallback("InitComplete", delegate(JSValue[] args)
        {
            VDebug.LogError("Loading complete: " + (DateTime.Now - startLoadHTMLTime).TotalSeconds);
            if (loading)
            {
                Debug.LogError("JavaScript Execution started BEFORE awesomium finished loading page!!");
                loading = false;
            }
            if (!skipLogin && GameManager.Inst.LevelLoaded == GameManager.Level.CONNECT)
            {
                System.Version currClientVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                Debug.LogError("Client version: " + currClientVersion.ToString() + " req: " + CommunicationManager.clientVersionRequirement);
                if (CommunicationManager.clientVersionRequirement == "")
                {
                    // no version requirement specified, hand control to the guilayer.
                    WebHelper.ClearCache = true;
                    HandleClientVersion(currClientVersion.ToString());
                    return;
                }
                System.Version clientReq = new System.Version(CommunicationManager.clientVersionRequirement);
                if (currClientVersion >= clientReq)
                {
                    AttemptLogin();
                }
                else
                {
                    ExecuteJavascriptWithValue(SetGUIVersionJSCmd() + SetBuildTypeCmd() + SetConfigCmd() + "showUpdateDialog();");
                }
            }
            else
            {
                Debug.LogError((skipLogin) ? "Login screen skipped" : "GUI Layer has been reloaded in another scene!");
                skipLogin = false;
            }
        });
        htmlPanel.RegisterNotificationCallback("Authentication_Success", delegate(JSValue[] args)
        {
            GameGUI.Inst.fadeOut = true;

            loginArgs = args[1].ToString();
            loggingIn = true;
        });
        htmlPanel.RegisterNotificationCallback("MouseUp_MouseClick", delegate(JSValue[] args) {
            string json = args[1].ToString();
            VDebug.Log("mouseup fields: " + json);
            GameObject hitObject = MouseHelpers.GetCurrentGameObjectHit();
            if (hitObject != null)
            {
                if (GameManager.Inst.LocalPlayer.gameObject == hitObject)
                {
                    string cmd = "OnLocalPlayerClick(" + json + ");";
                    ExecuteJavascript(cmd);
                }
                else
                {
                    PlayerController playerController = hitObject.GetComponent <PlayerController>();
                    if (playerController != null)
                    {
                        Player p   = playerController.playerScript;
                        string cmd = "OnPlayerClick(" + p.Id + ", " + p.Name + ", " + json + ");";
                        ExecuteJavascript(cmd);
                    }

                    WebPanel webPanel = hitObject.GetComponent <WebPanel>();
                    if (webPanel != null)
                    {
                        string cmd = "OnWebPanelClick(" + webPanel.browserTexture.id + ", " + json + ");";
                        ExecuteJavascript(cmd);
                    }


                    //string go = hitObject.name;// +hitObject.GetInstanceID();
                    //Debug.Log("We clicked something: " + go);
                    //string cmd = "OnUnityObjectClick('" + go + "', " + json + ");";
                    ////Debug.Log(cmd);
                    //ExecuteJavaScript(cmd);
                }
            }
        });
        htmlPanel.RegisterNotificationCallback("Out_UnityDebugLog", delegate(JSValue[] args) {
            string json           = args[1].ToString();
            JSONObject jsonObject = JSONObject.Parse(json);
            string msg            = jsonObject.GetString("msg");
            Debug.Log("Out_UnitDebugLog: " + msg);
        });
        htmlPanel.RegisterNotificationCallback("Clicked_QuitButton", delegate(JSValue[] args)
        {
            Application.Quit();
        });
        htmlPanel.RegisterNotificationCallback("Closed_DialogWindow", delegate(JSValue[] args)
        {
            AnnouncementManager.Inst.AnnouncementClosed();
        });
        htmlPanel.RegisterNotificationCallback("Clicked_AvatarButton", delegate(JSValue[] args)
        {
            GameManager.Inst.LoadLevel(GameManager.Level.AVATARSELECT);
        });
        htmlPanel.RegisterNotificationCallback("Clicked_ToggleVoice", delegate(JSValue[] args)
        {
            VoiceManager.Inst.ToggleToTalk = !VoiceManager.Inst.ToggleToTalk;
        });
        htmlPanel.RegisterNotificationCallback("VoicePush", delegate(JSValue[] args)
        {
            VoiceManager.Inst.PushToTalkButtonDown = args[1].ToBoolean();
        });
        htmlPanel.RegisterNotificationCallback("Clicked_RefreshAll", delegate(JSValue[] args)
        {
            if (GameManager.Inst.LevelLoaded == GameManager.Level.BIZSIM)
            {
                BizSimManager.Inst.ReloadAll();
            }
        });
        htmlPanel.RegisterNotificationCallback("Update_UserList", delegate(JSValue[] args)
        {
            GameGUI.Inst.userListMgr.RebuildHTMLUserList();
        });
        htmlPanel.RegisterNotificationCallback("Update_Timer", delegate(JSValue[] args)
        {
            UpdateTimer();
        });
        htmlPanel.RegisterNotificationCallback("Update_VoiceToggle", delegate(JSValue[] args)
        {
            // ask unity if the voice is toggled on or off
            InitVoiceToggle();
        });
        htmlPanel.RegisterNotificationCallback("Play_ButtonClickSound", delegate(JSValue[] args)
        {
            SoundManager.Inst.PlayClick();
        });
        htmlPanel.RegisterNotificationCallback("Clicked_LogoutButton", delegate(JSValue[] args)
        {
            CommunicationManager.Inst.LogOut();
        });


        // Tooltips
        htmlPanel.RegisterNotificationCallback("Set_Tooltip", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to change fixed tooltip, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.SetFixedTooltip(args[1].ToString());
        });
        htmlPanel.RegisterNotificationCallback("Clear_Tooltip", delegate(JSValue[] args)
        {
            GameGUI.Inst.ClearFixedTooltip();
            GameGUI.Inst.tooltipAvoidRect = new Rect(0, 0, 0, 0); // clear avoidance rectangle
        });
        htmlPanel.RegisterNotificationCallback("Set_TooltipAvoidRect", delegate(JSValue[] args)
        {
            if (args.Length <= 4)
            {
                Debug.LogError("attempting to change fixed tooltip avoidance rectangle, but didn't find enough arguments.");
                return;
            }
            GameGUI.Inst.tooltipAvoidRect = new Rect(int.Parse(args[1].ToString()), int.Parse(args[2].ToString()), int.Parse(args[3].ToString()), int.Parse(args[4].ToString()));
        });

        // Microphone selection menu
        htmlPanel.RegisterNotificationCallback("Open_Mic_Menu", delegate(JSValue[] args)
        {
            VoiceManager.Instance.micSelectMenuOpen = true;
        });
        htmlPanel.RegisterNotificationCallback("Close_Mic_Menu", delegate(JSValue[] args)
        {
            VoiceManager.Instance.micSelectMenuOpen = false;
        });
        htmlPanel.RegisterNotificationCallback("Toggle_Mic_Menu", delegate(JSValue[] args)
        {
            VoiceManager.Instance.micSelectMenuOpen = !VoiceManager.Instance.micSelectMenuOpen;
        });

        // Seed console with text and move cursor to the front of the input.
        htmlPanel.RegisterNotificationCallback("Seed_Console", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                GameGUI.Inst.consoleGui.SeedConsole("");
                return;
            }
            GameGUI.Inst.consoleGui.SeedConsole(args[1].ToString());
        });

        htmlPanel.RegisterNotificationCallback("Issue_ConsoleCmd", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to issue console command, but didn't find an argument.");
                return;
            }
            ConsoleInterpreter.Inst.ProcCommand(args[1].ToString());
        });
        htmlPanel.RegisterNotificationCallback("Issue_FacConsoleCmd", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to issue console command, but didn't find an argument.");
                return;
            }
            ConsoleInterpreter.Inst.ProcCommand(args[1].ToString(), PlayerType.LEADER);
        });
        htmlPanel.RegisterNotificationCallback("Write_ToConsole", delegate(JSValue[] args)
        {
            string msg = (args.Length <= 1) ? "" : args[1].ToString();
            GameGUI.Inst.WriteToConsoleLog(msg);
        });
        htmlPanel.RegisterNotificationCallback("Open_Browser", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("no url specified for Open_Browser command.");
            }
            OpenInExternalBrowser(args[1].ToString());
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarChangeCharacter", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("no url specified for Open_Browser command.");
                return;
            }
            int modelIdx;
            if (!int.TryParse(args[1].ToString(), out modelIdx))
            {
                Debug.LogError(args[1] + " not a valid int");
                return;
            }
            GameGUI.Inst.customizeAvatarGui.ChangeCharacter(modelIdx);
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarOption", delegate(JSValue[] args)
        {
            if (args.Length < 3)
            {
                Debug.LogError("Click_AvatarOption - not enough arguments: elementName, newIndex " + args.Length);
                return;
            }

            int optionIdx;
            if (!int.TryParse(args[2].ToString(), out optionIdx))
            {
                Debug.LogError(args[2] + " not a valid int");
                return;
            }
            GameGUI.Inst.customizeAvatarGui.ChangeElement(args[1].ToString(), optionIdx);
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarRotate", delegate(JSValue[] args)
        {
            if (args.Length < 3)
            {
                Debug.LogError("Click_AvatarRotate - not enough arguments: is_left, is_down");
                return;
            }

            GameGUI.Inst.customizeAvatarGui.HandleRotateBtn(args[1].ToBoolean());
            GameGUI.Inst.customizeAvatarGui.HandleRotateDown(args[2].ToBoolean());
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarDone", delegate(JSValue[] args)
        {
            bool save = true;
            if (args.Length > 1)
            {
                save = args[1].ToBoolean();
            }
            GameGUI.Inst.customizeAvatarGui.HandleDoneBtn(save);
        });
        htmlPanel.RegisterNotificationCallback("Confirm_Action", delegate(JSValue[] args)
        {
            string action = (args.Length > 1) ? args[1].ToString() : "";
            if (GameManager.Inst.LevelLoaded == GameManager.Level.BIZSIM)
            {
                BizSimManager.Inst.HandleAction(action);
            }
        });
        htmlPanel.RegisterNotificationCallback("Send_SFSRequest", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Not enough arguments for Send_SFSRequest");
                return;
            }

            string msg        = (args.Length > 2) ? args[2].ToString() : "";
            ISFSObject msgObj = new SFSObject();
            msgObj.PutUtfString("msg", msg);
            ExtensionRequest request = new ExtensionRequest(args[1].ToString(), msgObj);
            CommunicationManager.SendMsg(request);
        });
        htmlPanel.RegisterNotificationCallback("Set_InputFocus", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Set_InputFocus needs true/false argument");
                return;
            }
            hasInputFocus = args[1].ToString() == "true";
        });
        htmlPanel.RegisterNotificationCallback("Toggle_ClickOffElement", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Toggle_ClickOffElement needs true/false argument");
                return;
            }

            clickOffElementOpen = args[1].ToString() == "true";
        });
        htmlPanel.RegisterNotificationCallback("Overlay_URL", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Overlay_URL needs url");
                return;
            }
            string url = args[1].ToString();
            int width  = (args.Length > 2) ? args[2].ToInteger() : (int)(0.75f * Screen.width);
            int height = (args.Length > 3) ? args[3].ToInteger() : (int)(0.75f * Screen.height);

            GameManager.Inst.OverlayMgr.SetURL(url, width, height);
        });
        htmlPanel.RegisterNotificationCallback("Scale_PresentTool", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to scale present tool, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.presentToolScale = (float)args[1].ToDouble();
        });
        htmlPanel.RegisterNotificationCallback("Set_GameGUIGutter", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to set game gui gutter, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.gutter = args[1].ToInteger();
        });
        htmlPanel.RegisterNotificationCallback("Hide_PresentUI", delegate(JSValue[] args)
        {
            GameGUI.Inst.showPresentToolButtons = false;
        });
        htmlPanel.RegisterNotificationCallback("Open_FileDialog", delegate(JSValue[] args)
        {
            string file = NativePanels.OpenFileDialog(null);
            string cmd  = "handleOpenFile(\"" + file + "\");";
            ExecuteJavascript(cmd);
        });
        htmlPanel.RegisterNotificationCallback("Set_Clipboard", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to set clipboard, but didn't find an argument.");
                return;
            }
            ClipboardHelper.Clipboard = args[1].ToString();
        });
        htmlPanel.RegisterNotificationCallback("Set_GUIVisibility", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to set gui visibility, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.VisibilityFlags = args[1].ToInteger();
        });
        htmlPanel.RegisterNotificationCallback("Update_TutorialCode", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to update tutorial code, but didn't find an argument.");
                return;
            }
            CommunicationManager.CurrentUserProfile.UpdateTutorial(args[1].ToInteger());
        });



        htmlPanel.RegisterNotificationCallback("Request_AvatarOptions", SendGuiLayerAvatarOptions);
        htmlPanel.RegisterNotificationCallback("Request_GameIds", SendGuiLayerNumGames);
        htmlPanel.RegisterNotificationCallback("Request_TeamInfo", SendGuiLayerTeamInfo);
        htmlPanel.RegisterNotificationCallback("Request_MicInfo", SendGuiLayerMicInfo);
        htmlPanel.RegisterNotificationCallback("Request_TeacherClassInfo", SendGuiLayerTeamTeacherClass);
        htmlPanel.RegisterNotificationCallback("Request_PanelTitle", SendGuiLayerPanelTitle);
        htmlPanel.RegisterNotificationCallback("Request_PanelURL", SendGuiLayerPanelURL);
        htmlPanel.RegisterNotificationCallback("Request_PanelSelection", SendGuiLayerPanelSelection);
        htmlPanel.RegisterNotificationCallback("Request_GetClipboard", SendGuiLayerClipboard);
        htmlPanel.RegisterNotificationCallback("Request_GUIVisibility", SendGuiLayerGUIVisibility);
        htmlPanel.RegisterNotificationCallback("Request_PlayerInfo", SendGuiLayerPlayerInfo);
        htmlPanel.RegisterNotificationCallback("Request_WorkingDir", SendGuiLayerWorkingDir);
        htmlPanel.RegisterNotificationCallback("Request_ReplayUpdate", SendGuiLayerReplayPosInfo);
        htmlPanel.RegisterNotificationCallback("Request_TutorialCode", SendGuiLayerTutorialCode);
        htmlPanel.RegisterNotificationCallback("Request_HardwareInfo", SendGuiLayerHardwareInfo);

#if PATCHER_ENABLE
        //startingFile = GameManager.Inst.guipatcher.path + startingFile;
        Debug.LogError("HTMLGuiLayer - starting file: " + startingFile);
#endif
    }
Ejemplo n.º 22
0
 public override sealed async Task RunAsync(IInteractionProvider provider)
 {
     var c = new Coordinates(1503, 1086);
     await MouseHelpers.DoSimpleMouseClickAsync(provider, c);
 }
Ejemplo n.º 23
0
 void OnGUI()
 {
     if (msg != "" && Event.current != null && Event.current.type == EventType.MouseUp && MouseHelpers.GetCurrentGameObjectHit() == gameObject)
     {
         if (!AnnouncementManager.Inst.IsAnnouncementDisplayed)
         {
             AnnouncementManager.Inst.Announce(title, msg);
             SoundManager.Inst.PlayClick();
         }
     }
 }
Ejemplo n.º 24
0
 public override async Task RunAsync(IInteractionProvider provider)
 {
     var c = new Coordinates(1397, 206 + (int)this.button * 49);
     await MouseHelpers.DoSimpleMouseClickAsync(provider, c, VerticalScaleAlignment.Right);
 }
Ejemplo n.º 25
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();
        }
    }