Exemple #1
0
        void creareTextFile(string path)
        {
            FileStream   stream = new FileStream(path, FileMode.Create, FileAccess.Write);
            StreamWriter sw     = new StreamWriter(stream);

            string line = $"{list.Id},{list.Nume},{list.IdAutor}";

            sw.WriteLine(line);

            foreach (Object obj in this.flowLayoutPanel1.Controls)
            {
                try
                {
                    CardPreview preview = (CardPreview)obj;

                    Card card = preview.card;

                    line = $"   Id:{card.Id}, Nume: {card.Nume}, Descriere: {card.Descriere}";
                    sw.WriteLine(line);
                }
                catch (Exception) { }
            }

            sw.Close();
            stream.Close();
        }
Exemple #2
0
        private void onCardDelete(Object sender, EventArgs args)
        {
            //gasete cardul ce a fost sters, si scoate din flowlayout pentru a sincroniza cu BD
            Card card = (Card)sender;

            CardPreview preview = (CardPreview)this.flowLayoutPanel1.Controls.Find(card.Id.ToString(), false)[0];

            this.flowLayoutPanel1.Controls.Remove(preview);
        }
 void OnMouseOver()
 {
     //If your mouse hovers over the GameObject with the script attached, output this message
     if (!FaceDown && !hoveringCard)
     {
         CardPreview.ChangePreview(front_Sprite);
         hoveringCard = true;
     }
 }
Exemple #4
0
        public void LoadCards()
        {
            //opreste layout panel din a face calculele pentru a determina pozitia obiectului inserat
            //imbunatateste performanta
            this.flowLayoutPanel1.SuspendLayout();
            this.flowLayoutPanel1.Controls.Clear();

            foreach (Card card in this.list.GetCards())
            {
                card.deleted += this.onCardDelete;

                CardPreview cardPreview = new CardPreview(card);

                this.flowLayoutPanel1.Controls.Add(cardPreview);
            }

            //adauga la sfarsit butonul de "adauga card"
            this.flowLayoutPanel1.Controls.Add(this.containerPanel);
            this.flowLayoutPanel1.ResumeLayout();
        }
Exemple #5
0
    public static void GenerateCardPreview(Card c)
    {
        if (CurrentPreview != null)
        {
            return;
        }
        Transform parent = null;

        if (BattleManager.Instance != null && BattleManager.Instance.BattleState == BattleStates.BuyingCards)
        {
            parent = BuyManager.Instance.transform;
        }
        else
        {
            parent = GameObject.Find("MainCanvas").transform;
        }
        CurrentPreview = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/CardPreview"), parent).GetComponent <CardPreview>();
        if (BattleManager.Instance != null && BattleManager.Instance.BattleState == BattleStates.BuyingCards)
        {
            CurrentPreview.transform.GetChild(0).transform.localScale = Vector3.one * 1.8f;
        }
        CurrentPreview.SetCard(c);
    }
 void OnMouseExit()
 {
     //The mouse is no longer hovering over the GameObject so output this message each frame
     CardPreview.ChangePreview(back_Sprite);
     hoveringCard = false;
 }