public Server(Config config) { Port = 8877; Config = config; Messages = new List<ChatMessage>(); Players = new List<Player>(); }
public Package(Config config) { Server = config.Server; DataFolder = config.DataFolder; Cache = new PackageCache(config); Queued = new List<string>(); }
public Client(Config config) { Config = config; Messages = new List<string>(); NetPeerConfiguration netconfig = new NetPeerConfiguration("blueprint"); netconfig.EnableMessageType(NetIncomingMessageType.DiscoveryResponse); NetClient = new NetClient(netconfig); NetClient.Start(); Players = new List<Player>(); }
public BlueprintGame(string[] args) { // Graphics Setup graphics = new GraphicsDeviceManager(this); this.graphics.PreferredBackBufferWidth = 1280; this.graphics.PreferredBackBufferHeight = 720; this.graphics.SynchronizeWithVerticalRetrace = true; Content.RootDirectory = "Content"; this.Window.AllowUserResizing = true; this.Window.ClientSizeChanged += new EventHandler<EventArgs>(Window_ClientSizeChanged); // Setup a few classes Config = new Config(args); Package = new Package(Config); Lighting = new Lighting(this); Loading = new Loading(); }
static void Main(string[] args) { // use relative path in release builds if no arguments given. #if (DEBUG) const string relativePath = "C:\\Projects\\www\\blueprint-test"; #else string relativePath = System.Reflection.Assembly.GetExecutingAssembly().Location; relativePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); #endif // check program arguments if (args.Length < 1) { // set overrides for debug mode or defaults BlueprintAction = "manufacture"; SourceFolder = relativePath; DestinationFolder = relativePath + "\\_www\\"; } else { // check which arguments are present foreach (string argument in args) { int index = Array.IndexOf(args, argument); // assign arguments to properties if (index == 0) { BlueprintAction = argument; } else if (index == 1 && index != (args.Length - 1)) { SourceFolder = argument; } else if (index == 1 && index == (args.Length - 1)) { DestinationFolder = argument; } else if (index == 2) { DestinationFolder = argument; } } } // Load config from json Config = new Config(); Config = JsonConvert.DeserializeObject<Config>(File.ReadAllText(SourceFolder + "\\_config\\config.json")); // check if destination folder exists if (DestinationFolder != "" && !Directory.Exists(DestinationFolder)) { Directory.CreateDirectory(DestinationFolder); } // check if source folder exists if (Directory.Exists(SourceFolder)) { // start processing directies/files SourceBrowser processor = new SourceBrowser(); processor.ProcessDirectory(SourceFolder); foreach (SourceFile file in Config.Files) { string layout = (file.PageType == "post") ? Config.Defaults.Post.Layout : Config.Defaults.Page.Layout; switch(file.PageType) { case "page": file.GenerateHtmlFile(true, layout); break; case "post": file.DestinationPath = file.GenerateDirectoryStructureForPosts(file.FileName); file.GenerateHtmlFile(true, layout); break; } } Console.WriteLine("Process completed, press a key to exit"); } else { Console.WriteLine("Source folder does not exist."); Console.WriteLine("Please specify the correct source folder."); } Console.ReadLine(); }
public PackageCache(Config config) { DataFolder = config.DataFolder; }
public void Initialize( Texture2D mapTexture, Package package, Config config, GraphicsDevice graphics, ContentManager content ) { // Setup Liquids Fluids.Initialize(SizeX, SizeY, content.Load<Texture2D>("Blocks/blocks")); BlockTexture = mapTexture; BlockState = content.Load<Texture2D>("Blocks/blocks"); WallTexture = content.Load<Texture2D>("Blocks/wall"); Entities.Initialize(content); Flora.Initialize(this, content.Load<Texture2D>("flora")); // Gather Map Data string data = package.RemoteString("maps/manifest/" + config.MapId); XmlDocument xml = new XmlDocument(); xml.LoadXml(data); Spawn = new Vector2(Int32.Parse(xml.DocumentElement.Attributes["spawnx"].Value) * 24, Int32.Parse(xml.DocumentElement.Attributes["spawny"].Value) * 24); #region Xml Parsing foreach (XmlNode node in xml.DocumentElement.ChildNodes) { if (node.Name == "BlockType") { int upto = 0; foreach (XmlNode blocktype in node.ChildNodes) { Types[upto] = new BlockType(blocktype.Attributes["name"].Value, Int32.Parse(blocktype.Attributes["id"].Value), 100); foreach (XmlNode slice in blocktype.ChildNodes) { Types[upto].Slices[int.Parse(slice.Attributes["i"].Value)] = new Rectangle(int.Parse(slice.Attributes["x"].Value) * 24, int.Parse(slice.Attributes["y"].Value) * 24, 24, 24); } upto++; } } else if (node.Name == "Block") { foreach (XmlNode block in node.ChildNodes) { Blocks[Int32.Parse(block.Attributes["x"].Value), Int32.Parse(block.Attributes["y"].Value)] = new Block(GetBlockType(Int32.Parse(block.Attributes["type"].Value))); } } else if (node.Name == "Liquid") { foreach (XmlNode liquid in node.ChildNodes) { if(byte.Parse(liquid.Attributes["type"].Value) == 1){ Fluids.Water.Blocks[Int32.Parse(liquid.Attributes["x"].Value), int.Parse(liquid.Attributes["y"].Value)] = 24; } else if (byte.Parse(liquid.Attributes["type"].Value) == 1) { // lava } } } else if (node.Name == "EntityType") { //Entities.Types = new EntityType[node.ChildNodes.Count]; int i = 0; foreach (XmlNode entitytype in node.ChildNodes) { /*Entities.Types[i] = new EntityType( int.Parse(entitytype.Attributes["id"].Value), entitytype.Attributes["name"].Value, package.RemoteTexture(entitytype.Attributes["sprite"].Value, graphics), int.Parse(entitytype.Attributes["width"].Value), int.Parse(entitytype.Attributes["height"].Value), true );*/ i++; } } else if (node.Name == "Entity") { foreach (XmlNode entity in node.ChildNodes) { //EntityType type = Entities.getType(); //EntityType type = Entities.getType(int.Parse(entity.Attributes["type"].Value)); // int.Parse(entity.Attributes["width"].Value) /* Entities.Entities.Add( new Entity(type, int.Parse(entity.Attributes["x"].Value), int.Parse(entity.Attributes["y"].Value)) );*/ } } } #endregion // Autogenerate //MapGenerator generator = new MapGenerator(); //generator.Setup(SizeX, SizeY); //generator.Generate(this); }