Ejemplo n.º 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);
                    });
                }
            }
        }
Ejemplo n.º 2
0
        public void DisplayDlcMessage(DLCHelper.DLCComparison compare)
        {
            SetTitle("DLC Mismatch");

            DLCPanelNew dlcPanel = FindObjectOfType <DLCPanelNew>();

            string message = "Your DLCs don't match with the server's DLCs\n\n";

            if (compare.ClientMissing != SteamHelper.DLC_BitMask.None)
            {
                message += "You are missing the following DLCs:\n";
                message += string.Join("\n", compare.ClientMissing.DLCs().Select(dlc => GetDlcName(dlcPanel, dlc)).ToArray());
                message += "\n\n";
            }
            if (compare.ServerMissing != SteamHelper.DLC_BitMask.None)
            {
                message += "The server doesn't have the following DLCs:\n";
                message += string.Join("\n", compare.ServerMissing.DLCs().Select(dlc => GetDlcName(dlcPanel, dlc)).ToArray());
            }

            message += "\n\nDLCs can be enabled/disabled via checkbox in Steam.";

            SetMessage(message);

            Show(true);

            Log.Info("DLCs don't match:\n" + message);
        }
Ejemplo n.º 3
0
        public void DisplayDlcMessage(DLCHelper.DLCComparison compare)
        {
            _title = "DLC Mismatch";
            if (_titleLabel)
            {
                _titleLabel.text = _title;
            }

            DLCPanelNew dlcPanel = FindObjectOfType <DLCPanelNew>();

            string message = "Your DLCs don't match with the server's DLCs\n\n";

            if (compare.ClientMissing != SteamHelper.DLC_BitMask.None)
            {
                message += "You are missing the following DLCs:\n";
                message += string.Join("\n", compare.ClientMissing.DLCs().Select(dlc => dlcPanel.FindLocalizedDLCName(dlc)).ToArray());
                message += "\n\n";
            }
            if (compare.ServerMissing != SteamHelper.DLC_BitMask.None)
            {
                message += "The server doesn't have the following DLCs:\n";
                message += string.Join("\n", compare.ServerMissing.DLCs().Select(dlc => dlcPanel.FindLocalizedDLCName(dlc)).ToArray());
            }

            message += "\n\nDLCs can be enabled/disabled via checkbox in Steam.";

            _message = message;

            if (_messageLabel)
            {
                _messageLabel.text = message;
            }

            Show(true);

            _logger.Info("DLCs don't match:\n" + message);
        }
Ejemplo n.º 4
0
        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");
                }
            }
        }