private void HandleContext(HttpListenerContext context)
    {
        var failed = true;

        try
        {
            if (context.Request.Url.AbsolutePath != "/notification")
            {
                return;
            }
            if (context.Request.HttpMethod != "POST")
            {
                return;
            }

            using (var reader = new StreamReader(context.Request.InputStream))
            {
                var body = reader.ReadToEnd();
                var json = new JSONObject(body);
                var not  = Notification.FromJson(json);
                NotificationPanel.Show(not);
            }

            failed = false;
            context.Response.StatusCode = (int)HttpStatusCode.OK;
        }
        finally
        {
            if (failed)
            {
                context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
            }
            context.Response.Close();
        }
    }
Beispiel #2
0
    IEnumerator HandlePanelShowAndHide(NotificationPanel panel)
    {
        activePanels++;
        yield return(panel.Show(activePanels));

        yield return(new WaitForSeconds(2f));

        yield return(panel.Hide());

        Destroy(panel.gameObject);
        activePanels--;
    }
Beispiel #3
0
 public void Notification(string msg)
 {
     notificationPanel.Show(msg);
 }
Beispiel #4
0
 public void Notification(string message)
 {
     notificationPanel.Show(message);
 }