Add animations turn off
Signed-off-by: James Ketrenos <james_eikona@ketrenos.com>
This commit is contained in:
parent
b9e6f9128f
commit
ff35c7fbbc
@ -1,3 +1,3 @@
|
|||||||
PUBLIC_URL=/ketr.ketran
|
PUBLIC_URL=/ketr.ketran
|
||||||
HOST=nuc.ketrenos.com
|
HOST=localhost
|
||||||
DANGEROUSLY_DISABLE_HOST_CHECK='true'
|
DANGEROUSLY_DISABLE_HOST_CHECK='true'
|
||||||
|
@ -28,7 +28,7 @@ import { Winner } from "./Winner.js";
|
|||||||
import { HouseRules } from "./HouseRules.js";
|
import { HouseRules } from "./HouseRules.js";
|
||||||
import { Dice } from "./Dice.js";
|
import { Dice } from "./Dice.js";
|
||||||
import { assetsPath } from "./Common.js";
|
import { assetsPath } from "./Common.js";
|
||||||
import { Sheep } from "./Sheep.js";
|
//import { Sheep } from "./Sheep.js";
|
||||||
|
|
||||||
import history from "./history.js";
|
import history from "./history.js";
|
||||||
import "./App.css";
|
import "./App.css";
|
||||||
@ -84,6 +84,11 @@ const Table = () => {
|
|||||||
const [winnerDismissed, setWinnerDismissed] = useState(undefined);
|
const [winnerDismissed, setWinnerDismissed] = useState(undefined);
|
||||||
const [global, setGlobal] = useState({});
|
const [global, setGlobal] = useState({});
|
||||||
const [count, setCount] = useState(0);
|
const [count, setCount] = useState(0);
|
||||||
|
const [audio, setAudio] = useState(
|
||||||
|
localStorage.getItem('audio') ?
|
||||||
|
localStorage.getItem('audio') : false);
|
||||||
|
const [animations, setAnimations] = useState(
|
||||||
|
localStorage.getItem('animations') || false);
|
||||||
const [volume, setVolume] = useState(
|
const [volume, setVolume] = useState(
|
||||||
localStorage.getItem('volume') ?
|
localStorage.getItem('volume') ?
|
||||||
parseFloat(localStorage.getItem('volume')) : 0.5);
|
parseFloat(localStorage.getItem('volume')) : 0.5);
|
||||||
@ -421,7 +426,7 @@ const Table = () => {
|
|||||||
audioEffects.knights.hasPlayed = false;
|
audioEffects.knights.hasPlayed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [turn, color, volume]);
|
}, [state, turn, color, volume]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
for (let key in audioEffects) {
|
for (let key in audioEffects) {
|
||||||
@ -473,13 +478,19 @@ const Table = () => {
|
|||||||
<ChooseCard/>
|
<ChooseCard/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Board/>
|
<Board animations={animations}/>
|
||||||
<PlayersStatus/>
|
<PlayersStatus/>
|
||||||
<PlayersStatus active={true}/>
|
<PlayersStatus active={true}/>
|
||||||
<Hand {...{buildActive, setBuildActive, setCardActive}}/>
|
<Hand {...{buildActive, setBuildActive, setCardActive}}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="Sidebar">
|
<div className="Sidebar">
|
||||||
{ name !== "" && volume !== undefined && <Paper className="Volume">
|
{ name !== "" && volume !== undefined && <Paper className="Volume">
|
||||||
|
<div>Audio effects</div> <input type="checkbox" id="audio"
|
||||||
|
name="audio" defaultChecked={audio ? true : false} onInput={(e) => {
|
||||||
|
const value = !audio;
|
||||||
|
localStorage.setItem('audio', value);
|
||||||
|
setAudio(value)
|
||||||
|
}}/>
|
||||||
<div>Sound effects volume</div> <input type="range" id="volume" name="volume"
|
<div>Sound effects volume</div> <input type="range" id="volume" name="volume"
|
||||||
value={volume * 100}
|
value={volume * 100}
|
||||||
min="0" max="100" onInput={(e) => {
|
min="0" max="100" onInput={(e) => {
|
||||||
@ -488,7 +499,13 @@ const Table = () => {
|
|||||||
localStorage.setItem('volume', alpha);
|
localStorage.setItem('volume', alpha);
|
||||||
setVolume(alpha);
|
setVolume(alpha);
|
||||||
}}/>
|
}}/>
|
||||||
</Paper>}
|
<div>Animations</div> <input type="checkbox" id="animations"
|
||||||
|
name="animations" defaultChecked={animations ? true : false} onInput={(e) => {
|
||||||
|
const value = !animations;
|
||||||
|
localStorage.setItem('animations', value);
|
||||||
|
setAnimations(value)
|
||||||
|
}} />
|
||||||
|
</Paper>}
|
||||||
{ name !== "" && <PlayerList/> }
|
{ name !== "" && <PlayerList/> }
|
||||||
<Trade {...{tradeActive, setTradeActive}}/>
|
<Trade {...{tradeActive, setTradeActive}}/>
|
||||||
{ name !== "" && <Chat/> }
|
{ name !== "" && <Chat/> }
|
||||||
|
@ -34,7 +34,7 @@ const clearTooltip = () => {
|
|||||||
document.querySelector('.Board .Tooltip').style.display = 'none';
|
document.querySelector('.Board .Tooltip').style.display = 'none';
|
||||||
};
|
};
|
||||||
|
|
||||||
const Board = () => {
|
const Board = ({ animations }) => {
|
||||||
const { ws } = useContext(GlobalContext);
|
const { ws } = useContext(GlobalContext);
|
||||||
const board = useRef();
|
const board = useRef();
|
||||||
const [transform, setTransform] = useState(1.);
|
const [transform, setTransform] = useState(1.);
|
||||||
@ -554,24 +554,27 @@ const Board = () => {
|
|||||||
|
|
||||||
if (tile.type === 'wheat') {
|
if (tile.type === 'wheat') {
|
||||||
div = <div key={`tile-${order}`}>
|
div = <div key={`tile-${order}`}>
|
||||||
|
{ animations &&
|
||||||
<Flock count={Math.floor(1 + animationSeeds[index] * 2)}
|
<Flock count={Math.floor(1 + animationSeeds[index] * 2)}
|
||||||
style={{
|
|
||||||
top: `${tile.top - tileImageHeight * 0.5}px`,
|
|
||||||
left: `${tile.left - tileImageWidth * 0.5}px`,
|
|
||||||
width: `${tileImageWidth}px`,
|
|
||||||
height: `${tileImageHeight}px`
|
|
||||||
}}/><Tile
|
|
||||||
tile={tile}
|
|
||||||
/></div>;
|
|
||||||
} else if (tile.type === 'sheep') {
|
|
||||||
div = <div key={`tile-${order}`}>
|
|
||||||
<Herd count={Math.floor(1 + animationSeeds[index] * 4)}
|
|
||||||
style={{
|
style={{
|
||||||
top: `${tile.top - tileImageHeight * 0.5}px`,
|
top: `${tile.top - tileImageHeight * 0.5}px`,
|
||||||
left: `${tile.left - tileImageWidth * 0.5}px`,
|
left: `${tile.left - tileImageWidth * 0.5}px`,
|
||||||
width: `${tileImageWidth}px`,
|
width: `${tileImageWidth}px`,
|
||||||
height: `${tileImageHeight}px`
|
height: `${tileImageHeight}px`
|
||||||
}} /><Tile
|
}}/> } <Tile
|
||||||
|
tile={tile}
|
||||||
|
/></div>;
|
||||||
|
} else if (tile.type === 'sheep') {
|
||||||
|
div = <div key={`tile-${order}`}>
|
||||||
|
{ animations &&
|
||||||
|
<Herd count={Math.floor(1 + animationSeeds[index] * 4)}
|
||||||
|
style={{
|
||||||
|
top: `${tile.top - tileImageHeight * 0.5}px`,
|
||||||
|
left: `${tile.left - tileImageWidth * 0.5}px`,
|
||||||
|
width: `${tileImageWidth}px`,
|
||||||
|
height: `${tileImageHeight}px`
|
||||||
|
}} />
|
||||||
|
}<Tile
|
||||||
tile={tile}
|
tile={tile}
|
||||||
/></div>;
|
/></div>;
|
||||||
} else {
|
} else {
|
||||||
@ -696,7 +699,7 @@ const Board = () => {
|
|||||||
signature, generated,
|
signature, generated,
|
||||||
pips, pipOrder, borders, borderOrder, tiles, tileOrder,
|
pips, pipOrder, borders, borderOrder, tiles, tileOrder,
|
||||||
animationSeeds,
|
animationSeeds,
|
||||||
ws, state, rules
|
ws, state, rules, animations
|
||||||
]);
|
]);
|
||||||
|
|
||||||
/* Re-render turn info after every render */
|
/* Re-render turn info after every render */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user