Пример #1
0
        // This updates the overlay
        private void UpdateOverlay()
        {
            MapSet map = General.Map.Map;

            if (renderer.StartOverlay(true))
            {
                if (selected != null)
                {
                    int manualhiddencolor  = PixelColor.FromColor(Color.Red).ToInt();
                    int manualvisiblecolor = PixelColor.FromColor(Color.DeepSkyBlue).ToInt();
                    int tablevisiblecolor  = PixelColor.FromColor(Color.Blue).ToInt();

                    Array.Clear(manualsectors, 0, manualsectors.Length);

                    List <RejectSet> targets;
                    if (BuilderPlug.Me.RejectChanges.TryGetValue(selected.FixedIndex, out targets))
                    {
                        // Draw all sectors that were set manually
                        foreach (RejectSet rs in targets)
                        {
                            Sector ts = BuilderPlug.Me.GetSectorByFixedIndex(rs.target);
                            switch (rs.state)
                            {
                            case RejectState.ForceHidden: RenderSectorFilled(ts, manualhiddencolor); break;

                            case RejectState.ForceVisible: RenderSectorFilled(ts, manualvisiblecolor); break;

                            default: throw new NotImplementedException();
                            }
                            manualsectors[rs.target] = true;
                        }
                    }

                    // For all remaining sectors in the table, render them as the nodebuilder decided
                    bool[] tabletargets = BuilderPlug.Me.UnmodifiedTable[selected.Index];
                    for (int i = 0; i < tabletargets.Length; i++)
                    {
                        if (manualsectors[i])
                        {
                            continue;
                        }
                        if (tabletargets[i])
                        {
                            continue;
                        }

                        RenderSectorFilled(map.GetSectorByIndex(i), tablevisiblecolor);
                    }
                }
                else
                {
                    int indicationcolor = General.Colors.Indication.ToInt();
                    foreach (KeyValuePair <int, List <RejectSet> > ss in BuilderPlug.Me.RejectChanges)
                    {
                        RenderSectorFilled(BuilderPlug.Me.GetSectorByFixedIndex(ss.Key), indicationcolor);
                    }
                }

                renderer.Finish();
            }
        }