Пример #1
0
        public static void JoinExternalGame()
        {
            var addressParts = Game.Settings.Game.ConnectTo.Split(
                new [] { ':' }, StringSplitOptions.RemoveEmptyEntries);

            if (addressParts.Length < 1 || addressParts.Length > 2)
            {
                return;
            }

            var host = addressParts[0];
            var port = Exts.WithDefault(1234, () => int.Parse(addressParts[1]));

            Game.Settings.Game.ConnectTo = "";
            Game.Settings.Save();

            Game.JoinServer(host, port);
        }