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();
        }
Esempio n. 3
0
    void OnGUI()
    {
        GUIScaler.BeginGUI();

        if (playerInteracting)
        {
            GUI.Box(new Rect((Screen.width / 1024), Screen.height - 150, Screen.width - 5, 147), "");
            GUI.Label(new Rect((Screen.width / 1024) + 5, Screen.height - 150, 150, 150), Portrait);
            GUI.Label(new Rect((Screen.width / 1024) + 160, Screen.height - 150, 100, 20), NPCName, nameFontStyle);

            if (Messages[0] != null && !Conversation1 && !Conversation2 && !questAccepted)
            {
                float h = Input.GetAxis("Horizontal");
                if (h < 0)
                {
                    yesSelected = true;
                }
                else if (h > 0)
                {
                    yesSelected = false;
                }

                GUI.Label(new Rect((Screen.width / 1024) + 160, Screen.height - 110, Screen.width - 180, 140), Messages[0], bodyFontStyle);

                GUI.Label(new Rect((Screen.width / 1024) + 480, Screen.height - 42, 60, 20), "Yes", bodyFontStyle);
                GUI.Label(new Rect((Screen.width / 1024) + 560, Screen.height - 42, 60, 20), "No", bodyFontStyle);

                if (yesSelected)
                {
                    GUI.DrawTexture(new Rect((Screen.width / 1024) + 467, Screen.height - 48, HighlightSizeWidth, HighlightSizeHeight), OptionHighlighter);
                }
                else
                {
                    GUI.DrawTexture(new Rect((Screen.width / 1024) + 540, Screen.height - 48, HighlightSizeWidth, HighlightSizeHeight), OptionHighlighter);
                }
            }

            if (Conversation1)
            {
                GUI.Label(new Rect((Screen.width / 1024) + 160, Screen.height - 110, Screen.width - 180, 140), Messages[1], bodyFontStyle);
            }

            if (Conversation2)
            {
                GUI.Label(new Rect((Screen.width / 1024) + 160, Screen.height - 110, Screen.width - 180, 140), Messages[2], bodyFontStyle);
            }

            if (questAccepted)
            {
                GUI.Label(new Rect((Screen.width / 1024) + 160, Screen.height - 110, Screen.width - 180, 140), Messages[3], bodyFontStyle);
            }
        }

        GUIScaler.EndGUI();
    }
Esempio n. 4
0
    /// <summary>
    /// Initialization.
    /// </summary>
    void Start()
    {
        // GUI scaling.
        GUIScaler.Initialize();

        // Game logic.
        match3 = new Match3();

        // Start new game.
        NewGame();
    }
Esempio n. 5
0
    void OnGUI()
    {
        GUIScaler.Begin();

        if (!show)
        {
            return;
        }

        windowRect = GUILayout.Window(123456, windowRect, ConsoleWindow, "", mySkin.box);
        GUIScaler.End();
    }
Esempio n. 6
0
    void Start()
    {
        m_FpsNextPeriod = Time.realtimeSinceStartup + fpsMeasurePeriod;

        GUIScaler.Initialize();

        AddMarkedMethods();

        lowPassFilterFactor               = accelerometerUpdateInterval / lowPassKernelWidthInSeconds;
        shakeDetectionThreshold          *= shakeDetectionThreshold;
        lowPassValue                      = Input.acceleration;
        Input.eatKeyPressOnTextFieldFocus = false;
    }
        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();
        }
Esempio n. 9
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();
    }
Esempio n. 10
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();
        }