Skip to content

Commit

Permalink
add failure action music
Browse files Browse the repository at this point in the history
  • Loading branch information
punksta committed Apr 17, 2019
1 parent 700c9ce commit c965f60
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions android/app/build.gradle
Expand Up @@ -151,6 +151,7 @@ android {
}

dependencies {
implementation project(':react-native-sound')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-linear-gradient')
implementation fileTree(dir: "libs", include: ["*.jar"])
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/java/com/sortgame/MainApplication.java
Expand Up @@ -3,6 +3,7 @@
import android.app.Application;

import com.facebook.react.ReactApplication;
import com.zmxv.RNSound.RNSoundPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.BV.LinearGradient.LinearGradientPackage;
import com.facebook.react.ReactNativeHost;
Expand All @@ -25,6 +26,7 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNSoundPackage(),
new RNGestureHandlerPackage(),
new LinearGradientPackage()
);
Expand Down
Binary file added android/app/src/main/res/raw/angry_cat.mp3
Binary file not shown.
2 changes: 2 additions & 0 deletions android/settings.gradle
@@ -1,4 +1,6 @@
rootProject.name = 'sortGame'
include ':react-native-sound'
project(':react-native-sound').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sound/android')
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':react-native-linear-gradient'
Expand Down
19 changes: 19 additions & 0 deletions ios/sortGame.xcodeproj/project.pbxproj
Expand Up @@ -43,6 +43,7 @@
011E034382EE43388A94E903 /* MavenPro-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B019264024354815B8C3C005 /* MavenPro-Regular.ttf */; };
F521CC3EB28D4678974A4914 /* libBVLinearGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D64C1B9E05E54689AF759AA9 /* libBVLinearGradient.a */; };
E91CC28BFFE843C6AEA5ED9F /* libRNGestureHandler.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CA2C19306ED4E638864331B /* libRNGestureHandler.a */; };
C0CB6B4AAF3747F1917B5A43 /* libRNSound.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B5D7C906FE545EA8F107AA2 /* libRNSound.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -356,6 +357,8 @@
D64C1B9E05E54689AF759AA9 /* libBVLinearGradient.a */ = {isa = PBXFileReference; name = "libBVLinearGradient.a"; path = "libBVLinearGradient.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
7880ED94D39E436EA8112CC1 /* RNGestureHandler.xcodeproj */ = {isa = PBXFileReference; name = "RNGestureHandler.xcodeproj"; path = "../node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
8CA2C19306ED4E638864331B /* libRNGestureHandler.a */ = {isa = PBXFileReference; name = "libRNGestureHandler.a"; path = "libRNGestureHandler.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
0A1DB073FD0E4D009653D3D8 /* RNSound.xcodeproj */ = {isa = PBXFileReference; name = "RNSound.xcodeproj"; path = "../node_modules/react-native-sound/RNSound.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
2B5D7C906FE545EA8F107AA2 /* libRNSound.a */ = {isa = PBXFileReference; name = "libRNSound.a"; path = "libRNSound.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -386,6 +389,7 @@
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
F521CC3EB28D4678974A4914 /* libBVLinearGradient.a in Frameworks */,
E91CC28BFFE843C6AEA5ED9F /* libRNGestureHandler.a in Frameworks */,
C0CB6B4AAF3747F1917B5A43 /* libRNSound.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -574,6 +578,7 @@
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
DE8F1DC1A36E4985BC48BCF5 /* BVLinearGradient.xcodeproj */,
7880ED94D39E436EA8112CC1 /* RNGestureHandler.xcodeproj */,
0A1DB073FD0E4D009653D3D8 /* RNSound.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
Expand Down Expand Up @@ -1217,11 +1222,13 @@
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/sortGame.app/sortGame";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
);
};
name = Debug;
Expand All @@ -1242,11 +1249,13 @@
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/sortGame.app/sortGame";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
);
};
name = Release;
Expand All @@ -1270,6 +1279,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
);
};
name = Debug;
Expand All @@ -1292,6 +1302,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
);
};
name = Release;
Expand Down Expand Up @@ -1321,11 +1332,13 @@
TVOS_DEPLOYMENT_TARGET = 9.2;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
);
};
name = Debug;
Expand Down Expand Up @@ -1355,11 +1368,13 @@
TVOS_DEPLOYMENT_TARGET = 9.2;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
);
};
name = Release;
Expand Down Expand Up @@ -1388,11 +1403,13 @@
TVOS_DEPLOYMENT_TARGET = 10.1;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
);
};
name = Debug;
Expand Down Expand Up @@ -1421,11 +1438,13 @@
TVOS_DEPLOYMENT_TARGET = 10.1;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-linear-gradient/BVLinearGradient",
"$(SRCROOT)/../node_modules/react-native-gesture-handler/ios/**",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
);
};
name = Release;
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -23,6 +23,7 @@
"react-native-linear-gradient": "^2.5.4",
"react-native-material-menu": "^0.4.0",
"react-native-popup-dialog": "^0.15.0",
"react-native-sound": "^0.10.12",
"react-navigation": "^2.14.0",
"react-redux": "^5.0.7",
"recompose": "^0.29.0",
Expand Down
17 changes: 17 additions & 0 deletions src/components/Info.js
Expand Up @@ -133,6 +133,23 @@ const Info = ({scrollViewRef}) => {
</View>
);
})}
<Text
style={{
fontSize: 20,
marginTop: 16,
marginBottom: 8
}}
>
audio sources
</Text>
<Text
style={{
marginTop: 16,
marginBottom: 8
}}
>
"Cat, Screaming, A.wav" by InspectorJ (www.jshaw.co.uk) of Freesound.org
</Text>
</View>
</ScrollView>
);
Expand Down
2 changes: 2 additions & 0 deletions src/containers/GameScreen.js
Expand Up @@ -27,6 +27,7 @@ const getItemSize = makePhotoSourceSize(itemHeight);

import {consoleTime, consoleTimeEnd} from "../utils/debugUtils";
import AppearOnMount from "../components/AppearOnMount";
import {playFailureCat} from "../utils/music"

type State<T> = {
rightAnswers: Array<T>,
Expand Down Expand Up @@ -100,6 +101,7 @@ class GameScreen extends React.Component<$FlowFixMeProps, State<*>> {
}

vibrateOnWrongAnswer = () => {
playFailureCat()
Vibration.vibrate(200);
};

Expand Down
9 changes: 9 additions & 0 deletions src/utils/music.js
@@ -0,0 +1,9 @@
const Sound = require('react-native-sound');

const FailureCat = new Sound('angry_cat.mp3', Sound.MAIN_BUNDLE, (error) => {

});

export const playFailureCat = () => {
FailureCat.play();
}

0 comments on commit c965f60

Please sign in to comment.