Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GTA5.ts&添加开关显示前置列表的按钮 #25

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ yarn.lock

# config files
electron-builder.json5
/electron/model/Config.ts
/electron/model/Config.ts
/.vs
4 changes: 2 additions & 2 deletions src/Expands/GTA5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,10 @@ async function pedItem(name: string, mod: IModInfo, isInstall: boolean) {
"_text": "CLIP_SET_ID_INVALID"
},
"PoseMatcherName": {
"_text": "Male"
"_text": "Female"
},
"PoseMatcherProneName": {
"_text": "Male_prone"
"_text": "Female_prone"
},
"GetupSetHash": {
"_text": "NMBS_SLOW_GETUPS"
Expand Down
2 changes: 2 additions & 0 deletions src/lang/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ const Settings = {
"Document": "食用教程",
"Change in Game run": "游戏运行时修改",
"Default Page": "默认页面",
"Show Plugins List": "显示前置列表",
"Show required plugins list when connected to network": "连接网络时显示必需的前置插件列表"
}

const Backup = {
Expand Down
6 changes: 4 additions & 2 deletions src/model/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export class Config {
selectGameByFolder: settings.selectGameByFolder,
showPakeMessage: settings.showPakeMessage,
changeInRun: settings.changeInRun,
defaultPage: settings.defaultPage
defaultPage: settings.defaultPage,
showPlugins: settings.showPlugins
}
}
// 保存配置文件
Expand Down Expand Up @@ -86,7 +87,8 @@ export class Config {
selectGameByFolder: data.selectGameByFolder ?? false,
showPakeMessage: data.showPakeMessage ?? true,
changeInRun: data.changeInRun ?? false,
defaultPage: data.defaultPage ?? "Home"
defaultPage: data.defaultPage ?? "Home",
showPlugins: data.showPlugins ?? true // 添加这一行
}

// 初始化游戏
Expand Down
1 change: 1 addition & 0 deletions src/model/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class Manager {

// 检查插件是否已经安装
public static checkInstalled(name: string, webId: number) {
// 已经屏蔽了自动下载和安装的代码,但保留了判断逻辑
// const manager = useManager()
// let modId = manager.isAddedWebId(webId)
// if (modId) {
Expand Down
33 changes: 19 additions & 14 deletions src/stores/useGames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,27 @@ export const useGames = defineStore("Games", {
},
actions: {
async getGamePlugins() {
const settings = useSettings()
if (!settings.settings.showPlugins) {
this.GamePlugins = []
return
}

const { data } = await axios.post('https://mod.3dmgame.com/api/v2/GetPluginsList', {}, {
headers: {
"Authorization": "67d8667248a801ff6ddc74ac43016168"
try {
const { data } = await axios.post('https://mod.3dmgame.com/api/v2/GetPluginsList', {}, {
headers: {
"Authorization": "67d8667248a801ff6ddc74ac43016168"
}
})
if (data && data.data) {
this.GamePlugins = data.data
} else {
this.GamePlugins = []
}
})
console.log(data);
// let res = await fetch('https://mod.3dmgame.com/api/v2/GetPluginsList', {
// method: 'POST',
// headers: {
// "Authorization": "67d8667248a801ff6ddc74ac43016168"
// }
// })
// let data: any = await res.json()
this.GamePlugins = data.data ?? []

} catch (error) {
console.error('获取前置列表失败:', error)
this.GamePlugins = []
}
}
}
})
1 change: 1 addition & 0 deletions src/ts/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ declare global {
showPakeMessage: boolean
changeInRun: boolean
defaultPage: string
showPlugins: boolean // 是否显示前置列表
}

interface IFileTreeNode {
Expand Down
18 changes: 7 additions & 11 deletions src/views/Manager/Content/GamePlugins.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<script lang='ts' setup>



const manager = useManager()
const settings = useSettings()

function install(plugins: IGamePlugins) {

let mod: IModInfo = {
id: plugins.plugins_webId as number,
modName: plugins.plugins_name,
Expand All @@ -18,15 +15,19 @@ function install(plugins: IGamePlugins) {
webId: plugins.plugins_webId,
from: plugins.plugins_from as sourceType,
modWebsite: plugins.plugins_website

}

manager.updateMod(mod)
}

// 组件名称定义
defineOptions({
name: 'ManagerContentGamePlugins'
})
</script>

<template>
<v-card variant="tonal" color="#FFAB00" v-if="manager.plugins.length > 0">
<v-card variant="tonal" color="#FFAB00" v-if="manager.plugins.length > 0 && settings.settings.showPlugins">
<v-card-title>所需前置
<v-chip color="#1E88E5" label variant="text" target="_blank" href="https://cloud.aoe.top/s/KrRfO"
append-icon="mdi-open-in-new">前置包
Expand Down Expand Up @@ -64,10 +65,5 @@ function install(plugins: IGamePlugins) {
</v-card-text>
</v-card>
</template>
<script lang='ts'>

export default {
name: 'ManagerContentGamePlugins',
}
</script>
<style lang='less' scoped></style>
8 changes: 8 additions & 0 deletions src/views/Settings/SettingsInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ watch(() => settings.settings.autoLaunch, () => {
{ text: $t('About'), value: 'About' },
]" item-title="text" item-value="value"></v-select>
</v-col>
<v-col cols="12" sm="6" md="3">
<v-switch
v-model="settings.settings.showPlugins"
:label="$t('Show Plugins List')" color="#039BE5"
persistent-hint
:hint="$t('Show required plugins list when connected to network')"
></v-switch>
</v-col>
<v-col cols="12" sm="6" md="3">
<v-switch :label="$t('Auto install for download')" color="#039BE5"
v-model="settings.settings.autoInstall"></v-switch>
Expand Down