Example #1
0
        public void InitSubcategory(UICatalogSubcat cat)
        {
            var index = cat.MaskBit;

            if (!ChoosingSub)
            {
                return;
            }
            ChoosingSub = false;
            ((UIMainPanel)Parent).Switcher.Close();
            ((UIMainPanel)Parent).Switcher.MainButton.ReplaceImage(Content.Get().CustomUI.Get("cat_" + cat.IconName + ".png").Get(GameFacade.GraphicsDevice));

            foreach (var btn in SelButtons)
            {
                GameFacade.Screens.Tween.To(btn, 0.5f, new Dictionary <string, float>()
                {
                    { "Opacity", 0f }
                }, TweenQuad.EaseOut);
            }
            foreach (var label in SelLabels)
            {
                GameFacade.Screens.Tween.To(label, 0.5f, new Dictionary <string, float>()
                {
                    { "Opacity", 0f }
                }, TweenQuad.EaseOut);
            }

            CatContainer.Opacity = 0f;
            GameFacade.Screens.Tween.To(CatContainer, 0.5f, new Dictionary <string, float>()
            {
                { "Opacity", 1f }
            }, TweenQuad.EaseOut);

            if (Mode == UICatalogMode.Build)
            {
                InitCategory((sbyte)index, true);
                FilterCategory = FullCategory;
            }
            else if (index == 8)
            {
                FilterCategory = FullCategory.Where(x => (GetSubsort(x.Item)) > 0);
            }
            else
            {
                var mask = 1 << index;
                if (Mode == UICatalogMode.Normal && index == 7)
                {
                    mask |= 16;
                }
                FilterCategory = FullCategory.Where(x => (GetSubsort(x.Item) & mask) > 0);
            }
            CatContainer.Reset();
        }
Example #2
0
        private bool SubcatIsEmpty(UICatalogSubcat cat)
        {
            var index = cat.MaskBit;

            if (Mode == UICatalogMode.Build)
            {
                return(FullCategory.FirstOrDefault() == null);
            }
            else if (index == 8)
            {
                return(!FullCategory.Any(x => (GetSubsort(x.Item)) > 0));
            }
            else
            {
                var mask = 1 << index;
                return(!FullCategory.Any(x => (GetSubsort(x.Item) & mask) > 0));
            }
        }