Esempio n. 1
0
        private void DoMembers(Rect membersRect, Dictionary <string, RestrictionTemplate.Toggle[]> categories)
        {
            _membersList.Begin(membersRect, true);

            foreach (var category in categories.Where(category => category.Value.Length > 0))
            {
                _membersList.LabelTiny(category.Key.Bold());

                foreach (var member in category.Value)
                {
                    if (_presetList.EditMode)
                    {
                        _membersList.CheckboxLabeled(member.Def.LabelCap, ref member.Value, member.Def.description);
                    }
                    else
                    {
                        GUI.color = GuiPlus.ReadOnlyColor;
                        _membersList.CheckboxLabeled(member.Def.LabelCap, ref member.Value, member.Def.description, false);
                        GUI.color = _color;
                    }
                }
            }

            _membersList.Gap();
            _membersList.End();
        }
Esempio n. 2
0
        private void DoMembers(Rect rect)
        {
            _membersList.Begin(rect, true);

            foreach (var category in _template.Categories)
            {
                if ((_type == RestrictionType.Food) && (_rules.Pawn != null) && !category.Members.Any(member => _rules.Pawn.RaceProps.CanEverEat((ThingDef)member.Def)))
                {
                    continue;
                }

                _membersList.LabelTiny(category.Label.Bold());

                foreach (var member in category.Members)
                {
                    if (_presetList.EditMode)
                    {
                        _membersList.CheckboxLabeled(member.Def.LabelCap, ref member.Value, member.Def.description);
                        continue;
                    }

                    if ((_type == RestrictionType.Food) && (_rules.Pawn != null) && !_rules.Pawn.RaceProps.CanEverEat((ThingDef)member.Def))
                    {
                        continue;
                    }

                    GUI.color = GuiPlus.ReadOnlyColor;
                    _membersList.CheckboxLabeled(member.Def.LabelCap, ref member.Value, member.Def.description, false);
                    GUI.color = _color;
                }

                _membersList.Gap();
            }

            _membersList.End();
        }