Пример #1
0
        public override void Create()
        {
            base.Create();

            BitmapTextMultiline text = null;

            if (!NoText)
            {
                text          = CreateMultiline(Txt, 8);
                text.MaxWidth = WIDTH;
                text.Measure();
                Add(text);
            }

            _amulet = new Image(Assets.AMULET);
            Add(_amulet);

            var btnExit = new RedButton(TxtExit);

            btnExit.ClickAction = button =>
            {
                Dungeon.Win(ResultDescriptions.WIN);
                Dungeon.DeleteGame(Dungeon.Hero.heroClass, true);
                if (NoText)
                {
                    Game.SwitchScene <TitleScene>();
                }
                else
                {
                    Game.SwitchScene <RankingsScene>();
                }
            };
            btnExit.SetSize(WIDTH, BtnHeight);
            Add(btnExit);

            var btnStay = new RedButton(TxtStay);

            btnStay.ClickAction = button => OnBackPressed();
            btnStay.SetSize(WIDTH, BtnHeight);
            Add(btnStay);

            float height;

            if (NoText)
            {
                height = _amulet.Height + LargeGap + btnExit.Height + SmallGap + btnStay.Height;

                _amulet.X = Align((Camera.Main.CameraWidth - _amulet.Width) / 2);
                _amulet.Y = Align((Camera.Main.CameraHeight - height) / 2);

                btnExit.SetPos((Camera.Main.CameraWidth - btnExit.Width) / 2, _amulet.Y + _amulet.Height + LargeGap);
                btnStay.SetPos(btnExit.Left(), btnExit.Bottom() + SmallGap);
            }
            else
            {
                height = _amulet.Height + LargeGap + text.Height + LargeGap + btnExit.Height + SmallGap + btnStay.Height;

                _amulet.X = Align((Camera.Main.CameraWidth - _amulet.Width) / 2);
                _amulet.Y = Align((Camera.Main.CameraHeight - height) / 2);

                text.X = Align((Camera.Main.CameraWidth - text.Width) / 2);
                text.Y = _amulet.Y + _amulet.Height + LargeGap;

                btnExit.SetPos((Camera.Main.CameraWidth - btnExit.Width) / 2, text.Y + text.Height + LargeGap);
                btnStay.SetPos(btnExit.Left(), btnExit.Bottom() + SmallGap);
            }

            new Flare(8, 48).Color(0xFFDDBB, true).Show(_amulet, 0).AngularSpeed = +30;

            FadeIn();
        }