Пример #1
0
        public static void DoOrderButton(WidgetRow widgetRow, Area areaBase)
        {
            if (!(areaBase is Area_Allowed area))
            {
                return;
            }
            List <Area> areas = area.Map.areaManager.AllAreas.FindAll(a => a is Area_Allowed);
            int         index = areas.IndexOf(area);

            if (widgetRow.ButtonIcon(TexButton.Clear, "TD.ClearEntireArea".Translate()))
            {
                BoolGrid grid = (BoolGrid)innerGridInfo.GetValue(area);
                grid.Clear();
                area.Invert(); area.Invert();                //this is stupid but easiest way to access Dirtier
            }
            if (index > 0)
            {
                if (widgetRow.ButtonIcon(TexButton.ReorderUp))
                {
                    Area other = areas[index - 1];
                    area.Map.GetComponent <MapComponent_AreaOrder>().Swap(area, other);
                }
            }
            else
            {
                widgetRow.GapButtonIcon();
            }
            if (index < areas.Count - 1 && widgetRow.ButtonIcon(TexButton.ReorderDown))
            {
                Area other = areas[index + 1];
                area.Map.GetComponent <MapComponent_AreaOrder>().Swap(area, other);
            }
        }
Пример #2
0
        public static void DoOrderButton(WidgetRow widgetRow, Area areaBase)
        {
            if (!(areaBase is Area_Allowed area))
            {
                return;
            }
            List <Area> areas = area.Map.areaManager.AllAreas.FindAll(a => a is Area_Allowed);
            int         index = areas.IndexOf(area);

            if (widgetRow.ButtonIcon(TexButton.Clear, "TD.ClearEntireArea".Translate()))
            {
                BoolGrid grid = (BoolGrid)innerGridInfo.GetValue(area);
                grid.Clear();
                area.Invert(); area.Invert();                //this is stupid but easiest way to access Dirtier
            }

            var comp = area.Map.GetComponent <MapComponent_AreaOrder>();

            if (Mod.settings.areaForTypes)
            {
                //Animals checkbox
                bool forAnimals = !comp.notForAnimals.Contains(area);
                if (widgetRow.Checkbox(ref forAnimals))
                {
                    if (forAnimals)
                    {
                        comp.notForAnimals.Remove(area);
                    }
                    else
                    {
                        comp.notForAnimals.Add(area);
                    }
                }

                //Colonists checkbox
                bool forColonists = !comp.notForColonists.Contains(area);
                if (widgetRow.Checkbox(ref forColonists))
                {
                    if (forColonists)
                    {
                        comp.notForColonists.Remove(area);
                    }
                    else
                    {
                        comp.notForColonists.Add(area);
                    }
                }
            }

            //re-order up
            if (index > 0)
            {
                if (widgetRow.ButtonIcon(TexButton.ReorderUp))
                {
                    Area other = areas[index - 1];
                    comp.Swap(area, other);
                }
            }
            else
            {
                widgetRow.Gap(WidgetRow.IconSize);
            }

            //re-order down
            if (index < areas.Count - 1)
            {
                if (widgetRow.ButtonIcon(TexButton.ReorderDown))
                {
                    Area other = areas[index + 1];
                    comp.Swap(area, other);
                }
            }
            else
            {
                widgetRow.Gap(WidgetRow.IconSize);
            }
        }