Ejemplo n.º 1
0
        private bool resizeWindow()
        {
            Vector3 mousePos = Input.mousePosition;

            mousePos.y = Screen.height - mousePos.y;
            Rect windowHandle = new Rect(rect.x + rect.width - 8, rect.y + rect.height - 8, 8, 8);

            if (windowHandle.Contains(mousePos))
            {
                Texture2D cursorTex = GameDatabase.Instance.GetTexture("KSPIRC/resize-cursor", false);
                Cursor.SetCursor(cursorTex, new Vector2(7, 7), CursorMode.ForceSoftware);
                if (!resizeHandleMouseDown && Input.GetMouseButtonDown(0))
                {
                    resizeHandleMouseDown = true;
                    mouseDownPos          = mousePos;
                    resizeOrigRect        = rect;
                }
            }
            else
            {
                Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto);
            }

            if (resizeHandleMouseDown)
            {
                if (Input.GetMouseButtonUp(0))
                {
                    resizeHandleMouseDown = false;

                    UpdateConfig();
                    config.Save();
                }
                else
                {
                    rect.width  = Mathf.Clamp(resizeOrigRect.width + (mousePos.x - mouseDownPos.x), 50, Screen.width);
                    rect.height = Mathf.Clamp(resizeOrigRect.height + (mousePos.y - mouseDownPos.y), 50, Screen.height);
                    if (onResized != null)
                    {
                        onResized();
                    }
                }
            }

            return(resizeHandleMouseDown);
        }
Ejemplo n.º 2
0
 private void configChanged(ConfigChangedEvent e)
 {
     config.Save();
     SpeechLibWrapper.SetVolume(config.ttsVolume);
     client.connect(config);
 }