Example #1
0
        public void Init(Window main_window)
        {
            _main_window = main_window;
            m_theatre    = new Shinengine.Theatre.Theatre(BG, Usage, SBK, AirPt, character_usage, Lines, character, ShowIn, _Contents);

            #region logo
            m_logo = new Direct2DImage(new SharpDX.Size2((int)logo_frames[0].Size.Width, (int)logo_frames[0].Size.Height), 30)
            {
                Loadedsouce = logo_frames
            };
            m_logo.DrawProc += (t, s, w, h) =>
            {
                var frames = s as List <WICBitmap>;

                if (ims == frames.Count)
                {
                    ims = 0;
                }
                t.View.BeginDraw();
                t.View.Clear(null);
                D2DBitmap parl_map = D2DBitmap.FromWicBitmap(t.View, frames[ims]);
                t.View.DrawBitmap(parl_map, 1, InterpolationMode.Anisotropic);
                t.View.EndDraw();

                ims++;
                parl_map.Dispose();
                return(DrawProcResult.Normal);
            };
            m_logo.DrawStartup(Logo);


            #endregion
        }
Example #2
0
        public Character(Theatre father, string name, string template, bool canshow = true, double?time = null, bool isAscy = true, double vel_x = 0, double vel_y = 0)
        {
            var layer = father.CharacterLayer;

            m_father = father;
            ManualResetEvent msbn = new ManualResetEvent(false);

            _name = name;

            if (time == null)
            {
                time = SharedSetting.SwitchSpeed;
            }
            layer.Dispatcher.Invoke(new Action(() =>
            {
                whereIsShowed = layer;

                Init_action = Stage.LoadBitmap(template);

                shower = new Image
                {
                    Width             = Init_action.Size.Width * (layer.Height / Init_action.Size.Height),
                    Height            = layer.Height,
                    VerticalAlignment = VerticalAlignment.Bottom,
                    Stretch           = Stretch.Fill,

                    Margin = new Thickness(vel_x, 0, 0, vel_y)
                };
                if (time != 0 || !canshow)
                {
                    shower.Opacity = 0;
                }
                whereIsShowed.Children.Add(shower);

                Direct2DImage direct2DImage = new Direct2DImage(new Size2((int)shower.Width, (int)shower.Height), 30);
                direct2DImage.DrawProc     += (View, Souce, Width, Height) =>
                {
                    D2DBitmap m_bp = D2DBitmap.FromWicBitmap(View.View, Init_action, new BitmapProperties1(new PixelFormat(Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied)));

                    View.View.BeginDraw();
                    View.View.Clear(null);

                    View.View.DrawBitmap(m_bp,
                                         new RawRectangleF(0, 0, Width, Height),
                                         1, SharpDX.Direct2D1.BitmapInterpolationMode.Linear,
                                         new RawRectangleF(0, 0, Init_action.Size.Width, Init_action.Size.Height));

                    View.View.EndDraw();

                    m_bp.Dispose();
                    return(DrawProcResult.Death);
                };

                direct2DImage.Disposing += (e, s) =>
                {
                    Last_Draw = s.LastDraw;
                    msbn.Set();
                };

                direct2DImage.DrawStartup(shower);
            }));
            msbn.WaitOne();
            msbn.Dispose();
            if (!canshow)
            {
                return;
            }


            EasyAmal aml = new EasyAmal(shower, "(Opacity)", 0.0, 1.0, (double)time);

            aml.Start(isAscy);
        }//已经确认过安全的代码,再次修改需要小心
Example #3
0
 public DynamicCharacter(Theatre father, string name, string template, bool canshow = true, double?time = null, bool isAscy = true, double vel_x = 0, double vel_y = 0)
     : base(father, name, template, canshow, time, isAscy, vel_x, vel_y)
 {
 }