Пример #1
0
        protected internal virtual void SwitchScene()
        {
            Camera.Reset();

            if (Scene != null)
            {
                Scene.Destroy();
            }

            scene = requestedScene;
            scene.Create();

            Elapsed   = 0f;
            timeScale = 1f;
        }
Пример #2
0
        public override void Create()
        {
            base.Create();

            GameScene.Scene = null;

            defaultZoom = (int)Math.Ceiling(Game.density * 2.5);
            while ((Game.Width / defaultZoom < MIN_WIDTH || Game.Height / defaultZoom < MIN_HEIGHT) && defaultZoom > 1)
            {
                defaultZoom--;
            }

            landscapeAvailable = Game.Height / defaultZoom >= MIN_WIDTH && Game.Width / defaultZoom >= MIN_HEIGHT;

            if (PixelDungeon.ScaleUp())
            {
                while ((Game.Width / (defaultZoom + 1) >= MIN_WIDTH && Game.Height / (defaultZoom + 1) >= MIN_HEIGHT))
                {
                    defaultZoom++;
                }
            }

            minZoom = 1;
            maxZoom = defaultZoom * 2;


            Camera.Reset(new PixelCamera(defaultZoom));

            float uiZoom = defaultZoom;

            uiCamera = Camera.CreateFullscreen(uiZoom);
            Camera.Add(uiCamera);

            if (font1x == null)
            {
                // 3x5 (6)
                font1x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS1X), Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font1x.BaseLine = 6;
                font1x.tracking = -1;

                // 5x8 (10)
                font15x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS15X), 12, Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font15x.BaseLine = 9;
                font15x.tracking = -1;

                // 6x10 (12)
                font2x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS2X), 14, Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font2x.BaseLine = 11;
                font2x.tracking = -1;

                // 7x12 (15)
                font25x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS25X), 17, Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font25x.BaseLine = 13;
                font25x.tracking = -1;

                // 9x15 (18)
                font3x          = Font.ColorMarked(BitmapCache.Get(Assets.FONTS3X), 22, Android.Graphics.Color.Argb(0x00, 0x00, 0x00, 0x00), Font.LatinFull);
                font3x.BaseLine = 17;
                font3x.tracking = -2;
            }

            Sample.Instance.Load(Assets.SND_CLICK, Assets.SND_BADGE, Assets.SND_GOLD);
        }