Example #1
0
        private static void WelcomeHandler(GoodgameChannel channel, GoodGameData data)
        {
            //Log.WriteInfo("Goodgame protocol version: {0}", data.ProtocolVersion);
            //Log.WriteInfo("Goodgame servicer identity: {0}", data.ServerIdentity);

            channel.SendCredentials();
        }
Example #2
0
        private static void ChannelCountersHandler(GoodgameChannel channel, GoodGameData data)
        {
            //Log.WriteInfo("Goodgame counters. Clients: {0}, Users:{1}", data.ClientsInChannel, data.UsersInChannel);

            channel.ChannelStats.ViewersCount = (int)data.ClientsInChannel;

            channel.Chat.UpdateStats();
        }
Example #3
0
        private static void ViewersHandler(GoodgameChannel channel, GoodGameData data)
        {
            if (data.Count == null)
            {
                channel.ChannelStats.ViewersCount = 0;
            }
            else
            {
                channel.ChannelStats.ViewersCount = (int)data.Count;
            }

            channel.Chat.UpdateStats();
        }
Example #4
0
        private static void SuccessAuthHandler(GoodgameChannel channel, GoodGameData data)
        {
            channel.Chat.Status.IsConnected = true;
            if (data.UserId == 0)
            {
                channel.Chat.Status.IsLoggedIn = false;
                channel.Chat.IsAnonymous       = true;
            }
            else
            {
                channel.Chat.Status.IsLoggedIn = true;
                channel.Chat.IsAnonymous       = false;
            }

            channel.SendChannelJoin();
        }
Example #5
0
        private static void SuccessJoinHandler(GoodgameChannel channel, GoodGameData data)
        {
            UI.Dispatch(() => {
                channel.Chat.Status.IsConnecting = false;
                channel.Chat.Status.IsStarting   = false;
                channel.Chat.Status.IsConnected  = true;

                if (!channel.Chat.IsAnonymous)
                {
                    channel.Chat.Status.IsLoggedIn = true;
                }
            });

            channel.timer.Change(0, counterInterval);
            channel.disconnectTimer.Change(disconnectTimeout, Timeout.Infinite);

            if (channel.JoinCallback != null)
            {
                channel.JoinCallback(channel);
            }

            //Log.WriteInfo("Goodgame joined to #{0} id:{1}", data.ChannelName, data.ChannelId);
        }
Example #6
0
        private static void MessageHandler(GoodgameChannel channel, GoodGameData data)
        {
            if (String.IsNullOrWhiteSpace(data.UserName) || String.IsNullOrWhiteSpace(data.Text))
            {
                return;
            }

            channel.ChannelStats.MessagesCount++;
            channel.Chat.UpdateStats();

            if (channel.ReadMessage != null)
            {
                channel.ReadMessage(new ChatMessage()
                {
                    Channel         = channel.ChannelName,
                    ChatIconURL     = channel.Chat.IconURL,
                    ChatName        = channel.Chat.ChatName,
                    FromUserName    = data.UserName,
                    HighlyImportant = false,
                    IsSentByMe      = false,
                    Text            = HttpUtility.HtmlDecode(data.Text),
                });
            }
        }
Example #7
0
 private static void PongHandler(GoodgameChannel channel, GoodGameData data)
 {
     //Log.WriteInfo("Goodgame pong received");
 }