GameManagerPreload() public static méthode

public static GameManagerPreload ( GameManager gm ) : void
gm gbrainy.Core.Main.GameManager
Résultat void
Exemple #1
0
        void BuildPlayList(string [] names)
        {
            List <int> list = new List <int> ();

            GameLocator [] games;
            GameManager    gm = new GameManager();

            GtkClient.GameManagerPreload(gm);
            games = gm.AvailableGames;

            for (int i = 0; i < games.Length; i++)
            {
                Game game = (Game)Activator.CreateInstance(games[i].TypeOf, true);
                game.Translations = Translations;
                game.Variant      = games[i].Variant;

                try
                {
                    for (int n = 0; n < names.Length; n++)
                    {
                        if (String.Compare(game.Name, names [n], StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            list.Add(i);
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("CommandLine.BuildPlayList. Error adding {0} {1}", game.Name, e.Message);
                }
            }

            play_list = list.ToArray();
        }
Exemple #2
0
        void BuildPlayList(string [] names)
        {
            Dictionary <string, int> dictionary;

            GameManager.GameLocator [] games;
            GameManager gm = new GameManager();

            GtkClient.GameManagerPreload(gm);
            games = gm.AvailableGames;

            // Create a hash to map from game name to locator
            dictionary = new Dictionary <string, int> (games.Length);
            for (int i = 0; i < games.Length; i++)
            {
                if (games[i].IsGame == false)
                {
                    continue;
                }

                Game game = (Game)Activator.CreateInstance(games[i].TypeOf, true);
                game.Variant = games[i].Variant;

                try
                {
                    dictionary.Add(game.Name.ToLower(), i);
                }
                catch (Exception e)
                {
                    Console.WriteLine("gbrainy. Error adding {0} {1}", game.Name, e.Message);
                }
            }

            List <int> list = new List <int> (names.Length);

            for (int i = 0; i < names.Length; i++)
            {
                try
                {
                    list.Add(dictionary [names [i].ToLower()]);
                }
                catch (KeyNotFoundException)
                {
                    Console.WriteLine("gbrainy. Game [{0}] not found", names [i]);
                }
            }

            play_list = list.ToArray();
        }
Exemple #3
0
        static void GameList()
        {
            GameManager.GameLocator [] games;
            GameManager gm = new GameManager();

            GtkClient.GameManagerPreload(gm);
            gm.GameType = GameSession.Types.AllGames;
            games       = gm.AvailableGames;

            Console.WriteLine(Catalog.GetString("List of available games"));

            for (int i = 0; i < games.Length; i++)
            {
                if (games[i].IsGame == false)
                {
                    continue;
                }

                Game game = (Game)Activator.CreateInstance(games[i].TypeOf, true);
                game.Variant = games[i].Variant;
                Console.WriteLine(" {0}", game.Name);
            }
        }