Ejemplo n.º 1
0
        private void sendEventData(GameEvent gameEvent)
        {
            Response response = new Response();
            response.lastEvent = gameEvent;

            var result = JsonConvert.SerializeObject(response);

            foreach (WebSocketSession session in m_sessions)
            {
                session.Send(result);
            }
        }
Ejemplo n.º 2
0
        private void sendPlayerData(Player player,RecursionTracker.StatTracker.SessionStats sessionStats)
        {
            Response response = new Response();
            response.player = player;
            response.sessionStats = sessionStats;

            var result = JsonConvert.SerializeObject(response);

            foreach (WebSocketSession session in m_sessions)
            {
                session.Send(result);
            }
        }
Ejemplo n.º 3
0
        // Data Transfer Methods
        private void sendAchievement(Achievement achv)
        {
            Response response = new Response();
            response.achievementData = new AchievementData();
            Bitmap background = (Bitmap)achv.GetBackground();
            if (background != null &&
            achv.ignoreDefaultBackground == true)
            {
                MemoryStream ms = new MemoryStream();
                background.Save(ms, background.RawFormat);
                response.achievementData.Background = ms.GetBuffer();
            }
            Bitmap icon = (Bitmap)achv.GetIcon();
            if (icon != null)
            {
                MemoryStream ms = new MemoryStream();
                icon.Save(ms, icon.RawFormat);
                response.achievementData.Icon = ms.GetBuffer();
            }
            response.achievementData.Title = achv.GetLastTitle();
            response.achievementData.Description = achv.GetLastDescription();

            var result = JsonConvert.SerializeObject(response);

            foreach (WebSocketSession session in m_sessions)
            {
                session.Send(result);
            }
        }