Пример #1
0
        public void SelectUnselectPile(int pile)
        {
            var thisPile = PileList[pile];

            if (thisPile.IsSelected)
            {
                thisPile.IsSelected = false;
                return;
            }
            PileList.ForEach(tempPile => tempPile.IsSelected = false);
            thisPile.IsSelected = true;
        }
 public void RenderSvgTree(CustomBasicList <object> objects, int k, RenderTreeBuilder builder)
 {
     objects.ForEach(obj =>
     {
         RenderSvgTree(obj, k, builder);
     });
 }
Пример #3
0
        private static string GetPoints(this CustomBasicList <PointF> points)
        {
            StrCat cats = new StrCat();

            points.ForEach(x => cats.AddToString($"{x.X}, {x.Y}", " "));
            return(cats.GetInfo());
        }
Пример #4
0
        public void LoadCharacters(CustomBasicList <int> newCol)
        {
            var output = new CustomBasicList <EnumNameList>();

            newCol.ForEach(thisItem => output.Add(thisItem.ToEnum <EnumNameList>()));
            LoadCharacters(output);
        }
Пример #5
0
        private async Task CreateSetsAsync(string message)
        {
            var firstTemp = await js.DeserializeObjectAsync <CustomBasicList <string> >(message);

            SingleInfo = PlayerList !.GetWhoPlayer(); //trying this as well.
            foreach (var thisFirst in firstTemp)
            {
                CustomBasicList <int> thisCol = await js.DeserializeObjectAsync <CustomBasicList <int> >(thisFirst);

                thisCol.ForEach(deck =>
                {
                    CustomBasicList <int> otherList = SingleInfo.MainHandList.GetDeckListFromObjectList();
                    string thisstr = "";
                    otherList.ForEach(thisItem =>
                    {
                        thisstr += thisItem + ",";
                    });
                    if (SingleInfo.MainHandList.ObjectExist(deck) == false)
                    {
                        throw new BasicBlankException($"Deck of {deck} does not exist.  Player Is {SingleInfo.NickName}. ids are {thisstr} ");
                    }
                });
                var ThisCol = await thisFirst.GetObjectsFromDataAsync(SingleInfo.MainHandList);

                AddSet(ThisCol);
            }
        }
        public static CustomBasicList <CustomBasicList <RegularSimpleCard> > PossibleCombinations(this IDeckDict <RegularSimpleCard> thisList, EnumColorList whatColor, int maxs)
        {
            if (maxs < 3 && whatColor == EnumColorList.Red)
            {
                throw new BasicBlankException("Attack must allow 3 cards for combinations");
            }
            int mins;

            if (whatColor == EnumColorList.Red)
            {
                mins = 2;
            }
            else
            {
                mins = 1;
            }
            int x;
            CustomBasicList <int> firstList = new CustomBasicList <int>();
            var loopTo = maxs;

            for (x = mins; x <= loopTo; x++)
            {
                firstList.Add(x);
            }
            var newList = thisList.Where(items => items.Color == whatColor).ToCustomBasicList();
            CustomBasicList <CustomBasicList <RegularSimpleCard> > fullList = new CustomBasicList <CustomBasicList <RegularSimpleCard> >();

            firstList.ForEach(y =>
            {
                var thisCombo = newList.GetCombinations(y);
                fullList.AddRange(thisCombo);
            });
            return(fullList); //looks like has to return a standard list for this one.
        }
        public LifeBoardGameMainView(IEventAggregator aggregator,
                                     IGamePackageRegister register,
                                     GameBoardGraphicsCP graphicsCP
                                     )
        {
            _aggregator = aggregator;
            _aggregator.Subscribe(this);
            Grid grid = new Grid();

            AddAutoColumns(grid, 1);
            AddLeftOverColumn(grid, 70);
            AddLeftOverColumn(grid, 30);//i think split 50/50 is fine.
            SimpleLabelGrid firstInfo = new SimpleLabelGrid();

            firstInfo.AddRow("Turn", nameof(LifeBoardGameMainViewModel.NormalTurn));
            firstInfo.AddRow("Instructions", nameof(LifeBoardGameMainViewModel.Instructions));
            firstInfo.AddRow("Status", nameof(LifeBoardGameMainViewModel.Status));

            StackPanel stack = new StackPanel();

            stack.Margin = new Thickness(3);
            stack.Children.Add(firstInfo.GetContent);
            AddVerticalLabelGroup("Space Details", nameof(LifeBoardGameMainViewModel.GameDetails), stack);
            AddControlToGrid(grid, stack, 0, 2);
            //on tablets will be different.

            GameBoardWPF gameBoard = new GameBoardWPF(aggregator);

            gameBoard.VerticalAlignment = VerticalAlignment.Top;
            register.RegisterControl(gameBoard.Element, "");
            graphicsCP.LinkBoard();
            AddControlToGrid(grid, gameBoard, 0, 0);
            gameBoard.Margin = new Thickness(3);
            stack            = new StackPanel();
            //everything else will go to this stack.
            stack.Margin = new Thickness(3);

            Type type = typeof(LifeBoardGameMainViewModel);
            CustomBasicList <string> list = type.GetProperties(x => x.Name.EndsWith("Screen") && x.Name != "MainScreen" && x.Name != "BoardScreen").Select(x => x.Name).ToCustomBasicList();

            if (list.Count == 0)
            {
                throw new BasicBlankException("No screens found using reflection.  Rethink");
            }
            list.ForEach(x =>
            {
                ParentSingleUIContainer middle = new ParentSingleUIContainer()
                {
                    Name = x,
                    HorizontalAlignment = HorizontalAlignment.Left
                                          //Margin = new Thickness(5)
                };
                stack.Children.Add(middle);
            });
            AddControlToGrid(grid, stack, 0, 1);
            Content = grid;
        }
Пример #8
0
        private void ProcessBirthday()
        {
            decimal moneyGained = (_gameContainer.PlayerList.Count() - 1) * 100;

            _gameContainer.SingleInfo !.MoneyHas += moneyGained;
            CustomBasicList <PaydayPlayerItem> tempList = _gameContainer.PlayerList.Where(items => items.Id != _gameContainer.WhoTurn).ToCustomBasicList();

            tempList.ForEach(x => x.ReduceFromPlayer(100));
        }
Пример #9
0
        public CustomBasicList <YahtzeeResults> GetResults(CustomBasicList <ComboCardInfo> combinationList, CustomBasicList <ICard> cardList) // 0 means no results found
        {
            CustomBasicList <YahtzeeResults> resultList = new CustomBasicList <YahtzeeResults>();

            combinationList.ForEach(thisCombo =>
            {
                _firstNumber  = 0;
                _secondNumber = 0;
                var tempList  = cardList.ToCustomBasicList();
                if (thisCombo.FirstSet > 0 && thisCombo.SecondSet > 0)
                {
                    if (HasFullHouse(tempList) == true)
                    {
                        if (_firstNumber == 0 || _secondNumber == 0)
                        {
                            throw new BasicBlankException("Must have a first and second number used");
                        }
                        resultList.Add(new YahtzeeResults()
                        {
                            NumberUsed = _firstNumber + _secondNumber, Points = thisCombo.Points
                        });
                    }
                }
                else if (thisCombo.FirstSet > 0)
                {
                    if (HasKinds(tempList, thisCombo.FirstSet) == true)
                    {
                        if (_firstNumber == 0)
                        {
                            throw new Exception("Must have a number used for the kinds");
                        }
                        resultList.Add(new YahtzeeResults()
                        {
                            NumberUsed = _firstNumber, Points = thisCombo.Points
                        });
                    }
                }
                else if (thisCombo.NumberInStraight > 0)
                {
                    if (HasStraight(tempList, thisCombo.NumberInStraight) == true)
                    {
                        resultList.Add(new YahtzeeResults()
                        {
                            NumberUsed = _firstNumber, Points = thisCombo.Points
                        });
                    }
                }
                else
                {
                    throw new Exception("Invalid Combo");
                }
            });
            resultList = (from items in resultList
                          orderby items.Points descending, items.NumberUsed descending
                          select items).ToCustomBasicList();
            return(resultList);
        }
        //something else has to register network classes because its unknown at this point.


        public static void RegisterNonSavedClasses <V>(this IGamePackageRegister thisContainer)
        {
            //thisContainer.RegisterSingleton<ListContainer, ListContainer>(); //maybe try it here now.
            thisContainer.RegisterSingleton <IPlayOrder, PlayOrderClass>();
            Assembly thisAssembly           = Assembly.GetAssembly(typeof(V)) !;
            CustomBasicList <Type> thisList = thisAssembly.GetTypes().Where(items => items.HasAttribute <SingletonGameAttribute>()).ToCustomBasicList();

            thisList.ForEach(items =>
            {
                thisContainer.RegisterSingleton(items);
            });

            thisList = thisAssembly.GetTypes().Where(items => items.HasAttribute <InstanceGameAttribute>()).ToCustomBasicList();
            thisList.ForEach(items =>
            {
                thisContainer.RegisterInstanceType(items);
            });
        }
Пример #11
0
        public async Task <DeckObservableDict <D> > GetListFromJsonAsync(string jsonData)
        {
            bool doRedo = RedoList();
            CustomBasicList <int> thisList = await js.DeserializeObjectAsync <CustomBasicList <int> >(jsonData);

            CustomBasicList <D> tempList = new CustomBasicList <D>();

            if (doRedo == true)
            {
                thisList.ForEach(Items =>
                {
                    D thisD = new D();
                    _beforePopulate !.Invoke(thisD); //sometimes something has to be done before the card can be populated.
                    thisD.Populate(Items);
                    tempList.Add(thisD);
                });
                _privateDict.AddRange(tempList, System.Collections.Specialized.NotifyCollectionChangedAction.Add);
                return(new DeckObservableDict <D>(tempList));
            }
            if (_privateDict.Count == thisList.Count)
            {
                FixObjects();
                DeckRegularDict <D> newTemp = new DeckRegularDict <D>(_privateDict);
                thisList.ForEach(Items =>
                {
                    tempList.Add(newTemp.GetSpecificItem(Items));
                });
                _privateDict.ReplaceRange(tempList);
                return(new DeckObservableDict <D>(tempList));
            }
            UnlinkObjects();
            thisList.ForEach(items =>
            {
                D thisD          = _privateDict.GetSpecificItem(items);
                thisD.Visible    = true;
                thisD.IsEnabled  = true;
                thisD.IsUnknown  = false;
                thisD.IsSelected = false;
                thisD.Drew       = false;
                tempList.Add(thisD);
            });
            return(new DeckObservableDict <D>(tempList));
        }
        private static CustomBasicList <PaydayPlayerItem> GetPossiblePlayerList(PaydayGameContainer mainGame, PaydayVMData model)
        {
            CustomBasicList <PaydayPlayerItem> output   = new CustomBasicList <PaydayPlayerItem>();
            CustomBasicList <string>           tempList = model.PopUpList !.TextList.Select(items => items.DisplayText).ToCustomBasicList();

            tempList.ForEach(Name =>
            {
                output.Add(mainGame.PlayerList.Single(Items => Items.NickName == Name));
            });
            return(output);
        }
Пример #13
0
 public void DeleteRegistration <TIn>()
 {
     lock (_lockObj)
     {
         Type thisType = typeof(TIn);
         CustomBasicList <ContainerData> tempList = _thisSet.Where(Items => thisType.IsAssignableFrom(Items.TypeOut)).ToCustomBasicList();
         tempList.ForEach(Items =>
         {
             _thisSet.Remove(Items);
         });
     }
 }
        public void RefreshItems()
        {
            CustomBasicList <DeckOfCardsXF <SolitaireCard> > tempList = new CustomBasicList <DeckOfCardsXF <SolitaireCard> >();

            _cardList !.ForEach(thisCard =>
            {
                var thisD = _thisStack.FindControl(thisCard);
                tempList.Add(thisD !);
            });
            _thisStack !.Children.Clear();
            tempList.ForEach(thisD => _thisStack.Children.Add(thisD));
        }
 public void ClearDice()
 {
     if (DiceList.Count != 10)
     {
         throw new BasicBlankException("You had to have 10 dice.  Otherwise, can't clear");
     }
     DiceList.ForEach(Items =>
     {
         Items.DidHit = false;
         Items.Value  = false;
     });
 }
        async Task IHandleAsync <SubscribeGameBoardEventModel> .HandleAsync(SubscribeGameBoardEventModel message)
        {
            if (message.DrawCategory == EnumDrawCategory.NewLilyList)
            {
                if (_lilyList.Count > 0)
                {
                    _lilyList.ForEach(thisLily => _thisGrid.Children.Remove(thisLily));
                }
                var tempList = _game.GetCompleteLilyList();
                GamePackageViewModelBinder.ManuelElements.Clear();
                tempList.ForEach(thisTemp =>
                {
                    LilyPadWPF thisLily = new LilyPadWPF(thisTemp);
                    GamePackageViewModelBinder.ManuelElements.Add(thisLily); //try this way.
                    AddControlToGrid(_thisGrid, thisLily, thisTemp.Row, thisTemp.Column);
                    _lilyList.Add(thisLily);
                });
                await _view.RefreshBindingsAsync(_aggregator);

                return;
            }
            _lilyList.ForEach(thisLily => thisLily.Redraw());
        }
Пример #17
0
        public delegate void ItemChangedEventHandler(E?piece);  //can't be async since property does this.

        protected CustomBasicList <PI> PrivateGetList()
        {
            CustomBasicList <E>  firstList = _thisChoice.GetEnumList();
            CustomBasicList <PI> tempList  = new CustomBasicList <PI>();

            firstList.ForEach(items =>
            {
                PI thisTemp         = new PI();
                thisTemp.EnumValue  = items;
                thisTemp.IsSelected = false;
                thisTemp.IsEnabled  = IsEnabled; //start with false.  to prove the problem with bindings.
                tempList.Add(thisTemp);
            });
            return(tempList);
        }
Пример #18
0
        private CustomBasicList <char> PrivateGetTiles(CustomBasicList <SavedTile> thisList)
        {
            CustomBasicList <char> finList = new CustomBasicList <char>();

            thisList.ForEach(thisTile =>
            {
                int x;
                var loopTo = thisTile.HowMany;
                for (x = 1; x <= loopTo; x++)
                {
                    finList.Add(thisTile.Letter.Single());
                }
            });
            return(finList);
        }
Пример #19
0
        void IMailProcesses.SetUpMail()
        {
            CustomBasicList <int> list = _gameContainer.Random !.GenerateRandomList(47 + 24, 47, 25);

            if (list.Count != 47)
            {
                throw new BasicBlankException($"Must have 47 mail cards, not {list.Count} cards");
            }
            _gameContainer.SaveRoot !.MailListLeft.Clear();
            list.ForEach(index =>
            {
                MailCard thisCard = (MailCard)_gameContainer.GetCard(index);
                _gameContainer.SaveRoot.MailListLeft.Add(thisCard);
            });
        }
Пример #20
0
        public void LoadNumberList(CustomBasicList <int> thisList)
        {
            if (thisList.Any(Items => Items < 0))
            {
                throw new BasicBlankException("You should not be allowed to use less than 0.  If that is needed, then rethinking is required");
            }
            CustomBasicList <NumberPieceCP> tempList = new CustomBasicList <NumberPieceCP>();

            thisList.ForEach(items =>
            {
                NumberPieceCP ThisNumber = new NumberPieceCP();
                ThisNumber.NumberValue   = items;
                tempList.Add(ThisNumber);
            });
            NumberList.ReplaceRange(tempList);
        }
        //this will do without the canexceute version.
        public static CustomBasicList <BoardCommand> GetBoardCommandList(this ISeveralCommands vm)
        {
            CustomBasicList <BoardCommand> output = new CustomBasicList <BoardCommand>();

            Type type = vm.GetType();
            CustomBasicList <MethodInfo> methods = type.GetMethods().ToCustomBasicList(); //decided to just show all methods period.

            //must have no
            methods.ForEach(x =>
            {
                output.Add(new BoardCommand(vm, x, vm.Command, x.Name));
            });
            BoardCommand board = output.First();

            return(output);
        }
Пример #22
0
 public void ResetSeveralObjects(CustomBasicList <Type> list)
 {
     list.ForEach(type =>
     {
         CustomBasicList <ContainerData> tempList = _thisSet.Where(x => type.IsAssignableFrom(x.TypeOut) && x.Tag == "" && x.IsSingle == true).ToCustomBasicList();
         if (tempList.Count == 0)
         {
             throw new BasicBlankException($"The type of {type.Name} was never registered or was not singleton.  Rethink");
         }
         if (tempList.Count > 1)
         {
             throw new BasicBlankException($"The type of {type.Name} was registered more than once.  Rethink");
         }
         var output = tempList.Single();
         //has to ignore after all.
         output.ThisObject = null; //just set to null so when it asks for it again, will be fine.
     });
 }
        public async Task LoadGameAsync(string payLoad)
        {
            if (DiceList.Count != 10)
            {
                throw new BasicBlankException("You have to already have 10 dice");
            }
            CustomBasicList <bool> ThisList = await js.DeserializeObjectAsync <CustomBasicList <bool> >(payLoad);

            if (ThisList.Count != 10)
            {
                throw new BasicBlankException("You had to saved 10 items");
            }
            int x = 0;

            ThisList.ForEach(items =>
            {
                DiceList[x].DidHit = items;
                DiceList[x].Value  = items; //i think this was needed too.
                x++;
            });
        }
Пример #24
0
        public RotatedLabelXF(string text)
        {
            StackLayout stack = new StackLayout();

            stack.Spacing     = -5;
            HorizontalOptions = LayoutOptions.Start;
            VerticalOptions   = LayoutOptions.Start;
            stack.Orientation = StackOrientation.Vertical;
            CustomBasicList <char> list = text.ToCustomBasicList();

            list.ForEach(item =>
            {
                Label label             = new Label();
                label.HorizontalOptions = LayoutOptions.Start;
                label.VerticalOptions   = LayoutOptions.Start;
                label.TextColor         = Color.Aqua;
                label.FontAttributes    = FontAttributes.Bold;
                label.Text = item.ToString();
                stack.Children.Add(label);
            });
            Content = stack;
        }
Пример #25
0
 //private RegularRummyCard ManuallyChooseCard
 //{
 //    get
 //    {
 //        var tempList = _gameContainer.DeckList.Where(items => items.IsObjectWild == false).ToRegularDeckDict();
 //        do
 //        {
 //            var thisCard = tempList.GetRandomItem();
 //            if (_model!.Deck1!.CardExists(thisCard.Deck))
 //                return thisCard;
 //        } while (true);
 //    }
 //}
 public void ModifyCards(CustomBasicList <RegularRummyCard> thisList)
 {
     thisList.ForEach(thisCard =>
     {
         if (thisCard.Value == EnumCardValueList.Two || thisCard.Value == EnumCardValueList.HighAce)
         {
             thisCard.Points = 20;
         }
         else if (thisCard.Value == EnumCardValueList.Joker)
         {
             thisCard.Points = 50;
         }
         else if (thisCard.Value >= EnumCardValueList.Nine)
         {
             thisCard.Points = 10;
         }
         else
         {
             thisCard.Points = 5;
         }
     });
 }
Пример #26
0
 public void ModifyCards(CustomBasicList <ChinazoCard> thisList)
 {
     thisList.ForEach(thisCard =>
     {
         if (thisCard.Value == EnumCardValueList.Joker)
         {
             thisCard.Points = 50;
         }
         else if (thisCard.Value == EnumCardValueList.LowAce || thisCard.Value == EnumCardValueList.HighAce)
         {
             thisCard.Points = 20;
         }
         else if (thisCard.Value >= EnumCardValueList.Nine)
         {
             thisCard.Points = 10;
         }
         else
         {
             thisCard.Points = (int)thisCard.Value;
         }
     });
 }
        Task IHandleAsync <LoadEventModel> .HandleAsync(LoadEventModel message)
        {
            GamePackageViewModelBinder.ManuelElements.Clear();                   //often times i have to add manually.

            MillebournesSaveInfo save = cons !.Resolve <MillebournesSaveInfo>(); //usually needs this part for multiplayer games.

            _score !.LoadLists(save.PlayerList);
            _playerHandWPF !.LoadList(_model.PlayerHand1 !, ""); // i think
            _discardGPile !.Init(_model.Pile2 !, "");            // may have to be here (well see)
            _discardGPile.StartListeningDiscardPile();           // its the main one.

            _deckGPile !.Init(_model.Deck1 !, "");               // try here.  may have to do something else as well (?)
            _deckGPile.StartListeningMainDeck();

            _newCard !.Init(_model.Pile1 !, "");
            _disList.ForEach(thisD => thisD.Unregister());
            _disList.Clear();
            SetUpTeamPiles();


            return(this.RefreshBindingsAsync(_aggregator));
        }
        public void FillInRestOfColors() //this means fill rest of colors is no problem.
        {
            var thisList = ColorsLeft();

            thisList.ShuffleList();
            if (PlayerList.Any(x => x.DidChooseColor == false && x.InGame == true))
            {
                throw new BasicBlankException("There is at least one player who did not choose color who is in game.  That is wrong");
            }
            CustomBasicList <P> tempList = PlayerList.Where(Items => Items.DidChooseColor == false).ToCustomBasicList();

            tempList.ShuffleList();
            //i am guessing in this case, you have to literally have them match.
            if (thisList.Count != tempList.Count)
            {
                throw new BasicBlankException("Does not match.  Therefore, can't populate the rest of the colors");
            }
            tempList.ForEach(thisPlayer =>
            {
                thisPlayer.Color = thisList[tempList.IndexOf(thisPlayer)].EnumValue;
            });
        }
Пример #29
0
        public override async Task SetUpGameAsync(bool isBeginning)
        {
            LoadControls();
            if (FinishUpAsync == null)
            {
                throw new BasicBlankException("The loader never set the finish up code.  Rethink");
            }
            CustomBasicList <int> CardList = _rs !.GenerateRandomList(75);

            SaveRoot !.CallList.Clear();
            SaveRoot.BingoBoard.ClearBoard(_model); //i think.
            CardList.ForEach(x =>
            {
                CurrentInfo           = new BingoItem();
                CurrentInfo.WhatValue = x;
                CurrentInfo.Vector    = new Vector(0, MatchNumber(x));
                CurrentInfo.Letter    = WhatLetter(CurrentInfo.Vector.Column);
                SaveRoot.CallList.Add(SaveRoot.CallList.Count + 1, CurrentInfo);
            });
            CreateBingoCards();
            await FinishUpAsync(isBeginning);
            await CallNextNumberAsync(); //maybe i can have here this time.
        }
Пример #30
0
        private CustomBasicList <int> StraightPoints(CustomBasicList <ICard> cardList, int howManyInStraight)
        {
            CustomBasicList <CustomBasicList <int> > tempList = new CustomBasicList <CustomBasicList <int> >();

            if (howManyInStraight == 4)
            {
                tempList.Add(new CustomBasicList <int> {
                    1, 2, 3, 4
                });
                tempList.Add(new CustomBasicList <int> {
                    2, 3, 4, 5
                });
                tempList.Add(new CustomBasicList <int> {
                    3, 4, 5, 6
                });
            }
            else
            {
                tempList.Add(new CustomBasicList <int> {
                    1, 2, 3, 4, 5
                });
                tempList.Add(new CustomBasicList <int> {
                    2, 3, 4, 5, 6
                });
            }
            CustomBasicList <int> output = new CustomBasicList <int>();

            tempList.ForEach(thisItem =>
            {
                if (HasCompleteStraight(thisItem, cardList))
                {
                    output.Add(thisItem.Sum(items => items));
                }
            });
            return(output);
        }