コード例 #1
0
    void OnGUI()
    {
        GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
        {
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("START") && signalRConnection.State != ConnectionStates.Connected)
            {
                signalRConnection.Open();
            }

            if (GUILayout.Button("STOP") && signalRConnection.State == ConnectionStates.Connected)
            {
                signalRConnection.Close();
                messages.Clear();
            }

            if (GUILayout.Button("PING") && signalRConnection.State == ConnectionStates.Connected)
            {
                // Call a Hub-method on the server.
                signalRConnection["StatusHub"].Call("Ping");
            }

            GUILayout.EndHorizontal();

            GUILayout.Space(20);

            GUILayout.Label("Connection Status Messages");

            GUILayout.BeginHorizontal();
            GUILayout.Space(20);
            messages.Draw(Screen.width - 20, 0);
            GUILayout.EndHorizontal();
        });
    }
コード例 #2
0
    public void Draw()
    {
        GUILayout.Label(this.Title);

        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        messages.Draw(Screen.width - 20, 100);
        GUILayout.EndHorizontal();
    }
コード例 #3
0
    void OnGUI()
    {
        GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
        {
            GUILayout.Label("Messages");

            GUILayout.BeginHorizontal();
            GUILayout.Space(20);
            messages.Draw(Screen.width - 20, 0);
            GUILayout.EndHorizontal();
        });
    }
コード例 #4
0
    /// <summary>
    /// Draw the gui.
    /// Get input strings.
    /// Handle function calls.
    /// </summary>
    void OnGUI()
    {
        GUIHelper.DrawArea(GUIHelper.ClientArea, true, () =>
        {
            GUILayout.BeginVertical();

            #region To Everybody
            GUILayout.Label("To Everybody");

            GUILayout.BeginHorizontal();

            ToEveryBodyText = GUILayout.TextField(ToEveryBodyText, GUILayout.MinWidth(100));

            if (GUILayout.Button("Broadcast"))
            {
                Broadcast(ToEveryBodyText);
            }

            if (GUILayout.Button("Broadcast (All Except Me)"))
            {
                BroadcastExceptMe(ToEveryBodyText);
            }

            if (GUILayout.Button("Enter Name"))
            {
                EnterName(ToEveryBodyText);
            }

            if (GUILayout.Button("Join Group"))
            {
                JoinGroup(ToEveryBodyText);
            }

            if (GUILayout.Button("Leave Group"))
            {
                LeaveGroup(ToEveryBodyText);
            }

            GUILayout.EndHorizontal();
            #endregion

            #region To Me
            GUILayout.Label("To Me");

            GUILayout.BeginHorizontal();

            ToMeText = GUILayout.TextField(ToMeText, GUILayout.MinWidth(100));

            if (GUILayout.Button("Send to me"))
            {
                SendToMe(ToMeText);
            }

            GUILayout.EndHorizontal();
            #endregion

            #region Private Message
            GUILayout.Label("Private Message");

            GUILayout.BeginHorizontal();

            GUILayout.Label("Message:");
            PrivateMessageText = GUILayout.TextField(PrivateMessageText, GUILayout.MinWidth(100));

            GUILayout.Label("User or Group name:");
            PrivateMessageUserOrGroupName = GUILayout.TextField(PrivateMessageUserOrGroupName, GUILayout.MinWidth(100));

            if (GUILayout.Button("Send to user"))
            {
                SendToUser(PrivateMessageUserOrGroupName, PrivateMessageText);
            }

            if (GUILayout.Button("Send to group"))
            {
                SendToGroup(PrivateMessageUserOrGroupName, PrivateMessageText);
            }

            GUILayout.EndHorizontal();
            #endregion

            GUILayout.Space(20);

            if (signalRConnection.State == ConnectionStates.Closed)
            {
                if (GUILayout.Button("Start Connection"))
                {
                    signalRConnection.Open();
                }
            }
            else if (GUILayout.Button("Stop Connection"))
            {
                signalRConnection.Close();
            }

            GUILayout.Space(20);

            // Draw the messages
            GUILayout.Label("Messages");

            GUILayout.BeginHorizontal();
            GUILayout.Space(20);
            messages.Draw(Screen.width - 20, 0);
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        });
    }
コード例 #5
0
    /// <summary>
    /// Display the result's of the function calls.
    /// </summary>
    public void Draw()
    {
        GUILayout.Label("Arbitrary Code");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(string.Format("Sending {0} from arbitrary code without the hub itself!", fromArbitraryCodeResult));
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Group Added");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(groupAddedResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Dynamic Task");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(dynamicTaskResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Report Progress");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.BeginVertical();
        GUILayout.Label(longRunningJobStatus);
        GUILayout.HorizontalSlider(longRunningJobProgress, 0, 100);
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Generic Task");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(genericTaskResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Task With Exception");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(taskWithExceptionResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Generic Task With Exception");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(genericTaskWithExceptionResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Synchronous Exception");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(synchronousExceptionResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Invoking hub method with dynamic");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(invokingHubMethodWithDynamicResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Simple Array");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(simpleArrayResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Complex Type");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(complexTypeResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Complex Array");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(complexArrayResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Overloads");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.BeginVertical();
        GUILayout.Label(voidOverloadResult);
        GUILayout.Label(intOverloadResult);
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Read State Value");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(readStateResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Plain Task");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(plainTaskResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Generic Task With ContinueWith");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        GUILayout.Label(genericTaskWithContinueWithResult);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);

        GUILayout.Label("Message Pump");
        GUILayout.BeginHorizontal();
        GUILayout.Space(20);
        invokeResults.Draw(Screen.width - 40, 270);
        GUILayout.EndHorizontal();

        GUILayout.Space(10);
    }