mirror of
https://github.com/AltarikMC/Launcher
synced 2024-11-22 06:19:50 +01:00
Index.html now work
This commit is contained in:
parent
f856bd620e
commit
1a3082a90f
@ -21,7 +21,9 @@ app = vue.createApp({
|
||||
progressbarWidth: 0,
|
||||
sidebarContent: "<hr><p>Chargement en cours</p>",
|
||||
modsInformations: [],
|
||||
modsInformationsLoaded: true
|
||||
modsInformationsLoaded: true,
|
||||
selectedChapter: -1,
|
||||
gameLaunching: false
|
||||
}
|
||||
|
||||
},
|
||||
@ -33,16 +35,6 @@ app = vue.createApp({
|
||||
position: 'topRight',
|
||||
resetOnHover: true,
|
||||
})
|
||||
ipcRenderer.on("modsInformations", (e, args) => {
|
||||
console.log("loaded")
|
||||
if(args === null) {
|
||||
this.modsInformationsLoaded = false
|
||||
} else {
|
||||
this.modsInformationsLoaded = true
|
||||
}
|
||||
this.updateModsInformations(args)
|
||||
})
|
||||
ipcRenderer.on("nick", (_, args) => root.nick = args.name)
|
||||
},
|
||||
methods: {
|
||||
invalidateData () {
|
||||
@ -61,21 +53,26 @@ app = vue.createApp({
|
||||
ipcRenderer.send('launch', {
|
||||
minMem: this.minMemValue + "M",
|
||||
maxMem: this.maxMemValue + "M",
|
||||
chapter: selectedChapter
|
||||
chapter: this.selectedChapter
|
||||
})
|
||||
this.launchBtnDisable = true
|
||||
localStorage.setItem("minMem", this.minMemValue)
|
||||
localStorage.setItem("maxMem", this.maxMemValue)
|
||||
gameLaunching = true
|
||||
this.gameLaunching = true
|
||||
} else {
|
||||
this.showError("Erreur de lancement", "La mémoire minimale doit être inférieure ou égale à la mémoire maximale.")
|
||||
}
|
||||
},
|
||||
changeSelectedChapter(index) {
|
||||
this.selectedChapter = parseInt(index)
|
||||
root.launchBtnText = "JOUER"
|
||||
root.launchBtnDisable = false
|
||||
},
|
||||
disconnectBtn () {
|
||||
ipcRenderer.send('disconnect')
|
||||
},
|
||||
options () {
|
||||
if(!gameLaunching)
|
||||
if(!this.gameLaunching)
|
||||
this.displayFullscreen = "block"
|
||||
},
|
||||
discord() {
|
||||
@ -89,7 +86,6 @@ app = vue.createApp({
|
||||
},
|
||||
updateModsInformations(content) {
|
||||
this.modsInformations = content
|
||||
nextTick(() => {})
|
||||
},
|
||||
getModsInformations() {
|
||||
return this.modsInformations
|
||||
@ -121,16 +117,15 @@ app = vue.createApp({
|
||||
message: body,
|
||||
color: 'green'
|
||||
})
|
||||
},
|
||||
isSelected(index) {
|
||||
return this.selectedChapter === index
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let root = app.mount("#vue")
|
||||
|
||||
let gameLaunching = false
|
||||
|
||||
let selectedChapter = -1;
|
||||
|
||||
ipcRenderer.on("invalidated", () => {
|
||||
root.invalidateButtonDisabled = false
|
||||
root.invalidateButtonText = "Supprimer et retélécharger les bibliothèques"
|
||||
@ -149,7 +144,7 @@ ipcRenderer.on("close", (_e, _args) => {
|
||||
root.loadingMessageText = "Chargement de Minecraft en cours..."
|
||||
root.progressbarWidth = 0
|
||||
root.launchBtnDisable = false
|
||||
gameLaunching = false
|
||||
root.gameLaunching = false
|
||||
})
|
||||
|
||||
ipcRenderer.on('launch', (_e, _args) => {
|
||||
@ -157,12 +152,17 @@ ipcRenderer.on('launch', (_e, _args) => {
|
||||
root.loadingMessageHidden = true
|
||||
})
|
||||
|
||||
function changeSelectedChapter(element) {
|
||||
selectedChapter = Number(element.dataset.chapter)
|
||||
document.querySelectorAll("#sidebar-content > div").forEach((v) => {
|
||||
v.classList.remove("selected")
|
||||
})
|
||||
element.classList.add("selected")
|
||||
root.launchBtnText = "JOUER"
|
||||
root.launchBtnDisable = false
|
||||
}
|
||||
setInterval(() => {
|
||||
ipcRenderer.send("pageReady")
|
||||
}, 500)
|
||||
|
||||
ipcRenderer.on("modsInformations", (_e, args) => {
|
||||
if(args === null) {
|
||||
root.modsInformationsLoaded = false
|
||||
} else {
|
||||
root.modsInformationsLoaded = true
|
||||
}
|
||||
root.updateModsInformations(args)
|
||||
})
|
||||
|
||||
ipcRenderer.on("nick", (_e, args) => root.nick = args.name)
|
@ -40,7 +40,7 @@
|
||||
<h2>Chapitres</h2>
|
||||
<div id="sidebar-content" @change="modsInformations">
|
||||
<div v-if="modsInformationsLoaded === false">Une erreur est survenue lors de la récupération des informations, vérifiez votre connexion internet puis cliquez sur réessayez</div>
|
||||
<div v-for="(item, index) in modsInformations" v-else-if="modsInformations.length !== 0" data-chapter="{{index}}" v-on:click="changeSelectedChapter(this)">
|
||||
<div v-for="(item, index) in modsInformations" v-else-if="modsInformations.length !== 0" v-on:click="changeSelectedChapter(index)" :class="{ selected: isSelected(index) }">
|
||||
<h3>{{ item.title }}</h3>
|
||||
<p>{{ item.description}}</p>
|
||||
</div>
|
||||
|
@ -86,5 +86,7 @@ ipcMain.on("disconnect", () => {
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
ipcMain.on("pageReady", (event) => {
|
||||
event.sender.send("nick", { name: minecraft.auth.name })
|
||||
minecraft.getModsInformations(event)
|
||||
})
|
@ -30,13 +30,7 @@ class Minecraft {
|
||||
if(isDev || password.trim() !== "") {
|
||||
this.auth = Authenticator.getAuth(username, password)
|
||||
this.auth.then(v => {
|
||||
win.loadFile('src/client/index.html').then(() => {
|
||||
setInterval(() => {
|
||||
event.sender.send("nick", { name: v.name })
|
||||
this.getModsInformations(e)
|
||||
}, 1000)
|
||||
|
||||
})
|
||||
win.loadFile('src/client/index.html')
|
||||
}).catch(() => {
|
||||
event.sender.send("loginError")
|
||||
logger.error("[MJ login] User haven't purchase the game")
|
||||
@ -68,9 +62,7 @@ class Minecraft {
|
||||
} else {
|
||||
if(!msmc.isDemoUser(result)) {
|
||||
this.auth = msmc.getMCLC().getAuth(result)
|
||||
win.loadFile('src/client/index.html').then(() => {
|
||||
event.sender.send("nick", { name: this.auth.name })
|
||||
})
|
||||
win.loadFile('src/client/index.html')
|
||||
} else {
|
||||
event.sender.send("loginError")
|
||||
logger.error("[MS login] User haven't purchase the game")
|
||||
|
Loading…
Reference in New Issue
Block a user