Luchanso / bunny-funny-runner

Simple runner
https://luchanso.github.io/bunny-funny-runner/
14 stars 4 forks source link

WIP: feat(react): add react #37

Closed Luchanso closed 6 years ago

Luchanso commented 6 years ago

31

Luchanso commented 6 years ago
const onChangeState = state => {
  router.go(state);
}

const mapStateToProps = (state) => {
  isVK: state.router.path === 'vk'
  sceneType: selector(state);
}

if (store.getState().router.path === 'vk') { console.log('vk') };

class GameComponent extends React.Component {
  componentDidMount() {
    // this.props.stateName === 'shop' - react
    // this.props.stateName === 'boot' - game

    if (sceneType === SCENES_TYPE.REACT) {

    } else if (sceneType === SCENES_TYPE.GAME) {
      gameInit(this.props.stateName);
      // const game = new Game(...);

      // game.state.add(...);
      // game.state.start(this.props.router.stateName);
    }
  }

  render() {
    return (
      <div id="game" />
    );
  }
}

<Switch>
  <Router path=':platform/:stateName' component={GameComponent} />
</Switch>
Luchanso commented 6 years ago

Next: нарисовать наконец - то шоп