public void Awake()
        {
            BrowserCursor = new BrowserCursor();
            BrowserCursor.cursorChange += CursorUpdated;

            InputSettings = new BrowserInputSettings();
        }
Esempio n. 2
0
 protected override void SetCursor(BrowserCursor newCursor)
 {
     if (newCursor == null || base.MouseHasFocus)
     {
         cursorRenderer.SetCursor(newCursor, this);
     }
 }
        /**
         * Sets the current mouse cursor.
         * If the cursor is null we are not looking at this browser.
         *
         * This base implementation changes the mouse cursor, but you could change an in-game reticle, etc.
         */
        protected virtual void SetCursor(BrowserCursor newCursor)
        {
            //note that HandleKeyInputBrowserCursor can change while we don't have focus.
            //In such a case, don't do anything
            if (!MouseHasFocus && newCursor != null)
            {
                return;
            }

            if (newCursor == null)
            {
                Cursor.visible = true;
                Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
            }
            else
            {
                if (newCursor.Texture != null)
                {
                    Cursor.visible = true;
                    Cursor.SetCursor(newCursor.Texture, newCursor.Hotspot, CursorMode.Auto);
                }
                else
                {
                    Cursor.visible = false;
                    Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
                }
            }
        }
        protected virtual void SetCursor(BrowserCursor newCursor)
        {
            if (!_mouseHasFocus && newCursor != null)
            {
                return;
            }

            if (newCursor == null)
            {
                Cursor.visible = true;
                Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
            }
            else
            {
                if (newCursor.Texture != null)
                {
                    Cursor.visible = true;
                    Cursor.SetCursor(newCursor.Texture, newCursor.Hotspot, CursorMode.Auto);
                }
                else
                {
                    Cursor.visible = false;
                    Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
                }
            }
        }
Esempio n. 5
0
        protected override void SetCursor(BrowserCursor newCursor)
        {
            if (newCursor != null && !MouseHasFocus)
            {
                return;
            }

            cursorRenderer.SetCursor(newCursor, this);
        }
        private IEnumerator Setup()
        {
            if (cursor != null)
            {
                yield break;
            }

            yield return(null);   //wait a frame to let the browser UI get set up

            cursor = GetComponent <Browser>().UIHandler.BrowserCursor;
            cursor.cursorChange += CursorChange;
        }
        public void Start()
        {
            EnableInput = true;
            baseCursor  = new BrowserCursor();
            baseCursor.SetActiveCursor(BrowserNative.CursorType.Cross);
            GameObject guiReticle = GameObject.Find("GUIReticle");

            if (guiReticle != null)
            {
                reticleImage = guiReticle.GetComponent <Image> ();
            }
        }
Esempio n. 8
0
 protected void Awake()
 {
     BrowserCursor               = new BrowserCursor();
     InputSettings               = new BrowserInputSettings();
     browser                     = GetComponent <Browser>();
     myImage                     = GetComponent <RawImage>();
     browser.afterResize        += UpdateTexture;
     browser.UIHandler           = this;
     BrowserCursor.cursorChange += delegate
     {
         SetCursor(BrowserCursor);
     };
     rTransform = GetComponent <RectTransform>();
 }
Esempio n. 9
0
 public void OnGUI()
 {
     if (EnableInput)
     {
         BrowserCursor browserCursor = currentCursor ?? baseCursor;
         Texture2D     texture       = browserCursor.Texture;
         if (!(texture == null))
         {
             Rect position = new Rect((float)Screen.width / 2f, (float)Screen.height / 2f, (float)texture.width * scale, (float)texture.height * scale);
             position.x -= browserCursor.Hotspot.x * scale;
             position.y -= browserCursor.Hotspot.y * scale;
             GUI.DrawTexture(position, texture);
         }
     }
 }
Esempio n. 10
0
        public virtual void Awake()
        {
            BrowserCursor = new BrowserCursor();
            BrowserCursor.cursorChange += CursorUpdated;

            InputSettings = new BrowserInputSettings();

            browser           = GetComponent <Browser>();
            browser.UIHandler = this;


            onHandlePointers += OnHandlePointers;

            if (disableMouseEmulation)
            {
                Input.simulateMouseWithTouches = false;
            }
        }
Esempio n. 11
0
 public void SetCursor(BrowserCursor newCursor, FPSBrowserUI ui)
 {
     currentCursor = newCursor;
 }
Esempio n. 12
0
 public void Start()
 {
     EnableInput = true;
     baseCursor  = new BrowserCursor();
     baseCursor.SetActiveCursor(BrowserNative.CursorType.Cross);
 }