Ejemplo n.º 1
0
        private void PopButton_Activated()
        {
            var popupDialogue = new WinDialogPopup(5);

            AddChild(popupDialogue);
            popupDialogue.Show();

            //var background = new PopupBackground(Width, Height);
            //AddChild(background);
            //var textblock = new TextBlock(0,0, "Your mission is :", Height/50, CreateColor(255,255,255), HorizontalAlignment.Right);
            //var popup = new Popup(textblock, Height, Width);
            //AddChild(popup);

            //background.Show();
            //popup.Show();

            //popup.NextAction += () =>
            //{
            //    background.Hide();
            //};

            //popup.BackAction += () =>
            //{
            //    background.Hide();
            //};

            //background.Activated += () =>
            //{
            //    popup.HideLeft();
            //    background.Hide();
            //};
        }
Ejemplo n.º 2
0
        public async void Swipe(Direction direction)
        {
            if (IsBusy())
            {
                return;
            }

            if (_board != null && !_board.IsBusy)
            {
                _isBusy = true;

                var swipeResult = await _board.Swipe(direction);

                if (swipeResult.DeadGems.Count == 0 &&
                    swipeResult.FusedGems.Count == 0 &&
                    swipeResult.MovedGems.Count == 0)
                {
                    // Invalid swipe
                    Logger.Log("invalid swipe");
                    _isBusy = false;
                    return;
                }


                if (EvalWinStatus())
                {
                    Logger.Log("evalwin");
                    await Task.Delay(1000);

                    // WIN

                    PlayerDataService.Instance.UpdateLevelProgress(_currentLevelId, LevelProgressStatus.Completed);
                    PlayerLifeService.Instance.GainLife();
                    await Task.Delay(1000);

                    var dialogPopup = new WinDialogPopup(5);
                    PopupService.Instance.ShowPopup(dialogPopup);
                    dialogPopup.NextCommand = () =>
                    {
                        var worldId = _worldDataRepository.GetWorldIdByLevelId(_currentLevelId);

                        Navigator.Instance.GoTo(PageType.Map, worldId);
                    };
                    dialogPopup.BackCommand = () =>
                    {
                        Navigator.Instance.GoTo(PageType.Game, _currentLevelId);
                    };


                    BackgroundNextBoard();
                }
                else
                {
                    // Shards
                    //HandleShards(swipeResult);


                    // Events
                    await Task.Delay(500);

                    // LOSE
                    // TO Update move count logic
                    if (false)
                    {
                        await Task.Delay(1000);

                        var dialogPopup = new LoseDialogPopup();
                        PopupService.Instance.ShowPopup(dialogPopup);
                        dialogPopup.NextCommand = () =>
                        {
                            Navigator.Instance.GoTo(PageType.Game, _currentLevelId);
                        };
                        dialogPopup.BackCommand = () =>
                        {
                            Navigator.Instance.GoTo(PageType.Map);
                        };
                    }
                    else
                    {
                        _isBusy = false;
                    }
                }
            }
        }