Example #1
0
        private void load()
        {
            Resources.AddStore(new DllResourceStore(@"GamesToGo.Game.dll"));
            Textures.AddStore(Host.CreateTextureLoaderStore(new OnlineStore()));
            Textures.AddStore(Host.CreateTextureLoaderStore(new StorageBackedResourceStore(store)));
            dependencies.CacheAs(this);
            base.Content.Add(content = new DrawSizePreservingFillContainer
            {
                TargetDrawSize = new Vector2(1080, 1920),
                Strategy       = DrawSizePreservationStrategy.Minimum,
            });
            content.Add(stack = new ScreenStack
            {
                RelativeSizeAxes = Axes.Both,
                Depth            = 0,
            });
            content.Add(api = new APIController());
            dependencies.Cache(api);
            dependencies.Cache(stack);
            content.Add(infoOverlay = new SplashInfoOverlay(SplashPosition.Top, 150, 60)
            {
                Depth = -1
            });
            dependencies.Cache(infoOverlay);

            Invitations.BindCollectionChanged((_, e) =>
            {
                switch (e.Action)
                {
                case NotifyCollectionChangedAction.Add:
                    infoOverlay.Show(@$ "{e.NewItems.Cast<Invitation>().Last().Sender.Username} te ha invitado a jugar", Colour4.LightBlue);

                    break;

                case NotifyCollectionChangedAction.Remove:
                    break;
                }
            });
        }
Example #2
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            // Aspect ratio container
            Child = _content = new DrawSizePreservingFillContainer
            {
                TargetDrawSize = new Vector2(1440, 1080),
                Strategy       = DrawSizePreservationStrategy.Minimum
            };

            _content.Add(_rootScreen = new WorkspaceScreen());

            // Close host when root screen exits
            _rootScreen.Exited += _ => Host.Exit();
        }
Example #3
0
        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);
        }