Exemple #1
0
        protected override void Handle(ConnectionResultCommand command)
        {
            // We only want this message while connecting
            if (MultiplayerManager.Instance.CurrentClient.Status != ClientStatus.Connecting)
            {
                return;
            }

            // If we are allowed to connect
            if (command.Success)
            {
                // Log and set that we are connected.
                Log.Info("Successfully connected to server. Downloading world...");
                MultiplayerManager.Instance.CurrentClient.ClientPlayer = new Player();
                MultiplayerManager.Instance.CurrentClient.Status       = ClientStatus.Downloading;
                MultiplayerManager.Instance.CurrentClient.ClientId     = command.ClientId;
            }
            else
            {
                Log.Info($"Could not connect: {command.Reason}");
                MultiplayerManager.Instance.CurrentClient.ConnectionMessage = command.Reason;
                MultiplayerManager.Instance.CurrentClient.Disconnect();
                if (command.Reason.Contains("DLC")) // No other way to detect if we should display the box
                {
                    DLCHelper.DLCComparison compare = DLCHelper.Compare(command.DLCBitMask, DLCHelper.GetOwnedDLCs());

                    ThreadHelper.dispatcher.Dispatch(() =>
                    {
                        MessagePanel panel = PanelManager.ShowPanel <MessagePanel>();
                        panel.DisplayDlcMessage(compare);
                    });
                }
            }
        }
        public override void Handle(ConnectionResultCommand command)
        {
            // We only want this message while connecting
            if (MultiplayerManager.Instance.CurrentClient.Status != ClientStatus.Connecting)
            {
                return;
            }

            // If we are allowed to connect
            if (command.Success)
            {
                // Log and set that we are connected.
                _logger.Info("Successfully connected to server.");
                ChatLogPanel.PrintGameMessage("Successfully connected to server.");
                MultiplayerManager.Instance.CurrentClient.Status   = ClientStatus.Connected;
                MultiplayerManager.Instance.CurrentClient.ClientId = command.ClientId;
            }
            else
            {
                _logger.Info($"Could not connect: {command.Reason}");
                MultiplayerManager.Instance.CurrentClient.ConnectionMessage = command.Reason;
                MultiplayerManager.Instance.CurrentClient.Disconnect();
                if (command.DLCBitMask != SteamHelper.DLC_BitMask.None)
                {
                    DLCHelper.DLCComparison compare = DLCHelper.Compare(command.DLCBitMask, DLCHelper.GetOwnedDLCs());
                    if (compare.ClientMissing != SteamHelper.DLC_BitMask.None)
                    {
                        ChatLogPanel.PrintGameMessage(ChatLogPanel.MessageType.Error, $"You are missing the following DLCs: {compare.ClientMissing}");
                    }
                    if (compare.ServerMissing != SteamHelper.DLC_BitMask.None)
                    {
                        ChatLogPanel.PrintGameMessage(ChatLogPanel.MessageType.Error, $"The server doesn't have the following DLCs: {compare.ServerMissing}");
                    }
                    ChatLogPanel.PrintGameMessage(ChatLogPanel.MessageType.Normal, "DLCs can be disabled via checkbox in Steam");
                }
            }
        }