Пример #1
0
        public CustomBasicList <CustomBasicList <D> > RollDice(int howManySections = 6)
        {
            if (DiceList.Count() != HowManyDice)
            {
                RedoList();
            }
            CustomBasicList <CustomBasicList <D> > output = new CustomBasicList <CustomBasicList <D> >();

            AsyncDelayer.SetDelayer(this, ref _delay !); //try both places.
            IGenerateDice <int>   ThisG    = MainContainer !.Resolve <IGenerateDice <int> >();
            CustomBasicList <int> possList = ThisG.GetPossibleList;

            possList.MainContainer = MainContainer;
            D   tempDice;
            int chosen;

            howManySections.Times(() =>
            {
                CustomBasicList <D> firsts = new CustomBasicList <D>();
                for (int i = 0; i < HowManyDice; i++)
                {
                    tempDice = DiceList[i];
                    if (tempDice.Hold == false) //its uncommon enough that has to be different for different types of dice games.
                    {
                        chosen         = possList.GetRandomItem();
                        tempDice       = new D();
                        tempDice.Index = i + 1;    //i think
                        tempDice.Populate(chosen); //so they can do what they need to.
                    }
                    firsts.Add(tempDice);
                }
                output.Add(firsts);
            });
            return(output);
        }
 public RummyBoardCP(TestOptions test,
                     IGenerateDice <int> gens,
                     IAsyncDelayer delay,
                     BasicData basicData,
                     CommandContainer command
                     )
 {
     _test      = test;
     _gens      = gens; //hopefully putting here is acceptable
     _delay     = delay;
     _basicData = basicData;
     _command   = command;
     _network   = _basicData.GetNetwork();
 }
Пример #3
0
        public static CustomBasicList <T> GetSingleRolledDice <T>(int howManySections, IGenerateDice <T> dice) where T : IConvertible
        {
            CustomBasicList <T> thisList  = new CustomBasicList <T>();
            CustomBasicList <T> otherList = dice.GetPossibleList;

            howManySections.Times(items =>
            {
                thisList.Add(otherList.GetRandomItem());
            });
            return(thisList);
        }