Esempio n. 1
0
        public void createCardsForDeck(ICardFactory cardFactory)
        {
            this.CardFactory = cardFactory;

            for (int i = 0; i < 4; i++)
            {
                CardDeck.Add(CardFactory.CreateWildCard(CardType.Wild));
                CardDeck.Add(CardFactory.CreateWildCard(CardType.WildDrawFour));
            }

            foreach (CardColor color in Enum.GetValues(typeof(CardColor)))
            {
                foreach (CardType type in Enum.GetValues(typeof(CardType)))
                {
                    if (type != CardType.Wild && type != CardType.WildDrawFour)
                    {
                        CardDeck.Add(CardFactory.CreateCard(color, type));

                        if (type != CardType.Zero)
                        {
                            CardDeck.Add(CardFactory.CreateCard(color, type));
                        }
                    }
                }
            }
        }
Esempio n. 2
0
 public ManagerController()
 {
     playerFactory    = new PlayerFactory();
     cardFactory      = new CardFactory();
     playerRepository = new PlayerRepository();
     cardRepository   = new CardRepository();
 }
Esempio n. 3
0
 public ManagerController()
 {
     this.players = new PlayerRepository();
     this.cards = new CardRepository();
     this.playerFactory = new PlayerFactory();
     this.cardFactory = new CardFactory();
 }
Esempio n. 4
0
        public Engine()
        {
            this.cardController = new CardController();
            this.cardFactory    = new CardFactory();

            this.writer = new Writer();
            this.reader = new Reader();
        }
 public ManagerController()
 {
     playerRepository = new PlayerRepository();
     cardRepository   = new CardRepository();
     battleField      = new BattleField();
     playerFactory    = new PlayerFactory();
     cardFactory      = new CardFactory();
 }
 public ManagerController(IPlayerRepository playerRepository, IPlayerFactory playerFactory, ICardRepository cardRepository, ICardFactory cardFactory, IBattleField battleField)
 {
     this.playerRepository = playerRepository;
     this.playerFactory    = playerFactory;
     this.cardRepository   = cardRepository;
     this.cardFactory      = cardFactory;
     this.battleField      = battleField;
 }
Esempio n. 7
0
 public ManagerController()
 {
     this.cardRepository   = new CardRepository();
     this.playerRepository = new PlayerRepository();
     this.playerFactory    = new PlayerFactory();
     this.cardFactory      = new CardFactory();
     this.battleField      = new BattleField();
 }
        public PlayerGameState(ICardFactory cardFactory)
        {
            _cardFactory = cardFactory;

            HandZone        = new HandZone();
            GraveyardZone   = new GraveyardZone();
            BattlefieldZone = new BattlefieldZone();
        }
Esempio n. 9
0
        public void FixtureSetUp()
        {
            _cardFactory = new StandardCardFactory();

            _card1 = _cardFactory.CreateCard(10);
            _card2 = _cardFactory.CreateCard(20);
            _card3 = _cardFactory.CreateCard(30);
            _card4 = _cardFactory.CreateCard(10);
        }
Esempio n. 10
0
    public virtual void Build(ICardFactory <ICard> cardFactory, ICollectionCardsData collection, Action <ICard> clickCard)
    {
        (this.cardFactory, this.collection, this.clickCard) = (cardFactory, collection, clickCard);

        previousPage.onClick.AddListener(() => FlipPage(-1));
        nextPage.onClick.AddListener(() => FlipPage(+1));

        currentPage = 1;
    }
        public JsonResult VisitorOut(string cardNO)
        {
            //string cardID;
            if (cardNO != null)
            {
                cardFactory = new CardFactorys();
                utility     = new Utility();

                var appData = db.Appointments.Where(x => (x.CardNO == cardNO) && (x.Status == "I")).FirstOrDefault();

                if (appData != null)
                {
                    db.Entry(appData).State = EntityState.Detached;
                    appData.CheckedOutTime  = DateTime.Now;
                    appData.Status          = "O";

                    var cardInfo = db.Cards.Where(x => x.CardNO == cardNO).ToList();

                    if (cardInfo.Count > 0)
                    {
                        foreach (var card in cardInfo)
                        {
                            var deviceInfo = db.DeviceInfoes.Where(x => x.DeviceNO == card.DeviceNO).FirstOrDefault();

                            if (deviceInfo != null)
                            {
                                unScheduleAppointmentFactory = new UnScheduleAppointmentFactorys();
                                result = unScheduleAppointmentFactory.SaveAppointment(appData);
                                if (result.isSucess)
                                {
                                    card.CardNO    = null;
                                    result         = cardFactory.SaveCard(card);
                                    result.message = "Checked OUT Successful.";
                                }
                            }
                            else
                            {
                                result.message = card.DeviceNO + " Number Device Not Found!";
                                return(Json(result, JsonRequestBehavior.AllowGet));
                            }
                        }
                    }
                }
                else
                {
                    result.isSucess = false;
                    result.message  = "No Checked IN Visitor Found Against This Card";
                }
            }
            else
            {
                result.isSucess = false;
                result.message  = "Please Punch Visitor Card";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
 public void FillDeck(IPokerDatabase database, ICardFactory cardFactory)
 {
     for (int cardPower = 2; cardPower <= 14; cardPower++)
     {
         foreach (CardType cardType in Enum.GetValues(typeof(CardType)))
         {
             database.AddCard(cardFactory.CreateCard(cardPower, cardType));
         }
     }
 }
Esempio n. 13
0
        public CardFactoryUnitTests()
        {
            var cardFactorySettings = new CardFactorySettings
            {
                CardValueOverrides = new Dictionary <CardValueEnum, int> {
                    { CardValueEnum.Jack, 100 }
                }
            };

            _cardFactory = new CardFactory(cardFactorySettings);
        }
Esempio n. 14
0
        public static Deck Build(ICardFactory cardFactory)
        {
            var deck = new Deck();

            Card card = null;

            while ((card = cardFactory.Next()) != null)
            {
                deck.Push(card);
            }

            return(deck);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BotActivityHandler"/> class.
 /// </summary>
 /// <param name="resourceProvider">Resource provider.</param>
 /// <param name="cardFactory">Card factory.</param>
 /// <param name="urlParser">Url parser.</param>
 /// <param name="appSettings">App settings.</param>
 /// <param name="logger">Logger.</param>
 public BotActivityHandler(
     IResourceProvider resourceProvider,
     ICardFactory cardFactory,
     IUrlParser urlParser,
     IAppSettings appSettings,
     ILogger <BotActivityHandler> logger)
 {
     this.resourceProvider = resourceProvider ?? throw new ArgumentNullException(nameof(resourceProvider));
     this.cardFactory      = cardFactory ?? throw new ArgumentNullException(nameof(cardFactory));
     this.urlParser        = urlParser ?? throw new ArgumentNullException(nameof(urlParser));
     this.appSettings      = appSettings ?? throw new ArgumentNullException(nameof(appSettings));
     this.logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FileService"/> class.
 /// </summary>
 /// <param name="modalService">The modalService<see cref="IModalService"/>.</param>
 /// <param name="mediationService">The mediationService<see cref="IMediationService"/>.</param>
 /// <param name="cardFactory">The cardFactory<see cref="ICardFactory"/>.</param>
 /// <param name="cardSubStepFactory">The cardSubStepFactory<see cref="ICardSubStepFactory"/>.</param>
 /// <param name="programDataFactory">The programDataFactory<see cref="IProgramDataFactory"/>.</param>
 public FileService(
     IModalService modalService,
     IMediationService mediationService,
     ICardFactory cardFactory,
     ICardSubStepFactory cardSubStepFactory,
     IProgramDataFactory programDataFactory)
 {
     _modalService       = modalService;
     _mediationService   = mediationService;
     _cardFactory        = cardFactory;
     _cardSubStepFactory = cardSubStepFactory;
     _programDataFactory = programDataFactory;
 }
        public JsonResult VisitorBreakIn(DAL.db.Appointment appointment)
        {
            //Card card = new Card();
            //string cardID = string.Empty;
            if (appointment.CardNO != string.Empty)
            {
                int deviceNo = 1;
                cardFactory = new CardFactorys();
                utility     = new Utility();

                // Getting device Information
                //var empInfo = db.Employees.Where(x => x.EmployeeID == appointment.EmployeeID).FirstOrDefault();

                var appInfo = db.Appointments.Where(x => x.AppointmentID == appointment.AppointmentID).FirstOrDefault();
                db.Entry(appInfo).State = EntityState.Detached;

                if (appointment.Status == "I")
                {
                    var cardInfo = cardFactory.GetFreeCard(deviceNo);

                    if (cardInfo != null)
                    {
                        //cardID = cardInfo.CardID.ToString();
                        cardInfo.CardNO = appointment.CardNO;
                        result          = cardFactory.SaveCard(cardInfo);

                        appInfo.CardNO      = appointment.CardNO;
                        appInfo.BreakInTime = DateTime.Now;
                        appInfo.Status      = appointment.Status;

                        if (result.isSucess)
                        {
                            unScheduleAppointmentFactory = new UnScheduleAppointmentFactorys();
                            result = unScheduleAppointmentFactory.SaveAppointment(appInfo);
                            if (result.isSucess)
                            {
                                result.message = "Visitor Checked IN From Break Successful.";
                            }
                        }
                    }
                }
            }
            else
            {
                result.message = "Please Punch Visitor Card";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult VisitorBreakOut(MV_Appointment appointment)
        {
            //Card card = new Card();
            string cardID = string.Empty;

            if (appointment.CardNO != string.Empty)
            {
                int deviceNo = 1;
                cardFactory = new CardFactorys();
                utility     = new Utility();

                // Getting device Information
                //var empInfo = db.Employees.Where(x => x.EmployeeID == appointment.EmployeeID).FirstOrDefault();

                //DAL.db.Appointment appInfo = new DAL.db.Appointment();

                var appInfo = db.Appointments.Where(x => x.AppointmentID == appointment.AppointmentID).FirstOrDefault();
                db.Entry(appInfo).State = EntityState.Detached;


                if (appointment.Status == "B")
                {
                    //var cardInfo = cardFactory.GetFreeCard(deviceNo);
                    appInfo.Status = appointment.Status;
                    result         = cardFactory.UnassignCard(deviceNo, appInfo.CardNO);
                    if (result.isSucess)
                    {
                        unScheduleAppointmentFactory = new UnScheduleAppointmentFactorys();
                        appInfo.BreakOutTime         = DateTime.Now;
                        result = unScheduleAppointmentFactory.SaveAppointment(appInfo);
                        if (result.isSucess)
                        {
                            result.message = "Visitor Checked Out For Break Successful.";
                        }
                    }
                    else
                    {
                        result.message = appInfo.CardNO + " No card not found for break!!!";
                    }
                }
            }
            else
            {
                result.message = "Please Punch Visitor Card";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult VisitorIn(DAL.db.Appointment appointment)
        {
            int    deviceNo = 1;
            string cardID   = string.Empty;

            if (appointment.CardNO != string.Empty)
            {
                cardFactory = new CardFactorys();
                utility     = new Utility();

                // Getting device Information
                //var empInfo = db.Employees.Where(x => x.EmployeeID == appointment.EmployeeID).FirstOrDefault();
                if (appointment.Status == "I")
                {
                    var cardInfo = cardFactory.GetFreeCard(deviceNo);
                    if (cardInfo != null)
                    {
                        appointment.CheckedInTime = DateTime.Now;
                        cardID = cardInfo.CardID.ToString();

                        //result = utility.AssignToDevice(deviceNo, cardID, appointment.CardNO);
                        cardInfo.CardNO = appointment.CardNO;
                        result          = cardFactory.SaveCard(cardInfo);

                        if (result.isSucess)
                        {
                            unScheduleAppointmentFactory = new UnScheduleAppointmentFactorys();
                            result = unScheduleAppointmentFactory.SaveAppointment(appointment);
                            if (result.isSucess)
                            {
                                result.message = "Checked IN Successful.";
                            }
                        }
                    }
                    else
                    {
                        result.isSucess = false;
                        result.message  = deviceNo + " NO. Free Card Found.";
                    }
                }
            }
            else
            {
                result.message = "Please Punch Visitor Card";
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Esempio n. 20
0
        public SendAdaptiveDialog(TFactory modelFactory, ADSBotServices services)
            : base(nameof(TFactory))
        {
            // This array defines how the Waterfall will execute.
            var waterfallSteps = new WaterfallStep[]
            {
                InitStep
            };

            // Add named dialogs to the DialogSet. These names are saved in the dialog state.
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), waterfallSteps));

            // The initial child Dialog to run.
            InitialDialogId = nameof(WaterfallDialog);
            Services        = services;
            CardFactory     = modelFactory;
        }
Esempio n. 21
0
    protected BaseBattel Initialize(IBattel battel, IUserData player,
                                    BattelFieldFactory battelFieldFactory, ICardFactory <IAttackCard> cardFactory)
    {
        (this.Battel, this.UserData, this.battelFieldFactory, this.cardFactory)
            = (battel, player, battelFieldFactory, cardFactory);

        returnButton.SetListener(OnLeaveBattle);
        buttonFinishBattel.SetListener(OnLeaveBattle);
        buttonNextTurn.SetListener(NextTurn);

        buttonFinishBattel.gameObject.SetActive(false);
        buttonNextTurn.gameObject.SetActive(false);

        battel.InteractableButtonNextTurn += SetInteractableButtonNextTurn;
        battel.NextTurn     += NextTurn;
        battel.FinishBattel += FinishBattel;

        return(this);
    }
Esempio n. 22
0
        public RegisterCardViewModel(IUserDataStore userDataStoreFactory, IUserCardDataStore userCardDataStore, IValidatableObjectFactory validatableObjectFactory, RegisterEntry registerEntry, ICardFactory cardFactory)
        {
            _UserDataStore            = userDataStoreFactory;
            _UserCardDataStore        = userCardDataStore;
            _ValidatableObjectFactory = validatableObjectFactory;
            CardFactory = cardFactory;

            UserRegistrationInfo = registerEntry;

            RegisterCardCommand      = new Command(() => RegisterCard());
            TypeOfCardChangedCommand = new Command <CommandEventData>((data) => TypeOfCardSelectionChangedHandler(data));
            SkipToHomeCommand        = new Command(() => SkipToHome());

            CardNumber     = _ValidatableObjectFactory.CreateSimpleValidatebleObject <string>("1111111111111111111111111");
            TypeOfCard     = _ValidatableObjectFactory.CreateSimpleValidatebleObject <string>("Debit");
            SecurityCode   = _ValidatableObjectFactory.CreateSimpleValidatebleObject <string>();
            ExpirationDate = _ValidatableObjectFactory.CreateSimpleValidatebleObject(DateTime.Today);
            CardHolderName = _ValidatableObjectFactory.CreateSimpleValidatebleObject <string>("Ricardo");

            Init();
        }
Esempio n. 23
0
    int version = 0; // Used to throw an exception when enumerating through a deck that has been altered mid-enumeration.

    public Deck(IDictionary <CardFace, GameObject> cardModels, ICardFactory factory)
    {
        if (cardModels == null)
        {
            throw new ArgumentNullException("cardModels");
        }
        if (factory == null)
        {
            throw new ArgumentNullException("factory");
        }

        foreach (var pair in cardModels)
        {
            CardFace   face   = pair.Key;
            GameObject prefab = pair.Value;
            cards[pair.Key] = CreateCard(face, prefab, factory);
        }

        Assert.IsTrue(CardFace.EnumerateCardFaces().All(cards.ContainsKey));

        ResetDeck();
    }
Esempio n. 24
0
        static void Main(string[] args)
        {
            ICardFactory factory = null;

            Console.Write("Enter the card type you would like to visit: ");
            string cardType = Console.ReadLine();

            if (cardType != null)
            {
                switch (cardType.ToLower())
                {
                case "moneyback":
                    factory = new MoneyBackFactory(5000, 0);
                    break;

                case "titanium":
                    factory = new TitaniumFactory(10000, 300);
                    break;

                case "platinum":
                    factory = new PlatinumFactory(50000, 500);
                    break;

                default:
                    break;
                }
            }

            if (factory != null)
            {
                ICreditCard creditCard = factory.GetCreditCard();
                Console.WriteLine($"\n Your card details are : \n");
                Console.WriteLine("Card Type: {0}\nCredit Limit: {1}\nAnnual Charge: {2}",
                                  creditCard.CardType, creditCard.CreditLimit, creditCard.AnnualCharge);
            }

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            ICardFactory factory  = null;
            string       cardType = "MoneyBack";

            switch (cardType)
            {
            case "MoneyBack":
                factory = new MoneyBackFactory(12000, 0);
                break;

            case "RewardBack":
                factory = new RewardBackFactory(8000, 100);
                break;

            default:
                break;
            }

            var creditCard = factory.GetCreditCard();

            Console.WriteLine(
                $"Card details: \nCard Type: {creditCard.CardType}\nCredit Limit: {creditCard.CardLimit}\nAnnual Fee: {creditCard.AnnualFee}");
        }
 public void Initialise()
 {
     _cardFactory = new CardFactory <MockVirtualCashCard>();
 }
 public ClientFactory(ICardFactory factory, string type)
 {
     creditCard = factory.GetCreditCard(type);
     debitCard  = factory.GetDebitCard(type);
 }
 public void FillDeck(IPokerDatabase database, ICardFactory cardFactory)
 {
     for (int cardPower = 2; cardPower <= 14; cardPower++)
     {
         foreach (CardType cardType in Enum.GetValues(typeof(CardType)))
         {
             database.AddCard(cardFactory.CreateCard(cardPower, cardType));
         }
     }
 }
Esempio n. 29
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="simpleValidation"></param>
 /// <param name="cardFactory"></param>
 public PlayerHandFactory(ISimpleValidation <PlayerHandFactoryModel> simpleValidation, ICardFactory cardFactory)
 {
     _simpleValidation = simpleValidation;
     _cardFactory      = cardFactory;
 }
Esempio n. 30
0
    public void Construct(IBattel battel, IUserData player, BattelFieldFactory battelFieldFactory,
                          DeckBattleSelector.Factory factoriDeckBattleSelector, IAlTrainingBattel alTraining, ICardFactory <IAttackCard> cardFactory)
    {
        Initialize(battel, player, battelFieldFactory, cardFactory);
        (this.alTraining) = (alTraining);

        factoriDeckBattleSelector.Create().Build(transform, StartBattel);
        returnButton.transform.SetAsLastSibling();
    }
Esempio n. 31
0
 public BattelPersonPlayer(IFractionsData fractions, ICollectionCardsData collection, ICardFactory <IAttackCard> cardFactory)
     : base(fractions, collection, cardFactory)
 {
     TypePerson = TypePersonEnum.player;
 }
Esempio n. 32
0
 public void FixtureSetUp()
 {
     _cardFactory = new StandardCardFactory();
     _deckFactory = new StandardDeckFactory();
 }
Esempio n. 33
0
 public BoardManager(ICardFactory cardFactory)
 {
     PlayerGameState = new PlayerGameState(cardFactory);
 }