Loggy93 Posted November 13, 2020 Share Posted November 13, 2020 I apologize in advance if this is the wrong forum to post this. Hello, I am very very new to plugin development and using APIs in general. I am developing a very simple game randomizer for Big Box. I am using the IGameMenuItemPlugin interface and added an extra menu button on the game detail page on BigBox. So I have the logic that randomly selects an IGame object, and launches the game with the PluginHelper.BigBoxMainViewModel.ShowGame. method So how it works is: I would manually choose a game(game 1) and on the game detail page, I will click on the 'random game' menu button. Then the plugin will find a random game and load up the game detail page of the randomly selected game(game 2). The issue is, if I try to exit out of the game detail page of game 2, it would go back to the game detail page of game 1. And if I try to exit out of game 1, it would send me back to game 2, so it's stuck in this weird loop between the two games. Is this a bug? Or am I using this method wrong? using Unbroken.LaunchBox.Plugins; using Unbroken.LaunchBox.Plugins.Data; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Plugindemo { public class DemoPluginMenuItem : IGameMenuItemPlugin { public bool SupportsMultipleGames { get { return true; } } public string Caption { get { return "Random Game";} } public System.Drawing.Image IconImage { get { return null; } } public bool ShowInLaunchBox { get { return true; } } public bool ShowInBigBox { get { return true; } } public bool GetIsValidForGame(IGame selectedGame) { return true; } public bool GetIsValidForGames(IGame[] selectedGames) { return false; } public void OnSelected(IGame selectedGame) { IPlatform[] platforms = PluginHelper.DataManager.GetAllPlatforms(); Random rand = new Random(); int index = rand.Next(platforms.Length); IPlatform randomPlatform = platforms[index]; IGame[] platformAllGames = randomPlatform.GetAllGames(true, true); Random gameRand = new Random(); int gameIndex = rand.Next(platformAllGames.Length); PluginHelper.BigBoxMainViewModel.ShowGame(platformAllGames[gameIndex], FilterType.None); } public void OnSelected(IGame[] selectedGames) { return; } } } Quote Link to comment Share on other sites More sharing options...
Grila Posted November 14, 2020 Share Posted November 14, 2020 I already wrote a plugin for random game selection which you can download here: Additionally, you can view the source here: https://github.com/G-rila/BigBoxRGS which may help you on your quest! Quote Link to comment Share on other sites More sharing options...
Loggy93 Posted November 14, 2020 Author Share Posted November 14, 2020 Oh yeah I am very familiar of your plugin! I been using your plugin for the last couple of months now and it is really really good! I'm not sure if it's just me or not, but whenever I use your plugin on any version above 11.2, I get errors. I was hoping to make a simpler version of the plugin to avoid these errors. If you like, I can PM a copy of the errors I would get. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.