Exemplo n.º 1
0
        public DisplayPeople_GS(
            Lobby lobby,
            string title,
            IReadOnlyList <Person> peopleList,
            Func <Person, Color?> backgroundColor = null,
            Func <Person, string> imageIdentifier = null,
            Func <Person, string> imageTitle      = null,
            Func <Person, string> imageHeader     = null)
            : base(
                lobby: lobby,
                exit: new WaitForPartyLeader_StateExit(
                    lobby: lobby,
                    partyLeaderPromptGenerator: Prompts.PartyLeaderSkipRevealButton(),
                    waitingPromptGenerator: Prompts.DisplayText()
                    )
                )
        {
            if (peopleList == null || peopleList.Count == 0)
            {
                throw new ArgumentException("PeopleList cannot be empty");
            }

            this.Entrance.Transition(this.Exit);

            backgroundColor ??= (person) => null;
            imageIdentifier ??= (person) => null;
            imageTitle ??= (person) => null;
            imageHeader ??= (person) => null;
            var unityImages = new List <Legacy_UnityImage>();

            foreach (Person person in peopleList)
            {
                unityImages.Add(person.GetUnityImage(
                                    backgroundColor: backgroundColor(person),
                                    imageIdentifier: imageIdentifier(person),
                                    title: imageTitle(person),
                                    header: imageHeader(person)
                                    ));
            }

            this.Legacy_UnityView = new Legacy_UnityView(this.Lobby)
            {
                ScreenId = new StaticAccessor <TVScreenId> {
                    Value = TVScreenId.ShowDrawings
                },
                UnityImages = new StaticAccessor <IReadOnlyList <Legacy_UnityImage> > {
                    Value = unityImages
                },
                Title = new StaticAccessor <string> {
                    Value = title
                },
            };
        }