diff --git a/models/Button.js b/models/Button.js new file mode 100644 index 00000000..3ef7b814 --- /dev/null +++ b/models/Button.js @@ -0,0 +1,58 @@ +export default class Button { + constructor(e = {}) { + this.prefix = e.isSr ? "*" : "#" + } + + bindUid() { + return segment.button([ + { text: "绑定UID", input: `${this.prefix}绑定uid` }, + ]) + } + + gacha() { + return segment.button([ + { text: "角色记录", callback: `${this.prefix}角色记录` }, + { text: "角色统计", callback: `${this.prefix}角色统计` }, + ],[ + { text: "武器记录", callback: `${this.prefix}武器记录` }, + { text: "武器统计", callback: `${this.prefix}武器统计` }, + ],[ + { text: "常驻记录", callback: `${this.prefix}常驻记录` }, + { text: "常驻统计", callback: `${this.prefix}常驻统计` }, + ],[ + { text: "抽卡帮助", callback: `${this.prefix}抽卡帮助` }, + ]) + } + + profile(char = {}, uid = "") { + return segment.button([ + { text: `${char.name}卡片`, callback: `${this.prefix}${char.name}卡片${uid}` }, + { text: `${char.name}面板`, callback: `${this.prefix}${char.name}面板${uid}` }, + ],[ + { text: `${char.name}排行`, callback: `${this.prefix}${char.name}排行` }, + { text: `${char.name}圣遗物`, callback: `${this.prefix}${char.name}圣遗物${uid}` }, + ],[ + { text: `${char.name}图鉴`, callback: `${this.prefix}${char.name}图鉴` }, + { text: `${char.name}攻略`, callback: `${this.prefix}${char.name}攻略` }, + ],[ + { text: `${char.name}命座`, callback: `${this.prefix}${char.name}命座` }, + { text: `${char.name}天赋`, callback: `${this.prefix}${char.name}天赋` }, + ]) + } + + profileList(uid = "", charList = {}) { + const button = [[]] + for (const name in charList) { + const array = button[button.length-1] + array.push({ text: `${name}面板`, callback: `${this.prefix}${name}面板${uid}` }) + if (array.length > 1) + button.push([]) + } + if (!button[0].length) + button[0] = [ + { text: "更新面板", callback: `${this.prefix}更新面板${uid}` }, + { text: "删除面板", callback: `${this.prefix}删除面板${uid}` }, + ] + return segment.button(...button) + } +} \ No newline at end of file diff --git a/models/index.js b/models/index.js index ce3ab833..e86305ea 100644 --- a/models/index.js +++ b/models/index.js @@ -13,6 +13,7 @@ import Material from './Material.js' import Weapon from './Weapon.js' import User from './User.js' import MysApi from './MysApi.js' +import Button from './Button.js' for (let game of ['gs', 'sr']) { for (let type of ['artifact', 'character', 'material', 'weapon']) { @@ -30,6 +31,7 @@ for (let game of ['gs', 'sr']) { export { Base, Abyss, + Button, Character, Artifact, ArtifactSet, @@ -42,5 +44,3 @@ export { MysApi, Player } - -