Blame view

ios/Runner/Wowgame/Classes/game_food/SoundsRepo.h 2.77 KB
cb213901   xiaoyu   添加一个游戏的源码和编译选项
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  //
  //  SoundsRepo.h
  //  WattsenglishToyApp
  //
  //  Created by Katarzyna Kalinowska-Górska on 26/11/2019.
  //
  
  #ifndef SoundsRepo_h
  #define SoundsRepo_h
  
  #include <map>
  #include "audio/include/AudioEngine.h"
  
  class SoundsRepo {
  
  public:
      
      static std::string soundsFolder;
      static std::string musicBgFilePath;
      static std::map<std::string, float> soundDurations;
      
      static int currentMusicSoundId;
      
      struct SoundInfo {
          SoundInfo(std::string fp, float sd){
              filePath = fp;
              soundDuration = sd;
          };
          std::string filePath;
          float soundDuration;
      };
  
      // shoot game
  
      static void preloadAllShootGameSounds();
  
      static const char* SHOOT_GAME_SOUND_INTRO;
      static const char * SHOOT_GAME_SOUND_ALL_IN_TROLLEY;
      static const char* SHOOT_GAME_SOUND_SHOP_CLOSED;
      static const char* SHOOT_GAME_SOUND_WRONG_THREE_TIMES;
      static const char* SHOOT_GAME_SOUND_IN_TROLLEY;
      static const char* SHOOT_GAME_SOUND_NOT_IN_TROLLEY;
      static const char* SHOOT_GAME_SOUND_HIT_STEVE;
      static const char* SHOOT_GAME_SOUND_HIT_MAGGIE;
      static const char* SHOOT_GAME_SOUND_EFFECT_CATAPULT;
      static const char* SHOOT_GAME_SOUND_EFFECT_IN_TROLLEY;
      static const char* SHOOT_GAME_SOUND_EFFECT_SPLAT;
      
      static const char * MAP_GAME_SOUND_INTRO;
      static const char * MAP_GAME_SOUND_ALL_DONE;
  
      ///
      
      static SoundInfo hooraySound();
      static SoundInfo oopsSound();
      static SoundInfo pureOopsSound();
      static SoundInfo noSound();
      static SoundInfo pickLevelSound();
      static SoundInfo changeLevelSound();
  //    static SoundInfo gameFinishedSound();
  //    static SoundInfo scoreSound();
      static SoundInfo gameLostSound();
      static SoundInfo gameTNCIntroSound();
      static SoundInfo gameLetsStartIntroSound();
      static SoundInfo typeRequestSound(int game, int itemType);
      static SoundInfo typeConfirmSound(int game, int itemType);
      static SoundInfo typeWrongSound(int game, int itemType);
  
      static SoundInfo hurryUpSound();
  //    static SoundInfo tooSlowSound();
  //    static SoundInfo wrongThreeTimesSound();
      
      static int playSound(const std::string soundFilepath, bool stopOtherEffects = true);
      static int playMusic(const std::string musicFilepath);
      static void stopAllSounds();
      static void stopSoundById(int audioId);
      static void stopMusic();
      static void pauseAllSounds();
      static void resumeAllSounds();
      static float soundDuration(const std::string soundFilepath);
      static void preloadSoundEffect(std::string soundPath);
      static void preloadAllLoadedSoundEffects();
      
      static void loadSoundsList();
      static void parseSoundInfoFile(std::string soundFolderPath, std::string filePath, std::map<std::string, float>& mapToFill);
  };
      
  #endif /* SoundsRepo_h */