Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PagePresenter"/> class.
 /// </summary>
 /// <param name="initial">The initial.</param>
 /// <param name="textBoxHolder">The text box holder.</param>
 /// <param name="actionGrid">The action grid.</param>
 /// <param name="left">The left portraits.</param>
 /// <param name="right">The right portraits.</param>
 /// <param name="header">The header.</param>
 /// <param name="sound">The sound.</param>
 public PagePresenter(Page initial, TextBoxHolderView textBoxHolder, ActionGridView actionGrid, PortraitHolderView left, PortraitHolderView right, HeaderView header, SoundView sound)
 {
     this.textBoxHolder       = textBoxHolder;
     this.actionGrid          = actionGrid;
     this.left                = left;
     this.right               = right;
     this.header              = header;
     this.sound               = sound;
     this.characterPresenters = new List <CharacterPresenter>();
     InitializeFunctions();
     this.presenters = new Dictionary <Character, CharacterPresenter>(new IdNumberEqualityComparer <Character>());
     this.Page       = initial;
 }
Example #2
0
 private void SetCharacterPresenters(IList <Character> characters, PortraitHolderView portraitHolder)
 {
     AddCharactersToPortraitHolder(characters, portraitHolder);
     foreach (Character c in characters)
     {
         CharacterPresenter presenter = new CharacterPresenter(c, portraitHolder.GetPortrait(c.Id));
         presenter.Tick();
         if (!presenters.ContainsKey(c))
         {
             presenters.Add(c, null);
         }
         presenters[c] = presenter;
     }
 }
Example #3
0
        private void AddCharactersToPortraitHolder(IList <Character> characters, PortraitHolderView portraitHolder)
        {
            int revealContributionFromFlags = Convert.ToInt32(characters.Any(c => c.Brain is Player)); // Being in same party as player gives +1 to revealing

            portraitHolder.AddContents(
                characters
                .Select(
                    c => new PortraitHolderView.PortraitContent(
                        id: c.Id,
                        name: c.Look.DisplayName,
                        sprite: c.Look.Sprite,
                        tip: string.Format("Level {0} {1}\n<color=grey>{2}</color>",
                                           c.Stats.Level,
                                           c.Look.Breed.GetDescription(),
                                           c.Look.Tooltip),
                        buffs: c.Buffs
                        .Select(
                            b => new BuffHolderView.BuffContent(
                                id: b.Id,
                                color: Color.white,
                                description: b.Description,
                                duration: b.DurationText,
                                name: b.Name,
                                sprite: b.Sprite
                                )).ToArray(),
                        resources: c
                        .Stats
                        .Resources
                        .Select(
                            r => new ResourceHolderView.ResourceContent(
                                id: r.Type.GetHashCode(),
                                barText: r.Mod.ToString(),
                                numerator: r.Mod,
                                denominator: r.Max,
                                fillColor: r.Type.Color,
                                negativeColor: r.Type.NegativeColor,
                                sprite: r.Type.Sprite,
                                typeDescription: r.Type.Description,
                                title: r.Type.Name
                                )).ToList(),
                        isRevealed: IsRevealedCalculation(c.Stats, revealContributionFromFlags)
                        )
                    ).ToArray()
                );
        }