コード例 #1
0
 private void load(Storage store)
 {
     Resources.AddStore(new DllResourceStore(@"GamesToGo.Game.dll"));
     Resources.AddStore(new DllResourceStore(@"GamesToGo.Editor.dll"));
     Textures.AddStore(Host.CreateTextureLoaderStore(new OnlineStore()));
     Textures.AddStore(Host.CreateTextureLoaderStore(new StorageBackedResourceStore(store)));
     Textures.AddExtension("");
 }
コード例 #2
0
ファイル: GamesToGoEditor.cs プロジェクト: RVCorp/GamesToGo
        private void load(FrameworkConfigManager config, Storage store) //Esta es la manera en la que se acceden a elementos de las dependencias, su tipo y un nombre local.
        {
            Host.Window.Title = Name;
            Resources.AddStore(new DllResourceStore(@"GamesToGo.Editor.dll"));
            Textures.AddStore(Host.CreateTextureLoaderStore(new OnlineStore()));
            Textures.AddStore(Host.CreateTextureLoaderStore(new StorageBackedResourceStore(store)));
            Textures.AddExtension("");
            dependencies.CacheAs(dbContext = new Context(Host.Storage.GetDatabaseConnectionString(Name)));

            previewEvents();
            previewActions();
            previewArguments();

            try
            {
                dbContext.Database.Migrate();
            }
            catch
            {
                Host.Storage.DeleteDatabase(Name);

                try
                {
                    dbContext.Database.Migrate();
                }
                catch
                {
                    //Can't get a database going, bail!
                    Exit();
                }

                store.DeleteDirectory("files");
            }
            finally
            {
                foreach (var _ in dbContext.Projects)
                {
                }
                foreach (var _ in dbContext.Files)
                {
                }
                foreach (var _ in dbContext.Relations)
                {
                }
            }

            //Ventana sin bordes, sin requerir modo exclusivo.
            config.GetBindable <WindowMode>(FrameworkSetting.WindowMode).Value             = WindowMode.Borderless;
            config.GetBindable <FrameSync>(FrameworkSetting.FrameSync).Value               = FrameSync.VSync;
            config.GetBindable <ConfineMouseMode>(FrameworkSetting.ConfineMouseMode).Value = ConfineMouseMode.Never;

            //Para agregar un elemento a las dependencias se agrega a su caché. En este caso se agrega el "juego" como un GamesToGoEditor
            dependencies.CacheAs(this);

            base.Content.Add(content = new DrawSizePreservingFillContainer {
                TargetDrawSize = new Vector2(1920, 1080)
            });

            //Cargamos y agregamos nuestra pila de pantallas a la ventana.
            content.Add(stack = new ScreenStack {
                RelativeSizeAxes = Axes.Both, Depth = 0
            });

            content.Add(api = new APIController());

            dependencies.Cache(api);

            content.Add(splashOverlay = new SplashInfoOverlay(SplashPosition.Bottom, 80, 30)
            {
                Depth = -2
            });

            dependencies.Cache(splashOverlay);

            content.Add(imageFinder = new ImageFinderOverlay {
                Depth = -1
            });

            dependencies.Cache(imageFinder);

            content.Add(optionsOverlay = new MultipleOptionOverlay {
                Depth = -3
            });

            dependencies.Cache(optionsOverlay);
        }