Exemplo n.º 1
0
        void OnMouseDown()
        {
            if (cards.Count <= maxCards)
            {
                CardFacilitie facilitie = new SadowTwoSideCardFacilitie();
                CardRender    curCard   = facilitie.CreateMinionCard();
                curCard.Configure();
                Transform card = curCard.cardObject.transformObj;

                BoxCollider box = curCard.face.transform.gameObject.AddComponent <BoxCollider>();
                box.size = new Vector3(box.size.x, box.size.y, 0.1f);
                SelectCard s = curCard.face.transform.gameObject.AddComponent <SelectCard>();
                s.myTransform = card;
                s.creator     = this;

                card.localScale = new Vector3(size, size, 1);
                card.rotation   = hand.transform.rotation;

                cards.Add(s);
                setHand();
            }
        }
        public void Render(IEnumerable <Models.Card> batch)
        {
            if (CardRender == null)
            {
                throw new InvalidOperationException("Необходимо назначить CardRender");
            }

            if (Document == null)
            {
                throw new InvalidOperationException("Необходимо назначить Document");
            }

            if (batch == null || batch.Count() == 0)
            {
                throw new ArgumentNullException(nameof(batch));
            }

            var counter   = 0;
            var batchSize = batch.Count();

            CardRender.Page = Document.AddPage();

            foreach (var card in batch)
            {
                if (counter > 0 && counter % CARDS_PER_PAGE == 0)
                {
                    CardRender.Page = Document.AddPage();
                    counter         = 0;
                }

                CardRender.PageOffsetY = PdfCardRender.HEIGHT_FULL * counter;
                CardRender.Render(card);

                counter++;
            }
        }
Exemplo n.º 3
0
 protected virtual void Awake()
 {
     render = transform.Find("render").GetComponent <CardRender>();
 }