Пример #1
0
 private void SettingButtonOnTapped(SettingButton tappedButton)
 {
     ActivateDialog(tappedButton);
     foreach (SettingButton settingButton in _listOfSettingButtons.Where(e => e != tappedButton))
     {
         settingButton.Hide(tappedButton.OriginalY);
     }
 }
Пример #2
0
        private Task FocusButton(SettingButton settingButton)
        {
            PlayerLifeService.Instance.GainLife();

            return(settingButton.Focus(_topMargin + _y));
            //settingButton.Animate("FocusButton", p => settingButton.Y = (float)p, settingButton.Y, _topMargin, 8, (uint)_animationMs,
            //    Easing.CubicInOut);
            //return Task.Delay(_animationMs);
        }
Пример #3
0
        public SettingsPanel(float x, float y, float width, float height) : base(x, y, height, width)
        {
            PanelWidth  = Width;
            PanelHeight = Height;
            //_x = Width + Width - PanelWidth;

            _topMargin    = PanelHeight / 10;
            _blockMargin  = PanelHeight / 12;
            _buttonMargin = PanelHeight / 16;
            _buttonHeight = PanelHeight / 40;


            _dialogHeight = PanelHeight - PanelHeight / 4;
            _dialogWidth  = PanelWidth - PanelWidth / 4;

            _dialogExpanding = false;

            _settingDialog = new SettingDialog(0 + (PanelWidth - _dialogWidth) / 2, _topMargin + _buttonMargin + 2 * _buttonHeight, _dialogWidth, _dialogHeight, this);
            AddChild(_settingDialog);

            _buttonContainer = new Container();
            AddChild(_buttonContainer);

            _listOfSettingOptions = new List <IList <SettingsEnum> >()
            {
                new List <SettingsEnum>()
                {
                    SettingsEnum.GetLife
                },

                new List <SettingsEnum>()
                {
                    SettingsEnum.Language,
                    SettingsEnum.Sound,
                    SettingsEnum.Support,
                },
                new List <SettingsEnum>()
                {
                    SettingsEnum.RateUs,
                    SettingsEnum.ConnectWithFriends,
                    SettingsEnum.OtherGames,
                },

                new List <SettingsEnum>()
                {
                    SettingsEnum.ResetAccount,
                },
            };

            _listOfSettingButtons = new List <SettingButton>();
            float buttonY = _topMargin - _blockMargin - _buttonMargin;

            foreach (IList <SettingsEnum> blockOfOptions in _listOfSettingOptions)
            {
                buttonY += _blockMargin;

                foreach (SettingsEnum settingOption in blockOfOptions)
                {
                    buttonY += _buttonMargin;

                    SettingButton settingButton = new SettingButton(PanelWidth / 2, buttonY, _buttonHeight, settingOption, this);
                    _listOfSettingButtons.Add(settingButton);
                    _buttonContainer.AddContent(settingButton);

                    buttonY += _buttonHeight;

                    settingButton.Activated += () => SettingButtonOnTapped(settingButton);
                }
            }

            _menuLength = buttonY + _topMargin;

            DeclareTappable(this);

            Pan += (p) => MoveToY((float)p.Y);
            Up  += Release;

            _opacity = 1;

            //recoverButton.Activated += () =>
            //{
            //    PlayerLifeService.Instance.GainLife();
            //};

            //backButton.Activated += () =>
            //{
            //    Navigator.Instance.GoTo(PageType.Map);
            //    Hide();
            //};
        }
Пример #4
0
        private async void ActivateDialog(SettingButton settingButton)
        {
            await FocusButton(settingButton);

            _settingDialog.Expand(settingButton.SettingName);
        }