Example #1
0
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(this.gameObject);
 }
Example #2
0
            public PartialView(Color color, bool rotate = false)
            {
                //    new[] {
                //    Colors.Black,
                //    color,
                //    Colors.Black
                //}.ToGradient(DefaultHeight / 2).Select(
                //    (c, i) =>
                //        new Rectangle
                //        {
                //            Fill = new SolidColorBrush(c),
                //            Width = DefaultWidth / 2,
                //            Height = 3,
                //        }.MoveTo(0, i * 2).AttachTo(this)
                //).ToArray();

                var bg1 = new bg1().AttachTo(this);

                var buildmode = new Canvas().AttachTo(this);

                buildmode_off = new buildmode().AttachTo(buildmode);
                buildmode_on  = new buildmode_on().AttachTo(buildmode);

                buildmode_on.Hide();

                this.SizeChanged +=
                    delegate
                {
                    //var Height = Width;

                    {
                        var a = new AffineTransform
                        {
                            Width  = 720,
                            Height = 720,



                            X2 = Width,
                            Y2 = Height,

                            X3 = 000,
                            Y3 = Height
                        };

                        if (rotate)
                        {
                            a.X1 = Width;
                            a.X3 = Width;
                            a.X2 = 0;
                        }

                        bg1.RenderTransform = a;
                    }
                    {
                        var a = new AffineTransform
                        {
                            Width  = 128,
                            Height = 128,


                            X1 = 0,
                            Y1 = Height - 64,

                            X2 = 64,
                            Y2 = Height,

                            X3 = 0,
                            Y3 = Height
                        };

                        if (!rotate)
                        {
                            a.X1 += Width - (64 + 32);
                            a.X3 += Width - (64 + 32);
                            a.X2 += Width - (64 + 32);
                        }
                        else
                        {
                            a.X1 = 64;
                            a.Y1 = Height;

                            a.X2 = 0;
                            a.Y2 = Height - 64;

                            a.X3 = 64;
                            a.Y3 = Height - 64;

                            a.X1 += 32;
                            a.X3 += 32;
                            a.X2 += 32;
                        }

                        buildmode_off.RenderTransform = a;
                        buildmode_on.RenderTransform  = a;
                    }
                };

                this.ClipToBounds = true;
                //this.ClipTo(0, 0, DefaultWidth / 2, DefaultHeight);
            }
            public PartialView(Color color, bool rotate = false)
            {
                //    new[] {
                //    Colors.Black,
                //    color,
                //    Colors.Black
                //}.ToGradient(DefaultHeight / 2).Select(
                //    (c, i) =>
                //        new Rectangle
                //        {
                //            Fill = new SolidColorBrush(c),
                //            Width = DefaultWidth / 2,
                //            Height = 3,
                //        }.MoveTo(0, i * 2).AttachTo(this)
                //).ToArray();

                var bg1 = new bg1().AttachTo(this);

                var buildmode = new Canvas().AttachTo(this);

                buildmode_off = new buildmode().AttachTo(buildmode);
                buildmode_on = new buildmode_on().AttachTo(buildmode);

                buildmode_on.Hide();

                this.SizeChanged +=
                    delegate
                    {
                        //var Height = Width;

                        {
                            var a = new AffineTransform
                            {
                                Width = 720,
                                Height = 720,



                                X2 = Width,
                                Y2 = Height,

                                X3 = 000,
                                Y3 = Height

                            };

                            if (rotate)
                            {
                                a.X1 = Width;
                                a.X3 = Width;
                                a.X2 = 0;
                            }

                            bg1.RenderTransform = a;
                        }
                        {
                            var a = new AffineTransform
                            {
                                Width = 128,
                                Height = 128,


                                X1 = 0,
                                Y1 = Height - 64,

                                X2 = 64,
                                Y2 = Height,

                                X3 = 0,
                                Y3 = Height

                            };

                            if (!rotate)
                            {
                                a.X1 += Width - (64 + 32);
                                a.X3 += Width - (64 + 32);
                                a.X2 += Width - (64 + 32);
                            }
                            else
                            {
                                a.X1 = 64;
                                a.Y1 = Height;

                                a.X2 = 0;
                                a.Y2 = Height - 64;

                                a.X3 = 64;
                                a.Y3 = Height - 64;

                                a.X1 += 32;
                                a.X3 += 32;
                                a.X2 += 32;
                            }

                            buildmode_off.RenderTransform = a;
                            buildmode_on.RenderTransform = a;
                        }
                    };

                this.ClipToBounds = true;
                //this.ClipTo(0, 0, DefaultWidth / 2, DefaultHeight);
            }