1

cocos2dでサウンドを順番に再生する方法は、たとえば、次のような3つのサウンドがあるなど、体に何か考えがありますか

[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderOneSound]];

[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.WithSound]];

[[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderTwoSound]];

これは効果音再生のコードです

4

1 に答える 1

9
CCSequence* sequence = [CCSequence actions: 
                                [CCCallBlock actionWithBlock:^(void)
                                 { 
                                     [[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderOneSound]];
                                 }],
                                [CCDelayTime actionWithDuration:3],
                                [CCCallBlock actionWithBlock:^(void)
                                 { 
                                     [[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.WithSound]];
                                 }],
                                [CCDelayTime actionWithDuration:3],
                                [CCCallBlock actionWithBlock:^(void)
                                 { 
                                     [[SimpleAudioEngine sharedEngine] playEffect:[CommanMethods GetCompleteSoundPath:objplate.OrderTwoSound]];
                                 }],
                                nil];
[self runAction:sequence];

この方法で問題を解決できますが、唯一の欠点は、遅延時間を自分で挿入する必要があることです。あなたの状況でうまくいくことを願っています。

于 2012-02-02T01:11:33.657 に答える