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); } }
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(); }
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]; } }