コード例 #1
0
ファイル: logique.cs プロジェクト: RoaringSeagul/Memory_Game
        private void NewGame(int size, Theme theme)
        {
            if (bNewGame)
            {
                var path = Directory.GetCurrentDirectory() + @"\Image\fruits\";
                var images = Directory.GetFiles(path, "*.png");

                imagesPossibles = new ImagePossible[images.Count() * 2];
                int counter1 = 0;
                int counter2 = 0;

                foreach (var item in images)
                {
                    if (counter2 < (size * size))
                    {
                        imagesPossibles[counter2] = new ImagePossible();
                        imagesPossibles[counter2].imageName = images[counter1];
                        ++counter2;
                        imagesPossibles[counter2] = new ImagePossible();
                        imagesPossibles[counter2].imageName = images[counter1];
                        ++counter2;
                        ++counter1;
                    }
                }

                for (int i = 0; i < imagesPossibles.Count(); i++)
                {
                    imagesPossibles[i].IsRemoved = false;
                    imagesPossibles[i].IsUsed = false;
                }

                for (int x = 0; x < size; x++)
                    for (int y = 0; y < size; y++)
                        lstCoordUsed[x, y] = new CoordUsed();

                for (int Ux = 0; Ux < size; Ux++)
                    for (int Uy = 0; Uy < size; Uy++)
                        lstCoordUsed[Ux, Uy].IsRemoved = false;
                bNewGame = false;
            }

            if (theme == Theme.voitures)
            {
                for (int i = 0; i < 6; i++)
                {
                    switch (i)
                    {
                        case 0:
                            if (!JokerRemoved)
                                ChangerCarteSpecial("joker", size);
                            break;
                        case 1:
                            if (!cursed1)
                                ChangerCarteSpecial("maudite1", size);
                            break;
                        case 2:
                            if (!cursed2)
                                ChangerCarteSpecial("maudite2", size);
                            break;
                        case 3:
                            ChangerCarteSpecial("parking", size);
                            break;
                        case 4:
                            ChangerCarteSpecial("lfa", size);
                            break;
                        case 5:
                            ChangerCarteSpecial("saratoga", size);
                            break;
                        default:
                            break;
                    }

                }
                    ChargerCarteNormale(size);
            }

            if (theme == Theme.fruits)
            {
                for (int i = 0; i < 6; i++)
                {
                    switch (i)
                    {
                        case 0:
                            if (!JokerRemoved)
                                ChangerCarteSpecial("joker", size);
                            break;
                        case 1:
                            if (!cursed1)
                                ChangerCarteSpecial("maudite1", size);
                            break;
                        case 2:
                            if (!cursed2)
                                ChangerCarteSpecial("maudite2", size);
                            break;
                        case 3:
                            ChangerCarteSpecial("melange", size);
                            break;
                        case 4:
                            ChangerCarteSpecial("sapote", size);
                            break;
                        case 5:
                            ChangerCarteSpecial("maypop", size);
                            break;
                        default:
                            break;
                    }
                }
                ChargerCarteNormale(size);
            }
        }
コード例 #2
0
        private void NewGame(int size, Theme theme)
        {
            if (bNewGame)
            {
                var path   = Directory.GetCurrentDirectory() + @"\Image\fruits\";
                var images = Directory.GetFiles(path, "*.png");

                imagesPossibles = new ImagePossible[images.Count() * 2];
                int counter1 = 0;
                int counter2 = 0;

                foreach (var item in images)
                {
                    if (counter2 < (size * size))
                    {
                        imagesPossibles[counter2]           = new ImagePossible();
                        imagesPossibles[counter2].imageName = images[counter1];
                        ++counter2;
                        imagesPossibles[counter2]           = new ImagePossible();
                        imagesPossibles[counter2].imageName = images[counter1];
                        ++counter2;
                        ++counter1;
                    }
                }

                for (int i = 0; i < imagesPossibles.Count(); i++)
                {
                    imagesPossibles[i].IsRemoved = false;
                    imagesPossibles[i].IsUsed    = false;
                }

                for (int x = 0; x < size; x++)
                {
                    for (int y = 0; y < size; y++)
                    {
                        lstCoordUsed[x, y] = new CoordUsed();
                    }
                }

                for (int Ux = 0; Ux < size; Ux++)
                {
                    for (int Uy = 0; Uy < size; Uy++)
                    {
                        lstCoordUsed[Ux, Uy].IsRemoved = false;
                    }
                }
                bNewGame = false;
            }

            if (theme == Theme.voitures)
            {
                for (int i = 0; i < 6; i++)
                {
                    switch (i)
                    {
                    case 0:
                        if (!JokerRemoved)
                        {
                            ChangerCarteSpecial("joker", size);
                        }
                        break;

                    case 1:
                        if (!cursed1)
                        {
                            ChangerCarteSpecial("maudite1", size);
                        }
                        break;

                    case 2:
                        if (!cursed2)
                        {
                            ChangerCarteSpecial("maudite2", size);
                        }
                        break;

                    case 3:
                        ChangerCarteSpecial("parking", size);
                        break;

                    case 4:
                        ChangerCarteSpecial("lfa", size);
                        break;

                    case 5:
                        ChangerCarteSpecial("saratoga", size);
                        break;

                    default:
                        break;
                    }
                }
                ChargerCarteNormale(size);
            }

            if (theme == Theme.fruits)
            {
                for (int i = 0; i < 6; i++)
                {
                    switch (i)
                    {
                    case 0:
                        if (!JokerRemoved)
                        {
                            ChangerCarteSpecial("joker", size);
                        }
                        break;

                    case 1:
                        if (!cursed1)
                        {
                            ChangerCarteSpecial("maudite1", size);
                        }
                        break;

                    case 2:
                        if (!cursed2)
                        {
                            ChangerCarteSpecial("maudite2", size);
                        }
                        break;

                    case 3:
                        ChangerCarteSpecial("melange", size);
                        break;

                    case 4:
                        ChangerCarteSpecial("sapote", size);
                        break;

                    case 5:
                        ChangerCarteSpecial("maypop", size);
                        break;

                    default:
                        break;
                    }
                }
                ChargerCarteNormale(size);
            }
        }