Example #1
0
 public PriorityLayer(PriorityGrid grid, SpatialPriority priority, Color color)
 {
     _priority = priority;
     _grid     = grid;
     Color     = color;
     _drawer   = new CellBoolDrawer(this, grid.map.Size.x, grid.map.Size.z);
     Debug.Log($"Creating layer {priority} ({color})");
 }
Example #2
0
        public static PriorityGrid PriorityGrid(Map map)
        {
            var comp = map.GetComponent <PriorityGrid>();

            if (comp == null)
            {
                comp = new PriorityGrid(map);
                map.components.Add(comp);
            }
            return(comp);
        }
        public static void Postfix(float leftX, float width, ref float curBaseY)
        {
            var iconRect = new Rect(leftX + width - size - 8, curBaseY - size - 8, size, size);
            var active   = Find.DesignatorManager.SelectedDesignator == Designator_SpatialPriority.Instance;

            foreach (var priority in priorities)
            {
                var colour = PriorityGrid.Colour(priority);
                if (Widgets.ButtonImage(iconRect, PriorityGrid.Icon(priority), active ? colour : Color.white, colour))
                {
                    Designator_SpatialPriority.Instance.priority = priority;
                    Find.DesignatorManager.Select(Designator_SpatialPriority.Instance);
                }

                iconRect.x -= size + 4f;
            }

            GUI.color = Color.white;
            curBaseY -= size + 3 * 4;
        }