Example #1
0
        private static void Initialization()
        {
            List <Choice> choiceList1 = GetChoices(1,
                                                   new[] { "Получить предметы от бродяги" },
                                                   new[] { "Вам передали медальон и 50 монет" },
                                                   new[] { true });

            List <Choice> choiceList2 = GetChoices(1,
                                                   new [] { "Описание окружения в комнате" },
                                                   new [] { "Обычная поврежденная российская дорога" },
                                                   new [] { false });

            List <Action> actions = GetActions(2,
                                               new [] { "Поговорить с бродягой", "Осмотреть окрестности" },
                                               new [] { choiceList1, choiceList2 });

            Room road = new Room("Дорога", actions);

            _rooms.Add(road);

            List <Choice> GetChoices(int count, string[] names, string[] descriptions, bool[] isSingle)
            {
                List <Choice> list = new List <Choice>();

                for (int i = 0; i < count; i++)
                {
                    if (isSingle[i])
                    {
                        SingleChoice singleChoice = new SingleChoice(names[i], descriptions[i]);
                        list.Add(singleChoice);
                    }
                    else
                    {
                        Choice choice = new Choice(names[i], descriptions[i]);
                        list.Add(choice);
                    }
                }

                return(list);
            }

            List <Action> GetActions(int count, string[] names, List <Choice>[] choices)
            {
                List <Action> actions = new List <Action>();

                for (int i = 0; i < count; i++)
                {
                    Action action = new Action(names[i], choices[i]);
                    actions.Add(action);
                }

                return(actions);
            }
        }
Example #2
0
        public static void Selectable(SingleChoice singleChoice)
        {
            if (SingleChoices.Contains(singleChoice))
            {
                SelectableChoice(singleChoice);
                return;
            }

            SingleChoices.Add(singleChoice);
            OutPutDescriptionChoice(singleChoice);
            SelectableChoice(singleChoice);
        }