Exemplo n.º 1
0
        /// <summary>
        /// 次の週に入る画面
        /// </summary>
        /// <returns>ゲームが終わって次の週に入らない場合はtrue</returns>
        public bool ContinueDisplay()
        {
            bool?isContinue = ContinueGame();

            //勝敗が決まった
            if (isContinue != null)
            {
                CommonLibrary.ChangeDisplayColor(0);
                bool VillegeVictory = (bool)isContinue;

                //村人の勝ち
                if (VillegeVictory)
                {
                    DisplayLibrary.ColorConsole("村人", Villager.Forground, Villager.Background);
                }
                else //人狼の勝ち
                {
                    DisplayLibrary.ColorConsole("人狼", Wolf.Forground, Wolf.Background);
                }
                Console.WriteLine("の勝利。\n");
                Console.WriteLine("役職一覧");
                DisplayCast();

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 引数で与えられたプレイヤーを選択させる画面を表示する。
        /// /// </summary>
        /// <param name="JoinPlayers">表示するプレイヤー</param>
        /// <param name="message">メッセージ</param>
        /// <returns>選択されたプレイヤー</returns>
        public static Person StaticListUpMember(List <Person> JoinPlayers, string message = "プレイヤーを選んでください。")
        {
            Console.WriteLine(message + "\n");

            int p = DisplayLibrary.SelectDisplay(
                JoinPlayers.Select(x => x.PlayerName).ToList(),
                0
                );

            return(JoinPlayers[p]);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 配役表示
        /// </summary>
        public void DisplayCast()
        {
            int width = Players.Select(x => DisplayLibrary.StringCount(x.PlayerName)).ToList().Max() + 4;

            foreach (Person p in Players)
            {
                string displayname = p.PlayerName + new string(' ', width - DisplayLibrary.StringCount(p.PlayerName));
                Console.Write(displayname);
                CommonLibrary.WriteCastColor(p.Position);
                Console.WriteLine();
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// ゲームのチュートリアルとかを選択するやつを表示
        /// </summary>
        /// <param name="margin">縦方向の空白</param>
        static int WriteGameMenu(int margin)
        {
            string space = new string('\n', margin);

            Console.Write(space);

            List <string> selectStrs = new List <string>()
            {
                "ゲームを始める", "チュートリアル", "終了"
            };

            return(DisplayLibrary.SelectDisplay(selectStrs));
        }
Exemplo n.º 5
0
        public void MainGame()
        {
            bool isloop = true;

            JoinMember();
            DecisionCast();

            while (isloop)
            {
                OneGame();
                Console.WriteLine();
                isloop = DisplayLibrary.YesOrNo(0, "もう一度やりますか?");
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 画面の色を変える。
        /// 0->全員 1->1人 2->操作変更
        /// </summary>
        /// <param name="mode"></param>
        public static void ChangeDisplayColor(byte mode)
        {
            switch (mode)
            {
            case 0:
                DisplayLibrary.ChangeColorClear(AllPerson, BAllPerson);
                break;

            case 1:
                DisplayLibrary.ChangeColorClear(OnePerson, BOnePerson);
                break;

            default:
                DisplayLibrary.ChangeColorClear(ChangePerson, BChangePerson);
                break;
            }
        }
Exemplo n.º 7
0
        static public void MainTitle()
        {
            DisplayLibrary.ChangeColorClear();
            Console.Title = "シンプル人狼";
            writetitle();
            int select = WriteGameMenu(3);

            switch (select)
            {
            case 0:
                GameMaster master = new GameMaster();
                master.MainGame();
                MainTitle();
                break;

            case 1:
                Tutorial.TutorialRun();
                MainTitle();
                break;

            default:
                break;
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// 役職をいい感じに表示する(改行なし)
 /// </summary>
 /// <param name="cast">役職</param>
 public static void WriteCastColor(PlayerPosition cast)
 {
     DisplayLibrary.ColorConsole(cast.DisplayName(), cast.ForgroundColor(), cast.BackgroundColor());
 }
Exemplo n.º 9
0
 /// <summary>
 /// コンソールに色を使って表示(改行あり)
 /// </summary>
 /// <param name="str">表示する文字</param>
 /// <param name="Foreground">文字色</param>
 /// <param name="Background">背景色</param>
 /// <param name="args">引数</param>
 public static void ColorConsoleLine(string str, ConsoleColor Foreground, ConsoleColor Background, params string[] args)
 {
     DisplayLibrary.ColorConsole(str, Foreground, Background, args);
     Console.WriteLine();
 }
Exemplo n.º 10
0
        /// <summary>
        /// 参加者の役職の人数を決める
        /// </summary>
        public void DecisionCast()
        {
            //DisplayLibrary.ChangeColorClear(CommonLibrary.AllPerson);
            CommonLibrary.ChangeDisplayColor(0);

            int MemberCount = MemberName.Count();
            //MemberCount cast = new MemberCount();
            bool CastCheck = false;

            /*
             * PlayerPosition[] castlist = new PlayerPosition[] {
             *  PlayerPosition.Villager,
             *  PlayerPosition.Werewolf,
             *  PlayerPosition.Prophet,
             *  PlayerPosition.Psychic,
             *  PlayerPosition.Guardman,
             *  PlayerPosition.Madman
             * };
             */

            while (!CastCheck)
            {
                int remaining = MemberName.Count;

                Console.WriteLine();

                foreach (var s in CastEnum.AllCastList().Select((v, i) => new { v, i }))
                {
                    bool check = false;
                    int  n     = 0;

                    if (remaining > 0)
                    {
                        Console.WriteLine("{0}の人数を入力してください。(残り人数:{1}人)", s.v.DisplayName(), remaining);
                    }
                    else
                    {
                        check = true;
                    }

                    while (!check)
                    {
                        Console.Write("> ");
                        string input = Console.ReadLine();
                        try
                        {
                            n          = int.Parse(input);
                            remaining -= n;
                            if (remaining < 0)
                            {
                                Console.WriteLine("参加人数よりも多い配役になります。");
                                remaining += n;
                            }
                            else
                            {
                                check = true;
                            }
                        }
                        catch (FormatException)
                        {
                            Console.WriteLine("数字を入力してください。");
                        }
                    }
                    //CastCount[s.i] = n;
                    CastCount[s.v] = n;
                }

                int sum       = CastCount.Select(x => x.Value).Sum();
                int WolfCount = CastCount[PlayerPosition.Werewolf] + CastCount[PlayerPosition.Madman];
                //int VillagerCount = CastCount[PlayerPosition.Villager] + CastCount[PlayerPosition.Psychic] + CastCount[PlayerPosition.Prophet] + CastCount[PlayerPosition.Guardman];
                int VillagerCount = sum - WolfCount;
                if (sum == MemberName.Count)
                {
                    if (VillagerCount > WolfCount)
                    {
                        CastCheck = true;
                    }
                    else
                    {
                        Console.WriteLine("人狼陣営が多いです。");
                    }
                }
                else
                {
                    Console.WriteLine("人数が合いません");
                }
            }

            Console.WriteLine();

            int maxWidth = CastEnum.AllCastList().Select(x => (DisplayLibrary.StringCount(x.DisplayName()))).Max();

            foreach (var s in CastEnum.AllCastList().Select((v, i) => new { v, i }))
            {
                //DisplayLibrary.ColorConsole("{0}", s.v.ForgroundColor(), s.v.BackgroundColor(), s.v.DisplayName());
                CommonLibrary.WriteCastColor(s.v);

                int space = maxWidth - DisplayLibrary.StringCount(s.v.DisplayName()); //文字スペース
                Console.Write(new string(' ', space));

                Console.WriteLine("{0,5}人", CastCount[s.v]);
            }

            bool result = DisplayLibrary.YesOrNo(0, "\nこれでいいですか?");

            if (!result)
            {
                DecisionCast();
            }
        }