Пример #1
0
        public override void DrawBase(GraphicsManager gm, int lineNumber, bool isSecret)
        {
            Font drawFont = new Font(gm.FontFamily, gm.DrawFontSize);

            SolidBrush   drawBrush  = new SolidBrush(Color.White);
            RectangleF   drawRect   = new RectangleF((isSecret ? (gm.Width / 2) : 0) + gm.SWidth / 2, lineNumber * gm.SHeight, gm.HalfWidth, gm.SHeight);
            StringFormat drawFormat = new StringFormat
            {
                Alignment     = StringAlignment.Near,
                LineAlignment = StringAlignment.Center
            };

            gm.graphics.DrawStringWithOutline(text, gm.FontFamily, gm.DrawFontSize, drawBrush, Pens.Black, drawRect, drawFormat);
            drawBrush.Dispose();
            drawFont.Dispose();
        }
Пример #2
0
        int DrawTextFlipswitches(GraphicsManager gm, int offset, int totalStarLine)
        {
            //int totalStarLine = gm.ld.GetLength() + 2;
            string starLine = ActivePanelsCount.ToString() + "/" + TotalPanelsCount.ToString();

            SolidBrush redBrush  = new SolidBrush(Color.LightGreen);
            SolidBrush drawBrush = new SolidBrush(Color.White);

            gm.graphics.DrawImage(gm.flipswitchOff, offset * (gm.SWidth / 2), totalStarLine * gm.SHeight + (gm.SHeight / 2), gm.SWidth, gm.SWidth);
            gm.graphics.DrawStringWithOutline(starLine, gm.FontFamily, gm.MedFontSize, redBrush, Pens.Black, gm.SWidth + offset * (gm.SWidth / 2), totalStarLine * gm.SHeight + (gm.SHeight / 2));

            redBrush.Dispose();
            drawBrush.Dispose();

            return(starLine.Length + 4);
        }
Пример #3
0
        int DrawTextSecrets(GraphicsManager gm, int totalStarLine)
        {
            //int totalStarLine = gm.ld.GetLength() + 2;
            string starLine = CurrentSecretsCount.ToString() + "/" + TotalSecretsCount.ToString();

            SolidBrush blueBrush = new SolidBrush(Color.LightBlue);
            SolidBrush drawBrush = new SolidBrush(Color.White);

            gm.graphics.DrawStringWithOutline(starLine, gm.FontFamily, gm.MedFontSize, blueBrush, Pens.Black, gm.SWidth + (gm.SWidth / 2) * totalSize - starLine.Length * (gm.SWidth / 2), totalStarLine * gm.SHeight + (gm.SHeight / 2));
            gm.graphics.DrawImage(gm.secrets, (gm.SWidth / 2) * totalSize - starLine.Length * (gm.SWidth / 2), totalStarLine * gm.SHeight + (gm.SHeight / 2), gm.SWidth, gm.SWidth);

            blueBrush.Dispose();
            drawBrush.Dispose();

            return(starLine.Length + 4);
        }
Пример #4
0
        int DrawTextReds(GraphicsManager gm, int totalStarLine)
        {
            //int totalStarLine = gm.ld.GetLength() + 2;
            string starLine = CurrentRedsCount.ToString() + "/" + TotalRedsCount.ToString();

            SolidBrush redBrush  = new SolidBrush(Color.IndianRed);
            SolidBrush drawBrush = new SolidBrush(Color.White);

            gm.graphics.DrawImage(gm.reds, gm.SWidth, totalStarLine * gm.SHeight + gm.SHeight / 2, gm.SWidth, gm.SWidth);
            gm.graphics.DrawStringWithOutline(starLine, gm.FontFamily, gm.MedFontSize, redBrush, Pens.Black, gm.SWidth * 2, totalStarLine * gm.SHeight + gm.SHeight / 2);

            redBrush.Dispose();
            drawBrush.Dispose();

            return(starLine.Length + 4);
        }
Пример #5
0
        void DrawTextSecrets(GraphicsManager gm, int lineOffset)
        {
            string starLine = CurrentSecretsCount.ToString() + "/" + TotalSecretsCount.ToString();

            SolidBrush blueBrush = new SolidBrush(Color.LightBlue);
            SolidBrush drawBrush = new SolidBrush(Color.White);

            Font bigFont = new Font(gm.FontFamily, gm.MedFontSize);

            gm.graphics.DrawImage(gm.secrets, gm.Width / 2 + gm.SWidth, (lineOffset + Line) * gm.SHeight + gm.SWidth / 2, gm.SWidth, gm.SWidth);
            gm.graphics.DrawString(starLine, bigFont, blueBrush, gm.Width / 2 + gm.SWidth * 2, (lineOffset + Line) * gm.SHeight + gm.SWidth / 2);

            blueBrush.Dispose();
            drawBrush.Dispose();

            bigFont.Dispose();
        }
Пример #6
0
        void DrawTextReds(GraphicsManager gm, int lineOffset)
        {
            string starLine = CurrentRedsCount.ToString() + "/" + TotalRedsCount.ToString();

            SolidBrush redBrush  = new SolidBrush(Color.IndianRed);
            SolidBrush drawBrush = new SolidBrush(Color.White);

            Font bigFont = new Font(gm.FontFamily, gm.MedFontSize);

            gm.graphics.DrawImage(gm.reds, gm.SWidth, (lineOffset + Line) * gm.SHeight + gm.SWidth / 2, gm.SWidth, gm.SWidth);
            gm.graphics.DrawString(starLine, bigFont, redBrush, gm.SWidth * 2, (lineOffset + Line) * gm.SHeight + gm.SWidth / 2);

            redBrush.Dispose();
            drawBrush.Dispose();

            bigFont.Dispose();
        }
Пример #7
0
 public override int Execute(GraphicsManager gm, int lineOffset, SettingsManager sm)
 {
     for (int i = 0; i < gm.Ld.starsShown; i++)
     {
         if ((StarMask & (1 << i)) == 0)
         {
             continue;
         }
         float x          = (IsSecret ? gm.Width / 2 : 0) + (i + 1) * gm.SWidth;
         float y          = (lineOffset + Line) * gm.SHeight + gm.SOffset;
         bool  isAcquired = (StarByte & (1 << i)) != 0;
         if (isAcquired)
         {
             gm.graphics.DrawImage(FilledStar, x, y, gm.SWidth, gm.SWidth);
         }
     }
     return(0); //Line Actions should not increase global offset
 }
Пример #8
0
        public override int Execute(GraphicsManager gm, int lineOffset, SettingsManager sm)
        {
            bool isShown = sm.GetConfig(configureName, true);

            if (!isShown)
            {
                return(0);
            }

            SolidBrush drawBrush = new SolidBrush(Color.LightGreen);

            RectangleF   drawRect   = new RectangleF((IsSecret ? (gm.Width / 2) : 0), Line * gm.SHeight, gm.HalfWidth, gm.SHeight);
            StringFormat drawFormat = new StringFormat
            {
                Alignment     = StringAlignment.Near,
                LineAlignment = StringAlignment.Center
            };

            gm.graphics.DrawStringWithOutline(Text, gm.FontFamily, gm.DrawFontSize, drawBrush, Pens.Black, drawRect, drawFormat);

            drawBrush.Dispose();

            return(0);
        }
Пример #9
0
 public override int Execute(GraphicsManager gm, int lineOffset, SettingsManager sm)
 {
     throw new NotImplementedException();
 }
Пример #10
0
 public override int Execute(GraphicsManager gm, int lineOffset, SettingsManager sm)
 {
     gm.PaintHUD(lineOffset);
     return(0);
 }
Пример #11
0
 public override int Execute(GraphicsManager gm, int lineOffset, SettingsManager sm)
 {
     return(Length);
 }
Пример #12
0
 public override int Execute(GraphicsManager gm, int lineOffset, SettingsManager sm)
 {
     gm.LastSHA = this;
     return(0);
 }
Пример #13
0
        public override int Execute(GraphicsManager gm, int lineOffset, SettingsManager sm)
        {
            bool isShown = sm.GetConfig(configureName, true);

            if (!isShown)
            {
                return(0);
            }

            if (!sm.GetConfig(collectablesMinimizedConfigureName, false))
            {
                int[] textSizes = new int[8];
                for (int i = 0; i < 8; i++)
                {
                    int count = 0;
                    count += (i & 1) == 0 ? GetTextSize(TotalSecretsCount) : GetFullSize(TotalSecretsCount);
                    count += (i & 2) == 0 ? GetTextSize(TotalRedsCount) : GetFullSize(TotalRedsCount);
                    count += (i & 4) == 0 ? GetTextSize(TotalPanelsCount) : GetFullSize(TotalPanelsCount);
                    count += GetSpaceSize();
                    if (count > totalSize)
                    {
                        count = -1;
                    }
                    textSizes[i] = count;
                }
                int maxSize = textSizes.Max();
                int index   = Array.FindIndex(textSizes, a => a == maxSize);

                int offset = 2;
                if ((index & 2) == 0)
                {
                    offset += DrawTextReds(gm, lineOffset);
                }
                else
                {
                    offset += DrawFullReds(gm, lineOffset);
                }

                if (maxSize == totalSize)
                {
                    offset -= 1;
                }
                if ((index & 4) == 0)
                {
                    DrawTextFlipswitches(gm, offset, lineOffset);
                }
                else
                {
                    DrawFullFlipswitches(gm, offset, lineOffset);
                }

                if ((index & 1) == 0)
                {
                    DrawTextSecrets(gm, lineOffset);
                }
                else
                {
                    DrawFullSecrets(gm, lineOffset);
                }
            }
            else
            {
                if (TotalRedsCount != 0)
                {
                    DrawTextReds(gm, lineOffset);
                }
                if (TotalSecretsCount != 0)
                {
                    DrawTextSecrets(gm, lineOffset);
                }
            }
            return(2);
        }
Пример #14
0
 public abstract int Execute(GraphicsManager gm, int lineOffset, SettingsManager sm); //returns taken size
Пример #15
0
 public abstract void DrawBase(GraphicsManager gm, int lineNumber, bool isSecret);
        public MainWindow()
        {
            InitializeComponent();

            ld = LayoutDescriptionEx.GenerateDefault();

            // We need big enough picture to perform tests
            Image randomImage = new Bitmap(300, 50);

            gm = new GraphicsManager(Graphics.FromImage(randomImage), ld);
            starPicture.Image = randomImage;
            mm = new MemoryManager(null);
            um = new UpdateManager();

            try
            {
                LoadSettings();
            }
            catch (Exception)
            {
                sm = new SettingsManager();
            }

            if (sm == null || !sm.isValid())
            {
                sm = new SettingsManager();
            }

            DrawIntro();
            ResetForm();

            magicThread = new Thread(doMagicThread);
            magicThread.Start();

            timer = new System.Threading.Timer(UpdateStars, null, 1, Timeout.Infinite);

            oldCRC = 0;

            fileMenuItems    = new ToolStripMenuItem[4];
            fileMenuItems[0] = fileAToolStripMenuItem;
            fileMenuItems[1] = fileBToolStripMenuItem;
            fileMenuItems[2] = fileCToolStripMenuItem;
            fileMenuItems[3] = fileDToolStripMenuItem;

            IEnumerable <Type> types = Action.GetAllSubclasses();

            componentsClasses = new List <Type>();

            foreach (Type type in types)
            {
                MethodInfo info = type.GetMethod("DrawConfigs");
                if (info == null)
                {
                    continue;
                }

                componentsClasses.Add(type);
            }

            starPicture.Width  = this.Width;
            starPicture.Height = this.Height;
        }