private void FireOnSelect(ArcadeDisk disk, Mod mod) { if (OnSelect != null) { OnSelect.Invoke(this, new DiskSelectEventArgs(disk, mod)); } }
public static bool IsDiskUnlocked(ArcadeDisk disk, Mod mod, Progress progress) { if (App.Arguments.GetBool("unlockall") || disk.UnlockCampaign == null || disk.UnlockLevelCount == 0) { return(true); } var campaignPath = disk.UnlockCampaign; var campaign = (mod != null) ? mod.Assets.Load <Campaign>(campaignPath) : Campaign.Get(campaignPath); int levelsCompleted = 0; for (int i = 0; i < campaign.Levels.Count; ++i) { var levelPath = campaign.Levels[i]; var levelData = (mod != null) ? mod.Assets.Load <LevelData>(levelPath) : Assets.Get <LevelData>(levelPath); if (progress.IsLevelCompleted(levelData.ID)) { ++levelsCompleted; } } return(levelsCompleted >= disk.UnlockLevelCount); }
private void UnlockHighscoreAchievements(Mod mod, ArcadeDisk disk, int score) { if (mod == null) { if (disk.Path == "arcade/worm.disk" && score >= 60) { Game.User.Progress.UnlockAchievement(Achievement.WormHighScore); } else if (disk.Path == "arcade/invaders.disk" && score >= 750) { Game.User.Progress.UnlockAchievement(Achievement.InvadersHighScore); } else if (disk.Path == "arcade/tennis.disk" && score >= 10) { Game.User.Progress.UnlockAchievement(Achievement.TennisHighScore); } else if (disk.Path == "arcade/quest.disk" && score >= 1) { Game.User.Progress.UnlockAchievement(Achievement.QuestHighScore); } } Game.User.Progress.Save(); }
public DiskSelectEventArgs(ArcadeDisk disk, Mod mod) { Disk = disk; Mod = mod; }
public ArcadeState(Game.Game game) : base(game, "levels/startscreen.level", LevelOptions.Menu) { // Create computer m_computer = new Computer(GetComputerID()); m_computer.Memory.TotalMemory = RAM; m_computer.Host = App.Info.Title + " " + App.Info.Version; m_computer.Output = new LogWriter(LogLevel.User); m_computer.ErrorOutput = new LogWriter(LogLevel.Error); m_computer.SetPowerStatus(PowerStatus.Charged, 1.0); m_devices = new RobotDevices(); m_computer.Ports.Add(m_devices); // Create some textures m_displayBitmap = new Bitmap(m_devices.Display.Width, m_devices.Display.Height); m_displayTexture = new BitmapTexture(m_displayBitmap); UpdateDisplay(); // Create camera m_animatedCamera = new AnimatedCameraController(Level.TimeMachine); // Create prompts { m_zKey = Key.Z.RemapToLocal(); m_xKey = Key.X.RemapToLocal(); m_wKey = Key.W.RemapToLocal(); m_sKey = Key.S.RemapToLocal(); m_aKey = Key.A.RemapToLocal(); m_dKey = Key.D.RemapToLocal(); m_backPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.back"), TextAlignment.Right); m_backPrompt.MouseButton = MouseButton.Left; m_backPrompt.Key = Key.Escape; m_backPrompt.GamepadButton = GamepadButton.Back; m_backPrompt.SteamControllerButton = SteamControllerButton.ArcadeBack; m_backPrompt.Anchor = Anchor.BottomRight; m_backPrompt.LocalPosition = new Vector2(-16.0f, -16.0f - m_backPrompt.Font.Height); m_backPrompt.OnClick += delegate { GoBack(); }; m_diskSelectPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.arcade.swap_disk"), TextAlignment.Right); m_diskSelectPrompt.Key = Key.Tab; m_diskSelectPrompt.GamepadButton = GamepadButton.Start; m_diskSelectPrompt.SteamControllerButton = SteamControllerButton.ArcadeSwapDisk; m_diskSelectPrompt.Anchor = Anchor.BottomRight; m_diskSelectPrompt.LocalPosition = new Vector2(-16.0f, -16.0f - m_backPrompt.Font.Height - m_diskSelectPrompt.Height); m_bPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.arcade.b"), TextAlignment.Left); m_bPrompt.Key = m_xKey; m_bPrompt.GamepadButton = GamepadButton.B; m_bPrompt.SteamControllerButton = SteamControllerButton.ArcadeB; m_bPrompt.Anchor = Anchor.BottomLeft; m_bPrompt.LocalPosition = new Vector2(16.0f, -16.0f - m_bPrompt.Height); m_aPrompt = new InputPrompt(UIFonts.Smaller, Game.Language.Translate("menus.arcade.a"), TextAlignment.Left); m_aPrompt.Key = m_zKey; m_aPrompt.GamepadButton = GamepadButton.A; m_aPrompt.SteamControllerButton = SteamControllerButton.ArcadeA; m_aPrompt.Anchor = Anchor.BottomLeft; m_aPrompt.LocalPosition = new Vector2(16.0f, -16.0f - 2.0f * m_bPrompt.Height); } // Create disk selector m_diskSelector = null; m_activeDisk = null; m_activeDiskMod = null; m_cachedScore = 0; }
private void SelectDisk(ArcadeDisk disk, Mod mod) { if (m_activeDisk == disk) { return; } // Mount the disk m_activeDisk = disk; m_activeDiskMod = mod; if (m_activeDisk != null) { IEnumerable <IAssetSource> sources; if (mod != null) { sources = new IAssetSource[] { mod.Assets }; } else { sources = Assets.Sources.Where(source => source.Mod == null); } m_devices.DiskDrive.Disk = new Disk(new AssetMount("disk", sources, m_activeDisk.ContentPath)); App.Log("Started disk {0}", m_activeDisk.Path); } else { m_devices.DiskDrive.Disk = null; } // Update UI UpdatePrompts(); if (disk != null) { // Initialise the disk ID if (disk.ID == 0) { if ((mod != null && mod.Source == ModSource.Editor) || (mod == null && App.Debug)) { disk.ID = MathUtils.GenerateLevelID(disk.Path); if (mod != null) { disk.Save(Path.Combine(mod.Path, "assets/" + disk.Path)); } else { disk.Save(Path.Combine(App.AssetPath, "main/" + disk.Path)); } } } // Mark the disk as played if (disk.ID != 0) { Game.User.Progress.SetLastArcadeGamePlayed(disk.ID); if (!Game.User.Progress.IsArcadeGamePlayed(disk.ID)) { Game.User.Progress.SetArcadeGamePlayed(disk.ID); Game.User.Progress.IncrementStatistic(Statistic.ArcadeGamesPlayed); } Game.User.Progress.Save(); } if (App.Steam && mod != null && mod.Source == ModSource.Workshop && mod.SteamWorkshopID.HasValue) { Game.Network.Workshop.SetItemPlayed(mod.SteamWorkshopID.Value); } // Initialise the score chip m_devices.Score.Score = disk.ID != 0 ? Game.User.Progress.GetArcadeGameScore(disk.ID) : 0; m_cachedScore = m_devices.Score.Score; UnlockHighscoreAchievements(mod, disk, m_devices.Score.Score); } }
public static bool IsArcadeUnlocked(Progress progress) { return(IsDiskUnlocked(ArcadeDisk.Get("arcade/tennis.disk"), null, progress)); }
public DiskWithMod(ArcadeDisk disk, Mod mod) { Disk = disk; Mod = mod; }