コード例 #1
0
ファイル: Program.cs プロジェクト: BircanCiftci/GameProject
        static void Main(string[] args)
        {
            OldPlayer player1 = new OldPlayer();

            player1.Id             = 1;
            player1.TcNo           = "12345678901";
            player1.PlayerName     = "Bircan";
            player1.PlayerLastName = "ÇİFTÇİ";
            player1.DateOfBirth    = new DateTime(1998, 8, 21);
            player1.GameDegree     = "Gold 1";

            OldPlayer player2 = new OldPlayer();

            player2.Id             = 2;
            player2.TcNo           = "12345678910";
            player2.PlayerName     = "Serhat";
            player2.PlayerLastName = "DEVECİ";
            player2.DateOfBirth    = new DateTime(1997, 8, 8);
            player2.GameDegree     = "Platinum 1";

            NewPlayer player3 = new NewPlayer();

            player3.Id                  = 3;
            player3.TcNo                = "12345678910";
            player3.PlayerName          = "Serhat";
            player3.PlayerLastName      = "DEVECİ";
            player3.DateOfBirth         = new DateTime(1986, 5, 16);
            player3.MembershipReference = "Ocak1234";

            PlayerManager playerManager = new PlayerManager();

            playerManager.Add();
            playerManager.Delete();
            playerManager.Update();

            Games games1 = new Games();

            games1.Id        = 1;
            games1.GameName  = "LOL";
            games1.GameType  = "Strategy";
            games1.GamePrice = 25;
            games1.GameYear  = 2010;

            Games games2 = new Games();

            games2.Id        = 2;
            games2.GameName  = "Days Gone";
            games2.GameType  = "Action";
            games2.GamePrice = 50;
            games2.GameYear  = 2018;

            GameCampaign campaing1 = new GameCampaign();

            campaing1.Id           = 1;
            campaing1.CampaignName = "New Years";
            campaing1.Campaign     = 10;

            GameCampaign campaing2 = new GameCampaign();

            campaing2.Id           = 1;
            campaing2.CampaignName = "Student";
            campaing2.Campaign     = 20;

            GameCampaign campaign = new GameCampaign();

            campaign.CampaignAdd();
            campaign.CampaignDelete();
            campaign.CampaingUpdate();

            GameManager gameManager = new GameManager();

            gameManager.Add(games1);
            gameManager.Add(games2);

            GameSale gameSale1 = new GameSale(player1, games1, campaing1);

            gameSale1.GameSales();

            GameSale gameSale2 = new GameSale(player2, games2, campaing2);

            gameSale2.GameSales();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: sebakir/GameProject
        static void Main(string[] args)
        {
            IPlayer player1 = new OldPlayer()
            {
                TcNo = "1", BirthYear = 1998, PlayerName = "Seçkin", PlayerSurname = "Bakir", MembershipYear = 2
            };
            IPlayer player2 = new OldPlayer()
            {
                TcNo = "2", BirthYear = 1985, PlayerName = "Engin", PlayerSurname = "Demiroğ", MembershipYear = 20
            };
            PlayerManager playerManager = new PlayerManager();

            playerManager.Add(player1);
            playerManager.Add(player2);

            GameManager gameManager = new GameManager();

            gameManager.Add(new Game()
            {
                GameName = "Death Stranding", GameType = "Action", GamePrice = 499, GameReleaseYear = 2018, GameReviewScore = 8.3
            });
            gameManager.Add(new Game()
            {
                GameName = "Days Gone", GameType = "Action,Zombie", GamePrice = 139, GameReleaseYear = 2018, GameReviewScore = 7.3
            });
            gameManager.Add(new Game()
            {
                GameName = "Persona 5", GameType = "JRPG", GamePrice = 99, GameReleaseYear = 2015, GameReviewScore = 9.1
            });
            gameManager.Add(new Game()
            {
                GameName = "Cyberpunk 2077", GameType = "RPG", GamePrice = 499, GameReleaseYear = 2020, GameReviewScore = 7.1
            });
            gameManager.Add(new Game()
            {
                GameName = "Witcher 3", GameType = "RPG", GamePrice = 49, GameReleaseYear = 2015, GameReviewScore = 9.3
            });

            while (true)
            {
                Console.WriteLine("**********MENU**********");
                Console.WriteLine("1-)Oyuncu Ekle\n2-)Oyuncu Sil\n3-)Kullanıcıları Listele\n4-)Oyun Ekle\n5-)Oyun Sil\n6-)Oyunları Listele\n7-)Oyunları İnceleme Puanına Göre Listele\n8-)Kampanya Seçiniz\n9-)Çıkış");
                Console.WriteLine("************************");
                int choice = Convert.ToInt32(Console.ReadLine());
                Console.Clear();

                if (choice == 1)
                {
                    Console.WriteLine("Eklemek istediğiniz kullanıcı bilgilerini giriniz");
                    Console.WriteLine("Tc no:");
                    string TcNo = Console.ReadLine();
                    Console.WriteLine("Ad:");
                    string PlayerName = Console.ReadLine();
                    Console.WriteLine("Soyad:");
                    string PlayerSurname = Console.ReadLine();
                    Console.WriteLine("Doğum Yılı:");
                    int BirthYear = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Kaç yıl kullanmayı taahhüt ediyorsunuz:");
                    int UndertakingYear = Convert.ToInt32(Console.ReadLine());

                    playerManager.Add(new NewPlayer()
                    {
                        TcNo = TcNo, PlayerName = PlayerName, PlayerSurname = PlayerSurname, BirthYear = BirthYear, UndertakingYear = UndertakingYear
                    });
                }

                else if (choice == 2)
                {
                    Console.WriteLine("Silmek istediğiniz oyuncunun Tc Numarasını giriniz:");
                    playerManager.Delete(Console.ReadLine());
                }

                else if (choice == 3)
                {
                    playerManager.ListPlayer();
                }

                else if (choice == 4)
                {
                    Console.WriteLine("Eklemek istediğiniz oyunun bilgilerini giriniz");
                    Console.WriteLine("Oyun Adı:");
                    string GameName = Console.ReadLine();
                    Console.WriteLine("Oyunun Çıkış Yılı:");
                    int GameReleaseYear = Convert.ToInt32(Console.ReadLine());
                    Console.WriteLine("Oyunun Türü:");
                    string GameType = Console.ReadLine();
                    Console.WriteLine("Oyunun Fiyatı:");
                    double GamePrice = Convert.ToDouble(Console.ReadLine());
                    Console.WriteLine("Oyunun İnceleme Puanı:");
                    double GameReviewScore = Convert.ToDouble(Console.ReadLine());

                    gameManager.Add(new Game()
                    {
                        GameName = GameName, GameReleaseYear = GameReleaseYear, GameType = GameType, GamePrice = GamePrice, GameReviewScore = GameReviewScore
                    });
                }

                else if (choice == 5)
                {
                    Console.WriteLine("Silmek istediğiniz oyuncunun Adını giriniz:");
                    gameManager.Delete(Console.ReadLine());
                }

                else if (choice == 6)
                {
                    gameManager.ListGame();
                }

                else if (choice == 7)
                {
                    gameManager.SortByReviewScores();
                }

                else if (choice == 8)
                {
                    while (true)
                    {
                        Console.WriteLine("**********KAMPANYALAR**********");
                        Console.WriteLine("-1-Öğrenci Kampanyası\n-2-Kara Cuma Kampanyası\n-3-Ana Menüye Dön");
                        Console.WriteLine("*******************************");

                        int choice2 = Convert.ToInt32(Console.ReadLine());
                        Console.Clear();

                        if (choice2 == 1)
                        {
                            gameManager.ListGame();
                            Console.WriteLine("Yukarıdaki oyunlardan öğrencisi kampanyası uygulamak istediğiniz oyunun adını yazınız:");
                            string name = Console.ReadLine();
                            Console.Clear();
                            ICampaignService campaign = new StudentCampaign();
                            gameManager.GetGame(name, campaign);
                        }
                        else if (choice2 == 2)
                        {
                            gameManager.ListGame();
                            Console.WriteLine("Yukarıdaki oyunlardan kara cuma kampanyası uygulamak istediğiniz oyunun adını yazınız:");
                            string name = Console.ReadLine();
                            Console.Clear();
                            ICampaignService campaign = new BlackFridayCampaign();
                            gameManager.GetGame(name, campaign);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else
                {
                    Console.WriteLine("Programdan çıkış yaptınız.\nİyi günler...");
                    break;
                }
            }
        }