Exemple #1
0
        private async Task AnimateAllCardsBackToDeck(double duration = Double.MaxValue)
        {
            CountControl.Hide();
            if (duration == Double.MaxValue)
            {
                duration = MainPage.AnimationSpeeds.Medium;
            }

            // flip the cards and then move them for a nice affect

            List <Task <object> > list = new List <Task <object> >();

            GridPlayer.FlipAllCards(CardOrientation.FaceDown, list);
            GridPlayer.MoveAllCardsToTarget(GridDeck, list, duration);

            GridCrib.FlipAllCards(CardOrientation.FaceDown, list);
            GridCrib.MoveAllCardsToTarget(GridDeck, list, duration);

            GridPlayedCards.FlipAllCards(CardOrientation.FaceDown, list);
            GridPlayedCards.MoveAllCardsToTarget(GridDeck, list, duration);

            GridComputer.FlipAllCards(CardOrientation.FaceDown, list);
            GridComputer.MoveAllCardsToTarget(GridDeck, list, duration);

            foreach (CardView card in GridDeck.Items)
            {
                card.Reset();
            }

            GridDeck.UpdateCardLayout(list, duration, false);

            await Task.WhenAll(list);
        }
Exemple #2
0
        private async Task DealAnimation(HandsFromServer hfs, double duration = Double.MaxValue)
        {
            if (duration == Double.MaxValue)
            {
                duration = MainPage.AnimationSpeeds.Medium;
            }
            CardView card;
            List <Task <Object> > tasks = new List <Task <object> >();

            for (int i = 0; i < 6; i++)
            {
                card = hfs.PlayerCards[i];
                card.BoostZindex();
                card.Owner = Owner.Player;
                GridDeck.MoveCardToTarget(card, GridPlayer, tasks, duration, true);
                card       = hfs.ComputerCards[i];
                card.Owner = Owner.Computer;
                card.BoostZindex();
                GridDeck.MoveCardToTarget(card, GridComputer, tasks, duration, true);
            }

            await Task.WhenAll(tasks);

            await GridPlayer.FlipAllCards(CardOrientation.FaceUp, duration);

            for (int i = 0; i < 6; i++)
            {
                GridPlayer.Items[i].ResetZIndex();
                GridComputer.Items[i].ResetZIndex();
            }

            hfs.SharedCard.BoostZindex(ZIndexBoost.SmallBoost);
        }
Exemple #3
0
        private async Task AnimateCribCardsToOwner(PlayerType owner)
        {
            CardContainer cribOwner = GridPlayer;

            if (owner == PlayerType.Computer)
            {
                cribOwner = GridComputer;
            }

            List <Task <Object> > tasks = new List <Task <object> >();

            //
            //  return player and computer cards to the deck

            GridPlayer.FlipAllCards(CardOrientation.FaceDown, tasks);
            GridPlayer.MoveAllCardsToTarget(GridDeck, tasks, MainPage.AnimationSpeeds.Medium, true);
            GridComputer.FlipAllCards(CardOrientation.FaceDown, tasks);
            GridComputer.MoveAllCardsToTarget(GridDeck, tasks, MainPage.AnimationSpeeds.Medium, true);


            //
            //  move crib cards back to player
            GridCrib.MoveAllCardsToTarget(cribOwner, tasks, MainPage.AnimationSpeeds.Medium, true);
            cribOwner.FlipAllCards(CardOrientation.FaceUp, tasks);
            await Task.WhenAll(tasks);
        }
        public async Task <bool> DroppedCards(Point point, List <CardView> cards)
        {
            bool acceptedCards = GridPlayedCards.HitTest(point);

            if (point.X - int.MaxValue < 2) // happens on double tap --
            {
                acceptedCards = true;
            }
            if (acceptedCards)
            {
                foreach (CardView card in cards)
                {
                    card.Selected = false;
                    GridPlayer.TransferCard(card, GridPlayedCards);
                }
                try
                {
                    int maxSel = await StateMachine.DroppedCards(cards); // this throws if the count > 31

                    GridPlayer.MaxSelected = maxSel;
                }
                catch (Exception)
                {
                    return(false);
                }
            }

            GridPlayedCards.UpdateCardLayoutAsync();
            GridPlayer.UpdateCardLayoutAsync();
            return(acceptedCards);
        }
        private async Task OnCountResetUpdateUi()
        {
            CountControl.UpdateLayout();

            await GridPlayedCards.UpdateCardLayout();

            await GridComputer.UpdateCardLayout();

            await GridPlayer.UpdateCardLayout();

            if (Settings.HitContinueOnGo == true)
            {
                await HintWindow_ShowAndWait("Go!\n\nHit Continue.");
            }
            else
            {
                await Task.Delay(1000);
            }
            foreach (CardView c in GridPlayedCards.Items)
            {
                c.SetOrientationAsync(CardOrientation.FaceDown, MainPage.AnimationSpeeds.Medium);
            }
            UpdateCount(0);
            CountControl.UpdateLayout();
        }
 void Awake()
 {
     anim   = GetComponent <Animator>();
     bosco  = GameObject.FindGameObjectWithTag("Bosco");
     b      = bosco.GetComponent <Bosco> ();
     player = GameObject.FindGameObjectWithTag("Player");
     p      = player.GetComponent <GridPlayer> ();
 }
Exemple #7
0
        public static GridPlayer ToPlayer(this DbPlayer dbPlayer, IGame game)
        {
            var actions = dbPlayer.Class.Actions.Select(aref => aref.Action).Select(action => new GridTargetAction()
            {
                Name       = action.Name,
                TargetType = action.TargetType,
                Id         = action.Id,
                Modifiers  = action.Modifiers.Select(m => (IActionModifier) new GridActionModifier()
                {
                    Name = m.Name, TargetType = m.TargetType, ModifierType = m.ModifierType, Min = m.Min, Max = m.Max
                }).ToList(),
                Element = new Element()
                {
                    Id = action.ElementType.Id, Name = action.ElementType.Name, TextColor = action.ElementType.TextColor, Ranges = action.ElementType.Ranges.Select(r => (IElementRange) new ElementRange()
                    {
                        Text = r.Text, Min = r.Min, Max = r.Max, TextColor = r.TextColor
                    }).ToList()
                }
            }).ToList();


            var player = new GridPlayer(
                dbPlayer.Id,
                dbPlayer.Name,
                new List <EntityType>()
            {
                EntityType.Normal, EntityType.Combat
            },
                new List <IEntityComponent>()
            {
            },
                dbPlayer.Items.Select(dbItem => dbItem.BaseItem.ToItem(
                                          dbItem.Stats.Select(s =>
                                                              new BasicStat(s.Name, s.Base, s.Current)).ToList()
                                          )).ToList(),
                dbPlayer.Stats.Select(s => new BasicStat(s.Name, s.Base, s.Current)).ToList(),
                game.World.Maps.FirstOrDefault(m => m.Id == dbPlayer.LastMap)
                );

            player.EntityTypes.ForEach(e =>
            {
                switch (e)
                {
                case EntityType.Combat:
                    var playerIntelligence = new PlayerIntelligence(actions.FirstOrDefault());
                    player.EntityComponents.Add(new GridCombatant()
                    {
                        AllowedActions = actions, Intelligence = playerIntelligence
                    });
                    playerIntelligence.Configure(player);
                    break;
                }
            });

            return(player);
        }
        public async void UpdateAllCardGrids(double duration = Double.MaxValue, bool rotate = false)
        {
            foreach (CardView card in Deck.Cards)
            {
                GridDeck.SetCardSize(card);
            }

            List <Task <object> > taskList = new List <Task <object> >();

            GridDeck.UpdateCardLayout(taskList, duration, rotate);
            GridPlayer.UpdateCardLayout(taskList, duration, rotate);
            GridComputer.UpdateCardLayout(taskList, duration, rotate);
            GridPlayedCards.UpdateCardLayout(taskList, duration, rotate);
            GridCrib.UpdateCardLayout(taskList, duration, rotate);
            await Task.WhenAll(taskList);
        }
Exemple #9
0
 void Start()
 {
     lineRenderer = gameObject.GetComponent <LineRenderer>();
     playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent <GridPlayer>();
 }
 public void Configure(IEntity entity)
 {
     Player = (GridPlayer)entity;
 }
Exemple #11
0
	void Start () 
    {
        lineRenderer = gameObject.GetComponent<LineRenderer>();
        playerScript = GameObject.FindGameObjectWithTag("Player").GetComponent<GridPlayer>();
	}