Skip to content

Commit

Permalink
[Build] Sounds and Features
Browse files Browse the repository at this point in the history
1. Added new sounds for cards on lock and on unlock state
2. Added 'How to Play' interface for instructions on the game
3. Changed the UI/CSS for the app loader to black
  • Loading branch information
sricharankrishnan committed Nov 17, 2022
1 parent 665cde6 commit 2231de1
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 70 deletions.
Binary file modified public/app-favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/app-icon-ffffff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 20 additions & 29 deletions src/assets/icons/app-icon-ffffff.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/app-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 104 additions & 0 deletions src/assets/icons/app-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/icons/loader-icon.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/sounds/deselect-sound.wav
Binary file not shown.
Binary file added src/assets/sounds/notification-sound.wav
Binary file not shown.
Binary file added src/assets/sounds/selection-sound.wav
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/app-loader/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
left: 0;
width: 100%;
height: 100%;
background: $white;
background: $black;
z-index: 100;
img {
width: 100px;
Expand Down
12 changes: 11 additions & 1 deletion src/components/cards/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@ import "./styles.scss";
import { LockComponent } from "./lock-component.js";
import { setCardAsLocked } from "./service/set-card-as-locked.js";
import { setCardAsUnlocked } from "./service/set-card-as-unlocked.js";
import selectionSound from "@appSounds/selection-sound.wav";
import deselectionSound from "@appSounds/deselect-sound.wav";

export const Card = (props) => {
let [isLocked, setIsLocked] = useState(props.isLocked);
let [hasUpdated, setHasUpdated] = useState(false);
let [soundEffects] = useState({
lock: new Audio(selectionSound),
unlock: new Audio(deselectionSound)
});

const onClickHandler = () => {
setIsLocked((prevState) => !prevState);
setIsLocked((prevState) => {
const newLockState = !prevState;
newLockState === true ? soundEffects.lock.play() : soundEffects.unlock.play();
return newLockState;
});
};

/* after component load */
Expand Down
2 changes: 1 addition & 1 deletion src/components/cards/lock-component.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* react imports */
import React from "react";
import React, { useEffect } from "react";

/* app imports */
import { getLockIcons } from "./service/get-lock-icons.js";
Expand Down
21 changes: 17 additions & 4 deletions src/pages/home/header.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
/* react imports */
import React from "react";
import React, { useState } from "react";

/* app imports */
import diceImage from "@appImages/dice.jpg";
import popupSound from "@appSounds/click-sound.mp3";

export default function Header() {
const [textElementClass, setTextElementClass] = useState("text");
const notificationSound = new Audio(popupSound);

const onButtonClickHandler = () => {
setTextElementClass("text show");
notificationSound.play();
setTimeout(() => {
setTextElementClass("text");
}, 6000);
};

return (
<React.Fragment>
<div className="header positionRelative customRow">
<h1>Samurai <br/>Tenzies</h1>
{/*
<div className="text">
<button className="btn btn-light howToPlay" type="button" onClick={onButtonClickHandler}>
How to Play?
</button>
<div className={textElementClass}>
<p>{`Roll until all dice are the same. Click each die to freeze it as its current value
between rolls.`}</p>
</div>
*/}
</div>
</React.Fragment>
);
Expand Down
Loading

0 comments on commit 2231de1

Please sign in to comment.