Ejemplo n.º 1
0
        protected override void OnGotContext(RenderContext context)
        {
            base.OnGotContext(context);

            var settings     = Program.Settings;
            var theaterDays  = Game.AsTheaterDays();
            var debugOverlay = theaterDays.FindSingleElement <DebugOverlay>();

            var gamingArea = theaterDays.FindSingleElement <GamingArea>();

            if (gamingArea == null)
            {
                throw new InvalidOperationException();
            }

            if (settings.Images.Notes == null || settings.Images.Notes.Length == 0)
            {
                if (debugOverlay != null)
                {
                    debugOverlay.AddLine("WARNING: default notes image strip is not specified.");
                }
            }
            else
            {
                _noteImages = new D2DImageStrip[settings.Images.Notes.Length];

                for (var i = 0; i < settings.Images.Notes.Length; ++i)
                {
                    var notesImageEntry = settings.Images.Notes[i];
                    if (notesImageEntry == null)
                    {
                        continue;
                    }

                    if (notesImageEntry.File == null || !File.Exists(notesImageEntry.File))
                    {
                        if (i == 0)
                        {
                            if (debugOverlay != null)
                            {
                                debugOverlay.AddLine($"WARNING: default notes image strip <{notesImageEntry.File ?? string.Empty}> is not found.");
                            }
                        }
                        else
                        {
                            if (debugOverlay != null)
                            {
                                debugOverlay.AddLine($"WARNING: notes image strip <{notesImageEntry.File ?? string.Empty}> is not found, falling back to default.");
                            }
                        }
                        continue;
                    }

                    var imageStrip = Direct2DHelper.LoadImageStrip(context, notesImageEntry.File, notesImageEntry.Count, notesImageEntry.Orientation);
                    _noteImages[i] = imageStrip;
                }
            }

            _tapPointImage = Direct2DHelper.LoadBitmap(context, settings.Images.TapPoint.FileName);
        }
Ejemplo n.º 2
0
 protected override void OnGotContext(RenderContext context)
 {
     base.OnGotContext(context);
     if (_filePath != null)
     {
         _bitmap = Direct2DHelper.LoadBitmap(context, _filePath);
     }
 }
Ejemplo n.º 3
0
 public ProcessBar(DeviceContext DC) : base(DC)
 {
     using (WICBitmap sc = Direct2DHelper.LoadBitmap("assets\\process.bmp"))
         using (D2DBitmap sc_cv = D2DBitmap.FromWicBitmap(HostDC, sc))
         {
             br = new BitmapBrush(HostDC, sc_cv);
         }
     br.ExtendModeX = ExtendMode.Mirror;
 }
Ejemplo n.º 4
0
        public void ReLoad(string path)
        {
            var old = buffer;

            buffer    = Direct2DHelper.LoadBitmap(path);
            PixelSize = new Size(buffer.Size.Width, buffer.Size.Height);
            old.Dispose();
            Updated = true;
        }
Ejemplo n.º 5
0
        protected override void OnGotContext(RenderContext context)
        {
            base.OnGotContext(context);

            var settings = Program.Settings;

            _auraImage     = Direct2DHelper.LoadBitmap(context, settings.Images.SpecialNoteAura.FileName);
            _socketImage   = Direct2DHelper.LoadBitmap(context, settings.Images.SpecialNoteSocket.FileName);
            _tapPointImage = Direct2DHelper.LoadBitmap(context, settings.Images.TapPoint.FileName);
        }
Ejemplo n.º 6
0
        protected override void OnGotContext(RenderContext context)
        {
            base.OnGotContext(context);

            var settings = Program.Settings;

            _textImage = Direct2DHelper.LoadBitmap(context, settings.Images.Combo.Text.FileName);

            var clientSize = context.ClientSize;
            var layout     = settings.UI.Combo.Text.Layout;

            var x = layout.X.ToActualValue(clientSize.Width);
            var y = layout.Y.ToActualValue(clientSize.Height);

            Location = new Point((int)x, (int)y);
        }
Ejemplo n.º 7
0
 public BitmapImage(string path)
 {
     buffer    = Direct2DHelper.LoadBitmap(path);
     PixelSize = new Size(buffer.Size.Width, buffer.Size.Height);
 }
Ejemplo n.º 8
0
        protected override void OnGotContext(RenderContext context)
        {
            base.OnGotContext(context);

            var settings = Program.Settings;

            var avatarCount  = settings.Images.Avatars.Length;
            var avatarImages = new D2DBitmap[avatarCount];

            for (var i = 0; i < avatarCount; ++i)
            {
                try {
                    var image = Direct2DHelper.LoadBitmap(context, settings.Images.Avatars[i].FileName);
                    avatarImages[i] = image;
                } catch (Exception ex) {
                    Debug.Print(ex.Message);
                }
            }

            var clientSize = context.ClientSize;
            var layout     = settings.UI.Avatars.Layout;
            var x          = layout.X.IsPercentage ? layout.X.Value * clientSize.Width : layout.X.Value;
            var y          = layout.Y.IsPercentage ? layout.Y.Value * clientSize.Height : layout.Y.Value;
            var w          = layout.Width.IsPercentage ? layout.Width.Value * clientSize.Width : layout.Width.Value;
            var h          = layout.Height.IsPercentage ? layout.Height.Value * clientSize.Height : layout.Height.Value;

            var   rects = new RectangleF[avatarCount];
            float radius;

            if (w >= h)
            {
                radius = h / 2;
                for (var i = 0; i < avatarCount; ++i)
                {
                    var cx   = (w - radius * 2) / (avatarCount - 1) * i;
                    var rect = new RectangleF(x + cx, y, radius * 2, radius * 2);
                    rects[i] = rect;
                }
            }
            else
            {
                radius = w / 2;
                for (var i = 0; i < avatarCount; ++i)
                {
                    var cy   = (h - radius * 2) / (avatarCount - 1) * i;
                    var rect = new RectangleF(x, y + cy, radius * 2, radius * 2);
                    rects[i] = rect;
                }
            }

            _avatarImages     = avatarImages;
            _avatarRectangles = rects;

            var gamingArea = Game.AsTheaterDays().FindSingleElement <GamingArea>();

            if (gamingArea == null)
            {
                throw new InvalidOperationException();
            }

            var scalingResults = gamingArea.ScaleResults;

            _borderPen = new D2DPen(context, Color.White, scalingResults.AvatarBorder.Width);
        }