Exemplo n.º 1
0
 public void LoadCursor(Cursor cursor)
 {
     this.cursor = cursor;
 }
Exemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // настройка хранилища
            storage.TexturesLoader = Content.Load<Texture2D>;
            storage.FontLoader = Content.Load<SpriteFont>;

            // загрузка всех текстур из заданной папки
            // !!! пока, обязательно указывать CONTENT/
            storage.LoadTexture2DFolder("Content/Textures");
            storage.LoadTexture2DFolder("Content/players");
            storage.LoadTexture2DFolder("Content/advices");
            storage.PushFont("font", Content.Load<SpriteFont>("myFont1"));
            storage.PushFont("menufont", Content.Load<SpriteFont>("menufont"));

            // выбираем все возможные номера уровней
            storage.GetLevelNumbers();

            xmlCoreMissionLoader = Content.Load<XMLCoreMissionLoader>("lvls/tasks/mission_description1");
            foreach (XMLExpressionTarger st in xmlCoreMissionLoader.expressions) {
                toDraw.Add("Key point: " + st.point);
                toDraw.Add("Name: " + st.name + ", EXP: " + st.expression);
            }

            // инициализируем нового игрока
            Rectangle plaerPosition = new Rectangle(120, 120, LevelLoader.SizePeople, LevelLoader.SizePeople);
            player = new Player(storage.Pull2DTexture("player"), storage.Pull2DTexture("player_run"), storage.Pull2DTexture("player_run_goriz"), plaerPosition, this, camera);

            this.levelLoader = new LevelLoader(this, player, storage, camera);

            player.setLinkLevelLoader(levelLoader); // передадим игроку ссылку на загрузчик уровней

            maxLvl = storage.GetMaxLevelNumber();

            // стоит проверять существование уровня
            /*if (storage.IsExist(1))
            {
                levelLoader.CreateLevel(1);
                currentLvl = 1;
            }
            else
                levelLoader.CreateLevel(maxLvl);*/

            menuFont = storage.PullFont("menufont");

            inventory = storage.Pull2DTexture("inventory");
            menuButton = new Button(new Vector2(screenWidth - 40, 0), storage.Pull2DTexture("menu_active"), storage.PullFont("menufont"),new Vector2(0.6f,0.8f), "меню");
            menuButton.Click += new EventHandler(menuButton_Click);
            cursor = new Cursor(storage.Pull2DTexture("cursor"), storage.Pull2DTexture("pointer"));

            buttonTexture = storage.Pull2DTexture("button");
            LoadMenu();
            LoadLvlMenu();
        }