public void parseCommands(LinkedList<WorldObject> objects, Menu m)
        {
            String content;
            using (System.Xml.XmlReader r = System.Xml.XmlReader.Create(fileName))
            {
                r.MoveToContent();
                r.ReadToFollowing("objects");
                r.ReadToFollowing("commands");

                content = r.ReadElementContentAsString();
                content = content.Trim();
                r.Close();
            }
            String[] properties = content.Split('\n');
            int[] commandCounter = new int[7];
            if (properties.Length > 1)
            {
                for (int i = 0; i < properties.Length; i++)
                {
                    properties[i] = properties[i].Trim();
                    properties[i] = properties[i].Substring(7);
                    commandCounter[i] = Convert.ToInt32(properties[i]);
                }
                m.setCommandNums(commandCounter);
            }
        }
 public MenuItem(string text, Texture2D texture, Vector2 pos, int w, int h, bool selectable, Color c, Menu m, MenuAction a)
 {
     this.text = text;
     this.texture = texture;
     this.pos = pos;
     destination = pos;
     font = TextureManager.FontMap["menuFont"];
     this.m = m;
     action = a;
     this.width = w;
     this.height = h;
     this.c = c;
 }
 public MenuItemBlueprint(string text, Texture2D texture, Vector2 pos, int w, int h, bool selectable, Color c, Menu m, MenuActionS a, string bluePrintName)
     : base(text, texture, pos, w, h, selectable, c, m, delegate() { })
 {
     this.bluePrintName =  bluePrintName;
     action = a;
 }
 public static void OpenLayerMenu()
 {
     current = new LayerMenu();
 }
 public void parseFile(LinkedList<WorldObject> objects, Texture2D [,] textures, Menu m)
 {
     while (objects.First != null)
     {
         objects.RemoveLast();
     }
     parseStartAndGoal(objects, textures);
     parsePlatforms(objects, textures);
     parseEnemies(objects, textures);
     parseItems(objects);
     parseDoodads(objects, textures);
     parseCommands(objects,m);
     parseRopes(objects);
 }
 public static void OpenEntityMenu(Entity e)
 {
     current = new EntityMenu(e);
 }
 public static void OpenBlueprintMenu()
 {
     current = blueprints;
     blueprints.UpdateMenuItems();
 }
 public static void Close()
 {
     current = null;
 }
 public MenuItemLayer(string text, Texture2D texture, Vector2 pos, int w, int h, bool selectable, Color c, Menu m, LayerAction a, int i)
     : base(text, texture, pos, w, h, selectable, c, m, delegate() { })
 {
     this.index = i;
     action = a;
 }
Exemple #10
0
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     this.IsMouseVisible = true;
     objects = new LinkedList<WorldObject>();
     highlightRect = new Rectangle(-100, -100, 80, 30);
     palette = new Rectangle(0, 0, SCREEN_WIDTH - 200, SCREEN_HEIGHT);
     gridRect = new Rectangle(0, 0, 10, 10);
     backgroundRect = new Rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
     menuOpenRect = new Rectangle(0,0,100,70);
     menu = new Menu();
     levelExport = new LevelExporter();
     saveFile = false;
     openFile = false;
     showBounds = false;
     keyDown = false;
     addPlatform = addEnemy = addDoodad = addItem = addHazardousPlatform = addStart = addGoal = addRope = false;
     openMenu = false;
     oldScrollValue = 0;
     newScrollValue = 0;
     xAdd = 0;
     graphics.PreferredBackBufferWidth = SCREEN_WIDTH;
     graphics.PreferredBackBufferHeight = SCREEN_HEIGHT;
     graphics.ApplyChanges();
     zoom_scale = 1;
     base.Initialize();
 }