Ejemplo n.º 1
0
    /// <summary>
    /// Determines whether to send an asynchronous or synchronous call on the button click
    /// Async calls on button click when used in iOS results in random crashes thus sync calls
    /// are preferred in case iOS
    /// </summary>
    /// <param name="pubnubState">Pubnub state.</param>
    void AsyncOrNonAsyncCall(PubnubState pubnubState)
    {
#if (UNITY_IOS)
        if (pubnubState == PubnubState.DisconnectRetry)
        {
            if (!requestInProcess)
            {
                requestInProcess = true;
                ThreadPool.QueueUserWorkItem(new WaitCallback(DoAction), pubnubState);
            }
        }
        else
        {
            DoAction(pubnubState);
        }
#else
        ThreadPool.QueueUserWorkItem(new WaitCallback(DoAction), pubnubState);
#endif
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Determines whether to send an asynchronous or synchronous call on the button click
    /// Async calls on button click when used in iOS results in random crashes thus sync calls 
    /// are preferred in case iOS
    /// </summary>
    /// <param name="pubnubState">Pubnub state.</param>
    void AsyncOrNonAsyncCall (PubnubState pubnubState)
    {
#if(UNITY_IOS)
        if(pubnubState == PubnubState.DisconnectRetry)
        {
            if(!requestInProcess)
            {
                requestInProcess = true;
                ThreadPool.QueueUserWorkItem(new WaitCallback(DoAction), pubnubState);
            }
        }
        else
        {
            DoAction(pubnubState);
        }
#else
        ThreadPool.QueueUserWorkItem(new WaitCallback(DoAction), pubnubState);
#endif
    }
Ejemplo n.º 3
0
    void DoActionWindow (int windowID)
    {
        fLeft = fLeftInit - 10;
        fTop = fTopInit + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Disconnect/Retry")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.DisconnectRetry);
            showActionsPopupWindow = false;
        }
        fTop = fTopInit + 1 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Presence")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.Presence);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 2 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Subscribe")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.Subscribe);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 3 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Detailed History")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.DetailedHistory);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 4 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Publish")) {
            InstantiatePubnub ();
            allowUserSettingsChange = false;
            showActionsPopupWindow = false;
            showPublishPopupWindow = true;
        }

        fTop = fTopInit + 5 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Unsubscribe")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.Unsubscribe);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 6 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Presence-Unsub")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.PresenceUnsubscribe);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 7 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Here Now")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.HereNow);
            state = PubnubState.HereNow;
            showGrantWindow = true;
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 8 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Time")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.Time);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 9 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Where Now")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.WhereNow);
            showActionsPopupWindow = false;
            state = PubnubState.WhereNow;
            showAuthWindow = true;
        }
        fTop = fTopInit + 10 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Global Here Now")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.GlobalHereNow);
            showActionsPopupWindow = false;
            state = PubnubState.GlobalHereNow;
            showGrantWindow = true;
        }

        fTop = fTopInit + 11 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Change UUID")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.ChangeUUID);
            showActionsPopupWindow = false;
            state = PubnubState.ChangeUUID;
            showAuthWindow = true;
        }
        #if(UNITY_IOS || UNITY_ANDROID)
				GUI.enabled = false;
        #endif

        fTop = fTopInit + 12 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Disable Network")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.DisableNetwork);
            showActionsPopupWindow = false;
        }
        fTop = fTopInit + 13 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Enable Network")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.EnableNetwork);
            showActionsPopupWindow = false;
        }

        #if(UNITY_IOS || UNITY_ANDROID)
				GUI.enabled = true;
        #endif

    }
Ejemplo n.º 4
0
    void DoPamActionWindow (int windowID)
    {
        fLeft = fLeftInit - 10;
        fTop = fTopInit + 10;
        float fButtonWidth = 140;

        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Grant Subscribe")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.GrantSubscribe);
            state = PubnubState.GrantSubscribe;
            showPamPopupWindow = false;
            showGrantWindow = true;
        }
        fTop = fTopInit + 1 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Audit Subscribe")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.AuditSubscribe);
            showPamPopupWindow = false;
            showAuthWindow = true;
            state = PubnubState.AuditSubscribe;
        }

        fTop = fTopInit + 2 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Revoke Subscribe")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.RevokeSubscribe);
            showPamPopupWindow = false;
            showAuthWindow = true;
            state = PubnubState.RevokeSubscribe;
        }

        fTop = fTopInit + 3 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Grant Presence")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.GrantPresence);
            state = PubnubState.GrantPresence;
            showPamPopupWindow = false;
            showGrantWindow = true;
        }

        fTop = fTopInit + 4 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Audit Presence")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.AuditPresence);
            showPamPopupWindow = false;
            showAuthWindow = true;
            state = PubnubState.AuditPresence;
        }

        fTop = fTopInit + 5 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Revoke Presence")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.RevokePresence);
            showPamPopupWindow = false;
            showAuthWindow = true;
            state = PubnubState.RevokePresence;
        }

        fTop = fTopInit + 6 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Auth Key")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.AuthKey);
            showAuthWindow = true;
            showPamPopupWindow = false;
            state = PubnubState.AuthKey;
        }
        fTop = fTopInit + 7 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Add/Edit User State")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.SetUserStateKeyValue);
            showActionsPopupWindow = false;
            state = PubnubState.SetUserStateKeyValue;
            showTextWindow = true;
        }
        /*fTop = fTopInit + 8 * fRowHeight + 10;
				if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "View Local State")) {
						InstantiatePubnub ();
						AsyncOrNonAsyncCall (PubnubState.ViewLocalUserState);
						showActionsPopupWindow = false;
				}*/
        fTop = fTopInit + 8 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Del User State")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.DelUserState);
            showActionsPopupWindow = false;
            state = PubnubState.DelUserState;
            showTextWindow = true;
        }
        fTop = fTopInit + 9 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Set User State")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.SetUserStateJson);
            showActionsPopupWindow = false;
            state = PubnubState.SetUserStateJson;
            showTextWindow = true;
        }
        fTop = fTopInit + 10 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Get User State")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.GetUserState);
            showActionsPopupWindow = false;
            state = PubnubState.GetUserState;
            showTextWindow = true;
        }
        fTop = fTopInit + 11 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Presence Heartbeat")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.PresenceHeartbeat);
            state = PubnubState.PresenceHeartbeat;
            showAuthWindow = true;
            showActionsPopupWindow = false;
        }
        fTop = fTopInit + 12 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Presence Interval")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.PresenceInterval);
            state = PubnubState.PresenceInterval;
            showAuthWindow = true;
            showActionsPopupWindow = false;
        }
    }
Ejemplo n.º 5
0
    void ShowWindow (PubnubState state)
    {
        string title = "";
        string buttonTitle = "";
        if (state == PubnubState.AuthKey) {
            title = "Enter Auth Key";
            buttonTitle = "Set";
        } else if (state == PubnubState.ChangeUUID) {
            title = "Enter UUID";
            buttonTitle = "Change";
        } else if (state == PubnubState.WhereNow) {
            title = "Enter UUID";
            buttonTitle = "Run";
        } else if (state == PubnubState.PresenceHeartbeat) {
            title = "Enter Presence Heartbeat";
            buttonTitle = "Set";
        } else if (state == PubnubState.PresenceInterval) {
            title = "Enter Presence Interval";
            buttonTitle = "Set";
        } else if (state == PubnubState.AuditPresence) {
            title = "Enter Auth Key (Optional)";
            buttonTitle = "Run Audit";
        } else if (state == PubnubState.AuditSubscribe) {
            title = "Enter Auth Key (Optional)";
            buttonTitle = "Run Audit";
        } else if (state == PubnubState.RevokePresence) {
            title = "Enter Auth Key (Optional)";
            buttonTitle = "Revoke";
        } else if (state == PubnubState.RevokeSubscribe) {
            title = "Enter Auth Key (Optional)";
            buttonTitle = "Revoke";
        }
        GUI.Label (new Rect (10, 30, 100, fHeight), title);
        input = GUI.TextArea (new Rect (110, 30, 150, fHeight), input, 200);
        ShowGuiButton (buttonTitle, state);

        if (GUI.Button (new Rect (150, 80, 100, fButtonHeight), "Cancel")) {
            showAuthWindow = false;
            showPamPopupWindow = false;
        }
        GUI.DragWindow (new Rect (0, 0, 800, 400));
    }
Ejemplo n.º 6
0
    void ShowGuiButton (string buttonTitle, PubnubState state)
    {
        if (GUI.Button (new Rect (30, 80, 100, fButtonHeight), buttonTitle)) {
            if (state == PubnubState.AuthKey) {
                pubnub.AuthenticationKey = input;
            } else if (state == PubnubState.ChangeUUID) {
                pubnub.ChangeUUID (input);
            } else if (state == PubnubState.WhereNow) {
                pubnub.WhereNow<string> (input, DisplayReturnMessage, DisplayErrorMessage);
            } else if (state == PubnubState.PresenceHeartbeat) {
                int iInterval;

                Int32.TryParse (input, out iInterval);
                if (iInterval == 0) {
                    AddToPubnubResultContainer ("ALERT: Please enter an integer value.");
                } else {
                    pubnub.PresenceHeartbeat = int.Parse (input);
                    AddToPubnubResultContainer (string.Format ("Presence Heartbeat is set to {0}", pubnub.PresenceHeartbeat));
                }
            } else if (state == PubnubState.PresenceInterval) {
                int iInterval;

                Int32.TryParse (input, out iInterval);
                if (iInterval == 0) {
                    AddToPubnubResultContainer ("ALERT: Please enter an integer value.");
                } else {
                    pubnub.PresenceHeartbeatInterval = int.Parse (input);
                    AddToPubnubResultContainer (string.Format ("Presence Heartbeat Interval is set to {0}", pubnub.PresenceHeartbeatInterval));
                }
            } else if (state == PubnubState.AuditPresence) {
                AddToPubnubResultContainer ("Running Audit Presence");
                pubnub.AuditPresenceAccess<string> (channel, input, DisplayReturnMessage, DisplayErrorMessage);
            } else if (state == PubnubState.AuditSubscribe) {
                AddToPubnubResultContainer ("Running Audit Subscribe");
                pubnub.AuditAccess<string> (channel, input, DisplayReturnMessage, DisplayErrorMessage);
            } else if (state == PubnubState.RevokePresence) {
                AddToPubnubResultContainer ("Running Revoke Presence");
                pubnub.GrantPresenceAccess<string> (channel, input, false, false, DisplayReturnMessage, DisplayErrorMessage);
            } else if (state == PubnubState.RevokeSubscribe) {
                AddToPubnubResultContainer ("Running Revoke Subscribe");
                pubnub.GrantAccess<string> (channel, input, false, false, DisplayReturnMessage, DisplayErrorMessage);
            }

            input = "";
            showAuthWindow = false;
            showPamPopupWindow = false;
        }
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Determines whether to send an asynchronous or synchronous call on the button click
    /// Async calls on button click when used in iOS results in random crashes thus sync calls 
    /// are preferred in case iOS
    /// </summary>
    /// <param name="pubnubState">Pubnub state.</param>
    void AsyncOrNonAsyncCall (PubnubState pubnubState)
    {
//#if(UNITY_IOS)
        /*if(pubnubState == PubnubState.DisconnectRetry)
        {
            if(!requestInProcess)
            {
                requestInProcess = true;
                ThreadPool.QueueUserWorkItem(new WaitCallback(DoAction), pubnubState);
            }
        }
        else
        {
            DoAction(pubnubState);
        }*/
        //ThreadPool.QueueUserWorkItem (new WaitCallback (DoAction), pubnubState);
//#elif(UNITY_ANDROID)
#if(UNITY_IOS || UNITY_ANDROID)
        Thread requestThread = new Thread (delegate (object state) {
            DoAction(pubnubState);
        }); 
        requestThread.Name = "requestThread";
        requestThread.Start ();
#else
        /*if(pubnubState == PubnubState.Subscribe){
            StartCoroutine (RunCoroutine ());
        }*/

        ThreadPool.QueueUserWorkItem (new WaitCallback (DoAction), pubnubState);
#endif
    }
Ejemplo n.º 8
0
 /// <summary>
 /// Determines whether to send an asynchronous or synchronous call on the button click
 /// Async calls on button click when used in iOS results in random crashes thus sync calls 
 /// are preferred in case iOS
 /// </summary>
 /// <param name="pubnubState">Pubnub state.</param>
 void AsyncOrNonAsyncCall (PubnubState pubnubState)
 {
     DoAction(pubnubState);
 }
Ejemplo n.º 9
0
    void DoActionWindow (int windowID)
    {
        fLeft = fLeftInit - 10;
        fTop = fTopInit + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Disconnect/Retry")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.DisconnectRetry);
            showActionsPopupWindow = false;
        }
        fTop = fTopInit + 1 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Presence")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.Presence);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 2 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Subscribe")) {
            InstantiatePubnub ();
            DoAction (PubnubState.Subscribe);

            //pubnub.Subscribe<string> (channel, DisplayReturnMessage, DisplayConnectStatusMessage, DisplayErrorMessage);

            showActionsPopupWindow = false;
            //UnityEngine.Object.Destroy (gobj);
        }

        fTop = fTopInit + 3 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Detailed History")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.DetailedHistory);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 4 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Publish")) {
            InstantiatePubnub ();
            allowUserSettingsChange = false;
            showActionsPopupWindow = false;
            showPublishPopupWindow = true;
        }

        fTop = fTopInit + 5 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Unsubscribe")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.Unsubscribe);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 6 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Presence-Unsub")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.PresenceUnsubscribe);
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 7 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Here Now")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.HereNow);
            state = PubnubState.HereNow;
            showGrantWindow = true;
            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 8 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Time")) {
            InstantiatePubnub ();
            //AsyncOrNonAsyncCall (PubnubState.Time);
            //GameObject gobj = new GameObject ();
            //pubnub = gobj.AddComponent<Pubnub> ();

            //pubnub.Time<string> (DisplayReturnMessage, DisplayErrorMessage);
            DoAction (PubnubState.Time);

            showActionsPopupWindow = false;
        }

        fTop = fTopInit + 9 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Where Now")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.WhereNow);
            showActionsPopupWindow = false;
            state = PubnubState.WhereNow;
            showAuthWindow = true;
        }
        fTop = fTopInit + 10 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Global Here Now")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.GlobalHereNow);
            showActionsPopupWindow = false;
            state = PubnubState.GlobalHereNow;
            showGrantWindow = true;
        }

        fTop = fTopInit + 11 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Change UUID")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.ChangeUUID);
            showActionsPopupWindow = false;
            state = PubnubState.ChangeUUID;
            showAuthWindow = true;
        }
        #if(UNITY_IOS || UNITY_ANDROID)
                GUI.enabled = false;
        #endif

        fTop = fTopInit + 12 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Disable Network")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.DisableNetwork);
            showActionsPopupWindow = false;
        }
        fTop = fTopInit + 13 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Enable Network")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.EnableNetwork);
            showActionsPopupWindow = false;
        }

        #if(UNITY_IOS || UNITY_ANDROID)
                GUI.enabled = true;
        #endif

    }
Ejemplo n.º 10
0
    void DoPamActionWindow (int windowID)
    {
        fLeft = fLeftInit - 10;
        fTop = fTopInit + 10;
        float fButtonWidth = 140;

        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Grant Subscribe")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.GrantSubscribe);
            state = PubnubState.GrantSubscribe;
            showPamPopupWindow = false;
            showGrantWindow = true;
        }
        fTop = fTopInit + 1 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Audit Subscribe")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.AuditSubscribe);
            showPamPopupWindow = false;
            showAuthWindow = true;
            state = PubnubState.AuditSubscribe;
        }

        fTop = fTopInit + 2 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Revoke Subscribe")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.RevokeSubscribe);
            showPamPopupWindow = false;
            showAuthWindow = true;
            state = PubnubState.RevokeSubscribe;
        }

        fTop = fTopInit + 3 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Grant Presence")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.GrantPresence);
            state = PubnubState.GrantPresence;
            showPamPopupWindow = false;
            showGrantWindow = true;
        }

        fTop = fTopInit + 4 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Audit Presence")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.AuditPresence);
            showPamPopupWindow = false;
            showAuthWindow = true;
            state = PubnubState.AuditPresence;
        }

        fTop = fTopInit + 5 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Revoke Presence")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.RevokePresence);
            showPamPopupWindow = false;
            showAuthWindow = true;
            state = PubnubState.RevokePresence;
        }

        fTop = fTopInit + 6 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Auth Key")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.AuthKey);
            showAuthWindow = true;
            showPamPopupWindow = false;
            state = PubnubState.AuthKey;
        }
        fTop = fTopInit + 7 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Add/Edit User State")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.SetUserStateKeyValue);
            showActionsPopupWindow = false;
            state = PubnubState.SetUserStateKeyValue;
            showTextWindow = true;
        }
        /*fTop = fTopInit + 8 * fRowHeight + 10;
                if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "View Local State")) {
                        InstantiatePubnub ();
                        AsyncOrNonAsyncCall (PubnubState.ViewLocalUserState);
                        showActionsPopupWindow = false;
                }*/
        fTop = fTopInit + 8 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Del User State")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.DelUserState);
            showActionsPopupWindow = false;
            state = PubnubState.DelUserState;
            showTextWindow = true;
        }
        fTop = fTopInit + 9 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Set User State")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.SetUserStateJson);
            showActionsPopupWindow = false;
            state = PubnubState.SetUserStateJson;
            showTextWindow = true;
        }
        fTop = fTopInit + 10 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Get User State")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.GetUserState);
            showActionsPopupWindow = false;
            state = PubnubState.GetUserState;
            showTextWindow = true;
        }
        fTop = fTopInit + 11 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Presence Heartbeat")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.PresenceHeartbeat);
            state = PubnubState.PresenceHeartbeat;
            showAuthWindow = true;
            showActionsPopupWindow = false;
        }
        fTop = fTopInit + 12 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Presence Interval")) {
            InstantiatePubnub ();
            AsyncOrNonAsyncCall (PubnubState.PresenceInterval);
            state = PubnubState.PresenceInterval;
            showAuthWindow = true;
            showActionsPopupWindow = false;
        }
        /*fTop = fTopInit + 13 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "Publish Tests")) {
            InstantiatePubnub ();
            pubnub.Publish<string> (channel, 1, storeInHistory, DisplayReturnMessage, DisplayErrorMessage);
            pubnub.Publish<string> (channel, 1.2f, storeInHistory, DisplayReturnMessage, DisplayErrorMessage);
            pubnub.Publish<string> (channel, 14248827499560123, storeInHistory, DisplayReturnMessage, DisplayErrorMessage);
        }*/
        fTop = fTopInit + 13 * fRowHeight + 10;
        if (GUI.Button (new Rect (fLeft, fTop, fButtonWidth, fButtonHeight), "DH Tests")) {
            InstantiatePubnub ();
            string[] chArr = {"hello_world", "hello_world2", "hello_world3"};
            RunDetailedHistoryForMultipleChannels(chArr, 0);
        }
    }