Skip to content

Commit

Permalink
对于额外存储库进行了一定修改
Browse files Browse the repository at this point in the history
  • Loading branch information
iamapig120 committed Feb 6, 2019
1 parent cdcc4f7 commit 3053f74
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 59 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

## 致用户

  感谢您正在阅读这段文字,我是《雀魂 Plus》开发者之一:Handle。首先,感谢您信赖并使用《雀魂 Plus》,这是我第一个破10Star的项目,同时也是我倾注了大量心血的作品,对于其意外登上一些论坛的置顶,我感到兴奋,但同时更多的是震惊。
  感谢您正在阅读这段文字,我是《雀魂 Plus》开发者之一:Handle。首先,感谢您信赖并使用《雀魂 Plus》,这是我第一个破 10 Star 的项目,同时也是我倾注了大量心血的作品,对于其意外登上一些论坛的置顶,我感到兴奋,但同时更多的是震惊。

  相信您和我一样是喜欢着《雀魂》这款游戏才能让您读到这段文字,同样,也相信您了解一款游戏的生存无非能否长期稳定地盈利,《雀魂 Plus》提供的功能最初只是为了方便修改桌布和音乐,但目前的发展情况,但很明显,《雀魂 Plus》的传播已经明显超出了可控范围。试想,如果您是《雀魂》的付费用户,在得知免费玩家可以享受到付费体验,心中会有什么想法?还会继续为《雀魂》付费么?如果大家都在使用修改实现的装扮而不为《雀魂》付费,那么这款游戏的未来会怎样?会继续盈利下去么?相信您您的内心现在已经想到了未来可能发生的事,我们都不希望那样的未来。

Expand Down
4 changes: 2 additions & 2 deletions configs-user.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"isHardwareAccelerationDisable": false,
"isInProcessGpuOn": true
},
"userData":{
"userLibPath": ""
"userData": {
"useAppdataLibrary": false
}
}
29 changes: 15 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { Menu, MenuItem } = electron
let userConfigs = JSON.parse(fs.readFileSync(configs.USER_CONFIG_PATH))

// 同步 configs-user.json
function jsonKeyUpdate (ja, jb) {
function jsonKeyUpdate(ja, jb) {
Object.keys(ja).forEach(key => {
if (typeof ja[key] === 'object' && typeof jb[key] === 'object') {
jsonKeyUpdate(ja[key], jb[key])
Expand All @@ -32,16 +32,14 @@ function jsonKeyUpdate (ja, jb) {
}

jsonKeyUpdate(userConfigs, require(path.join(__dirname, '/configs-user.json')))

userConfigs.userData.userLibPath = electronApp.getPath('userData')
const paths = [
configs.EXECUTES_DIR,
configs.MODS_DIR,
configs.TOOLS_DIR
]
paths.map(dir => path.join(userConfigs.userData.userLibPath, dir)).forEach(dir => !fs.existsSync(dir) && fs.mkdirSync(dir))
fs.writeFileSync(configs.USER_CONFIG_PATH, JSON.stringify(userConfigs))

const userDataDir = electronApp.getPath('userData')
const paths = [configs.EXECUTES_DIR, configs.MODS_DIR, configs.TOOLS_DIR]
paths
.map(dir => path.join(userDataDir, dir))
.forEach(dir => !fs.existsSync(dir) && fs.mkdirSync(dir))

if (userConfigs.chromium.isInProcessGpuOn) {
electronApp.commandLine.appendSwitch('in-process-gpu')
}
Expand Down Expand Up @@ -459,11 +457,14 @@ const windowControl = {
break
}
case 'open-file-dialog': {
dialog.showOpenDialog({
properties: ['openFile', 'openDirectory']
}, function (files) {
if (files) event.sender.send('selected-directory', files)
})
dialog.showOpenDialog(
{
properties: ['openFile', 'openDirectory']
},
function(files) {
if (files) event.sender.send('selected-directory', files)
}
)
break
}
default:
Expand Down
2 changes: 1 addition & 1 deletion manager/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h3>更新</h3>
<!-- 关于页面 -->
<section data-name="aboutPage">
<!-- <button id="saveConfigs" class="big-btn save-btn"></button> -->
<div id="aboutInner" class="setting-innner">
<div id="aboutInner" class="about-innner">
</div>
</section>

Expand Down
100 changes: 72 additions & 28 deletions manager/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ const InfoCard = require('./InfoCard')
const app = electronRemote.app
const userConfig = require(configs.USER_CONFIG_PATH)

const userDataPaths = [
path.join(__dirname, '../'),
userConfig.userData.userLibPath
]
const userDataPaths = [path.join(__dirname, '../'), app.getPath('userData')]

// 注入脚本根文件根目录
const executeRootDirs = userDataPaths.map(root =>
Expand Down Expand Up @@ -351,13 +348,19 @@ const installResources = () => {
let installDir
switch (extname) {
case '.mspm':
installDir = modRootDirs[1]
installDir = userConfig.userData.useAppdataLibrary
? modRootDirs[1]
: modRootDirs[0]
break
case '.mspe':
installDir = executeRootDirs[1]
installDir = userConfig.userData.useAppdataLibrary
? executeRootDirs[1]
: executeRootDirs[0]
break
case '.mspt':
installDir = toolRootDirs[1]
installDir = userConfig.userData.useAppdataLibrary
? toolRootDirs[1]
: toolRootDirs[0]
break
}
unzip.extractAllToAsync(installDir, true, err => {
Expand Down Expand Up @@ -520,20 +523,26 @@ Array.prototype.forEach.call(
node => {
node.addEventListener('click', () => {
const sections = document.getElementsByTagName('section')
Array.prototype.forEach.call(sections, section => {
if (section.dataset.name === node.dataset.target) {
section.className = 'show'
} else {
section.className = ''
Array.prototype.forEach.call(
sections,
/**
* @param {HTMLElement} section
*/
section => {
if (section.dataset.name === node.dataset.target) {
section.classList.add('show')
} else {
section.classList.remove('show')
}
}
})
)
Array.prototype.forEach.call(
document.querySelectorAll('.left-panel ul li'),
node => {
node.className = ''
node.classList.remove('show')
}
)
node.className = 'active'
node.classList.add('show')
})
}
)
Expand Down Expand Up @@ -972,23 +981,25 @@ checkUpdate(userConfig.update).then(
/* 设置项业务逻辑 Start */
const getKeyText = key => {
const lang = {
window: '窗口',
window: '窗口(Window)',
zoomFactor: '资源管理器缩放(Zoom Factor)',
gameSSAA: '超采样抗锯齿(SSAA)',
renderingMultiple: '% 渲染比率(Rendering Multiple)',
isKioskModeOn: '使用原生模式代替默认全屏幕模式(Use Kiosk Fullscreen Mode)',
update: '更新',
update: '更新(Update)',
prerelease: '获取浏览版(Get Pre-releases)',
chromium: '核心(需重启软件)',
chromium: '核心(需重启软件)(Core - Restart app needed)',
isHardwareAccelerationDisable:
'关闭硬件加速(Turn Hardware Acceleration Off)',
isInProcessGpuOn: '启用进程内GPU处理(Turn in-process-gpu On)',
isNoBorder: '使用无边框窗口进入游戏(Turn BorderLess On)',
userData: '用户数据',
userData: '用户数据(User Data)',
isUseDefaultPath: '使用默认用户库目录',
useAppdataLibrary:
'使用AppData存储扩展资源(Use AppData dir to storage resources)',
userLibPath: '用户库目录',
programName: '雀魂Plus',
localVersion: '当前版本'
programName: '雀魂Plus(Majsoul Plus)',
localVersion: '版本(Version)'
}
return lang[key] ? lang[key] : key
}
Expand Down Expand Up @@ -1050,15 +1061,48 @@ const userConfigInit = () => {
})
}
const aboutPageInit = () => {
// 在结尾叠加版本号信息
const aboutInner = document.getElementById('aboutInner')
aboutInner.innerHTML = ''
const versionH3 = document.createElement('h3')
versionH3.innerText = getKeyText('programName')
const versionInfo = document.createElement('p')
versionInfo.innerText = `${getKeyText('localVersion')} ${app.getVersion()}`
aboutInner.append(versionH3)
aboutInner.append(versionInfo)
/**
*
* @param {string} title
* @param {string | HTMLElement} value
*/
const addBlock = (title, value) => {
// 在结尾叠加信息
const h3 = document.createElement('h3')
const info = document.createElement('p')
if (typeof value === 'string') {
h3.innerText = title
info.innerText = value
aboutInner.append(h3)
aboutInner.append(info)
} else {
h3.innerText = title
aboutInner.append(h3)
aboutInner.append(value)
}
}
addBlock(
'致用户',
'  感谢您正在阅读这段文字,我是《雀魂 Plus》开发者之一:Handle。首先,感谢您信赖并使用《雀魂 Plus》,这是我第一个破 10 Star 的项目,同时也是我倾注了大量心血的作品,对于其意外登上一些论坛的置顶,我感到兴奋,但同时更多的是震惊。\n\n  相信您和我一样是喜欢着《雀魂》这款游戏才能让您读到这段文字,同样,也相信您了解一款游戏的生存无非能否长期稳定地盈利,《雀魂 Plus》提供的功能最初只是为了方便修改桌布和音乐,但目前的发展情况,但很明显,《雀魂 Plus》的传播已经明显超出了可控范围。试想,如果您是《雀魂》的付费用户,在得知免费玩家可以享受到付费体验,心中会有什么想法?还会继续为《雀魂》付费么?如果大家都在使用修改实现的装扮而不为《雀魂》付费,那么这款游戏的未来会怎样?会继续盈利下去么?相信您您的内心现在已经想到了未来可能发生的事,我们都不希望那样的未来。\n\n  作为“始作俑者”,我不希望《雀魂 Plus》被滥用,我希望的是《雀魂 Plus》可以为《雀魂》提供一个PC稳定的游戏环境和体验,在这基础上体验一些《雀魂》尚未实现的、或是其他游戏中存在的优秀功能,并非为了让使用者白嫖《雀魂》,这是一个不健康的发展路径,无论你我,当然不希望《雀魂》会走上《雀龙门》的老路,成为一款冷门游戏,或是成为下一个《X海战记》。《雀魂》当前的付费点主要就是装扮,还望各位手下留情,使用魔改的同时别忘为游戏付费,一款好的游戏值得去为其体验埋单。\n\n  《雀魂 Plus》现在的更新重点是作为一个游戏客户端体验的优化上,对于目前已有的扩展功能将仅做维护,感谢您的理解。相信您在思考后,也会在《雀魂》中“补票”吧。'
)
addBlock(
getKeyText('programName'),
(() => {
const info = document.createElement('p')
info.innerHTML = `在 PC 上跨平台的雀魂麻将第三方客户端,提供资源替换和代码注入功能,并对直播环境进行了一定优化<br><a href="https://github.com/MajsoulPlus/majsoul-plus-client"><img alt="Github Stars" src="https://img.shields.io/github/stars/MajsoulPlus/majsoul-plus-client.svg?style=social"></a><br>${getKeyText(
'localVersion'
)} ${app.getVersion()}`
;[...info.getElementsByTagName('a')].forEach(a => {
a.addEventListener('click', event => {
event.preventDefault()
shell.openExternal(a.href)
})
})
return info
})()
)
}
userConfigInit()
aboutPageInit()
Expand Down
34 changes: 28 additions & 6 deletions manager/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,6 @@ h1 {
.main-context > section[data-name='settingPage'] {
padding: 40px 0 20px 102px;
}
.main-context > section[data-name='settingPage'] > .save-btn {
left: 102px;
}
.main-context > section[data-name='settingPage'] > .save-btn::before {
content: '';
}
.main-context > section[data-name='settingPage'] > .setting-innner {
height: 100%;
width: calc(100% - 16px);
Expand Down Expand Up @@ -506,6 +500,34 @@ h1 {
.main-context > section[data-name='settingPage'] > .setting-innner > input[type='checkbox']:checked + label::after {
left: calc(-12px - 2px + 20px);
}
.main-context > section[data-name='aboutPage'] {
padding: 40px 0 20px 102px;
}
.main-context > section[data-name='aboutPage'] > .save-btn {
left: 102px;
}
.main-context > section[data-name='aboutPage'] > .save-btn::before {
content: '';
}
.main-context > section[data-name='aboutPage'] > .about-innner {
height: 100%;
width: calc(100% - 80px);
overflow-y: auto;
}
.main-context > section[data-name='aboutPage'] > .about-innner > h3 {
cursor: default;
font-size: 18px;
padding-top: 8px;
line-height: 22px;
}
.main-context > section[data-name='aboutPage'] > .about-innner > p {
margin-top: 4px;
padding-bottom: 4px;
cursor: default;
line-height: 20px;
font-size: 14px;
padding-left: 16px;
}
.main-context > .left-panel {
height: var(--main-height);
width: calc(240px + 1px);
Expand Down
37 changes: 31 additions & 6 deletions manager/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,6 @@ h1 {
&[data-name='settingPage'] {
padding: 40px 0 20px 102px;

& > .save-btn {
left: 102px;
&::before {
content: '';
}
}
& > .setting-innner {
height: 100%;
width: calc(100% - 16px);
Expand Down Expand Up @@ -510,6 +504,37 @@ h1 {
}
}
}

&[data-name='aboutPage'] {
padding: 40px 0 20px 102px;

& > .save-btn {
left: 102px;
&::before {
content: '';
}
}
& > .about-innner {
height: 100%;
width: calc(100% - 80px);
overflow-y: auto;

& > h3 {
cursor: default;
font-size: 18px;
padding-top: 8px;
line-height: 22px;
}
& > p {
margin-top: 4px;
padding-bottom: 4px;
cursor: default;
line-height: 20px;
font-size: 14px;
padding-left: 16px;
}
}
}
}
& > .left-panel {
height: var(--main-height);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "majsoul-plus-client",
"version": "1.10.4-alpha.5",
"version": "1.10.4",
"productName": "Majsoul Plus",
"author": "MajsoulPlus Team",
"description": "Majsoul Plus",
Expand Down

0 comments on commit 3053f74

Please sign in to comment.