Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ae64b3a04 | ||
|
|
02b2e93e02 | ||
|
|
5c2252f5bf | ||
|
|
47deb43845 | ||
|
|
c1d1c10ca7 | ||
|
|
3ff62c5156 |
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
Prettier Fixer.py
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
# 导入os模块,用于操作文件和目录
|
|
||||||
import os
|
|
||||||
from time import sleep
|
|
||||||
# 定义一个函数,接受一个文件名作为参数,返回修改后的内容
|
|
||||||
|
|
||||||
def modify_file(filename):
|
|
||||||
# 打开文件,以只读模式
|
|
||||||
with open(filename, 'r', encoding='UTF-8') as f:
|
|
||||||
# 读取文件的所有行,存入一个列表
|
|
||||||
lines = f.readlines()
|
|
||||||
# 创建一个空列表,用于存储修改后的行
|
|
||||||
new_lines = []
|
|
||||||
num = 0
|
|
||||||
# 遍历每一行
|
|
||||||
for line in lines:
|
|
||||||
if '"step 0";' in line:
|
|
||||||
line = line.replace('"step 0";', '"step 0"')
|
|
||||||
num+=1
|
|
||||||
if '("step 1");' in line:
|
|
||||||
line = line.replace('("step 1");', '"step 1"')
|
|
||||||
num+=1
|
|
||||||
if '("step 2");' in line:
|
|
||||||
line = line.replace('("step 2");', '"step 2"')
|
|
||||||
num+=1
|
|
||||||
if '("step 3");' in line:
|
|
||||||
line = line.replace('("step 3");', '"step 3"')
|
|
||||||
num+=1
|
|
||||||
if '("step 4");' in line:
|
|
||||||
line = line.replace('("step 4");', '"step 4"')
|
|
||||||
num+=1
|
|
||||||
if '("step 5");' in line:
|
|
||||||
line = line.replace('("step 5");', '"step 5"')
|
|
||||||
num+=1
|
|
||||||
if '("step 6");' in line:
|
|
||||||
line = line.replace('("step 6");', '"step 6"')
|
|
||||||
num+=1
|
|
||||||
if '("step 7");' in line:
|
|
||||||
line = line.replace('("step 7");', '"step 7"')
|
|
||||||
num+=1
|
|
||||||
if '("step 8");' in line:
|
|
||||||
line = line.replace('("step 8");', '"step 8"')
|
|
||||||
num+=1
|
|
||||||
if '("step 9");' in line:
|
|
||||||
line = line.replace('("step 9");', '"step 9"')
|
|
||||||
num+=1
|
|
||||||
if '("step 10");' in line:
|
|
||||||
line = line.replace('("step 10");', '"step 10"')
|
|
||||||
num+=1
|
|
||||||
print(line)
|
|
||||||
# 将修改后的行添加到新列表中
|
|
||||||
new_lines.append(line)
|
|
||||||
# 返回新列表中的所有行,用换行符连接
|
|
||||||
print("Successfully fixed " + str(num) +" code errors")
|
|
||||||
return ''.join(new_lines)
|
|
||||||
|
|
||||||
# 获取当前目录下的所有文件和子目录
|
|
||||||
flag = False
|
|
||||||
files = os.listdir('.')
|
|
||||||
# 遍历每一个文件或子目录
|
|
||||||
for file in files:
|
|
||||||
# 如果是文件,并且文件名是extension.js
|
|
||||||
if os.path.isfile(file) and file == 'extension.js':
|
|
||||||
# 调用函数,传入文件名,得到修改后的内容
|
|
||||||
content = modify_file(file)
|
|
||||||
# 打开文件,以写入模式,覆盖原内容
|
|
||||||
with open(file, 'w', encoding='UTF-8') as f:
|
|
||||||
# 写入修改后的内容
|
|
||||||
f.write(content)
|
|
||||||
flag = True
|
|
||||||
if os.path.isfile(file) and file == 'game.js':
|
|
||||||
# 调用函数,传入文件名,得到修改后的内容
|
|
||||||
content = modify_file(file)
|
|
||||||
# 打开文件,以写入模式,覆盖原内容
|
|
||||||
with open(file, 'w', encoding='UTF-8') as f:
|
|
||||||
# 写入修改后的内容
|
|
||||||
f.write(content)
|
|
||||||
flag = True
|
|
||||||
|
|
||||||
if flag:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
print('ERROR')
|
|
||||||
sleep(3)
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
// 用于在game.import中包裹skill,对其进行一定的预处理,使其支持一些如自动导入子技能,自动设置技能名等的功能
|
|
||||||
export function skillFactory(skill) {
|
|
||||||
for (let skill_name in skill.skill) {
|
|
||||||
const skill_content = skill.skill[skill_name];
|
|
||||||
// 自动导入在autoSubSkill下的子技能
|
|
||||||
if (skill_content.autoSubSkill) {
|
|
||||||
skill_content.group || (skill_content.group = []);
|
|
||||||
skill_content.subSkill || (skill_content.subSkill = {});
|
|
||||||
// skill_content.subSkill = skill_content.subSkill ?? {};
|
|
||||||
// skill_content.group = skill_content.group ?? [];
|
|
||||||
for (let autoSubSkillName in skill_content.autoSubSkill) {
|
|
||||||
skill_content.subSkill[autoSubSkillName] = skill_content.autoSubSkill[autoSubSkillName];
|
|
||||||
skill_content.group.push(`${skill_name}_${autoSubSkillName}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 自动根据autoTranslate设置技能的translate相关内容
|
|
||||||
if (skill_content.autoTranslate) {
|
|
||||||
skill.translate[`${skill_name}`] = skill_content.autoTranslate.name;
|
|
||||||
skill.translate[`${skill_name}_info`] = skill_content.autoTranslate.info;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return skill;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default (lib, game, ui, get, ai, _status) => {
|
|
||||||
return {
|
|
||||||
isAsyncFunction(func) {
|
|
||||||
return func.constructor.name === "AsyncFunction";
|
|
||||||
},
|
|
||||||
watch: function (obj, key, callback) {},
|
|
||||||
game: {},
|
|
||||||
/**
|
|
||||||
* Description 角色相关操作
|
|
||||||
*/
|
|
||||||
player: {
|
|
||||||
/**
|
|
||||||
* Description 更换角色的头像
|
|
||||||
* @param {Player} player 需要更换头像的玩家
|
|
||||||
* @param {string} imageSource 图片源,可以为角色名(player.name)
|
|
||||||
* @param {number|string} replace 要替代的,默认为1(单将模式不用管)
|
|
||||||
* @returns {null} 无返回
|
|
||||||
*/
|
|
||||||
changeAvatar(player, imageSource, replace) {
|
|
||||||
if (replace && (player.name2 === replace || replace === 2)) {
|
|
||||||
player.node.avatar2.setBackground(imageSource, "character");
|
|
||||||
} else {
|
|
||||||
player.node.avatar.setBackground(imageSource, "character");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* Description 为角色设置用于显示的名称(如吕布,貂蝉等)
|
|
||||||
* @param {Player} player 要设置名称的玩家
|
|
||||||
* @param {string} name 新名称
|
|
||||||
* @param {undefined | 1 | 2} replace name1或name2
|
|
||||||
* @returns {null}
|
|
||||||
*/
|
|
||||||
setName(player, name, replace) {
|
|
||||||
let targetNode = player.node.name;
|
|
||||||
if (replace && (player.name2 === replace || replace === 2)) {
|
|
||||||
targetNode = player.node.name2;
|
|
||||||
}
|
|
||||||
targetNode.innerHTML = name;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
loadash: {
|
|
||||||
/**
|
|
||||||
* Description 浅浅拷贝对象
|
|
||||||
* @param {Array | Object} target
|
|
||||||
* @returns {Array | Object}
|
|
||||||
*/
|
|
||||||
shallowClone(target) {
|
|
||||||
if (Array.isArray(target)) {
|
|
||||||
return [...target];
|
|
||||||
}
|
|
||||||
if (typeof target === "object" && target !== null) {
|
|
||||||
return { ...target };
|
|
||||||
}
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 提供一些便捷的math功能
|
|
||||||
math: {},
|
|
||||||
other: {
|
|
||||||
/**
|
|
||||||
* Description 返回一个function,每次执行会控制台递增输出0,1,2等等,用于debug挺好
|
|
||||||
* @returns {function}
|
|
||||||
*/
|
|
||||||
useLogger() {
|
|
||||||
let count = 0;
|
|
||||||
return (...args) => {
|
|
||||||
console.log(count++, ...args);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
After Width: | Height: | Size: 352 KiB |
|
After Width: | Height: | Size: 272 KiB |
|
After Width: | Height: | Size: 297 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 756 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 8.9 MiB |
|
Before Width: | Height: | Size: 532 KiB |
|
Before Width: | Height: | Size: 3.2 MiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 297 KiB |
|
Before Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 449 KiB |
|
Before Width: | Height: | Size: 359 KiB |
|
Before Width: | Height: | Size: 331 KiB |
|
Before Width: | Height: | Size: 451 KiB |
|
Before Width: | Height: | Size: 245 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 584 KiB |
|
Before Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 334 KiB |
|
Before Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 314 KiB |
|
Before Width: | Height: | Size: 338 KiB |
|
Before Width: | Height: | Size: 13 MiB |
|
Before Width: | Height: | Size: 562 KiB |
|
Before Width: | Height: | Size: 569 KiB |
|
Before Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 9.1 MiB |
|
Before Width: | Height: | Size: 8.6 MiB |
|
Before Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 367 KiB |
|
Before Width: | Height: | Size: 6.6 MiB |
|
Before Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 456 KiB |
|
Before Width: | Height: | Size: 359 KiB |
|
Before Width: | Height: | Size: 328 KiB |
|
Before Width: | Height: | Size: 843 KiB |
|
Before Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 307 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 320 KiB |
|
Before Width: | Height: | Size: 371 KiB |
|
Before Width: | Height: | Size: 316 KiB |
|
Before Width: | Height: | Size: 355 KiB |
|
Before Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 815 KiB |
|
Before Width: | Height: | Size: 920 KiB |
|
Before Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 544 KiB |
|
Before Width: | Height: | Size: 337 KiB |
|
Before Width: | Height: | Size: 658 KiB |
|
Before Width: | Height: | Size: 313 KiB |
|
Before Width: | Height: | Size: 928 KiB |
|
Before Width: | Height: | Size: 104 KiB |
|
Before Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 263 KiB |
|
Before Width: | Height: | Size: 5.6 MiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 342 KiB |
|
Before Width: | Height: | Size: 298 KiB |
|
Before Width: | Height: | Size: 157 KiB |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 235 KiB |
|
Before Width: | Height: | Size: 279 KiB |
|
Before Width: | Height: | Size: 480 KiB |
|
Before Width: | Height: | Size: 2.8 MiB |