Exemplo n.º 1
0
        public void Refresh()
        {
            // upate our list of jobs
            Jobs = Manager.For(manager).JobStack.FullStack <ManagerJob_Hunting>();

            // update pawnkind options
            foreach (ManagerJob_Hunting job in Jobs)
            {
                job.RefreshAllowedAnimals();
            }
            _selected?.RefreshAllowedAnimals();
        }
Exemplo n.º 2
0
        public void DoContent(Rect rect)
        {
            // layout: settings | animals
            // draw background
            Widgets.DrawMenuSection(rect);

            // rects
            var optionsColumnRect = new Rect(
                rect.xMin,
                rect.yMin,
                rect.width * 3 / 5f,
                rect.height - Margin - ButtonSize.y);
            var animalsColumnRect = new Rect(
                optionsColumnRect.xMax,
                rect.yMin,
                rect.width * 2 / 5f,
                rect.height - Margin - ButtonSize.y);
            var buttonRect = new Rect(
                rect.xMax - ButtonSize.x,
                rect.yMax - ButtonSize.y,
                ButtonSize.x - Margin,
                ButtonSize.y - Margin);

            Vector2 position;
            float   width;

            // options
            Widgets_Section.BeginSectionColumn(optionsColumnRect, "Hunting.Options", out position, out width);
            Widgets_Section.Section(ref position, width, DrawThresholdSettings, "FM.Threshold".Translate());
            Widgets_Section.Section(ref position, width, DrawUnforbidCorpses);
            Widgets_Section.Section(ref position, width, DrawHuntingGrounds, "FM.Hunting.AreaRestriction".Translate());
            Widgets_Section.EndSectionColumn("Hunting.Options", position);

            // animals
            Widgets_Section.BeginSectionColumn(animalsColumnRect, "Hunting.Animals", out position, out width);
            var refreshRect = new Rect(
                position.x + width - SmallIconSize - 2 * Margin,
                position.y + Margin,
                SmallIconSize,
                SmallIconSize);

            if (Widgets.ButtonImage(refreshRect, Resources.Refresh, Color.grey))
            {
                _selected.RefreshAllowedAnimals();
            }
            Widgets_Section.Section(ref position, width, DrawAnimalShortcuts, "FMH.Animals".Translate());
            Widgets_Section.Section(ref position, width, DrawAnimalList);
            Widgets_Section.EndSectionColumn("Hunting.Animals", position);

            // do the button
            if (!_selected.Managed)
            {
                if (Widgets.ButtonText(buttonRect, "FM.Manage".Translate()))
                {
                    // activate job, add it to the stack
                    _selected.Managed = true;
                    Manager.For(manager).JobStack.Add(_selected);

                    // refresh source list
                    Refresh();
                }
            }
            else
            {
                if (Widgets.ButtonText(buttonRect, "FM.Delete".Translate()))
                {
                    // inactivate job, remove from the stack.
                    Manager.For(manager).JobStack.Delete(_selected);

                    // remove content from UI
                    _selected = null;

                    // refresh source list
                    Refresh();
                }
            }
        }