Rebeloper

Amazing Thief

Amazing Thief iOS

Screenshots

Amazing Thief iOS
Amazing Thief iOS
Amazing Thief iOS
Amazing Thief iOS
Amazing Thief iOS
Amazing Thief iOS
Amazing Thief iOS
Amazing Thief iOS

Specification

How to Use

Sample Code

// // MainMenu.m // AmazingThief /* * Copyright (c) 2014 Rebeloper. All rights reserved. * * http://www.rebeloper.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either expressed or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #import "MainMenu.h" #import "Defaults.h" #import "iRate.h" #import "RootViewControllerInterface.h" #import "StoreInventory.h" #import "AmazingThiefBlueprintStoreAssets.h" #import "SoomlaStore.h" #import "AppDelegate.h" #import <Chartboost/Chartboost.h> #import "Flurry.h" @implementation MainMenu { CCButton *_toggleSoundOnOffButton; } - (void)didLoadFromCCB { // showing ads at startup [AppController showAdsAtStartup]; [MainMenu playBackgroundMusic]; } - (void) rateButtonTapped { // FLURRY LOG [Flurry logEvent:@"[Main Menu] Rate button tapped."]; [MainMenu playTapSound]; [[iRate sharedInstance] openRatingsPageInAppStore]; } - (void) playButtonTapped { // FLURRY LOG [Flurry logEvent:@"[Main Menu] Play Inferno button tapped."]; [MainMenu playTapSound]; CCScene *gameplayInfernoScene = [CCBReader loadAsScene:@"Gameplay"]; [[CCDirector sharedDirector] replaceScene:gameplayInfernoScene]; } - (void) gameCenterButtonTapped { // FLURRY LOG [Flurry logEvent:@"[Main Menu] Game Center button tapped."]; [MainMenu playTapSound]; NSLog(@"Passing Game Center opening to rootViewControllerInterface"); [[RootViewControllerInterface sharedManager] openGameCenterFromRootViewController]; } - (void) moreGamesButtonTapped { // FLURRY LOG [Flurry logEvent:@"[Main Menu] More games button tapped."]; [MainMenu playTapSound]; // Show more apps [Chartboost showMoreApps:CBLocationSettings]; // Cache more apps if (![Chartboost hasMoreApps:CBLocationSettings]) { [Chartboost cacheMoreApps:CBLocationSettings]; } } - (void) noAdsButtonTapped { NSLog(@"No Ads Button tapped."); // FLURRY LOG [Flurry logEvent:@"[Main Menu] No Ads button tapped."]; [MainMenu playTapSound]; [StoreInventory buyItemWithItemId:NO_ADS_ITEM_ID andPayload:@"noAds"]; } - (void) restorePurchasesButtonTapped { // FLURRY LOG [Flurry logEvent:@"[Main Menu] Buy Restore button tapped."]; [MainMenu playTapSound]; NSLog(@"Restore purchases button tapped."); [[SoomlaStore getInstance] restoreTransactions]; } #pragma mark - #pragma mark Sounds and music - (void) toggleSoundOnOffButtonTapped:(id) sender { // FLURRY LOG [Flurry logEvent:@"[Main Menu] Toggle sound button tapped."]; [MainMenu playTapSound]; _toggleSound if (_toggleSoundOnOffButton.selected) { NSLog(@"Sound is OFF."); [MainMenu stopBackgroundMusic]; [MainMenu registerFXState:NO]; } else { NSLog(@"Sound is ON."); [MainMenu registerFXState:YES]; [MainMenu playBackgroundMusic]; } } + (void) registerFXState:(BOOL) onOrOff { [[NSUserDefaults standardUserDefaults] setBool:onOrOff forKey:kFXState]; [[NSUserDefaults standardUserDefaults] synchronize]; } + (BOOL) getFXState { return [[NSUserDefaults standardUserDefaults] boolForKey:kFXState]; } + (void) playTapSound { if ([self getFXState]) { // access audio object OALSimpleAudio *audio = [OALSimpleAudio sharedInstance]; // play sound effect [audio playEffect:@"tap.wav"]; [audio preloadEffect:@"tap.wav"]; } } + (void) playHitSound { if ([self getFXState]) { // access audio object OALSimpleAudio *audio = [OALSimpleAudio sharedInstance]; // play sound effect [audio playEffect:@"hit.wav"]; [audio preloadEffect:@"hit.wav"]; } } + (void) playWoshSound { if ([self getFXState]) { // access audio object OALSimpleAudio *audio = [OALSimpleAudio sharedInstance]; // play sound effect [audio playEffect:@"wosh.wav"]; [audio preloadEffect:@"wosh.wav"]; } } + (void) playScoreSound { if ([self getFXState]) { // access audio object OALSimpleAudio *audio = [OALSimpleAudio sharedInstance]; // play sound effect [audio playEffect:@"score.wav"]; [audio preloadEffect:@"score.wav"]; } } + (void) playBackgroundMusic { if ([self getFXState]) { // access audio object OALSimpleAudio *audio = [OALSimpleAudio sharedInstance]; // play background music [audio playBg:@"BackgroundMusic.mp3" loop:YES]; } } + (void) stopBackgroundMusic { if ([self getFXState]) { // access audio object OALSimpleAudio *audio = [OALSimpleAudio sharedInstance]; // stop background music [audio stopBg]; } } @end

Video

Comments (1)

  • {{com.username}}
    {{com.username}}
    Buyer
    Seller

    {{com.username}}

    {{com.ctime}}

    {{com.content}}

    • {{com2.username}}
      {{com2.username}}
      Buyer
      Seller

      {{com2.username}}

      {{com2.ctime}}

      {{com2.content}}