Quick Table of Contents
  1. Table of Contents
  2. Preface
  3. Section 1: Application Design Concepts and Principles
  4. Section 2: Common Architectures
  5. Section 3: Integration and Messaging
  6. Section 4: Business Tiers Technologies
  7. Section 5: Web Tier Technologies
  8. Section 6: Applicability of Java EE Technology
  9. Section 7: Patterns
  10. Section 8: Security

Mediator

Description

An object that encapsulates how a set of objects interact.

Scenario

Benefits

Drawbacks

Related patterns

Comments
Yogaraj Khanal - 6 April 2010May be its good idea to put hyperlink in related pattern so that people and go back and forth when they want to refer it.Just my 2 cents won't hurt the way it is now.
ognaaxjs - 14 April 2012htZXDU <a href="http://wurdojjjnwev.com/">wurdojjjnwev</a>
Jose - 13 April 2012Bomb : CCLayer (I also tried CCNode)Bomb.m- (void)onEnter{[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self irtorpiy:kCCMenuTouchPriority swallowsTouches:YES];[super onEnter];}- (void)onExit{[[CCTouchDispatcher sharedDispatcher] removeDelegate:self];[super onExit];}- (BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event{if(isPaused || !canBeDragged || LOST)return NO;//take the coordinates of the touch and transform them into the OpenGL system.CGPoint location = [touch locationInView: [touch view]];location = [[CCDirector sharedDirector] convertToGL: location];CGRect frame = CGRectMake(self.position.x, self.position.y, self.contentSize.width, self.contentSize.height);if(!CGRectContainsPoint(frame, location))return NO;location.x *= factor;location.y *= factor;if(BombShape){offsetX = BombShape->body->p.x location.x;offsetY = BombShape->body->p.y location.y;BombShape->body->v = cpvzero;BombShape->collision_type++;//make it Dragged'. For example RedNinja++ is DraggedRedNinja} return YES;}//****************************************************************************************- (void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event{if(isPaused || !canBeDragged)return;CGPoint location = [touch locationInView: [touch view]];location = [[CCDirector sharedDirector] convertToGL: location];CGPoint prevLocation = [touch previousLocationInView: [touch view]];prevLocation = [[CCDirector sharedDirector] convertToGL: prevLocation];location.x *= factor;location.y *= factor;prevLocation.x *= factor;prevLocation.y *= factor;if(BombBody){//during the dragging, the bomb must not have velocity. Otherwise, it will run beneath your finger.//so we are constantly calculating the velocity and ,when you end the draging, assign that value to the velocity of the bomb.velocity = cpv((location.x prevLocation.x) * 30 , (location.y prevLocation.y)*30); CGPoint newPosition = cpv(location.x + offsetX, location.y + offsetY);//test per XcanMoveOnX = CheckOnX(BombBody->p , newPosition,radius);canMoveOnY = CheckOnY(BombBody->p , newPosition,radius);if(canMoveOnX)BombBody->p.x = newPosition.x;if(canMoveOnY)BombBody->p.y = newPosition.y;}}//****************************************************************************************- (void) ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event{if(!canBeDragged || isPaused)return;//set velocity backBombShape->body->v = velocity;BombShape->collision_type ;offsetX = 0;offsetY = 0;}//****************************************************************************************-(void) ccTouchCancelled:(UITouch *)touch withEvent:(UIEvent *)event{}My second touch is not detected how can I make this work? Thanks!!
Leave a comment


Name:*
Email:
Message:*
Security code:*
(type the code in the text field)