示例#1
0
        public bool SelectCategory(PickedCategory pc, int depth)
        {
            var changed = false;

            var categoryFound = false;

            if (pc.path.Count > depth)
            {
                NameForPEGI.nl();

                if (pc.path.Count == depth + 1 && icon.Exit.Click(ref changed))
                {
                    pc.path.RemoveLast();
                }
                else
                {
                    var ind = pc.path[depth];

                    foreach (var t in subCategories)
                    {
                        if (t.IndexForPEGI == ind)
                        {
                            categoryFound = true;
                            t.SelectCategory(pc, depth + 1).changes(ref changed);
                            break;
                        }
                    }
                }
            }

            if (categoryFound)
            {
                return(false);
            }

            NameForPEGI.write(PEGI_Styles.ClickableText);

            int tmp = -1;

            if ("Sub Category".select_Index(ref tmp, subCategories).nl(ref changed))
            {
                var c = subCategories.TryGet(tmp);
                if (c != null)
                {
                    pc.path.ForceSet(depth, c.IndexForPEGI);
                }
            }

            return(changed);
        }
示例#2
0
        public bool SelectCategory(PickedCategory pc)
        {
            var changed = false;

            var categoryFound = false;

            if (pc.path.Count > 0)
            {
                var ind = pc.path[0];

                foreach (var t in subCategories)
                {
                    if (t.IndexForPEGI == ind)
                    {
                        categoryFound = true;
                        t.SelectCategory(pc, 1).changes(ref changed);
                        break;
                    }
                }
            }

            if (categoryFound)
            {
                return(changed);
            }

            int tmp = -1;

            if ("Category".select_Index(ref tmp, subCategories).changes(ref changed))
            {
                var c = subCategories.TryGet(tmp);
                if (c != null)
                {
                    pc.path.ForceSet(0, c.IndexForPEGI);
                }
            }


            return(changed);
        }