コード例 #1
0
ファイル: Form1.cs プロジェクト: wnddpd01/RabbitGames
        private void Form1_Load(object sender, EventArgs e)
        {
            label1.Parent          = pictureBox_background;
            label1.BackColor       = Color.Transparent;
            label1.Visible         = false;
            groupBox1.Visible      = false;
            btn_Start_fake.Visible = false;
            my_rabbit = new rabbit(pictureBox_nomal_rabbit, label_Speed, label_Star);

            string[] scores = new string[5];
            if (File.Exists(@"./rank.txt") == false)
            {
                FileStream a = File.Create(@"./rank.txt");
                a.Close();

                StreamWriter sw = new StreamWriter(@"./rank.txt");
                for (int i = 0; i < 5; i++)
                {
                    sw.WriteLine(0.ToString());
                }
                sw.Close();
            }

            StreamReader sr = new StreamReader(@"./rank.txt");

            for (int i = 0; i < 5; i++)
            {
                scores[i] = sr.ReadLine();
            }
            sr.Close();
            for (int i = 0; i < 5; i++)
            {
                i_scores[i] = Int32.Parse(scores[i]);
            }
            Array.Sort(i_scores);
            Array.Reverse(i_scores);

            pictureBox_cloud.Visible        = false;
            pictureBox_nomal_rabbit.Visible = false;
            this.Focus();
            this.Show();
            this.SetTopLevel(true);
        }
コード例 #2
0
ファイル: item.cs プロジェクト: wnddpd01/RabbitGames
        public item(Form1 Form1, PictureBox parent, PictureBox Cloud, PictureBox pictureboxrabbit, rabbit rabbit, Label healtlabel, Label label_Star, Label label_score, Label label_level)
        {
            pic_rabbit = pictureboxrabbit;
            Bitmap my_image = getMyImage(rabbit.score);

            state      = true;
            location   = Cloud.Location;
            location.X = location.X + 35;
            location.Y = location.Y + 50;
            my_item    = new PictureBox();
            try
            {
                Form1.Invoke(new MethodInvoker(delegate()
                {
                    health_label = healtlabel;
                    Star_label   = label_Star;
                    Score_label  = label_score;
                    Level_label  = label_level;
                    IntPtr x;
                    if (!my_item.IsHandleCreated)
                    {
                        x = my_item.Handle;
                    }
                    my_item.Parent    = parent;
                    my_item.BackColor = Color.Transparent;
                    my_item.Name      = "item";
                    my_item.Size      = new Size(30, 30);
                    my_item.Location  = location;
                    my_item.Image     = my_image;
                    my_item.Visible   = true;
                    my_item.SizeMode  = PictureBoxSizeMode.StretchImage;
                }));
                this.myrabbit = rabbit;
                this.Form1    = Form1;
                T_move        = new Task(new Action(move));
                T_move.Start();
            }
            catch (Exception e) { }
        }
コード例 #3
0
        private void makeitem(Form1 Form1, PictureBox background, PictureBox Cloud, PictureBox prabbit, rabbit rabbit, List <item> itemList, Label label_health, Label label_Star, Label label_score, Label label_level)
        {
            int a = 1200;

            Thread.Sleep(3000);
            while (rabbit.health > 0)
            {
                if (a > 500)
                {
                    a = 2000 - (rabbit.score / 100) * 300;
                }
                if (a < 500)
                {
                    a = 500;
                }
                itemList.Add(new item(Form1, background, Cloud, prabbit, rabbit, label_health, label_Star, label_score, label_level));
                for (int i = itemList.Count - 1; i >= 0; i--)
                {
                    if (itemList[i].state == false)
                    {
                        itemList.RemoveAt(i);
                    }
                }
                Thread.Sleep(a);
            }
        }
コード例 #4
0
 public itemManager(Form1 Form1, PictureBox background, PictureBox Cloud, PictureBox prabbit, rabbit rabbit, List <item> itemList, Label label_health, Label label_Star, Label label_score, Label label_level)
 {
     MakeItem = new Thread(delegate()
     {
         makeitem(Form1, background, Cloud, prabbit, rabbit, itemList, label_health, label_Star, label_score, label_level);
     });
     MakeItem.Start();
 }