diff --git a/client/index.js b/client/index.js index 7540b13..7cc7d93 100644 --- a/client/index.js +++ b/client/index.js @@ -37,8 +37,6 @@ stage.element.addEventListener('focus', () => { isFocused = true; }); stage.addToDom(appNode); -// World time ticker. -const worldTimeTicker = new Ticker(1 / 10); // Handle "own" entity. let selfEntity; function hasSelfEntity() { @@ -51,9 +49,6 @@ const roomView = new RoomView(room, stage.renderer); stage.addChild(roomView); // Time. const worldTime = new WorldTime(); -worldTimeTicker.on('tick', () => { - worldTimeTicker.emit('updateTime', worldTime.hour) -}); // Synchronize state. let state = undefined; const synchronizer = new Synchronizer({ @@ -208,8 +203,6 @@ const predictionHandle = setInterval(() => { state = synchronizer.state; // Render timing. renderTicker.tick(elapsed); - // World time ticker. - worldTimeTicker.tick(elapsed); // Throughput ticker. throughputTicker.tick(elapsed); // Apply environmental lighting. @@ -267,7 +260,7 @@ function render() { const renderHandle = setAnimation(render); // UI. const UiComponent = ; ReactDOM.render(UiComponent, stage.ui); diff --git a/client/ui/index.js b/client/ui/index.js index 2573978..a12ed43 100644 --- a/client/ui/index.js +++ b/client/ui/index.js @@ -5,9 +5,9 @@ import {hot} from 'react-hot-loader/root'; import Throughput from './throughput'; import WorldTime from './world-time'; -const Ui = ({throughputTicker, worldTimeTicker}) => { +const Ui = ({throughputTicker, worldTime}) => { return - + ; }; diff --git a/client/ui/world-time.js b/client/ui/world-time.js index 8e8ef3c..d7b8136 100644 --- a/client/ui/world-time.js +++ b/client/ui/world-time.js @@ -23,15 +23,15 @@ const decorate = compose( `), ); -const WorldTimeComponent = ({ticker}) => { +const WorldTimeComponent = ({worldTime}) => { const [time, setTime] = useState('--:-- --'); useEffect(() => { - const updater = (hour) => { - setTime(WorldTime.format(hour)); + const updater = () => { + setTime(WorldTime.format(worldTime.hour)); }; - ticker.on('updateTime', updater); + worldTime.ticker.on('tick', updater); return () => { - ticker.off('updateTime', updater); + worldTime.ticker.off('tick', updater); }; }, []); return
{time}
;