void RenderGUI()
        {
            _gs          = new GUIStyle(GUI.skin.button);
            _gs.fontSize = 11;
            //gs.padding = new RectOffset(2,2,2,2);

            GUIScaler.Begin();

            Event e = Event.current;
        }
        void RenderGUI()
        {
            _gs          = new GUIStyle(GUI.skin.button);
            _gs.fontSize = 11;
            //gs.padding = new RectOffset(2,2,2,2);

            GUIScaler.Begin();

            //Event e = Event.current;
            GUI.BeginGroup(new Rect((Screen.width / GUIScaler.GuiScale.x) * xPos, (Screen.height / GUIScaler.GuiScale.y) * yPos, (Screen.width / GUIScaler.GuiScale.x), (Screen.height / GUIScaler.GuiScale.y)));

            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("");
            sb.AppendLine("Send OSC:");
            sb.AppendLine(String.Format("IP:{0}", oscOutIPAddress));
            sb.AppendLine(String.Format("Address:{0}", oscOutAddress));
            sb.AppendLine(String.Format("Port:{0}", oscOutPort));
            GUIContent buttonText = new GUIContent(sb.ToString());
            Rect       toggleRect = GUILayoutUtility.GetRect(buttonText, _gs);

            toggleRect.width  *= 1.0f;
            toggleRect.height *= 1.0f;

            toggleRect = new Rect(0f, 0f, sliderSize, sliderSize);

            // toggleState = GUI.Toggle(toggleRect, toggleState, buttonText);
            //_sliderValue = GUI.Slider(toggleRect, _sliderValue, 100, 0f, 100f, null, null, true, 0);
            switch (sliderMode)
            {
            case SliderMode.Horizontal:
                _sliderValue = GUI.HorizontalSlider(toggleRect, _sliderValue, minOSCDataValue, maxOSCDataValue);
                break;

            case SliderMode.Vertical:
                _sliderValue = GUI.VerticalSlider(toggleRect, _sliderValue, maxOSCDataValue, minOSCDataValue);
                break;
            }


            if (_sliderValue != _prev_sliderValue)
            {
                SendOSCMessage();
            }

            _prev_sliderValue = _sliderValue;

            GUILayout.EndVertical();
            GUI.EndGroup();

            GUIScaler.End();
        }
Пример #3
0
    void OnGUI()
    {
        GUIScaler.Begin();

        if (!show)
        {
            return;
        }

        windowRect = GUILayout.Window(123456, windowRect, ConsoleWindow, "", mySkin.box);
        GUIScaler.End();
    }
        void RenderGUI()
        {
            _gs          = new GUIStyle(GUI.skin.button);
            _gs.fontSize = 11;
            //gs.padding = new RectOffset(2,2,2,2);

            GUIScaler.Begin();

            //Event e = Event.current;
            GUI.BeginGroup(new Rect((Screen.width / GUIScaler.GuiScale.x) * xPos, (Screen.height / GUIScaler.GuiScale.y) * yPos, (Screen.width / GUIScaler.GuiScale.x), (Screen.height / GUIScaler.GuiScale.y)));

            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("");
            sb.AppendLine("Send OSC:");
            sb.AppendLine(String.Format("IP:{0}", oscOutIPAddress));
            sb.AppendLine(String.Format("Address:{0}", oscOutAddress));
            sb.AppendLine(String.Format("Port:{0}", oscOutPort));
            GUIContent buttonText = new GUIContent(sb.ToString());
            Rect       toggleRect = GUILayoutUtility.GetRect(buttonText, _gs);

            toggleRect.width  *= 1.0f;
            toggleRect.height *= 1.0f;

            toggleState = GUI.Toggle(toggleRect, toggleState, buttonText);

            if (toggleState != prevToggleState)
            {
                Debug.Log("Toggle.Clicked:" + toggleState);
                if (toggleState)
                {
                    SendOSCMessageOn();
                }
                else
                {
                    SendOSCMessageOff();
                }
            }

            prevToggleState = toggleState;

            GUILayout.EndVertical();
            GUI.EndGroup();

            GUIScaler.End();
        }
        void RenderGUI()
        {
            _gs          = new GUIStyle(GUI.skin.button);
            _gs.fontSize = 11;
            //gs.padding = new RectOffset(2,2,2,2);

            GUIScaler.Begin();

            Event e = Event.current;

            GUI.BeginGroup(new Rect((Screen.width / GUIScaler.GuiScale.x) * xPos, (Screen.height / GUIScaler.GuiScale.y) * yPos, (Screen.width / GUIScaler.GuiScale.x), (Screen.height / GUIScaler.GuiScale.y)));

            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("");
            sb.AppendLine("Send OSC:");
            sb.AppendLine(String.Format("IP:{0}", oscOutIPAddress));
            sb.AppendLine(String.Format("Address:{0}", oscOutAddress));
            sb.AppendLine(String.Format("Port:{0}", oscOutPort));
            GUIContent buttonText = new GUIContent(sb.ToString());
            Rect       buttonRect = GUILayoutUtility.GetRect(buttonText, _gs);

            buttonRect.width  *= 1.0f;
            buttonRect.height *= 1.0f;

            if (e.isMouse && buttonRect.Contains(e.mousePosition))
            {
                if (e.type == EventType.MouseDown)
                {
                    SendOSCMessageDown();
                }
                if (e.type == EventType.MouseUp)
                {
                    SendOSCMessageUp();
                }
            }

            GUI.Button(buttonRect, buttonText, _gs);

            GUILayout.EndVertical();
            GUI.EndGroup();

            GUIScaler.End();
        }
Пример #6
0
    /// <summary>
    /// On GUI.
    /// </summary>
    void OnGUI()
    {
        GUIScaler.Begin();

        // New game button.
        if (GUI.Button(new Rect(10, 10, 150, 100), "New Game"))
        {
            NewGame();
        }

        // Score label.
        string score = "Score: " + match3.Score.ToString();

        if (gameState == GameState.GameOver)
        {
            score = "Game Over!, " + score;
        }
        GUI.Label(new Rect(10, 120, 150, 50), score);

        GUIScaler.End();
    }
Пример #7
0
        void OnGUI()
        {
            if (!Application.isPlaying)
            {
                if (!ShowInEditMode)
                {
                    return;
                }
            }

            GUIScaler.Begin();
            GUILayout.BeginVertical(GUILayout.Width(Screen.width / GUIScaler.GuiScale.x), GUILayout.Height(Screen.height / (GUIScaler.GuiScale.y)));       //
            GUILayout.Space(10f);

            #region IPAddress
            GUILayout.BeginHorizontal();
            GUILayout.Space(10f);
            UniOSCUtils.DrawTexture(tex_logo);
            GUILayout.FlexibleSpace();
            GUILayout.Label(_IPAddress, GUILayout.Height(30f));
            GUILayout.FlexibleSpace();
            _showGUI = GUILayout.Toggle(_showGUI, new GUIContent(_showGUI? "Hide GUI":"Show GUI"), GUI.skin.button, GUILayout.Height(30), GUILayout.Width(130));
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();
            #endregion IPAddress

            if (!_showGUI)
            {
                GUILayout.EndVertical();
                GUIScaler.End();
                return;
            }

            GUILayout.Space(10f);

            GUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();

            #region OSCConnections
            GUILayout.BeginVertical();

            foreach (var con in UniOSCConnection.Instances)
            {
                if (con.gameObject.activeInHierarchy && con.enabled)
                {
                    con.RenderGUI();
                    GUILayout.Space(5f);
                }                //if
            }                    //for

            GUILayout.EndVertical();
            #endregion OSCConnections

            GUILayout.FlexibleSpace();

            #region trace
            if (gs_textArea == null)
            {
                gs_textArea                  = new GUIStyle(GUI.skin.textArea);
                gs_textArea.fontSize         = 10;
                gs_textArea.normal.textColor = Color.yellow;
            }

            GUILayout.BeginVertical(GUILayout.Width(200f));

            traceScrollpos = GUILayout.BeginScrollView(traceScrollpos, GUILayout.Height(((Screen.height / GUIScaler.GuiScale.y) * 0.75f) - 40f), GUILayout.ExpandHeight(false));
            GUILayout.TextArea(_oscTraceStr, gs_textArea, GUILayout.ExpandHeight(true));
            GUILayout.EndScrollView();

            if (GUILayout.Button("Clear Trace", GUILayout.Height(30)))
            {
                _oscTraceStr  = "";
                _osctraceStrb = new StringBuilder();
            }

            GUILayout.EndVertical();
            #endregion trace
            GUILayout.Space(10f);
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();

            GUIScaler.End();
        }