[to pick] customize gamemode from menu!
This commit is contained in:
parent
4f9efb4c01
commit
830424eec2
3 changed files with 14 additions and 5 deletions
|
|
@ -15,6 +15,7 @@ export const addNewStat = (id: string, width = 80, x = rightOffset, y = 0) => {
|
|||
pane.style.fontFamily = 'monospace'
|
||||
pane.style.fontSize = '12px'
|
||||
pane.style.zIndex = '10000'
|
||||
pane.style.pointerEvents = 'none'
|
||||
document.body.appendChild(pane)
|
||||
stats[id] = pane
|
||||
if (y === 0) { // otherwise it's a custom position
|
||||
|
|
|
|||
|
|
@ -8,17 +8,19 @@ import styles from './createWorld.module.css'
|
|||
|
||||
// const worldTypes = ['default', 'flat', 'largeBiomes', 'amplified', 'customized', 'buffet', 'debug_all_block_states']
|
||||
const worldTypes = ['default', 'flat'/* , 'void' */]
|
||||
const gameModes = ['survival', 'creative'/* , 'adventure', 'spectator' */]
|
||||
|
||||
export const creatingWorldState = proxy({
|
||||
title: '',
|
||||
type: worldTypes[0],
|
||||
gameMode: gameModes[0],
|
||||
version: ''
|
||||
})
|
||||
|
||||
export default ({ cancelClick, createClick, customizeClick, versions, defaultVersion }) => {
|
||||
const [quota, setQuota] = useState('')
|
||||
|
||||
const { title, type, version } = useSnapshot(creatingWorldState)
|
||||
const { title, type, version, gameMode } = useSnapshot(creatingWorldState)
|
||||
useEffect(() => {
|
||||
creatingWorldState.version = defaultVersion
|
||||
void navigator.storage?.estimate?.().then(({ quota, usage }) => {
|
||||
|
|
@ -54,9 +56,15 @@ export default ({ cancelClick, createClick, customizeClick, versions, defaultVer
|
|||
<Button onClick={() => {
|
||||
const index = worldTypes.indexOf(type)
|
||||
creatingWorldState.type = worldTypes[index === worldTypes.length - 1 ? 0 : index + 1]
|
||||
}}>{type}</Button>
|
||||
<Button onClick={() => customizeClick()} disabled>
|
||||
}}>World Type: {type}</Button>
|
||||
{/* <Button onClick={() => customizeClick()} disabled>
|
||||
Customize
|
||||
</Button> */}
|
||||
<Button onClick={() => {
|
||||
const index = gameModes.indexOf(gameMode)
|
||||
creatingWorldState.gameMode = gameModes[index === gameModes.length - 1 ? 0 : index + 1]
|
||||
}}>
|
||||
Gamemode: {gameMode}
|
||||
</Button>
|
||||
</div>
|
||||
<div className='muted' style={{ fontSize: 8 }}>Default and other world types are WIP</div>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export default () => {
|
|||
}}
|
||||
createClick={async () => {
|
||||
// create new world
|
||||
const { title, type, version } = creatingWorldState
|
||||
const { title, type, version, gameMode } = creatingWorldState
|
||||
// todo display path in ui + disable if exist
|
||||
const savePath = await uniqueFileNameFromWorldName(title, getWorldsPath())
|
||||
await mkdirRecursive(savePath)
|
||||
|
|
@ -52,7 +52,7 @@ export default () => {
|
|||
version,
|
||||
generation,
|
||||
'worldFolder': savePath,
|
||||
gameMode: 0,
|
||||
gameMode: gameMode === 'survival' ? 0 : 1,
|
||||
},
|
||||
}))
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue