Example #1
0
        public void CheckForWin()
        {
            // Check for Winning here
            // ***************************************************************************************
            Class.Structure.Info infoR = Class.Structure.CheckWinning(this.MStructures);
            // ***************************************************************************************
            if (infoR.OK)
            {
                Class.ExtendendList <Class.Cart> toRemove = new Class.ExtendendList <Class.Cart>();
                for (int i = infoR.CurrentStructure.lstCards.IndexOf(infoR.SelectedCart); i <= infoR.CurrentStructure.lstCards.Count - 1; i++)
                {
                    toRemove.Add(infoR.CurrentStructure.lstCards[i]);
                }

                // 0 ... 1 it doesn't matter
                Cart.GameMode currentMode = toRemove[0].GameMode_;

                foreach (Class.Cart toRem in toRemove)
                {
                    infoR.CurrentStructure.lstCards.Remove(toRem);
                }
                this.ReDraw();

                // Add a structure wird currentMode to the array.
                this.WinningCards[WCounter++] = new SpecialCard(currentMode);
                this.ReDraw();

                foreach (Class.Structure s in this.MStructures)
                {
                    if (s.lstCards.Count != 0)
                    {
                        if (!(s.lstCards[s.lstCards.Count - 1].Active))
                        {
                            s.lstCards[s.lstCards.Count - 1].Active = true;
                        }
                    }
                }
            }
            bool gameend = false;

            foreach (Class.Structure current in this.MStructures)
            {
                gameend = (current.lstCards.Count == 0);
                if (!gameend)
                {
                    break;
                }
            }
            this.endOfGame = gameend;
            this.throwEvent();
            // ---------------------------------------------------------------------------------------
        }
Example #2
0
        public Class.ExtendendList <Class.Cart> GetShouldSelectedCards(Class.Structure.Info strM)
        {
            Class.ExtendendList <Class.Cart> shouldSelected = new Class.ExtendendList <Class.Cart>();
            // Select carts, which are under this cart
            int index = strM.CurrentStructure.lstCards.IndexOf(strM.SelectedCart);

            if (index != -1)
            {
                for (int i = index; i <= strM.CurrentStructure.lstCards.Count - 1; i++)
                {
                    Class.Cart current = strM.CurrentStructure.lstCards[i];
                    shouldSelected.Add(current);
                }
            }
            return(shouldSelected);
        }