Skip to content

Commit

Permalink
Merge branch 'master' of github.com:bemusic/bemuse into webpack2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dtinth committed Mar 10, 2017
2 parents 9b382d9 + a8b7756 commit ea7855f
Show file tree
Hide file tree
Showing 48 changed files with 1,445 additions and 334 deletions.
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,8 @@ __Play now at https://bemuse.ninja/.__
Install [Node.js](https://nodejs.org/en/) and [Yarn](https://github.com/yarnpkg).

```
# Create a folder for Bemuse
mkdir Bemuse
cd Bemuse
# Clone Bemuse and music server (warning, very large repo!!)
# Clone Bemuse
git clone git@github.com:bemusic/bemuse.git
git clone git@github.com:bemusic/music.git
# Enter the main repository
cd bemuse
Expand Down
2 changes: 1 addition & 1 deletion bin/release
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e

git pull --ff-only
npm version "$@"
npm version "$@" -m ':bookmark: %s'
git push --follow-tags

3 changes: 2 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ deployment:
- git remote add www https://akibot:$GH_TOKEN@github.com/bemusic/bemusic.github.io.git
- git config --global user.email "aki@spacet.me"
- git config --global user.name "Aki running on CircleCI"
- git log --format=%B -n 1 | egrep '^[0-9]+\.[0-9]+\.[0-9]+' && ./node_modules/.bin/gulp deploy || echo 'Not a release commit, skipped!'
- |
git log --format=%B -n 1 | egrep '^:bookmark: [0-9]+\.[0-9]+\.[0-9]+' && ./node_modules/.bin/gulp deploy || echo 'Not a release commit, skipped!'
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bemuse",
"version": "34.0.0",
"version": "36.1.0",
"description": "BEAT☆MUSIC☆SEQUENCE, a web-based music game of the future",
"main": "index.js",
"scripts": {
Expand All @@ -15,6 +15,12 @@
"test-bed": "bash -c \"NODE_ENV=test test-bed\"",
"travis": "gulp travis"
},
"importSort": {
".js, .jsx, .es6, .es": {
"parser": "babylon",
"style": "renke"
}
},
"repository": {
"type": "git",
"url": "https://github.com/spacetme/bemuse.git"
Expand Down Expand Up @@ -72,6 +78,7 @@
"gulp-mocha": "^2.0.1",
"gulp-util": "^3.0.1",
"hide-stack-frames-from": "^1.0.0",
"import-sort-style-renke": "^2.4.0",
"jade": "^1.9.2",
"jade-loader": "^0.8.0",
"js-yaml": "^3.5.5",
Expand Down Expand Up @@ -110,6 +117,8 @@
},
"dependencies": {
"audio-context": "^0.1.0",
"auth0-js": "^8.1.2",
"axios": "^0.15.3",
"baconjs": "^0.7.75",
"bemuse-indexer": "^3.1.0",
"bemuse-notechart": "^1.1.0",
Expand All @@ -135,7 +144,6 @@
"mean": "^1.0.0",
"median": "0.0.2",
"once": "^1.3.1",
"parse": "^1.5.0",
"pixi.js": "^4.1.0",
"power-assert": "^1.2.0",
"qs": "^6.2.0",
Expand Down
2 changes: 0 additions & 2 deletions src/app/constants.js

This file was deleted.

12 changes: 10 additions & 2 deletions src/app/entities/Options.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as options from '../options'

import u from 'updeep'

import * as options from '../options'

// Initializers
export const initialState = options.DEFAULTS
export const initWithDataFromStorage = (options) => ({ ...initialState, ...options })
Expand Down Expand Up @@ -82,6 +82,14 @@ export const toggleAutoVelocity = u({
'player.P1.auto-velocity': toggleOption
})

// Song preview enabled
export const isPreviewEnabled = (state) => (
toggleOptionEnabled(state['system.preview.enabled'])
)
export const togglePreview = u({
'system.preview.enabled': toggleOption
})

// Gauge
export const isGaugeEnabled = (state) => (
getGauge(state) !== 'off'
Expand Down
25 changes: 8 additions & 17 deletions src/app/game-launcher.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
import * as Analytics from './analytics'
import * as Options from './entities/Options'

import co from 'co'
import invariant from 'invariant'
import query from 'bemuse/utils/query'
import screenfull from 'screenfull'
import BemusePackageResources from 'bemuse/resources/bemuse-package'
import GameScene from 'bemuse/game/game-scene'
import LoadingScene from 'bemuse/game/ui/LoadingScene.jsx'
import React from 'react'
import SCENE_MANAGER from 'bemuse/scene-manager'
import URLResource from 'bemuse/resources/url'
import { shouldDisableFullScreen, isTitleDisplayMode } from 'bemuse/devtools/query-flags'
import co from 'co'
import invariant from 'invariant'
import query from 'bemuse/utils/query'
import { MISSED } from 'bemuse/game/judgments'
import { getGrade } from 'bemuse/rules/grade'
import { unmuteAudio } from 'bemuse/sampling-master'
import { isTitleDisplayMode } from 'bemuse/devtools/query-flags'
import { resolve as resolveUrl } from 'url'
import { unmuteAudio } from 'bemuse/sampling-master'

import createAutoVelocity from './interactors/createAutoVelocity'
import * as Analytics from './analytics'
import * as Options from './entities/Options'
import ResultScene from './ui/ResultScene'
import createAutoVelocity from './interactors/createAutoVelocity'

const Log = BemuseLogger.forModule('game-launcher')

Expand All @@ -31,13 +29,6 @@ export function launch ({ server, song, chart, options, saveSpeed, saveLeadTime
unmuteAudio()

return co(function * () {
// go fullscreen
if (screenfull.enabled && !shouldDisableFullScreen()) {
let safari = /Safari/.test(navigator.userAgent) &&
!/Chrom/.test(navigator.userAgent)
if (!safari) screenfull.request()
}

// get the options from the store
invariant(options, 'Options must be passed!')

Expand Down
29 changes: 14 additions & 15 deletions src/app/index.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
import * as Analytics from './analytics'
import * as OptionsIO from './io/OptionsIO'
import * as ReduxState from './redux/ReduxState'

import React from 'react'
import SCENE_MANAGER from 'bemuse/scene-manager'
import now from 'bemuse/utils/now'
import workerPath from
'bemuse/hacks/service-worker-url/index.loader.js!serviceworker-loader!./service-worker.js'
import { OFFICIAL_SERVER_URL } from 'bemuse/music-collection'
import { createIO, createRun } from 'impure'
import { getInitialGrepString, getMusicServer, getTimeSynchroServer }
from './query-flags'
import { shouldShowAbout, shouldShowModeSelect }
from 'bemuse/devtools/query-flags'
import { withContext } from 'recompose'

import * as Analytics from './analytics'
import * as OptionsIO from './io/OptionsIO'
import * as ReduxState from './redux/ReduxState'
import AboutScene from './ui/AboutScene'
import BrowserSupportWarningScene from './ui/BrowserSupportWarningScene'
import ModeSelectScene from './ui/ModeSelectScene'
import { OFFICIAL_SERVER_URL } from './constants'
import React from 'react'
import SCENE_MANAGER from 'bemuse/scene-manager'
import TitleScene from './ui/TitleScene'
import { WarpDestination } from '../react-warp'
import ioContext from './io/ioContext'
import { isBrowserSupported } from './browser-support'
import now from 'bemuse/utils/now'
import store from './redux/instance'
import { withContext } from 'recompose'
import workerPath from
'bemuse/hacks/service-worker-url/index.loader.js!serviceworker-loader!./service-worker.js'
import { WarpDestination } from '../react-warp'
import { getInitialGrepString, getMusicServer, getTimeSynchroServer }
from './query-flags'
import { isBrowserSupported } from './browser-support'

export const runIO = createRun({
context: ioContext
Expand Down
6 changes: 3 additions & 3 deletions src/app/interactors/createCollectionLoader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import * as Rx from 'rxjs/Rx'
import { load as loadCollection } from 'bemuse/music-collection'

import performSideEffects from './performSideEffects'

export function createCollectionLoader ({
Expand All @@ -13,8 +14,7 @@ export function createCollectionLoader ({
.groupBy(url => url)
.flatMap(url川 => url川.switchMap(url => Rx.Observable.concat(
Rx.Observable.of(() => onBeginLoading(url)),
Rx.Observable.fromPromise(fetch(url + '/index.json')
.then(response => response.json())
Rx.Observable.fromPromise(loadCollection(url, { fetch })
.then(
data => () => onLoad(url, data),
error => () => onErrorLoading(url, error)
Expand Down
8 changes: 4 additions & 4 deletions src/app/interactors/createCollectionLoader.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import { createCollectionLoader } from './createCollectionLoader'
import waitUntil from 'bemuse/wait-until'
import assert from 'power-assert'
import co from 'co'
import waitUntil from 'bemuse/wait-until'

import { createCollectionLoader } from './createCollectionLoader'

function setup ({ fetch }) {
const onBeginLoading = sinon.spy()
Expand Down Expand Up @@ -30,7 +30,7 @@ describe('createCollectionLoader', () => {
assert(onBeginLoading.called)
}))

it('should load the collection and call `onErrorLoading`', co.wrap(function * () {
it('should load the collection and call `onErrorLoading` when there is an error', co.wrap(function * () {
const { collectionLoader, onErrorLoading } = setup({
fetch: (url) => Promise.reject(new Error('???'))
})
Expand Down
1 change: 1 addition & 0 deletions src/app/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const DEFAULTS = {

// BGA
'system.bga.enabled': '1',
'system.preview.enabled': '1',

// Version
'system.last-seen-version': '0.0.0',
Expand Down
25 changes: 15 additions & 10 deletions src/app/redux/ReduxState.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
// - The selectors can be used to query data from the store.
//

import _ from 'lodash'
import filterSongs from 'bemuse/music-collection/filterSongs'
import getPlayableCharts from 'bemuse/music-collection/getPlayableCharts'
import groupSongsIntoCategories from 'bemuse/music-collection/groupSongsIntoCategories'
import preprocessCollection from 'bemuse/music-collection/preprocessCollection'
import sortSongs from 'bemuse/music-collection/sortSongs'
import { combineReducers } from 'redux'
import { createSelector } from 'reselect'

import * as Collections from '../entities/Collections'
import * as LoadState from '../entities/LoadState'
import * as MusicSearchText from '../entities/MusicSearchText'
import * as MusicSelection from '../entities/MusicSelection'
import * as Options from '../entities/Options'

import _ from 'lodash'
import { combineReducers } from 'redux'
import { createSelector } from 'reselect'

import createReducer from './createReducer'
import filterSongs from '../interactors/filterSongs'
import getPlayableCharts from '../interactors/getPlayableCharts'
import groupSongsIntoCategories from '../interactors/groupSongsIntoCategories'
import sortSongs from '../interactors/sortSongs'

// Actions
export const COLLECTION_LOADING_BEGAN = 'COLLECTION_LOADING_BEGAN'
Expand Down Expand Up @@ -128,10 +128,15 @@ export const selectCurrentCorrectionLoadError = (state) => (
LoadState.error(selectCurrentCollection(state))
)

export const selectCurrentCollectionValue = (state) => (
export const selectRawCurrentCollectionValue = (state) => (
LoadState.value(selectCurrentCollection(state))
)

export const selectCurrentCollectionValue = createSelector(
selectRawCurrentCollectionValue,
(collection) => collection && preprocessCollection(collection)
)

export const selectSearchInputText = (state) => (
MusicSearchText.inputText(state.musicSearchText)
)
Expand Down
5 changes: 5 additions & 0 deletions src/app/service-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ self.addEventListener('activate', function () {
})

self.addEventListener('fetch', function (event) {
if (event.request.headers.get('range')) {
// https://bugs.chromium.org/p/chromium/issues/detail?id=575357
log('Bailing out for ranged request.', event.request.url)
return
}
var build = location.origin + '/build/'
var skin = location.origin + '/skins/'
var res = location.origin + '/res/'
Expand Down
2 changes: 2 additions & 0 deletions src/app/song-loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export function loadSongFromResources (resources, options = {}) {
}
}
worker.onerror = function (e) {
onMessage('Worker error: ' + e)
console.error('Worker error: ' + e)
reject(e)
}
worker.postMessage({ files })
Expand Down
7 changes: 5 additions & 2 deletions src/app/ui/MusicChartSelectorItem.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import './MusicChartSelectorItem.scss'

import c from 'classnames'
import Icon from 'react-fa'
import React from 'react'
import c from 'classnames'

export default React.createClass({

Expand All @@ -19,7 +19,10 @@ export default React.createClass({
onClick={this.handleClick}>
{
this.props.isTutorial
? 'Start Tutorial'
? (this.props.chart.keys === '5K'
? 'Start Tutorial (5 keys)'
: 'Start Tutorial (7 keys)'
)
: (
<span className="MusicChartSelectorItemのlevel">
{this.props.chart.info.level}
Expand Down
9 changes: 4 additions & 5 deletions src/app/ui/MusicListItem.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@

import './MusicListItem.scss'

import React from 'react'
import c from 'classnames'
import getPlayableCharts from 'bemuse/music-collection/getPlayableCharts'
import pure from 'recompose/pure'

import { visibleCharts } from '../utils/music-select-utils'

import MusicListItemCharts from './MusicListItemCharts'

export const MusicListItem = React.createClass({
Expand Down Expand Up @@ -54,10 +52,11 @@ export const MusicListItem = React.createClass({
},
renderChartlist () {
return <MusicListItemCharts
charts={visibleCharts(this.props.song.charts)}
charts={getPlayableCharts(this.props.song.charts)}
selectedChart={this.props.selectedChart}
onChartClick={this.handleChartClick}
playMode={this.props.playMode} />
playMode={this.props.playMode}
/>
},
renderHighlight (text) {
if (!this.props.highlight) return text
Expand Down
Loading

0 comments on commit ea7855f

Please sign in to comment.