예제 #1
0
 private void Start()
 {
     randomProducts = GetComponent <RandomProducts>();
     if (randomProducts == null)
     {
         Debug.LogError("Could not find random product script.");
     }
 }
예제 #2
0
        private void Magazin_Load(object sender, EventArgs e)
        {
            cos = new List <Produse>();
            //panel5.Visible = false;
            produses = ProduseController.GetProduse().ToList();
            foreach (Produse p in produses)
            {
                comboBox2.Items.Add(p.NumeProdus);
            }
            //autocomplete
            this.comboBox2.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            this.comboBox2.AutoCompleteSource = AutoCompleteSource.ListItems;
            //size of window
            this.MinimumSize  = new System.Drawing.Size(this.Width, this.Height);
            this.MaximumSize  = new System.Drawing.Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            this.AutoSize     = true;
            this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            FormBorderStyle   = FormBorderStyle.None;
            WindowState       = FormWindowState.Maximized;

            //produse
            List <PictureBox> pictures = new List <PictureBox> {
                pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8
            };
            List <Label> smallLabels = new List <Label> {
                label3, label4, label5, label6, label7, label8, label9, label10
            };
            List <Label> bigLabels = new List <Label> {
                label13, label14, label15, label16, label17, label18, label19, label20
            };
            List <Button> buttons = new List <Button> {
                button11, button12, button12, button13, button14, button15, button16, button17, button18
            };

            produses = RandomProducts.RandomProduse();
            for (int i = 0; i < 8; i++)
            {
                smallLabels[i].Text = null;
                string   produ = produses[i].NumeProdus.ToString();
                string[] vs    = produ.Split(' ');
                for (int j = 0; j < vs.Length; j++)
                {
                    smallLabels[i].Text += vs[j] + " ";
                    if (j % 3 == 0 && j != 0)
                    {
                        smallLabels[i].Text += "\n";
                    }
                }
                bigLabels[i].Text = produses[i].Pret.ToString() + " Lei";
            }
        }