Exemple #1
0
 private void ClickMovable(DrawableItems sender, MouseEventArgs e)
 {
     drawArea1.ActiveItem=sender;
     offset=new Point(e.X,e.Y);
     int x=(int)((sender.Bounds.X+sender.Bounds.X+sender.Bounds.Width)/2);
     int y=(int)((sender.Bounds.Y+sender.Bounds.Y+sender.Bounds.Height)/2);
     sender.Parent.BringItemToFront(sender);
     dragging=(!dragging)&sender.Enabled;
 }
Exemple #2
0
 public GameFruits()
 {
     InitializeComponent();
     for(int i=0;i<((int)Config.LoggedInUser.difficulty)+2;i++) {
         plate[i]=new DrawableItems();
         plate[i].Parent=drawArea1;
         plate[i].Image=global::glass.Resources.plate;
         plate[i].Bounds=platePositions[i];
         drawArea1.Items.Add(plate[i]);
     }
     SpawnItems();
 }
Exemple #3
0
 public GameFruits()
 {
     InitializeComponent();
     for(int i=0;i<((int)Config.LoggedInUser.difficulty)+2;i++) {
         plate[i]=new DrawableItems();
         plate[i].Parent=drawArea1;
         plate[i].Image=global::glass.Resources.plate;
         plate[i].Bounds=platePositions[i];
         drawArea1.Items.Add(plate[i]);
     }
     SpawnItems();
     Framework.sndPlay.SoundLocation=@"Sounds\Fruits\flyttafrukt.wav";
     Framework.sndPlay.Play();
 }
Exemple #4
0
 public static void EnterClickable(DrawableItems sender, EventArgs e)
 {
     sender.Parent.Cursor=Cursors.Hand;
 }
Exemple #5
0
 public void BringItemToFront(DrawableItems item)
 {
     Items.Remove(item);
     Items.Insert(0,item);
     Invalidate();
 }
Exemple #6
0
 private void stubMouseEvent(DrawableItems sender, MouseEventArgs e)
 {
 }
Exemple #7
0
 private void stubEvent(DrawableItems sender, EventArgs e)
 {
 }
Exemple #8
0
        public GameClothes()
        {
            InitializeComponent();
            DrawableItems d=new DrawableItems();
            d.Parent=drawArea1;
            d.Image=global::glass.Resources.gubbe;
            d.Bounds=new Rectangle(250,20,300,500);
            drawArea1.Items.Add(d);

            SpawnClothes();
        }
Exemple #9
0
        private void ClickMovable(DrawableItems sender, MouseEventArgs e)
        {
            drawArea1.ActiveItem=sender;
            offset=new Point(e.X,e.Y);

            int x=(int)((sender.Bounds.X+sender.Bounds.X+sender.Bounds.Width)/2);
            int y=(int)((sender.Bounds.Y+sender.Bounds.Y+sender.Bounds.Height)/2);
            sender.Parent.BringItemToFront(sender);
            dragging=(!dragging)&sender.Enabled;
            if((!dragging)&&(sender.Enabled)) {
                foreach (Places place in PlaceCollection[Config.LoggedInUser.difficulty]) {
                    if((place.Name==goal.Name)&&(Framework.PointInPolygon(new Point(x,y),place.Polygon))) {
                       	sender.Enabled=false;
                       	Rectangle InvalidateRect=new Rectangle(sender.Bounds.X,sender.Bounds.Y,sender.Bounds.Width,sender.Bounds.Height);
                       	correct++;
                       	prgProgress.PerformStep();
                       	drawArea1.Items.Remove(sender);
                       	if(correct>=total) {
                       		if((Config.LoggedInUser.score&((int)Framework.LevelScores.Prepositons<<(int)Config.LoggedInUser.difficulty))!=((int)Framework.LevelScores.Prepositons<<(int)Config.LoggedInUser.difficulty)) {
                       			Config.LoggedInUser.score+=(uint)Framework.LevelScores.Prepositons<<(int)Config.LoggedInUser.difficulty;
                       			Config.UpdateScore(Config.LoggedInUser);
                       		}
                       		Framework.sndPlay.SoundLocation=@"Sounds\bra.wav";
                            Framework.sndPlay.PlaySync();
                       		this.Close();
                       	}else{
                       		SpawnItem();
                       		Invalidate(InvalidateRect);
                       	}
                    }
                }
            }
        }
Exemple #10
0
 private void ClickMovable(DrawableItems sender, MouseEventArgs e)
 {
     drawArea1.ActiveItem=sender;
     offset=new Point(e.X,e.Y);
     int x=(int)((sender.Bounds.X+sender.Bounds.X+sender.Bounds.Width)/2);
     int y=(int)((sender.Bounds.Y+sender.Bounds.Y+sender.Bounds.Height)/2);
     sender.Parent.BringItemToFront(sender);
     dragging=(!dragging)&sender.Enabled;
     if((!dragging)&&(sender.Enabled)) {
         MessageBox.Show("omg");
         foreach (ClothPlaces place in PlaceCollection) {
             if((place.Name==goal.Name)&&(Framework.PointInPolygon(new Point(x,y),place.Polygon))) {
                 MessageBox.Show("lol");
             }
         }
     }
 }
Exemple #11
0
        void SpawnClothes()
        {
            if(Config.LoggedInUser.difficulty==Difficulty.easy) {
                DrawableItems d=new DrawableItems();
                d.Parent=drawArea1;
                d.Image=trojor[Framework.rndInt(0,trojor.Length)];
                d.Bounds=new Rectangle(0,0,236,185);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                d.Image=byxor[Framework.rndInt(0,byxor.Length)];
                d.Bounds=new Rectangle(600,100,213,178);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                d.Image=mossor[Framework.rndInt(0,mossor.Length)];
                d.Bounds=new Rectangle(600,300,87,60);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                goal=PlaceCollection[0];
            }
        }
Exemple #12
0
 public fruit(DrawableItems it, fruitType ft)
 {
     Item=it;
     Type=ft;
 }
Exemple #13
0
 private void SpawnItems()
 {
     Fruits.Clear();
     int f1=Framework.rndInt(0,fruitImg.Length);
     int f3=f1;
     int f2=f1;
     while(f2==f1) {
         f2=Framework.rndInt(0,fruitImg.Length);
     }
     while(f3==f1||f3==f2) {
         f3=Framework.rndInt(0,fruitImg.Length);
     }
     t1=f1;t2=f2;
     if (Config.LoggedInUser.difficulty== Difficulty.easy){
         int r=(((int)Config.LoggedInUser.difficulty+2)*(Framework.rndInt(1,4)));
         for (int i = 0; i<r;i++) {
             DrawableItems d=new DrawableItems();
          	d.MouseDown+=new DrawableItems.ItemMouseEventHandler(ClickMovable);
             d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
             d.Parent=drawArea1;
             d.Image=fruitImg[f1];
             d.Bounds=new Rectangle(Framework.rndInt(250,400),Framework.rndInt(100,400),100,100);
             Fruits.Add(new fruit(d,(fruitType)f1));
          	drawArea1.Items.Add(d);
         }
     }else {
         int r;
         r=(((int)Config.LoggedInUser.difficulty+2)*(Framework.rndInt(1,4)));
         for (int i = 0; i<r;i++) {
             DrawableItems d=new DrawableItems();
          	d.MouseDown+=new DrawableItems.ItemMouseEventHandler(ClickMovable);
             d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
             d.Parent=drawArea1;
             d.Image=fruitImg[f1];
             d.Bounds=new Rectangle(Framework.rndInt(250,400),Framework.rndInt(100,400),100,100);
             Fruits.Add(new fruit(d,(fruitType)f1));
          	drawArea1.Items.Add(d);
         }
         r=(((int)Config.LoggedInUser.difficulty+2)*(Framework.rndInt(1,4)));
         for (int i = 0; i<r;i++) {
             DrawableItems d=new DrawableItems();
          	d.MouseDown+=new DrawableItems.ItemMouseEventHandler(ClickMovable);
             d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
             d.Parent=drawArea1;
             d.Image=fruitImg[f2];
             d.Bounds=new Rectangle(Framework.rndInt(250,400),Framework.rndInt(100,400),100,100);
             Fruits.Add(new fruit(d,(fruitType)f2));
          	drawArea1.Items.Add(d);
         }
         if(Config.LoggedInUser.difficulty== Difficulty.hard) {
             r=Framework.rndInt(1,4);
             for (int i = 0; i<r;i++) {
                 DrawableItems d=new DrawableItems();
              	d.MouseDown+=new DrawableItems.ItemMouseEventHandler(ClickMovable);
                 d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                 d.Parent=drawArea1;
                 d.Image=fruitImg[f3];
                 d.Bounds=new Rectangle(Framework.rndInt(250,400),Framework.rndInt(100,400),100,100);
                 OddFruits.Add(new fruit(d,(fruitType)f3));
              	drawArea1.Items.Add(d);
             }
         }
     }
 }
Exemple #14
0
 public static void LeaveClickable(DrawableItems sender, EventArgs e)
 {
     sender.Parent.Cursor=Cursors.Default;
 }
Exemple #15
0
 private void ClickMovable(DrawableItems sender, MouseEventArgs e)
 {
     drawArea1.ActiveItem=sender;
     offset=new Point(e.X,e.Y);
     int x=(int)((sender.Bounds.X+sender.Bounds.X+sender.Bounds.Width)/2);
     int y=(int)((sender.Bounds.Y+sender.Bounds.Y+sender.Bounds.Height)/2);
     dragging=(!dragging)&sender.Enabled;
     if((!dragging)&&(sender.Enabled)) {
         //if(sender.Tag==ActiveClothes&&goal.Polygon.Contains(new Point(x,y))) {
         if(sender.Tag==ActiveClothes&&goal.Polygon.Contains(sender.Bounds.Location)) {
             sender.Bounds=new Rectangle(goal.Polygon.Location.X+16,goal.Polygon.Y+16, sender.Bounds.Width, sender.Bounds.Height);
             sender.Enabled=false;
             drawArea1.Invalidate();
             ActiveClothes++;
             if(ActiveClothes==Clothes[Config.LoggedInUser.difficulty].Length) {
                 if((Config.LoggedInUser.score&((int)Framework.LevelScores.Clothes<<(int)Config.LoggedInUser.difficulty))!=((int)Framework.LevelScores.Clothes<<(int)Config.LoggedInUser.difficulty)) {
                		Config.LoggedInUser.score+=(uint)Framework.LevelScores.Clothes<<(int)Config.LoggedInUser.difficulty;
                		Config.UpdateScore(Config.LoggedInUser);
                	}
                 Framework.sndPlay.SoundLocation=@"Sounds\bra.wav";
                 Framework.sndPlay.Play();
                 //MessageBox.Show("omglol");
                 this.Close();
             }else{
                 goal=PlaceCollection[Clothes[Config.LoggedInUser.difficulty][ActiveClothes]];
                 Framework.sndPlay.SoundLocation=@"Sounds\Clothes\klapa.wav";
                 Framework.sndPlay.PlaySync();
                 Framework.sndPlay.SoundLocation=@"Sounds\Clothes\"+ClothSounds[Config.LoggedInUser.difficulty][ActiveClothes];
                 Framework.sndPlay.Play();
                 //MessageBox.Show(goal.Name+" "+goal.Polygon.X.ToString()+" "+goal.Polygon.Y.ToString());
                 //picBack.Bounds=goal.Polygon;
                 //drawArea1.Controls.Add(picBack);
             }
         }
     }
     if(sender.Enabled) {
         sender.Parent.BringItemToFront(sender);
     }
 }
Exemple #16
0
        public void SpawnItem()
        {
            DrawableItems d=new DrawableItems();
            Items item=ItemCollection[Framework.rndInt(0,ItemCollection.Length)];
            Places place=PlaceCollection[Config.LoggedInUser.difficulty][Framework.rndInt(0,PlaceCollection[Config.LoggedInUser.difficulty].Length)];
            d.Parent=drawArea1;
            d.Image=item.Image;
            d.Bounds=new Rectangle(Framework.rndInt(64,736),Framework.rndInt(500,506),d.Image.Width,d.Image.Height);
            d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
            d.MouseMove+= new DrawableItems.ItemMouseEventHandler(MoveMovable);
            drawArea1.Items.Add(d);
            goal=place;
            lblInstruction.Text="Lägg "+item.Name+item.Ending+" "+place.Name+"; "+Convert.ToString(total-correct)+" kvar";
            string itemsound=item.Name+item.Ending;
            itemsound=itemsound.ToLower().Replace(" ","").Replace('ä','a').Replace('å','a').Replace('ö','o')+".wav";
            string placesound=place.Name;
            placesound=placesound.ToLower().Replace(" ","").Replace('ä','a').Replace('å','a').Replace('ö','o')+".wav";

            Framework.sndPlay.SoundLocation=@"Sounds\Prepositions\"+itemsound;
            Framework.sndPlay.PlaySync();
            Framework.sndPlay.SoundLocation=@"Sounds\Prepositions\"+placesound;
            Framework.sndPlay.Play();
        }
Exemple #17
0
        void SpawnClothes()
        {
            int l;
            if(Config.LoggedInUser.difficulty==Difficulty.easy) {
                DrawableItems d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=trojor[l];
                d.Tag=0;
                d.Bounds=new Rectangle(0,0,236,185);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=byxor[l];
                d.Tag=1;
                d.Bounds=new Rectangle(600,100,213,178);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=mossor[l];
                d.Tag=2;
                d.Bounds=new Rectangle(600,300,87,60);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);
            }else if(Config.LoggedInUser.difficulty==Difficulty.normal) {
                DrawableItems d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=trojor[l];
                d.Tag=0;
                d.Bounds=new Rectangle(0,0,236,185);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=strumpor[l];
                d.Tag=1;
                d.Bounds=new Rectangle(200,510,274,38);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=byxor[l];
                d.Tag=2;
                d.Bounds=new Rectangle(550,100,213,178);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=mossor[l];
                d.Tag=3;
                d.Bounds=new Rectangle(20,300,87,60);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=jackor[l];
                d.Tag=4;
                d.Bounds=new Rectangle(600,300,237,187);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);
            }else if(Config.LoggedInUser.difficulty==Difficulty.hard) {
                DrawableItems d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=tshirts[l];
                d.Tag=0;
                d.Bounds=new Rectangle(0,0,236,180);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=trojor[l];
                d.Tag=1;
                d.Bounds=new Rectangle(500,50,236,185);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=strumpor[l];
                d.Tag=2;
                d.Bounds=new Rectangle(200,510,274,38);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=byxor[l];
                d.Tag=3;
                d.Bounds=new Rectangle(600,200,213,178);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=mossor[l];
                d.Tag=4;
                d.Bounds=new Rectangle(20,200,87,60);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);

                d=new DrawableItems();
                d.Parent=drawArea1;
                l=Framework.rndInt(0,trojor.Length);
                d.Image=jackor[l];
                d.Tag=5;
                d.Bounds=new Rectangle(600,400,237,187);
                d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
                d.MouseMove+=new DrawableItems.ItemMouseEventHandler(MoveMovable);
                drawArea1.Items.Add(d);
            }
            goal=PlaceCollection[0];
            ActiveClothes=0;
            Framework.sndPlay.SoundLocation=@"Sounds\Clothes\klapa.wav";
            Framework.sndPlay.PlaySync();
            Framework.sndPlay.SoundLocation=@"Sounds\Clothes\"+ClothSounds[Config.LoggedInUser.difficulty][ActiveClothes];
            Framework.sndPlay.Play();
        }
Exemple #18
0
 private void MoveMovable(DrawableItems sender,MouseEventArgs e)
 {
     if(dragging&&sender.Enabled) {
         Point p=sender.Bounds.Location;
         sender.Bounds=new Rectangle(new Point(p.X+e.X-offset.X,p.Y+e.Y-offset.Y),new Size(sender.Bounds.Width,sender.Bounds.Height));
         Rectangle InvalidateRect=new Rectangle(Math.Min(sender.Bounds.X,p.X),Math.Min(sender.Bounds.Y,p.Y),sender.Bounds.Width+Math.Abs(sender.Bounds.X-p.X),sender.Bounds.Height+Math.Abs(sender.Bounds.Y-p.Y));
         drawArea1.Invalidate(InvalidateRect);
         this.Cursor=Cursors.SizeAll;
     } else {
         this.Cursor=Cursors.Default;
     }
 }
Exemple #19
0
 public void SpawnItem()
 {
     DrawableItems d=new DrawableItems();
     Items item=ItemCollection[Framework.rndInt(0,ItemCollection.Length)];
     Places place=PlaceCollection[Config.LoggedInUser.difficulty][Framework.rndInt(0,PlaceCollection[Config.LoggedInUser.difficulty].Length)];
     d.Parent=drawArea1;
     d.Image=item.Image;
     d.Bounds=new Rectangle(Framework.rndInt(64,736),Framework.rndInt(500,506),d.Image.Width,d.Image.Height);
     //d.MouseEnter+= new DrawableItems.ItemEventHandler(Framework.EnterClickable);
     //d.MouseLeave+= new DrawableItems.ItemEventHandler(Framework.LeaveClickable);
     d.MouseDown+= new DrawableItems.ItemMouseEventHandler(ClickMovable);
     d.MouseMove+= new DrawableItems.ItemMouseEventHandler(MoveMovable);
     drawArea1.Items.Add(d);
     goal=place;
     lblInstruction.Text="Lägg "+item.Name+item.Ending+" "+place.Name+"; "+Convert.ToString(total-correct)+" kvar";
 }