static void Main() { Console.WriteLine("CLIENTE DE SOKOBANURJC"); // Recuperar tabla de nombres remota: RemotingConfiguration.RegisterWellKnownClientType(typeof(SokobanURJC.TablaNombres), "http://localhost:1232/TablaNombres.remoto"); TablaNombres tablaNombres = (TablaNombres)Activator.GetObject(typeof(SokobanURJC.TablaNombres), "http://localhost:1232/TablaNombres.remoto"); int puertoLogica = tablaNombres.puertoLogica; int puertoNiveles = tablaNombres.puertoNiveles; RemotingConfiguration.RegisterWellKnownClientType(typeof(SokobanURJC.Level), "http" + "://localhost:" + puertoLogica + "/Level.remoto"); RemotingConfiguration.RegisterWellKnownClientType(typeof(SokobanURJC.LevelSet), "http" + "://localhost:" + puertoLogica + "/LevelSet.remoto"); RemotingConfiguration.RegisterWellKnownClientType(typeof(SokobanURJC.ColeccionNiveles), "http" + "://localhost:" + puertoNiveles + "/ColeccionNiveles.remoto"); levelSet = (LevelSet)Activator.GetObject(typeof(LevelSet), "http" + "://localhost:" + puertoLogica + "/LevelSet.remoto"); level = (Level)Activator.GetObject(typeof(Level), "http" + "://localhost:" + puertoLogica + "/Level.remoto"); coleccionNiveles = (ColeccionNiveles)Activator.GetObject(typeof(SokobanURJC.ColeccionNiveles), "http" + "://localhost:" + puertoNiveles + "/ColeccionNiveles.remoto"); // Lanzar juego: Application.Run(new Board()); }
/// <summary> /// Reads all the Level elements from the level set. This method is /// called when we have selected a level set that we want to play (or /// we've read the level set from the savegame when we're continuing a /// previously saved game. /// </summary> /// <param name="setName"></param> public void SetLevelsInLevelSet(int indice) { // Cargar XML remoto: ColeccionNiveles coleccionNiveles = new ColeccionNiveles(); byte[] docbytearray = coleccionNiveles.ficheroXMLRemoto(indice); XmlDocument doc = new XmlDocument(); MemoryStream ms = new MemoryStream(docbytearray); doc.Load(ms); // Get all Level elements from the level set XmlNodeList levelInfoList = doc.SelectNodes("//Level"); int levelNr = 1; foreach (XmlNode levelInfo in levelInfoList) { LoadLevel(levelInfo, levelNr); levelNr++; } }