예제 #1
0
        public override void OnGameLoad(GameSpecification specification, MachinaRuntime runtime)
        {
            SceneLayers.BackgroundColor = Color.Maroon;
            var scene     = SceneLayers.AddNewScene();
            var rootActor = scene.AddActor("Main");

            var errorText = this.exception.Message + "\n\n" + this.exception.StackTrace;

            var filePath = $"{Path.Join(MachinaClient.FileSystem.AppDataPath, $"crashdump-{DateTime.Now.ToFileTime()}.txt")}";

            MachinaClient.FileSystem.WriteStringToAppData(errorText, filePath, true);

            var titleText       = "Game Crashed, sorry about that :(";
            var contactInfoText = $"You can also get this message in text form at:\n{filePath}\nReach out to @NotExplosive on Twitter so I can fix it";

            new BoundingRect(rootActor, Point.Zero);
            new BoundingRectToViewportSize(rootActor);
            new LayoutGroup(rootActor, Orientation.Vertical)
            .AddHorizontallyStretchedElement("title", 64, titleActor =>
            {
                new BoundedTextRenderer(titleActor, titleText, MachinaClient.DefaultStyle.uiElementFont);
            })
            .AddHorizontallyStretchedElement("contact-info", 80, contactInfoActor =>
            {
                new BoundedTextRenderer(contactInfoActor, contactInfoText, MachinaClient.DefaultStyle.uiElementFont, Color.White, Alignment.TopLeft, Overflow.Ignore);
            })
            .AddBothStretchedElement("content", contentActor =>
            {
                new BoundedTextRenderer(contentActor, errorText, MachinaClient.DefaultStyle.uiElementFont);
            });
        }
예제 #2
0
        public override void OnGameLoad(GameSpecification specification, MachinaRuntime runtime)
        {
            var gameScene = SceneLayers.AddNewScene();

            var platform = gameScene.AddActor("Platform", new Vector2(200, 300));

            new BoundingRect(platform, new Point(300, 32))
            .SetOffsetToCenter();
            new BoundingRectFill(platform, Color.White);

            var playerActor   = gameScene.AddActor("Player", new Vector2(200, 200));
            var playerSprites = MachinaClient.Assets.GetMachinaAsset <GridBasedSpriteSheet>("player");

            new BoundingRect(playerActor, new Point(64, 32));
            new SpriteRenderer(playerActor, playerSprites)
            .SetupBoundingRect();
            // new PlayerController(playerActor);


            var uiScene     = SceneLayers.AddNewScene();
            var healthActor = uiScene.AddActor("Healthbar", new Vector2(10, 10));

            new BoundingRect(healthActor, new Point(200, 20));
            // new HealthbarRenderer(healthActor);
        }
예제 #3
0
 public static void Run(GameSpecification specification, GameCartridge gameCartridge, string devContentPath)
 {
     using (var game = new MachinaGame(specification, gameCartridge, new DesktopPlatformContext(), devContentPath))
     {
         game.Run();
     }
 }
예제 #4
0
        public void DeleteGame(int id)
        {
            var gameSpecification = new GameSpecification(gameId: id);
            var game = _gameRepository.Query(gameSpecification).First();

            game.Hidden = true;
            _gameRepository.Update(game);
        }
예제 #5
0
        public void SetupSceneLayers(MachinaRuntime runtime, GameSpecification specification, WindowInterface machinaWindow)
        {
            BuildSceneLayers(runtime);

            SceneLayers.OnError += (exception) =>
            {
                runtime.InsertCartridge(new CrashCartridge(specification.settings, exception));
            };
        }
예제 #6
0
        public override void OnGameLoad(GameSpecification specification, MachinaRuntime runtime)
        {
            var introScene = SceneLayers.AddNewScene();

            var textActor = introScene.AddActor("text");

            new BoundingRect(textActor, 20, 20);
            new BoundingRectToViewportSize(textActor);
            new BoundedTextRenderer(textActor, "", MachinaClient.Assets.GetSpriteFont("LogoFont"), Color.White, Alignment.Center);
            new IntroTextAnimation(textActor);
            new CallbackOnDestroy(textActor, onEnd);
        }
예제 #7
0
        // GET: GameSpecifications/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GameSpecification gameSpecification = _uow.GameSpecifications.GetById(id);

            if (gameSpecification == null)
            {
                return(HttpNotFound());
            }
            return(View(gameSpecification));
        }
예제 #8
0
        public static void Run(GameCartridge cartridge, GameSpecification spec, Activity activity)
        {
            GamePlatform.Set(PlatformType.Android, GetFilesAtContentDirectory_Android, ReadFileInContentDirectory_Android, ReadTextFile_Android);

            // I don't think I need these but they might be useful
            // activity.Window.AddFlags(WindowManagerFlags.Fullscreen);
            // activity.Window.AddFlags(WindowManagerFlags.LayoutInOverscan);

            var game = new MachinaGame(spec, cartridge, new AndroidPlatformContext());
            var view = game.Services.GetService(typeof(View)) as View;

            view.SystemUiVisibility =
                (StatusBarVisibility)(SystemUiFlags.LayoutStable | SystemUiFlags.LayoutHideNavigation | SystemUiFlags.LayoutFullscreen | SystemUiFlags.HideNavigation | SystemUiFlags.Fullscreen | SystemUiFlags.ImmersiveSticky);
            activity.SetContentView(view);
            game.Run();
        }
예제 #9
0
        // GET: GameSpecifications/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GameSpecification gameSpecification = _uow.GameSpecifications.GetById(id);

            if (gameSpecification == null)
            {
                return(HttpNotFound());
            }

            var vm = new GameSpecificationCreateEditViewModel()
            {
                GameSpecification = gameSpecification
            };

            vm.PlayerSelectList = new SelectList(_uow.Players.GetAllForUser(User.Identity.GetUserId <int>()), nameof(Player.PlayerId), nameof(Player.FullName), vm.GameSpecification.PlayerId);
            return(View(vm));
        }
예제 #10
0
 public override void OnGameLoad(GameSpecification specification, MachinaRuntime runtime)
 {
     SceneLayers.BackgroundColor = Color.Black;
 }