Exemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void LoadContent(ContentManager Content)
        {
            // Create a new SpriteBatch, which can be used to draw textures.

            /*/////////////////////////////////////////////////////////////////
             * Cam.spriteBatch = new SpriteBatch(GraphicsDevice);
             *//////////////////////////////////////////////////////////////////

            UI.UIText.UIFrame.Initialize(Content);

            Utils.ModelList ModelNames = new Utils.ModelList();

            ModelNames = Newtonsoft.Json.JsonConvert.DeserializeObject <Utils.ModelList>(File.ReadAllText("VegitationPack.json"));

            UInt32 UUIDIndex = 0;

            foreach (var ModelList in ModelNames.Models)
            {
                if (ModelList[0] != "UnusedGrass")
                {
                    List <Model> CurrentModelList = new List <Model>();
                    for (int i = 1; i < ModelList.Count(); i++)
                    {
                        if (!ModelList[i].EndsWith(".psd"))
                        {
                            var model = Content.Load <Model>(ModelNames.RelativePath + ModelList[i]);
                            foreach (var a in model.Meshes)
                            {
                                a.Tag = new MeshTag()
                                {
                                    Scale = (((GSV.spacingX + GSV.spacingY) / 2f) - 275) / a.BoundingSphere.Radius,
                                    UUID  = new Color((float)Utils.RNG.NextDouble(), (float)Utils.RNG.NextDouble(), 0).ToVector3()
                                };
                                UUIDIndex += 1;
                            }
                            CurrentModelList.Add(model);
                        }
                    }
                    OrderedModels.Add(ModelList[0], CurrentModelList);
                }
            }

            HelpButton.Load(Content);

            Entities.Bush.Sprite       = Content.Load <Texture2D>(@"GUI\Bush");
            Entities.Flower.Sprite     = Content.Load <Texture2D>(@"GUI\Flower");
            Entities.Reed.Sprite       = Content.Load <Texture2D>(@"GUI\Reed");
            Entities.Shrub.Sprite      = Content.Load <Texture2D>(@"GUI\Shrub");
            Entities.FlowerBush.Sprite = Content.Load <Texture2D>(@"GUI\FlowerBush");

            ContentLoaded = true;

            Cam.PEffect = new PrimitiveEffect()
            {
                InternalEffect = Content.Load <Effect>("PrimitivesEffect")
            };

            WEffect = new WaterEffect()
            {
                InternalEffect = Content.Load <Effect>("WaterShader")
            };
        }