예제 #1
0
 public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
 {
     bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
         BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface,
         new FlavorTextBestiaryInfoElement($"Mods.FargowiltasSouls.Bestiary.{Name}")
     });
 }
예제 #2
0
 public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
 {
     bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
         BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface,
         new FlavorTextBestiaryInfoElement("Mods.AlchemistNPCLite.Bestiary.Tinkerer")
     });
 }
예제 #3
0
 public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
 {
     bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
         BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Sky,
         new FlavorTextBestiaryInfoElement("Mods.Fargowiltas.Bestiary.Abominationn")
     });
 }
예제 #4
0
        private void AddInfoToList(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
        {
            BestiaryUICollectionInfo uiCollectionInfo = this.GetUICollectionInfo(entry, extraInfo);
            IOrderedEnumerable <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement> > orderedEnumerable = new List <IBestiaryInfoElement>((IEnumerable <IBestiaryInfoElement>)entry.Info).GroupBy <IBestiaryInfoElement, UIBestiaryEntryInfoPage.BestiaryInfoCategory>(new Func <IBestiaryInfoElement, UIBestiaryEntryInfoPage.BestiaryInfoCategory>(this.GetBestiaryInfoCategory)).OrderBy <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement>, UIBestiaryEntryInfoPage.BestiaryInfoCategory>((Func <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement>, UIBestiaryEntryInfoPage.BestiaryInfoCategory>)(x => x.Key));
            UIElement uiElement1 = (UIElement)null;

            foreach (IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement> source in (IEnumerable <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement> >)orderedEnumerable)
            {
                if (source.Count <IBestiaryInfoElement>() != 0)
                {
                    bool flag = false;
                    foreach (IBestiaryInfoElement bestiaryInfoElement in (IEnumerable <IBestiaryInfoElement>)source)
                    {
                        UIElement uiElement2 = bestiaryInfoElement.ProvideUIElement(uiCollectionInfo);
                        if (uiElement2 != null)
                        {
                            this._list.Add(uiElement2);
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        UIHorizontalSeparator horizontalSeparator1 = new UIHorizontalSeparator(2, true);
                        horizontalSeparator1.Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f);
                        horizontalSeparator1.Color = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f;
                        UIHorizontalSeparator horizontalSeparator2 = horizontalSeparator1;
                        this._list.Add((UIElement)horizontalSeparator2);
                        uiElement1 = (UIElement)horizontalSeparator2;
                    }
                }
            }
            this._list.Remove(uiElement1);
        }
예제 #5
0
        private BestiaryUICollectionInfo GetUICollectionInfo(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
        {
            BestiaryUICollectionInfo result = entry.UIInfoProvider?.GetEntryUICollectionInfo() ?? default(BestiaryUICollectionInfo);

            result.OwnerEntry = entry;
            return(result);
        }
예제 #6
0
        private Asset <Texture2D> TryGettingBackgroundImageProvider(BestiaryEntry entry)
        {
            IEnumerable <IBestiaryBackgroundImagePathAndColorProvider> enumerable = from x in entry.Info
                                                                                    where x is IBestiaryBackgroundImagePathAndColorProvider
                                                                                    select x as IBestiaryBackgroundImagePathAndColorProvider;
            IEnumerable <IPreferenceProviderElement> preferences = entry.Info.OfType <IPreferenceProviderElement>();
            IEnumerable <IBestiaryBackgroundImagePathAndColorProvider> enumerable2 = enumerable.Where((IBestiaryBackgroundImagePathAndColorProvider provider) => preferences.Any((IPreferenceProviderElement preference) => preference.Matches(provider)));
            Asset <Texture2D> val = null;

            foreach (IBestiaryBackgroundImagePathAndColorProvider item in enumerable2)
            {
                val = item.GetBackgroundImage();
                if (val != null)
                {
                    return(val);
                }
            }
            foreach (IBestiaryBackgroundImagePathAndColorProvider item2 in enumerable)
            {
                val = item2.GetBackgroundImage();
                if (val != null)
                {
                    return(val);
                }
            }
            return(null);
        }
예제 #7
0
        public UIBestiaryNPCEntryPortrait(
            BestiaryEntry entry,
            Asset <Texture2D> portraitBackgroundAsset,
            Color portraitColor,
            List <IBestiaryBackgroundOverlayAndColorProvider> overlays)
        {
            this.Entry = entry;
            this.Height.Set(112f, 0.0f);
            this.Width.Set(193f, 0.0f);
            this.SetPadding(0.0f);
            UIElement element = new UIElement()
            {
                Width  = new StyleDimension(-4f, 1f),
                Height = new StyleDimension(-4f, 1f),
                IgnoresMouseInteraction = true,
                OverflowHidden          = true,
                HAlign = 0.5f,
                VAlign = 0.5f
            };

            element.SetPadding(0.0f);
            if (portraitBackgroundAsset != null)
            {
                UIElement uiElement = element;
                UIImage   uiImage   = new UIImage(portraitBackgroundAsset);
                uiImage.HAlign     = 0.5f;
                uiImage.VAlign     = 0.5f;
                uiImage.ScaleToFit = true;
                uiImage.Width      = new StyleDimension(0.0f, 1f);
                uiImage.Height     = new StyleDimension(0.0f, 1f);
                uiImage.Color      = portraitColor;
                uiElement.Append((UIElement)uiImage);
            }
            for (int index = 0; index < overlays.Count; ++index)
            {
                Asset <Texture2D> backgroundOverlayImage = overlays[index].GetBackgroundOverlayImage();
                Color?            backgroundOverlayColor = overlays[index].GetBackgroundOverlayColor();
                UIElement         uiElement = element;
                UIImage           uiImage   = new UIImage(backgroundOverlayImage);
                uiImage.HAlign     = 0.5f;
                uiImage.VAlign     = 0.5f;
                uiImage.ScaleToFit = true;
                uiImage.Width      = new StyleDimension(0.0f, 1f);
                uiImage.Height     = new StyleDimension(0.0f, 1f);
                uiImage.Color      = backgroundOverlayColor.HasValue ? backgroundOverlayColor.Value : Color.Lerp(Color.White, portraitColor, 0.5f);
                uiElement.Append((UIElement)uiImage);
            }
            UIBestiaryEntryIcon bestiaryEntryIcon = new UIBestiaryEntryIcon(entry, true);

            element.Append((UIElement)bestiaryEntryIcon);
            this.Append(element);
            UIImage uiImage1 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Portrait_Front", (AssetRequestMode)1));

            uiImage1.VAlign = 0.5f;
            uiImage1.HAlign = 0.5f;
            uiImage1.IgnoresMouseInteraction = true;
            this.Append((UIElement)uiImage1);
        }
예제 #8
0
 public void FillInfoForEntry(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
 {
     _list.Clear();
     if (entry != null)
     {
         AddInfoToList(entry, extraInfo);
         Recalculate();
     }
 }
예제 #9
0
        private BestiaryUICollectionInfo GetUICollectionInfo(
            BestiaryEntry entry,
            ExtraBestiaryInfoPageInformation extraInfo)
        {
            IBestiaryUICollectionInfoProvider uiInfoProvider   = entry.UIInfoProvider;
            BestiaryUICollectionInfo          uiCollectionInfo = uiInfoProvider == null ? new BestiaryUICollectionInfo() : uiInfoProvider.GetEntryUICollectionInfo();

            uiCollectionInfo.OwnerEntry = entry;
            return(uiCollectionInfo);
        }
예제 #10
0
 public void FillInfoForEntry(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
 {
     this._list.Clear();
     if (entry == null)
     {
         return;
     }
     this.AddInfoToList(entry, extraInfo);
     this.Recalculate();
 }
예제 #11
0
 public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
 {
     bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(
         ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[ModContent.NPCType <LifeChampion>()],
         quickUnlock: true
         );
     bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
         BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow,
         new FlavorTextBestiaryInfoElement($"Mods.FargowiltasSouls.Bestiary.{Name}")
     });
 }
예제 #12
0
 public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
 {
     bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(
         ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCID.QueenBee],
         quickUnlock: true
         );
     bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
         BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.UndergroundJungle,
         new FlavorTextBestiaryInfoElement("Mods.FargowiltasSouls.Bestiary.RoyalSubject")
     });
 }
예제 #13
0
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            // We can use AddRange instead of calling Add multiple times in order to add multiple items at once
            bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
                // Sets the spawning conditions of this NPC that is listed in the bestiary.
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Times.NightTime,

                // Sets the description of this NPC that is listed in the bestiary.
                new FlavorTextBestiaryInfoElement("This type of zombie for some reason really likes to spread confetti around. Otherwise, it behaves just like a normal zombie.")
            });
        }
예제 #14
0
        private int?TryGettingDisplayIndex(BestiaryEntry entry)
        {
            int?nullable = new int?();
            IBestiaryInfoElement bestiaryInfoElement = entry.Info.FirstOrDefault <IBestiaryInfoElement>((Func <IBestiaryInfoElement, bool>)(x => x is IBestiaryEntryDisplayIndex));

            if (bestiaryInfoElement != null)
            {
                nullable = new int?((bestiaryInfoElement as IBestiaryEntryDisplayIndex).BestiaryDisplayIndex);
            }
            return(nullable);
        }
예제 #15
0
 public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
 {
     bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(
         ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCID.BrainofCthulhu],
         quickUnlock: true
         );
     bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
         BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheCrimson,
         new FlavorTextBestiaryInfoElement("Mods.FargowiltasSouls.Bestiary.GuttedCreeper")
     });
 }
예제 #16
0
        private int?TryGettingDisplayIndex(BestiaryEntry entry)
        {
            int?result = null;
            IBestiaryInfoElement bestiaryInfoElement = entry.Info.FirstOrDefault((IBestiaryInfoElement x) => x is IBestiaryEntryDisplayIndex);

            if (bestiaryInfoElement != null)
            {
                result = (bestiaryInfoElement as IBestiaryEntryDisplayIndex).BestiaryDisplayIndex;
            }
            return(result);
        }
예제 #17
0
        public UIBestiaryNPCEntryPortrait(BestiaryEntry entry, Asset <Texture2D> portraitBackgroundAsset, Color portraitColor, List <IBestiaryBackgroundOverlayAndColorProvider> overlays)
        {
            Entry = entry;
            Height.Set(112f, 0f);
            Width.Set(193f, 0f);
            SetPadding(0f);
            UIElement uIElement = new UIElement
            {
                Width  = new StyleDimension(-4f, 1f),
                Height = new StyleDimension(-4f, 1f),
                IgnoresMouseInteraction = true,
                OverflowHidden          = true,
                HAlign = 0.5f,
                VAlign = 0.5f
            };

            uIElement.SetPadding(0f);
            if (portraitBackgroundAsset != null)
            {
                uIElement.Append(new UIImage(portraitBackgroundAsset)
                {
                    HAlign     = 0.5f,
                    VAlign     = 0.5f,
                    ScaleToFit = true,
                    Width      = new StyleDimension(0f, 1f),
                    Height     = new StyleDimension(0f, 1f),
                    Color      = portraitColor
                });
            }
            for (int i = 0; i < overlays.Count; i++)
            {
                Asset <Texture2D> backgroundOverlayImage = overlays[i].GetBackgroundOverlayImage();
                Color?            backgroundOverlayColor = overlays[i].GetBackgroundOverlayColor();
                uIElement.Append(new UIImage(backgroundOverlayImage)
                {
                    HAlign     = 0.5f,
                    VAlign     = 0.5f,
                    ScaleToFit = true,
                    Width      = new StyleDimension(0f, 1f),
                    Height     = new StyleDimension(0f, 1f),
                    Color      = (backgroundOverlayColor.HasValue ? backgroundOverlayColor.Value : Color.Lerp(Color.White, portraitColor, 0.5f))
                });
            }
            UIBestiaryEntryIcon element = new UIBestiaryEntryIcon(entry, isPortrait: true);

            uIElement.Append(element);
            Append(uIElement);
            Append(new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Portrait_Front", Main.content, (AssetRequestMode)1))
            {
                VAlign = 0.5f,
                HAlign = 0.5f,
                IgnoresMouseInteraction = true
            });
        }
예제 #18
0
파일: Worm.cs 프로젝트: vSLG/tModLoader
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            // We can use AddRange instead of calling Add multiple times in order to add multiple items at once
            bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
                // Sets the spawning conditions of this NPC that is listed in the bestiary.
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground,
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Caverns,

                // Sets the description of this NPC that is listed in the bestiary.
                new FlavorTextBestiaryInfoElement("Looks like a Digger fell into some aqua-colored paint. Oh well.")
            });
        }
예제 #19
0
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            // We can use AddRange instead of calling Add multiple times in order to add multiple items at once
            bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
                // Sets the preferred biomes of this town NPC listed in the bestiary.
                // With Town NPCs, you usually set this to what biome it likes the most in regards to NPC happiness.
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface,

                // Sets your NPC's flavor text in the bestiary.
                new FlavorTextBestiaryInfoElement("Armored to the bone, this heartless carries a sword and is weak to a sun rising.\nWill only appear in really large groups alongsode Surveilance Robots")
            });
        }
예제 #20
0
 public UIBestiaryEntryIcon(BestiaryEntry entry, bool isPortrait)
 {
     this._entry = entry;
     this.IgnoresMouseInteraction = true;
     this.OverrideSamplerState    = Main.DefaultSamplerState;
     this.UseImmediateMode        = true;
     this.Width.Set(0.0f, 1f);
     this.Height.Set(0.0f, 1f);
     this._notUnlockedTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Locked", (AssetRequestMode)1);
     this._isPortrait         = isPortrait;
     this._collectionInfo     = this._entry.UIInfoProvider.GetEntryUICollectionInfo();
 }
 public UIBestiaryEntryIcon(BestiaryEntry entry, bool isPortrait)
 {
     _entry = entry;
     IgnoresMouseInteraction = true;
     OverrideSamplerState    = Main.DefaultSamplerState;
     UseImmediateMode        = true;
     Width.Set(0f, 1f);
     Height.Set(0f, 1f);
     _notUnlockedTexture = Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Locked", Main.content, (AssetRequestMode)1);
     _isPortrait         = isPortrait;
     _collectionInfo     = _entry.UIInfoProvider.GetEntryUICollectionInfo();
 }
예제 #22
0
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            // We can use AddRange instead of calling Add multiple times in order to add multiple items at once
            bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
                // Sets the preferred biomes of this town NPC listed in the bestiary.
                // With Town NPCs, you usually set this to what biome it likes the most in regards to NPC happiness.
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface,

                // Sets your NPC's flavor text in the bestiary.
                new FlavorTextBestiaryInfoElement("These small flying drone Heartless fire lasers that can be returned with a block, but they will respond with an even stronger power laser")
            });
        }
예제 #23
0
        public static void SetBestiary(NPC npc, BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            if (npc.ModNPC != null)
            {
                bestiaryEntry.Info.Add(npc.ModNPC.Mod.ModSourceBestiaryInfoElement);
            }
            npc.ModNPC?.SetBestiary(database, bestiaryEntry);

            foreach (GlobalNPC g in HookSetBestiary.Enumerate(npc.globalNPCs))
            {
                g.SetBestiary(npc, database, bestiaryEntry);
            }
        }
예제 #24
0
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            // We can use AddRange instead of calling Add multiple times in order to add multiple items at once
            bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
                // Sets the preferred biomes of this town NPC listed in the bestiary.
                // With Town NPCs, you usually set this to what biome it likes the most in regards to NPC happiness.
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Underground,

                // Sets your NPC's flavor text in the bestiary.
                new FlavorTextBestiaryInfoElement("Don't be fooled by this pot looking creature or it will come at you and take your money away" +
                                                  "\nKeep hurting it to take it's money away instead.")
            });
        }
예제 #25
0
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            // We can use AddRange instead of calling Add multiple times in order to add multiple items at once
            bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
                // Sets the preferred biomes of this town NPC listed in the bestiary.
                // With Town NPCs, you usually set this to what biome it likes the most in regards to NPC happiness.
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface,

                // Sets your NPC's flavor text in the bestiary.
                new FlavorTextBestiaryInfoElement("Heartless that emerge from various places" +
                                                  "\nThey sneak up to their enemies and strike them with sharp claws" +
                                                  "\nThey are extremely tenacious, often chasing their prey to the end")
            });
        }
예제 #26
0
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            // We can use AddRange instead of calling Add multiple times in order to add multiple items at once
            bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
                // Sets the preferred biomes of this town NPC listed in the bestiary.
                // With Town NPCs, you usually set this to what biome it likes the most in regards to NPC happiness.
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface,

                // Sets your NPC's flavor text in the bestiary.
                new FlavorTextBestiaryInfoElement("Spellcasting Heartless" +
                                                  "\nWhile hovering about, they attack by casting Fire" +
                                                  "\nHaving low HP, they keep their distance from their opponents, making them difficult to attack")
            });
        }
예제 #27
0
        public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry)
        {
            // We can use AddRange instead of calling Add multiple times in order to add multiple items at once
            bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] {
                // Sets the preferred biomes of this town NPC listed in the bestiary.
                // With Town NPCs, you usually set this to what biome it likes the most in regards to NPC happiness.
                BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Surface,

                // Sets your NPC's flavor text in the bestiary.
                new FlavorTextBestiaryInfoElement("Hailing from a mysterious greyscale cube world, the Example Person is here to help you understand everything about tModLoader."),

                // You can add multiple elements if you really wanted to
                // You can also use localization keys (see Localization/en-US.lang)
                new FlavorTextBestiaryInfoElement("Mods.ExampleMod.Bestiary.ExamplePerson")
            });
        }
예제 #28
0
        private Asset <Texture2D> TryGettingBackgroundImageProvider(BestiaryEntry entry)
        {
            IEnumerable <IBestiaryBackgroundImagePathAndColorProvider> source = entry.Info.Where <IBestiaryInfoElement>((Func <IBestiaryInfoElement, bool>)(x => x is IBestiaryBackgroundImagePathAndColorProvider)).Select <IBestiaryInfoElement, IBestiaryBackgroundImagePathAndColorProvider>((Func <IBestiaryInfoElement, IBestiaryBackgroundImagePathAndColorProvider>)(x => x as IBestiaryBackgroundImagePathAndColorProvider));
            IEnumerable <IPreferenceProviderElement> preferences = entry.Info.OfType <IPreferenceProviderElement>();

            foreach (IBestiaryBackgroundImagePathAndColorProvider andColorProvider in source.Where <IBestiaryBackgroundImagePathAndColorProvider>((Func <IBestiaryBackgroundImagePathAndColorProvider, bool>)(provider => preferences.Any <IPreferenceProviderElement>((Func <IPreferenceProviderElement, bool>)(preference => preference.Matches(provider))))))
            {
                Asset <Texture2D> backgroundImage = andColorProvider.GetBackgroundImage();
                if (backgroundImage != null)
                {
                    return(backgroundImage);
                }
            }
            foreach (IBestiaryBackgroundImagePathAndColorProvider andColorProvider in source)
            {
                Asset <Texture2D> backgroundImage = andColorProvider.GetBackgroundImage();
                if (backgroundImage != null)
                {
                    return(backgroundImage);
                }
            }
            return((Asset <Texture2D>)null);
        }
예제 #29
0
        private void AddInfoToList(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo)
        {
            BestiaryUICollectionInfo uICollectionInfo = GetUICollectionInfo(entry, extraInfo);
            IOrderedEnumerable <IGrouping <BestiaryInfoCategory, IBestiaryInfoElement> > orderedEnumerable = from x in new List <IBestiaryInfoElement>(entry.Info).GroupBy(GetBestiaryInfoCategory)
                                                                                                             orderby x.Key
                                                                                                             select x;
            UIElement item = null;

            foreach (IGrouping <BestiaryInfoCategory, IBestiaryInfoElement> item2 in orderedEnumerable)
            {
                if (item2.Count() == 0)
                {
                    continue;
                }
                bool flag = false;
                foreach (IBestiaryInfoElement item3 in item2)
                {
                    UIElement uIElement = item3.ProvideUIElement(uICollectionInfo);
                    if (uIElement != null)
                    {
                        _list.Add(uIElement);
                        flag = true;
                    }
                }
                if (flag)
                {
                    UIHorizontalSeparator uIHorizontalSeparator = new UIHorizontalSeparator
                    {
                        Width = StyleDimension.FromPixelsAndPercent(0f, 1f),
                        Color = new Color(89, 116, 213, 255) * 0.9f
                    };
                    _list.Add(uIHorizontalSeparator);
                    item = uIHorizontalSeparator;
                }
            }
            _list.Remove(item);
        }
예제 #30
0
        public UIBestiaryEntryButton(BestiaryEntry entry, bool isAPrettyPortrait)
        {
            this.Entry = entry;
            this.Height.Set(72f, 0.0f);
            this.Width.Set(72f, 0.0f);
            this.SetPadding(0.0f);
            UIElement element = new UIElement()
            {
                Width  = new StyleDimension(-4f, 1f),
                Height = new StyleDimension(-4f, 1f),
                IgnoresMouseInteraction = true,
                OverflowHidden          = true,
                HAlign = 0.5f,
                VAlign = 0.5f
            };

            element.SetPadding(0.0f);
            UIImage uiImage1 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Back", (AssetRequestMode)1));

            uiImage1.VAlign = 0.5f;
            uiImage1.HAlign = 0.5f;
            element.Append((UIElement)uiImage1);
            if (isAPrettyPortrait)
            {
                Asset <Texture2D> texture = this.TryGettingBackgroundImageProvider(entry);
                if (texture != null)
                {
                    UIElement uiElement = element;
                    UIImage   uiImage2  = new UIImage(texture);
                    uiImage2.HAlign = 0.5f;
                    uiImage2.VAlign = 0.5f;
                    uiElement.Append((UIElement)uiImage2);
                }
            }
            UIBestiaryEntryIcon bestiaryEntryIcon = new UIBestiaryEntryIcon(entry, isAPrettyPortrait);

            element.Append((UIElement)bestiaryEntryIcon);
            this.Append(element);
            this._icon = bestiaryEntryIcon;
            int?nullable = this.TryGettingDisplayIndex(entry);

            if (nullable.HasValue)
            {
                UIText uiText = new UIText(nullable.Value.ToString(), 0.9f, false);
                uiText.Top  = new StyleDimension(10f, 0.0f);
                uiText.Left = new StyleDimension(10f, 0.0f);
                uiText.IgnoresMouseInteraction = true;
                this.Append((UIElement)uiText);
            }
            UIImage uiImage3 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Selection", (AssetRequestMode)1));

            uiImage3.VAlign = 0.5f;
            uiImage3.HAlign = 0.5f;
            uiImage3.IgnoresMouseInteraction = true;
            this._bordersGlow = uiImage3;
            UIImage uiImage4 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Overlay", (AssetRequestMode)1));

            uiImage4.VAlign = 0.5f;
            uiImage4.HAlign = 0.5f;
            uiImage4.IgnoresMouseInteraction = true;
            uiImage4.Color       = Color.White * 0.6f;
            this._bordersOverlay = uiImage4;
            this.Append((UIElement)this._bordersOverlay);
            UIImage uiImage5 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Front", (AssetRequestMode)1));

            uiImage5.VAlign = 0.5f;
            uiImage5.HAlign = 0.5f;
            uiImage5.IgnoresMouseInteraction = true;
            this.Append((UIElement)uiImage5);
            this._borders = uiImage5;
            if (isAPrettyPortrait)
            {
                this.RemoveChild((UIElement)this._bordersOverlay);
            }
            if (isAPrettyPortrait)
            {
                return;
            }
            this.OnMouseOver += new UIElement.MouseEvent(this.MouseOver);
            this.OnMouseOut  += new UIElement.MouseEvent(this.MouseOut);
        }