Exemplo n.º 1
0
        /// <summary>
        /// Setup the content manager so it knows where to find various files.
        /// </summary>
        private void Init()
        {
            /** Scan system for files **/
            var allFiles = new List <string>();

            _ScanFiles(BasePath, allFiles);
            AllFiles = allFiles.ToArray();

            PIFFRegistry.Init("Content/Patch/");
            Archives = new Dictionary <string, FAR3Archive>();
            UIGraphics.Init();
            AvatarMeshes.Init();
            AvatarBindings.Init();
            AvatarTextures.Init();
            AvatarSkeletons.Init();
            AvatarAppearances.Init();
            AvatarOutfits.Init();
            AvatarAnimations.Init();
            Audio.Init();
            AvatarPurchasables.Init();
            AvatarHandgroups.Init();
            AvatarThumbnails.Init();

            InitWorld();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new instance of Content.
        /// </summary>
        /// <param name="basePath">Path to client directory.</param>
        /// <param name="device">A GraphicsDevice instance.</param>
        private Content(string basePath, GraphicsDevice device)
        {
            this.BasePath = basePath;
            this.Device   = device;

            Changes = new ChangeManager();

            UIGraphics         = new UIGraphicsProvider(this, Device);
            AvatarMeshes       = new AvatarMeshProvider(this, Device);
            AvatarBindings     = new AvatarBindingProvider(this);
            AvatarTextures     = new AvatarTextureProvider(this, Device);
            AvatarSkeletons    = new AvatarSkeletonProvider(this);
            AvatarAppearances  = new AvatarAppearanceProvider(this);
            AvatarOutfits      = new AvatarOutfitProvider(this);
            AvatarAnimations   = new AvatarAnimationProvider(this);
            AvatarPurchasables = new AvatarPurchasables(this);
            AvatarHandgroups   = new HandgroupProvider(this, Device);
            AvatarThumbnails   = new AvatarThumbnailProvider(this, Device);

            WorldObjects       = new WorldObjectProvider(this);
            WorldFloors        = new WorldFloorProvider(this);
            WorldWalls         = new WorldWallProvider(this);
            WorldObjectGlobals = new WorldGlobalProvider(this);
            WorldCatalog       = new WorldObjectCatalog();

            Audio        = new Audio(this);
            GlobalTuning = new Tuning(Path.Combine(basePath, "tuning.dat"));

            Init();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Setup the content manager so it knows where to find various files.
        /// </summary>
        private void Init()
        {
            Inited = true;
            if (!TS1)
            {
                Audio.Init();
            }
            /** Scan system for files **/
            if (AllFiles == null)
            {
                LoadProgress = ContentLoadingProgress.ScanningFiles;
                var allFiles = new List <string>();
                if (Target != FSOEngineMode.TS1)
                {
                    _ScanFiles(BasePath, allFiles, BasePath);
                    AllFiles = allFiles.ToArray();
                }
            }

            var ts1AllFiles = new List <string>();
            var oldBase     = BasePath;

            if (TS1)
            {
                _ScanFiles(TS1BasePath, ts1AllFiles, TS1BasePath);
                TS1AllFiles = ts1AllFiles.ToArray();
            }

            LoadProgress = ContentLoadingProgress.InitGlobal;
            TS1Global?.Init();
            LoadProgress = ContentLoadingProgress.InitBCF;
            BCFGlobal?.Init();

            if (!TS1)
            {
                PIFFRegistry.Init(Path.Combine(FSOEnvironment.ContentDir, "Patch/"));
            }
            else
            {
                PIFFRegistry.Init(Path.Combine(FSOEnvironment.ContentDir, "TS1Patch/"));
            }

            LoadProgress = ContentLoadingProgress.InitAvatars;
            _archives    = new Dictionary <string, FAR3Archive>();
            if (Target != FSOEngineMode.TS1 && Mode == ContentMode.CLIENT)
            {
                UIGraphics.Init();
            }

            if (TS1)
            {
                ((TS1AvatarTextureProvider)AvatarTextures)?.Init();
                ((TS1BMFProvider)AvatarMeshes)?.Init();
                Jobs         = new TS1JobProvider(TS1Global);
                Neighborhood = new TS1NeighborhoodProvider(this);
            }
            else
            {
                if (Mode == ContentMode.CLIENT)
                {
                    AvatarHandgroups.Init();
                }
                AvatarBindings.Init();
                AvatarOutfits.Init();
                AvatarPurchasables.Init();
                AvatarCollections.Init();
                AvatarThumbnails.Init();
                ((AvatarTextureProvider)AvatarTextures)?.Init();
                ((AvatarAnimationProvider)AvatarAnimations).Init();
                ((AvatarSkeletonProvider)AvatarSkeletons).Init();
                ((AvatarAppearanceProvider)AvatarAppearances).Init();
                ((AvatarMeshProvider)AvatarMeshes)?.Init();
                CityMaps.Init();
                RackOutfits.Init();
                Ini.Init();
            }

            LoadProgress = ContentLoadingProgress.InitAudio;
            if (TS1)
            {
                Audio.Init();
            }

            InitWorld();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new instance of Content.
        /// </summary>
        /// <param name="basePath">Path to client directory.</param>
        /// <param name="device">A GraphicsDevice instance.</param>
        private GameContent(string basePath, ContentMode mode, GraphicsDevice device, bool init)
        {
            LoadProgress = ContentLoadingProgress.Started;
            BasePath     = basePath;
            _device      = device;
            Mode         = mode;

            ImageLoader.PremultiplyPNG = 1;// (FSOEnvironment.DirectX)?0:1;

            if (device != null)
            {
                RCMeshes   = new RCMeshProvider(device);
                UIGraphics = new UIGraphicsProvider(this);
                if (TS1)
                {
                    TS1Global      = new TS1Provider(this);
                    AvatarTextures = new TS1AvatarTextureProvider(TS1Global);
                    AvatarMeshes   = new TS1BMFProvider(TS1Global);
                }
                else
                {
                    AvatarTextures = new AvatarTextureProvider(this);
                    AvatarMeshes   = new AvatarMeshProvider(this, _device);
                }
                AvatarHandgroups = new HandgroupProvider(this);
                AbstractTextureRef.FetchDevice        = device;
                AbstractTextureRef.ImageFetchFunction = AbstractTextureRef.ImageFetchWithDevice;
            }
            Changes  = new ChangeManager();
            CustomUI = new CustomUIProvider(this);

            if (TS1)
            {
                var provider = new TS1ObjectProvider(this, TS1Global);
                WorldObjects      = provider;
                WorldCatalog      = provider;
                BCFGlobal         = new TS1BCFProvider(this, TS1Global);
                AvatarAnimations  = new TS1BCFAnimationProvider(BCFGlobal);
                AvatarSkeletons   = new TS1BCFSkeletonProvider(BCFGlobal);
                AvatarAppearances = new TS1BCFAppearanceProvider(BCFGlobal);
                Audio             = new TS1Audio(this);
            }
            else
            {
                AvatarBindings    = new AvatarBindingProvider(this);
                AvatarAppearances = new AvatarAppearanceProvider(this);
                AvatarOutfits     = new AvatarOutfitProvider(this);

                AvatarPurchasables = new AvatarPurchasables(this);
                AvatarCollections  = new AvatarCollectionsProvider(this);
                AvatarThumbnails   = new AvatarThumbnailProvider(this);

                AvatarAnimations = new AvatarAnimationProvider(this);
                AvatarSkeletons  = new AvatarSkeletonProvider(this);
                WorldObjects     = new WorldObjectProvider(this);
                WorldCatalog     = new WorldObjectCatalog();
                Audio            = new Audio(this);
                CityMaps         = new CityMapsProvider(this);
                RackOutfits      = new RackOutfitsProvider(this);
                Ini          = new IniProvider(this);
                GlobalTuning = new Tuning(Path.Combine(basePath, "tuning.dat"));
            }
            WorldFloors        = new WorldFloorProvider(this);
            WorldWalls         = new WorldWallProvider(this);
            WorldObjectGlobals = new WorldGlobalProvider(this);
            WorldRoofs         = new WorldRoofProvider(this);

            InitBasic();
            if (init)
            {
                Init();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a new instance of Content.
        /// </summary>
        /// <param name="basePath">Path to client directory.</param>
        /// <param name="device">A GraphicsDevice instance.</param>
        private Content(string basePath, ContentMode mode, GraphicsDevice device)
        {
            this.BasePath = basePath;
            this.Device   = device;
            this.Mode     = mode;

            if (device != null)
            {
                UIGraphics = new UIGraphicsProvider(this);
                if (TS1)
                {
                    TS1Global      = new TS1Provider(this);
                    AvatarTextures = new TS1AvatarTextureProvider(TS1Global);
                    AvatarMeshes   = new TS1BMFProvider(TS1Global);
                }
                else
                {
                    AvatarTextures = new AvatarTextureProvider(this);
                    AvatarMeshes   = new AvatarMeshProvider(this, Device);
                }
                AvatarHandgroups = new HandgroupProvider(this);
                AbstractTextureRef.FetchDevice        = device;
                AbstractTextureRef.ImageFetchFunction = AbstractTextureRef.ImageFetchWithDevice;
            }
            Changes           = new ChangeManager();
            AvatarBindings    = new AvatarBindingProvider(this);
            AvatarAppearances = new AvatarAppearanceProvider(this);
            AvatarOutfits     = new AvatarOutfitProvider(this);

            AvatarPurchasables = new AvatarPurchasables(this);
            AvatarCollections  = new AvatarCollectionsProvider(this);
            AvatarThumbnails   = new AvatarThumbnailProvider(this);

            if (TS1)
            {
                var provider = new TS1ObjectProvider(this, TS1Global);
                WorldObjects      = provider;
                WorldCatalog      = provider;
                BCFGlobal         = new TS1BCFProvider(this, TS1Global);
                AvatarAnimations  = new TS1BCFAnimationProvider(BCFGlobal);
                AvatarSkeletons   = new TS1BCFSkeletonProvider(BCFGlobal);
                AvatarAppearances = new TS1BCFAppearanceProvider(BCFGlobal);
                Audio             = new TS1Audio(this);
            }
            else
            {
                AvatarAnimations = new AvatarAnimationProvider(this);
                AvatarSkeletons  = new AvatarSkeletonProvider(this);
                WorldObjects     = new WorldObjectProvider(this);
                WorldCatalog     = new WorldObjectCatalog();
                Audio            = new Audio(this);
            }
            WorldFloors        = new WorldFloorProvider(this);
            WorldWalls         = new WorldWallProvider(this);
            WorldObjectGlobals = new WorldGlobalProvider(this);
            WorldRoofs         = new WorldRoofProvider(this);

            GlobalTuning = new Tuning(Path.Combine(basePath, "tuning.dat"));
            Ini          = new IniProvider(this);
            CityMaps     = new CityMapsProvider(this);

            RackOutfits = new RackOutfitsProvider(this);

            Init();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Setup the content manager so it knows where to find various files.
        /// </summary>
        private void Init()
        {
            /** Scan system for files **/
            var allFiles = new List <string>();

            _ScanFiles(BasePath, allFiles);
            AllFiles = allFiles.ToArray();

            var ts1AllFiles = new List <string>();
            var oldBase     = BasePath;

            if (TS1)
            {
                BasePath = TS1BasePath;
                _ScanFiles(TS1BasePath, ts1AllFiles);
                BasePath    = oldBase;
                TS1AllFiles = ts1AllFiles.ToArray();
            }

            TS1Global?.Init();
            BCFGlobal?.Init();

            if (!TS1)
            {
                PIFFRegistry.Init(Path.Combine(FSOEnvironment.ContentDir, "Patch/"));
            }
            Archives = new Dictionary <string, FAR3Archive>();
            if (Mode == ContentMode.CLIENT)
            {
                UIGraphics.Init();
                AvatarHandgroups.Init();
            }

            AvatarBindings.Init();
            AvatarOutfits.Init();
            if (TS1)
            {
                ((TS1AvatarTextureProvider)AvatarTextures)?.Init();
                ((TS1BMFProvider)AvatarMeshes)?.Init();
                Jobs         = new TS1JobProvider(TS1Global);
                Neighborhood = new TS1NeighborhoodProvider(this);
            }
            else
            {
                ((AvatarTextureProvider)AvatarTextures)?.Init();
                ((AvatarAnimationProvider)AvatarAnimations).Init();
                ((AvatarSkeletonProvider)AvatarSkeletons).Init();
                ((AvatarAppearanceProvider)AvatarAppearances).Init();
                ((AvatarMeshProvider)AvatarMeshes)?.Init();
            }

            Audio.Init();
            AvatarPurchasables.Init();
            AvatarCollections.Init();
            Ini.Init();
            CityMaps.Init();
            RackOutfits.Init();

            DataDefinition = new TSODataDefinition();
            using (var stream = File.OpenRead(GetPath("TSOData_datadefinition.dat")))
            {
                DataDefinition.Read(stream);
            }

            AvatarThumbnails.Init();

            InitWorld();
        }