/// <summary>
        /// Called when the local user has joined the game channel.
        /// </summary>
        public void OnJoined()
        {
            FileHashCalculator fhc = new FileHashCalculator();

            fhc.CalculateHashes(gameModes);

            if (IsHost)
            {
                connectionManager.SendCustomMessage(new QueuedMessage(
                                                        string.Format("MODE {0} +klnNs {1} {2}", channel.ChannelName,
                                                                      channel.Password, SGPlayers.Count),
                                                        QueuedMessageType.SYSTEM_MESSAGE, 50));

                connectionManager.SendCustomMessage(new QueuedMessage(
                                                        string.Format("TOPIC {0} :{1}", channel.ChannelName,
                                                                      ProgramConstants.CNCNET_PROTOCOL_REVISION + ";" + localGame.ToLower()),
                                                        QueuedMessageType.SYSTEM_MESSAGE, 50));

                gameFilesHash = fhc.GetCompleteHash();

                gameBroadcastTimer.Enabled = true;
                gameBroadcastTimer.Start();
                gameBroadcastTimer.SetTime(TimeSpan.FromSeconds(INITIAL_GAME_BROADCAST_DELAY));
            }
            else
            {
                channel.SendCTCPMessage(FILE_HASH_CTCP_COMMAND + " " + fhc.GetCompleteHash(), QueuedMessageType.SYSTEM_MESSAGE, 10);

                channel.SendCTCPMessage(TUNNEL_PING_CTCP_COMMAND + " " + tunnel.PingInMs, QueuedMessageType.SYSTEM_MESSAGE, 10);

                if (tunnel.PingInMs < 0)
                {
                    AddNotice(ProgramConstants.PLAYERNAME + " - unknown ping to tunnel server.");
                }
                else
                {
                    AddNotice(ProgramConstants.PLAYERNAME + " - ping to tunnel server: " + tunnel.PingInMs + " ms");
                }
            }

            topBar.AddPrimarySwitchable(this);
            topBar.SwitchToPrimary();
            WindowManager.SelectedControl = tbChatInput;
            UpdateDiscordPresence(true);
        }
Пример #2
0
 public void Open()
 {
     topBar.AddPrimarySwitchable(this);
     Enable();
 }