mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2026-02-06 10:16:29 +01:00
Add full build download to menu
This commit is contained in:
@@ -63,6 +63,7 @@
|
|||||||
"port_help_text": "Ensure this is the Dispatch server port, not the Game server port. This is almost always '443'.",
|
"port_help_text": "Ensure this is the Dispatch server port, not the Game server port. This is almost always '443'.",
|
||||||
"game_help_text": "You do not need to use a separate copy to play with Grasscutter. This is for either downgrading to 2.6 or if you do not have the game installed.",
|
"game_help_text": "You do not need to use a separate copy to play with Grasscutter. This is for either downgrading to 2.6 or if you do not have the game installed.",
|
||||||
"gc_stable_jar": "Download the current stable Grasscutter build, which includes jar file and data files.",
|
"gc_stable_jar": "Download the current stable Grasscutter build, which includes jar file and data files.",
|
||||||
|
"gc_full_build": "Download a full Grasscutter build, including repo, jar, and resources. Is fully set up and does not require any other downloads from this menu.",
|
||||||
"gc_dev_jar": "Download the latest development Grasscutter build, which includes jar file and data files.",
|
"gc_dev_jar": "Download the latest development Grasscutter build, which includes jar file and data files.",
|
||||||
"gc_stable_data": "Download the current stable Grasscutter data files, which does not come with a jar file. This is useful for updating.",
|
"gc_stable_data": "Download the current stable Grasscutter data files, which does not come with a jar file. This is useful for updating.",
|
||||||
"gc_dev_data": "Download the latest development Grasscutter data files, which does not come with a jar file. This is useful for updating.",
|
"gc_dev_data": "Download the latest development Grasscutter data files, which does not come with a jar file. This is useful for updating.",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "Cultivation",
|
"productName": "Cultivation",
|
||||||
"version": "1.0.10"
|
"version": "1.0.11-Thorny"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { invoke } from '@tauri-apps/api'
|
|||||||
import { listen } from '@tauri-apps/api/event'
|
import { listen } from '@tauri-apps/api/event'
|
||||||
import HelpButton from '../common/HelpButton'
|
import HelpButton from '../common/HelpButton'
|
||||||
|
|
||||||
|
const FULL_BUILD_DOWNLOAD = 'https://download1074.mediafire.com/cpryvy2flqggXpX7N6jastZ9nGMMZZCNnTmIXpHLqT6hEcRNsylllBgRuQG3of04A0LqOwHR4D59G7RtfqQMwMZdVg/qtmkrdicdnr4d37/GrasscutterCulti3.4.zip'
|
||||||
const STABLE_REPO_DOWNLOAD = 'https://github.com/Grasscutters/Grasscutter/archive/refs/heads/stable.zip'
|
const STABLE_REPO_DOWNLOAD = 'https://github.com/Grasscutters/Grasscutter/archive/refs/heads/stable.zip'
|
||||||
const DEV_REPO_DOWNLOAD = 'https://github.com/Grasscutters/Grasscutter/archive/refs/heads/development.zip'
|
const DEV_REPO_DOWNLOAD = 'https://github.com/Grasscutters/Grasscutter/archive/refs/heads/development.zip'
|
||||||
const STABLE_DOWNLOAD = 'https://nightly.link/Grasscutters/Grasscutter/workflows/build/stable/Grasscutter.zip'
|
const STABLE_DOWNLOAD = 'https://nightly.link/Grasscutters/Grasscutter/workflows/build/stable/Grasscutter.zip'
|
||||||
@@ -25,6 +26,7 @@ interface IProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface IState {
|
interface IState {
|
||||||
|
fullbuild_downloading: boolean
|
||||||
grasscutter_downloading: boolean
|
grasscutter_downloading: boolean
|
||||||
resources_downloading: boolean
|
resources_downloading: boolean
|
||||||
repo_downloading: boolean
|
repo_downloading: boolean
|
||||||
@@ -37,6 +39,7 @@ export default class Downloads extends React.Component<IProps, IState> {
|
|||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
|
fullbuild_downloading: this.props.downloadManager.downloadingFullBuild(),
|
||||||
grasscutter_downloading: this.props.downloadManager.downloadingJar(),
|
grasscutter_downloading: this.props.downloadManager.downloadingJar(),
|
||||||
resources_downloading: this.props.downloadManager.downloadingResources(),
|
resources_downloading: this.props.downloadManager.downloadingResources(),
|
||||||
repo_downloading: this.props.downloadManager.downloadingRepo(),
|
repo_downloading: this.props.downloadManager.downloadingRepo(),
|
||||||
@@ -45,6 +48,7 @@ export default class Downloads extends React.Component<IProps, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.getGrasscutterFolder = this.getGrasscutterFolder.bind(this)
|
this.getGrasscutterFolder = this.getGrasscutterFolder.bind(this)
|
||||||
|
this.downloadGrasscutterFullBuild = this.downloadGrasscutterFullBuild.bind(this)
|
||||||
this.downloadGrasscutterStableRepo = this.downloadGrasscutterStableRepo.bind(this)
|
this.downloadGrasscutterStableRepo = this.downloadGrasscutterStableRepo.bind(this)
|
||||||
this.downloadGrasscutterDevRepo = this.downloadGrasscutterDevRepo.bind(this)
|
this.downloadGrasscutterDevRepo = this.downloadGrasscutterDevRepo.bind(this)
|
||||||
this.downloadGrasscutterStable = this.downloadGrasscutterStable.bind(this)
|
this.downloadGrasscutterStable = this.downloadGrasscutterStable.bind(this)
|
||||||
@@ -109,6 +113,16 @@ export default class Downloads extends React.Component<IProps, IState> {
|
|||||||
return folderPath
|
return folderPath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async downloadGrasscutterFullBuild() {
|
||||||
|
const folder = await this.getGrasscutterFolder()
|
||||||
|
this.props.downloadManager.addDownload(FULL_BUILD_DOWNLOAD, folder + '\\GrasscutterCulti3.4.zip', async () => {
|
||||||
|
await unzip(folder + '\\GrasscutterCulti3.4.zip', folder + '\\', true)
|
||||||
|
this.toggleButtons()
|
||||||
|
})
|
||||||
|
|
||||||
|
this.toggleButtons()
|
||||||
|
}
|
||||||
|
|
||||||
async downloadGrasscutterStableRepo() {
|
async downloadGrasscutterStableRepo() {
|
||||||
const folder = await this.getGrasscutterFolder()
|
const folder = await this.getGrasscutterFolder()
|
||||||
this.props.downloadManager.addDownload(STABLE_REPO_DOWNLOAD, folder + '\\grasscutter_repo.zip', async () => {
|
this.props.downloadManager.addDownload(STABLE_REPO_DOWNLOAD, folder + '\\grasscutter_repo.zip', async () => {
|
||||||
@@ -187,6 +201,7 @@ export default class Downloads extends React.Component<IProps, IState> {
|
|||||||
|
|
||||||
// Set states since we know we are downloading something if this is called
|
// Set states since we know we are downloading something if this is called
|
||||||
this.setState({
|
this.setState({
|
||||||
|
fullbuild_downloading: this.props.downloadManager.downloadingFullBuild(),
|
||||||
grasscutter_downloading: this.props.downloadManager.downloadingJar(),
|
grasscutter_downloading: this.props.downloadManager.downloadingJar(),
|
||||||
resources_downloading: this.props.downloadManager.downloadingResources(),
|
resources_downloading: this.props.downloadManager.downloadingResources(),
|
||||||
repo_downloading: this.props.downloadManager.downloadingRepo(),
|
repo_downloading: this.props.downloadManager.downloadingRepo(),
|
||||||
@@ -197,6 +212,23 @@ export default class Downloads extends React.Component<IProps, IState> {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Menu closeFn={this.props.closeFn} className="Downloads" heading="Downloads">
|
<Menu closeFn={this.props.closeFn} className="Downloads" heading="Downloads">
|
||||||
|
<div className="DownloadMenuSection" id="downloadMenuContainerGCFullBuild">
|
||||||
|
<div className="DownloadLabel" id="downloadMenuLabelGCFullBuild">
|
||||||
|
<Tr
|
||||||
|
text={this.state.grasscutter_set ? 'downloads.grasscutter_full_build' : 'downloads.grasscutter_full_build_update'}
|
||||||
|
/>
|
||||||
|
<HelpButton contents="help.gc_full_build" />
|
||||||
|
</div>
|
||||||
|
<div className="DownloadValue" id="downloadMenuButtonGCFullBuild">
|
||||||
|
<BigButton
|
||||||
|
disabled={this.state.grasscutter_downloading}
|
||||||
|
onClick={this.downloadGrasscutterFullBuild}
|
||||||
|
id="grasscutterFullBuildBtn"
|
||||||
|
>
|
||||||
|
<Tr text="components.download" />
|
||||||
|
</BigButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div className="DownloadMenuSection" id="downloadMenuContainerGCStable">
|
<div className="DownloadMenuSection" id="downloadMenuContainerGCStable">
|
||||||
<div className="DownloadLabel" id="downloadMenuLabelGCStable">
|
<div className="DownloadLabel" id="downloadMenuLabelGCStable">
|
||||||
<Tr
|
<Tr
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ export default class NewsSection extends React.Component<IProps, IState> {
|
|||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
selected: props.selected || 'commits',
|
// Set to commits since latest doesn't show any real info anyways
|
||||||
|
selected: 'commits',
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setSelected = this.setSelected.bind(this)
|
this.setSelected = this.setSelected.bind(this)
|
||||||
@@ -59,7 +60,6 @@ export default class NewsSection extends React.Component<IProps, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async showLatestCommits() {
|
async showLatestCommits() {
|
||||||
if (!this.state.commitList) {
|
|
||||||
// Just use official API
|
// Just use official API
|
||||||
const response: string = await invoke('req_get', {
|
const response: string = await invoke('req_get', {
|
||||||
url: 'https://api.github.com/repos/Grasscutters/Grasscutter/commits',
|
url: 'https://api.github.com/repos/Grasscutters/Grasscutter/commits',
|
||||||
@@ -105,7 +105,6 @@ export default class NewsSection extends React.Component<IProps, IState> {
|
|||||||
commitList: commitsListHtml,
|
commitList: commitsListHtml,
|
||||||
news: <>{commitsListHtml}</>,
|
news: <>{commitsListHtml}</>,
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
return this.state.commitList
|
return this.state.commitList
|
||||||
}
|
}
|
||||||
@@ -125,7 +124,7 @@ export default class NewsSection extends React.Component<IProps, IState> {
|
|||||||
case 'latest_version':
|
case 'latest_version':
|
||||||
news = (
|
news = (
|
||||||
<tr>
|
<tr>
|
||||||
<td>Latest version</td>
|
<td>Latest version: Grasscutter 1.4.6 - Cultivation 1.0.10</td>
|
||||||
</tr>
|
</tr>
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -104,6 +104,11 @@ export default class DownloadHandler {
|
|||||||
return this.downloads.some((d) => d.path.includes('grasscutter.zip'))
|
return this.downloads.some((d) => d.path.includes('grasscutter.zip'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
downloadingFullBuild() {
|
||||||
|
// Kinda hacky but it works
|
||||||
|
return this.downloads.some((d) => d.path.includes('GrasscutterCulti3.4.zip'))
|
||||||
|
}
|
||||||
|
|
||||||
downloadingResources() {
|
downloadingResources() {
|
||||||
// Kinda hacky but it works
|
// Kinda hacky but it works
|
||||||
return this.downloads.some((d) => d.path.includes('resources'))
|
return this.downloads.some((d) => d.path.includes('resources'))
|
||||||
|
|||||||
Reference in New Issue
Block a user