cocos2d iphone - Playing soundeffect on item touch -


In cocosdaddy for iOS, how do I make a click sound effect automatically whenever the user has a menu item ?

My idea was to change ccTouchEnded in CCMenu.m:

  - (zero) ccTouchEnded: (UITouch *) document with touch: (UIEvent *) event {nsassart ( State_ == KCsenmenuastettrackingTouch, @ "[menu ccTechended] - invalid status"); [SelectedItem_unlected]; [SelectedItem_active]; State_ = kCCMenuState is waiting; // Click any effect when clicked on any menu item [MyMusicHandler playClick];   

}

It works and what I have to do. But this is "hacking source", and I love sub-closing ccmenu instead. However, if I keep that exact method in my sub-class of CCMenu, then it does not work. Suggestion:

In this way I do this in my game:

Init (GETextMenuItem subclasses CCMenuItemLabel): confirmMenuItem _ = [GETextMenuItem textMenuItemWithText: @ "Buy" dimension: CGSizeMake (9032) Alignment: UITextAlignmentCenter font: @ "Cochin-Bold" font size: 17 Goal: Self Selector: @Selector (OnConfirm)];

and in the selector (GameAgein is a homeowner that offers all types of services elsewhere):

  - (void ) {// Instantly double-click menu_.isTouchEnabled = NO; [[Gaingenjin shared game engine]. SoundProvider playFxNowWithSound: @ "sound_fx_menu_buy.mp3"]; NSString * params = [NSString stringWithFormat: @ "Quantity:% i", quantity_]; [Consumer_Manu Returns Formatting: Manually by Migration with Param: Params]; [Flyoot]; }    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -