bc-deeplib 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.types/declarations.d.ts +15 -0
- package/.types/elements.d.ts +38 -0
- package/.types/type-override.d.ts +3 -0
- package/README.md +1 -1
- package/package.json +28 -12
- package/public/styles/DeepLib.css +206 -0
- package/public/styles/Gratitude.css +23 -0
- package/src/Base/BaseModule.ts +45 -0
- package/src/Base/BaseSubscreen.ts +198 -0
- package/src/Base/Initialization.ts +83 -0
- package/src/Base/Modules.ts +16 -0
- package/src/Base/SettingDefinitions.ts +14 -0
- package/src/DeepLib.ts +33 -0
- package/src/Migrators/BaseMigrator.ts +4 -0
- package/src/Models/Base.ts +4 -0
- package/src/Models/Settings.ts +7 -0
- package/src/Modules/GUI.ts +123 -0
- package/src/Modules/Version.ts +89 -0
- package/src/Screens/Debug.ts +99 -0
- package/src/Screens/MainMenu.ts +138 -0
- package/src/Screens/Support.ts +99 -0
- package/src/Utilities/Data.ts +40 -0
- package/src/Utilities/Elements/.AdvancedElements.ts +70 -0
- package/src/Utilities/Elements/.ElementHelpers.ts +100 -0
- package/src/Utilities/Elements/Button.ts +54 -0
- package/src/Utilities/Elements/Checkbox.ts +63 -0
- package/src/Utilities/Elements/Input.ts +72 -0
- package/src/Utilities/Elements/Label.ts +50 -0
- package/src/Utilities/Elements/Tooltip.ts +30 -0
- package/src/Utilities/Logger.ts +79 -0
- package/src/Utilities/Messages.ts +36 -0
- package/src/Utilities/SDK.ts +104 -0
- package/src/Utilities/String.ts +31 -0
- package/src/Utilities/Style.ts +24 -0
- package/src/Utilities/Translation.ts +59 -0
- package/dist/Base/BaseModule.d.ts +0 -13
- package/dist/Base/BaseModule.js +0 -41
- package/dist/Base/BaseSetting.d.ts +0 -29
- package/dist/Base/BaseSetting.js +0 -152
- package/dist/Base/Modules.d.ts +0 -5
- package/dist/Base/Modules.js +0 -17
- package/dist/Base/SettingDefinitions.d.ts +0 -8
- package/dist/Base/SettingDefinitions.js +0 -19
- package/dist/Base/SettingUtils.d.ts +0 -17
- package/dist/Base/SettingUtils.js +0 -101
- package/dist/DeepLib.d.ts +0 -17
- package/dist/DeepLib.js +0 -33
- package/dist/Models/Base.d.ts +0 -4
- package/dist/Models/Base.js +0 -2
- package/dist/Models/Settings.d.ts +0 -6
- package/dist/Models/Settings.js +0 -2
- package/dist/Modules/Version.d.ts +0 -13
- package/dist/Modules/Version.js +0 -62
- package/dist/Screens/MainMenu.d.ts +0 -11
- package/dist/Screens/MainMenu.js +0 -80
- package/dist/Screens/Support.d.ts +0 -14
- package/dist/Screens/Support.js +0 -99
- package/dist/Utils/Data.d.ts +0 -5
- package/dist/Utils/Data.js +0 -42
- package/dist/Utils/Logger.d.ts +0 -4
- package/dist/Utils/Logger.js +0 -6
- package/dist/Utils/Messages.d.ts +0 -2
- package/dist/Utils/Messages.js +0 -32
- package/dist/Utils/RibbonMenu.d.ts +0 -9
- package/dist/Utils/RibbonMenu.js +0 -32
- package/dist/Utils/SDK.d.ts +0 -21
- package/dist/Utils/SDK.js +0 -75
- package/dist/Utils/String.d.ts +0 -5
- package/dist/Utils/String.js +0 -30
- package/dist/Utils/Translation.d.ts +0 -10
- package/dist/Utils/Translation.js +0 -43
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseSubscreen, GUI } from '../DeepLib';
|
|
2
|
+
|
|
3
|
+
export function getCurrentSubscreen(): BaseSubscreen | null {
|
|
4
|
+
return GUI.instance && GUI.instance.currentSubscreen;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function setSubscreen(subscreen: BaseSubscreen | string | null): BaseSubscreen | null {
|
|
8
|
+
if (!GUI.instance) {
|
|
9
|
+
throw new Error('Attempt to set subscreen before init');
|
|
10
|
+
}
|
|
11
|
+
GUI.instance.currentSubscreen = subscreen;
|
|
12
|
+
|
|
13
|
+
return GUI.instance.currentSubscreen;
|
|
14
|
+
}
|
package/src/DeepLib.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export * from './Base/BaseModule';
|
|
2
|
+
export * from './Base/BaseSubscreen';
|
|
3
|
+
export * from './Base/Initialization';
|
|
4
|
+
export * from './Base/Modules';
|
|
5
|
+
export * from './Base/SettingDefinitions';
|
|
6
|
+
|
|
7
|
+
export * from './Migrators/BaseMigrator';
|
|
8
|
+
|
|
9
|
+
export * from './Models/Base';
|
|
10
|
+
export * from './Models/Settings';
|
|
11
|
+
|
|
12
|
+
export * from './Modules/GUI';
|
|
13
|
+
export * from './Modules/Version';
|
|
14
|
+
|
|
15
|
+
export * from './Screens/Debug';
|
|
16
|
+
export * from './Screens/MainMenu';
|
|
17
|
+
export * from './Screens/Support';
|
|
18
|
+
|
|
19
|
+
export * from './Utilities/Data';
|
|
20
|
+
export * from './Utilities/Elements/.AdvancedElements';
|
|
21
|
+
export * from './Utilities/Elements/.ElementHelpers';
|
|
22
|
+
export * from './Utilities/Elements/Button';
|
|
23
|
+
export * from './Utilities/Elements/Checkbox';
|
|
24
|
+
export * from './Utilities/Elements/Input';
|
|
25
|
+
export * from './Utilities/Elements/Label';
|
|
26
|
+
export * from './Utilities/Elements/Tooltip';
|
|
27
|
+
export * from './Utilities/Logger';
|
|
28
|
+
export * from './Utilities/Messages';
|
|
29
|
+
export * from './Utilities/SDK';
|
|
30
|
+
export * from './Utilities/String';
|
|
31
|
+
export * from './Utilities/Style';
|
|
32
|
+
export * from './Utilities/Translation';
|
|
33
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { BaseModule, BaseSubscreen, MainMenu, modules, setSubscreen } from '../DeepLib';
|
|
2
|
+
|
|
3
|
+
type ModButtonOptions = {
|
|
4
|
+
Identifier: string;
|
|
5
|
+
ButtonText: string | (()=>string);
|
|
6
|
+
Image: string | (()=>string);
|
|
7
|
+
|
|
8
|
+
load?: () => void;
|
|
9
|
+
click?: () => void;
|
|
10
|
+
run?: () => void;
|
|
11
|
+
unload?: () => void;
|
|
12
|
+
exit?: () => boolean | void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export class GUI extends BaseModule {
|
|
16
|
+
static instance: GUI | null = null;
|
|
17
|
+
|
|
18
|
+
private _subscreens: BaseSubscreen[];
|
|
19
|
+
private _mainMenu: MainMenu;
|
|
20
|
+
private _currentSubscreen: BaseSubscreen | null = null;
|
|
21
|
+
private _modButtonOptions: ModButtonOptions;
|
|
22
|
+
|
|
23
|
+
get subscreens(): BaseSubscreen[] {
|
|
24
|
+
return this._subscreens;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get mainMenu(): MainMenu {
|
|
28
|
+
return this._mainMenu;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get currentSubscreen(): BaseSubscreen | null {
|
|
32
|
+
return this._currentSubscreen;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
set currentSubscreen(subscreen: BaseSubscreen | string | null) {
|
|
36
|
+
if (this._currentSubscreen) {
|
|
37
|
+
this._currentSubscreen.unload();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (typeof subscreen === 'string') {
|
|
41
|
+
const scr = this._subscreens?.find((s) => s.name === subscreen);
|
|
42
|
+
if (!scr) throw `Failed to find screen name ${subscreen}`;
|
|
43
|
+
this._currentSubscreen = scr;
|
|
44
|
+
} else {
|
|
45
|
+
this._currentSubscreen = subscreen;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
PreferenceMessage = '';
|
|
49
|
+
PreferencePageCurrent = 1;
|
|
50
|
+
|
|
51
|
+
if (this._currentSubscreen) {
|
|
52
|
+
this._currentSubscreen.load();
|
|
53
|
+
this._currentSubscreen.resize(true);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
constructor(modButtonOptions: ModButtonOptions) {
|
|
58
|
+
super();
|
|
59
|
+
if (GUI.instance) {
|
|
60
|
+
throw new Error('Duplicate initialization');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
for (const module of modules()) {
|
|
64
|
+
if (!module.settingsScreen) continue;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this._mainMenu = new MainMenu(this);
|
|
68
|
+
this._subscreens = [this._mainMenu];
|
|
69
|
+
this._modButtonOptions = modButtonOptions;
|
|
70
|
+
|
|
71
|
+
GUI.instance = this;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
get defaultSettings(): null {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
load(): void {
|
|
79
|
+
for (const module of modules()) {
|
|
80
|
+
if (!module.settingsScreen) continue;
|
|
81
|
+
|
|
82
|
+
this._subscreens.push(new module.settingsScreen(module));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
this._mainMenu.subscreens = this._subscreens;
|
|
86
|
+
PreferenceRegisterExtensionSetting({
|
|
87
|
+
Identifier: this._modButtonOptions.Identifier,
|
|
88
|
+
ButtonText: this._modButtonOptions.ButtonText,
|
|
89
|
+
Image: this._modButtonOptions.Image,
|
|
90
|
+
load: this._modButtonOptions.load || (() => {
|
|
91
|
+
setSubscreen(new MainMenu(this));
|
|
92
|
+
}),
|
|
93
|
+
run: this._modButtonOptions.run || (() => {
|
|
94
|
+
if (this._currentSubscreen) {
|
|
95
|
+
MainCanvas.textAlign = 'left';
|
|
96
|
+
this._currentSubscreen.run();
|
|
97
|
+
MainCanvas.textAlign = 'center';
|
|
98
|
+
|
|
99
|
+
const newCanvasPosition: RectTuple = [MainCanvas.canvas.offsetLeft, MainCanvas.canvas.offsetTop, MainCanvas.canvas.clientWidth, MainCanvas.canvas.clientHeight];
|
|
100
|
+
if (!CommonArraysEqual(newCanvasPosition, DrawCanvasPosition)) {
|
|
101
|
+
DrawCanvasPosition = newCanvasPosition;
|
|
102
|
+
this._currentSubscreen.resize(false);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
click: this._modButtonOptions.click || (() => {
|
|
107
|
+
if (this._currentSubscreen) {
|
|
108
|
+
this._currentSubscreen.click();
|
|
109
|
+
}
|
|
110
|
+
}),
|
|
111
|
+
exit: this._modButtonOptions.exit || (() => {
|
|
112
|
+
if (this._currentSubscreen) {
|
|
113
|
+
this._currentSubscreen.exit();
|
|
114
|
+
}
|
|
115
|
+
}),
|
|
116
|
+
unload: this._modButtonOptions.unload || (() => {
|
|
117
|
+
if (this._currentSubscreen) {
|
|
118
|
+
this._currentSubscreen.unload();
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { BaseMigrator, BaseModule, HookPriority, PlayerStorage, bcSdkMod, dataStore, deepLibLogger, sendLocalMessage } from '../DeepLib';
|
|
2
|
+
|
|
3
|
+
export class VersionModule extends BaseModule {
|
|
4
|
+
private static isItNewVersion: boolean = false;
|
|
5
|
+
static Version: string;
|
|
6
|
+
static NewVersionMessage: string = '';
|
|
7
|
+
private static Migrators: BaseMigrator[] = [];
|
|
8
|
+
|
|
9
|
+
load(): void {
|
|
10
|
+
VersionModule.Version = bcSdkMod.ModInfo.version;
|
|
11
|
+
|
|
12
|
+
bcSdkMod.prototype.hookFunction(
|
|
13
|
+
'ChatRoomSync',
|
|
14
|
+
HookPriority.Observe,
|
|
15
|
+
(args, next) => {
|
|
16
|
+
next(args);
|
|
17
|
+
if (PlayerStorage().GlobalModule.doShowNewVersionMessage && VersionModule.isItNewVersion) {
|
|
18
|
+
VersionModule.sendNewVersionMessage();
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
999
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static checkVersionUpdate() {
|
|
26
|
+
const PreviousVersion = VersionModule.loadVersion();
|
|
27
|
+
const CurrentVersion = VersionModule.Version;
|
|
28
|
+
|
|
29
|
+
if (VersionModule.isNewVersion(PreviousVersion, CurrentVersion)) {
|
|
30
|
+
VersionModule.isItNewVersion = true;
|
|
31
|
+
VersionModule.saveVersion();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static checkVersionMigration() {
|
|
36
|
+
const PreviousVersion = VersionModule.loadVersion();
|
|
37
|
+
|
|
38
|
+
let saveRequired = false;
|
|
39
|
+
for (const migrator of VersionModule.Migrators) {
|
|
40
|
+
if (VersionModule.isNewVersion(PreviousVersion, migrator.MigrationVersion)) {
|
|
41
|
+
saveRequired = saveRequired || migrator.Migrate();
|
|
42
|
+
deepLibLogger.info(`Migrating ${bcSdkMod.ModInfo.name} from ${PreviousVersion} to ${migrator.MigrationVersion} with ${migrator.constructor.name}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (saveRequired) {
|
|
47
|
+
dataStore();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static registerMigrator(migrator: BaseMigrator) {
|
|
52
|
+
VersionModule.Migrators.push(migrator);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static setNewVersionMessage(newVersionMessage: string) {
|
|
56
|
+
VersionModule.NewVersionMessage = newVersionMessage;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static sendNewVersionMessage() {
|
|
60
|
+
sendLocalMessage('deeplib-new-version', VersionModule.NewVersionMessage);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private static isNewVersion(current: string | undefined, candidate: string) {
|
|
64
|
+
if (current !== undefined) {
|
|
65
|
+
const CURRENT_ = current.split('.'),
|
|
66
|
+
CANDIDATE_ = candidate.split('.');
|
|
67
|
+
for (let i = 0; i < 3; i++) {
|
|
68
|
+
if (CURRENT_[i] === CANDIDATE_[i]) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
return CANDIDATE_[i] > CURRENT_[i];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (current === undefined || current === '' || !current) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private static saveVersion() {
|
|
81
|
+
if (PlayerStorage()) {
|
|
82
|
+
Player[bcSdkMod.ModInfo.name].Version = VersionModule.Version;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private static loadVersion() {
|
|
87
|
+
return PlayerStorage()?.Version;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
|
|
2
|
+
import { Button, Checkbox, Input, Label, SettingElement } from 'Types/elements';
|
|
3
|
+
import { BaseSubscreen, deepLibLogger } from '../DeepLib';
|
|
4
|
+
|
|
5
|
+
export class GuiDebug extends BaseSubscreen {
|
|
6
|
+
|
|
7
|
+
get name(): string {
|
|
8
|
+
return 'debug';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get pageStructure(): SettingElement[][] {
|
|
12
|
+
return [[
|
|
13
|
+
<Button>{
|
|
14
|
+
type: 'button',
|
|
15
|
+
roundness: 50,
|
|
16
|
+
id: 'test-deeplib-big-button',
|
|
17
|
+
size: [405, 80],
|
|
18
|
+
label: 'Big Button',
|
|
19
|
+
tooltip: 'This is a big button',
|
|
20
|
+
image: 'Icons/Exit.png',
|
|
21
|
+
onClick() {
|
|
22
|
+
deepLibLogger.info('Big Button Clicked');
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
<Button>{
|
|
26
|
+
type: 'button',
|
|
27
|
+
roundness: 5,
|
|
28
|
+
id: 'test-deeplib-small-button',
|
|
29
|
+
size: [90, 90],
|
|
30
|
+
tooltip: 'This is a small button',
|
|
31
|
+
image: 'Icons/Exit.png',
|
|
32
|
+
onClick() {
|
|
33
|
+
deepLibLogger.info('Small Button Clicked');
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
<Checkbox>{
|
|
37
|
+
type: 'checkbox',
|
|
38
|
+
id: 'test-deeplib-checkbox',
|
|
39
|
+
label: 'Checkbox',
|
|
40
|
+
description: 'This is a checkbox',
|
|
41
|
+
checked: false,
|
|
42
|
+
getSettingValue() {
|
|
43
|
+
return true;
|
|
44
|
+
},
|
|
45
|
+
setSettingValue(val: boolean) {
|
|
46
|
+
deepLibLogger.info('Checkbox value:', val);
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
<Input>{
|
|
50
|
+
type: 'text',
|
|
51
|
+
id: 'test-deeplib-text-input',
|
|
52
|
+
label: 'Input',
|
|
53
|
+
description: 'This is a text input',
|
|
54
|
+
getElementValue() {
|
|
55
|
+
return 'Input Value';
|
|
56
|
+
},
|
|
57
|
+
setSettingValue(val: string) {
|
|
58
|
+
deepLibLogger.info('Input value:', val);
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
<Input>{
|
|
62
|
+
type: 'number',
|
|
63
|
+
id: 'test-deeplib-number-input',
|
|
64
|
+
label: 'Input',
|
|
65
|
+
description: 'This is a number input',
|
|
66
|
+
getElementValue() {
|
|
67
|
+
return '123';
|
|
68
|
+
},
|
|
69
|
+
setSettingValue(val: string) {
|
|
70
|
+
deepLibLogger.info('Input value:', val);
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
<Label>{
|
|
74
|
+
type: 'label',
|
|
75
|
+
id: 'test-deeplib-label',
|
|
76
|
+
label: 'Label',
|
|
77
|
+
description: 'This is a label',
|
|
78
|
+
}
|
|
79
|
+
]];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
load(): void {
|
|
83
|
+
super.load();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
run() {
|
|
87
|
+
super.run();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
click() { }
|
|
91
|
+
|
|
92
|
+
exit(): void {
|
|
93
|
+
super.exit();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
resize(): void {
|
|
97
|
+
super.resize();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
|
|
2
|
+
import { BaseSubscreen, GUI, GuiDebug, GuiSupport, elementAppendToMiscDiv, elementAppendToSettingsDiv, elementAppendToSubscreenDiv, elementCreateButton, elementCreateMiscDiv, elementSetPosSizeFont, getText } from '../DeepLib';
|
|
3
|
+
|
|
4
|
+
export class MainMenu extends BaseSubscreen {
|
|
5
|
+
subscreens: BaseSubscreen[] = [];
|
|
6
|
+
|
|
7
|
+
static wikiLink: string = '';
|
|
8
|
+
static resetSubscreen: BaseSubscreen | null = null;
|
|
9
|
+
|
|
10
|
+
get name(): string {
|
|
11
|
+
return 'mainmenu';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
constructor(module: GUI) {
|
|
15
|
+
super(module);
|
|
16
|
+
|
|
17
|
+
this.subscreens = module.subscreens;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
load(): void {
|
|
21
|
+
if (!GUI.instance?.currentSubscreen) {
|
|
22
|
+
this.setSubscreen(this);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
super.load();
|
|
27
|
+
|
|
28
|
+
const exitButton = elementCreateButton({
|
|
29
|
+
type: 'button',
|
|
30
|
+
id: 'exit',
|
|
31
|
+
position: [1815, 75],
|
|
32
|
+
size: [90, 90],
|
|
33
|
+
image: 'Icons/Exit.png',
|
|
34
|
+
onClick: () => {
|
|
35
|
+
this.exit();
|
|
36
|
+
},
|
|
37
|
+
tooltip: getText('settings.button.back_button_hint')
|
|
38
|
+
});
|
|
39
|
+
elementAppendToSubscreenDiv(exitButton);
|
|
40
|
+
|
|
41
|
+
for (const screen of this.subscreens) {
|
|
42
|
+
|
|
43
|
+
if (screen.name == 'mainmenu') continue;
|
|
44
|
+
|
|
45
|
+
const button = elementCreateButton({
|
|
46
|
+
type: 'button',
|
|
47
|
+
id: `${screen.name}-button`,
|
|
48
|
+
image: screen.icon,
|
|
49
|
+
label: getText(`mainmenu.button.${screen.name}`),
|
|
50
|
+
onClick: () => {
|
|
51
|
+
this.setSubscreen(screen);
|
|
52
|
+
},
|
|
53
|
+
size: [450, 90],
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
elementAppendToSettingsDiv(button);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const miscDiv = elementCreateMiscDiv();
|
|
60
|
+
elementAppendToSubscreenDiv(miscDiv);
|
|
61
|
+
|
|
62
|
+
if (MainMenu.resetSubscreen) {
|
|
63
|
+
const resetButton = elementCreateButton({
|
|
64
|
+
type: 'button',
|
|
65
|
+
id: 'deeplib-reset-button',
|
|
66
|
+
image: 'Icons/ServiceBell.png',
|
|
67
|
+
label: 'Reset',
|
|
68
|
+
onClick: () => {
|
|
69
|
+
this.setSubscreen(MainMenu.resetSubscreen);
|
|
70
|
+
},
|
|
71
|
+
size: [405, 80],
|
|
72
|
+
});
|
|
73
|
+
elementAppendToMiscDiv(resetButton);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (MainMenu.wikiLink) {
|
|
77
|
+
const wikiButton = elementCreateButton({
|
|
78
|
+
type: 'button',
|
|
79
|
+
id: 'deeplib-wiki-button',
|
|
80
|
+
image: 'Icons/Introduction.png',
|
|
81
|
+
label: 'Wiki',
|
|
82
|
+
onClick: () => {
|
|
83
|
+
window.open(MainMenu.wikiLink, '_blank');
|
|
84
|
+
},
|
|
85
|
+
size: [405, 80],
|
|
86
|
+
});
|
|
87
|
+
elementAppendToMiscDiv(wikiButton);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const supportButton = elementCreateButton({
|
|
91
|
+
type: 'button',
|
|
92
|
+
id: 'deeplib-support-button',
|
|
93
|
+
image: 'Assets/Female3DCG/Emoticon/Coffee/Icon.png',
|
|
94
|
+
label: 'Support',
|
|
95
|
+
onClick: () => {
|
|
96
|
+
this.setSubscreen(new GuiSupport());
|
|
97
|
+
},
|
|
98
|
+
size: [405, 80],
|
|
99
|
+
});
|
|
100
|
+
elementAppendToMiscDiv(supportButton);
|
|
101
|
+
elementSetPosSizeFont({ elementId: 'deeplib-misc' }, 1500, 670, 405, 260);
|
|
102
|
+
|
|
103
|
+
const debugButton = elementCreateButton({
|
|
104
|
+
type: 'button',
|
|
105
|
+
id: 'deeplib-debug-button',
|
|
106
|
+
image: 'Assets/Female3DCG/Emoticon/Coffee/Icon.png',
|
|
107
|
+
onClick: () => {
|
|
108
|
+
this.setSubscreen(new GuiDebug());
|
|
109
|
+
},
|
|
110
|
+
size: [90, 90],
|
|
111
|
+
position: [75, 75],
|
|
112
|
+
});
|
|
113
|
+
elementAppendToMiscDiv(debugButton);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
run() {
|
|
117
|
+
super.run();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
click() { }
|
|
121
|
+
|
|
122
|
+
exit(): void {
|
|
123
|
+
CharacterAppearanceForceUpCharacter = -1;
|
|
124
|
+
CharacterLoadCanvas(Player);
|
|
125
|
+
this.setSubscreen(null);
|
|
126
|
+
PreferenceSubscreenExtensionsClear();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
resize(): void {
|
|
130
|
+
super.resize();
|
|
131
|
+
elementSetPosSizeFont({ elementId: 'deeplib-misc' }, 1500, 670, 405, 260);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function setMainMenuOptions(wikiLink: string, resetSubscreen: BaseSubscreen | null) {
|
|
136
|
+
MainMenu.wikiLink = wikiLink;
|
|
137
|
+
MainMenu.resetSubscreen = resetSubscreen;
|
|
138
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Button, SettingElement } from '../../.types/elements';
|
|
2
|
+
import { BaseSubscreen, elementSetPosSizeFont, getText } from '../DeepLib';
|
|
3
|
+
|
|
4
|
+
export class SupportHelper {
|
|
5
|
+
private static thankYouList: string[] = ['Ellena', 'weboos', 'Jamie'];
|
|
6
|
+
private static thankYouNext = 0;
|
|
7
|
+
private static thankYou = '';
|
|
8
|
+
|
|
9
|
+
static getSupporter() {
|
|
10
|
+
if (SupportHelper.thankYouNext < CommonTime()) SupportHelper.doNextThankYou();
|
|
11
|
+
return `${getText('support.other.thankyou')}, ${SupportHelper.thankYou}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static doNextThankYou() {
|
|
15
|
+
if (SupportHelper.thankYou && SupportHelper.thankYouList.length < 2) return;
|
|
16
|
+
SupportHelper.thankYou = CommonRandomItemFromList(SupportHelper.thankYou, SupportHelper.thankYouList);
|
|
17
|
+
SupportHelper.thankYouNext = CommonTime() + 5000;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class GuiSupport extends BaseSubscreen {
|
|
22
|
+
get name(): string {
|
|
23
|
+
return 'Support';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get currentPage(): SettingElement[] {
|
|
27
|
+
return [
|
|
28
|
+
<Button>{
|
|
29
|
+
type: 'button',
|
|
30
|
+
id: 'deeplib-support-kofi',
|
|
31
|
+
size: [405, 80],
|
|
32
|
+
label: getText('support.button.ko-fi'),
|
|
33
|
+
image: 'https://storage.ko-fi.com/cdn/nav-logo-stroke.png',
|
|
34
|
+
onClick() {
|
|
35
|
+
window.open('https://ko-fi.com/monikka_bc', '_blank');
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
<Button>{
|
|
39
|
+
type: 'button',
|
|
40
|
+
id: 'deeplib-support-patreon',
|
|
41
|
+
size: [405, 80],
|
|
42
|
+
label: getText('support.button.patreon'),
|
|
43
|
+
image: 'https://c5.patreon.com/external/favicon/rebrand/favicon-32.png?v=af5597c2ef',
|
|
44
|
+
onClick() {
|
|
45
|
+
window.open('https://patreon.com/monikka_bc', '_blank');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
load() {
|
|
52
|
+
SupportHelper.doNextThankYou();
|
|
53
|
+
super.load();
|
|
54
|
+
ElementRemove('deeplib-settngs');
|
|
55
|
+
|
|
56
|
+
ElementCreateDiv('deeplib-gratitude');
|
|
57
|
+
const elm = document.getElementById('deeplib-gratitude') as HTMLElement;
|
|
58
|
+
ElementContent('deeplib-gratitude', gratitudeHtml);
|
|
59
|
+
elementSetPosSizeFont({ element: elm }, 1000, 250, 400, 400);
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
run() {
|
|
64
|
+
super.run();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
click() {
|
|
68
|
+
super.click();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
exit() {
|
|
72
|
+
ElementRemove('deeplib-gratitude');
|
|
73
|
+
super.exit();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
resize(): void {
|
|
77
|
+
super.resize();
|
|
78
|
+
elementSetPosSizeFont({ elementId: 'deeplib-gratitude' }, 1000, 250, 400, 400);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const gratitudeHtml = /*html*/ `
|
|
83
|
+
<h1>Dear Supporters!</h1>
|
|
84
|
+
<p>
|
|
85
|
+
I want to take a moment to express my heartfelt gratitude for considering supporting me. Your willingness to stand by
|
|
86
|
+
my side in this creative journey means the world to me, and I am truly humbled by your generosity.
|
|
87
|
+
</p>
|
|
88
|
+
<p>
|
|
89
|
+
Your support goes far beyond the financial contributions; it represents belief in my work and a shared passion for
|
|
90
|
+
what I do. Your encouragement inspires me to continue developing.
|
|
91
|
+
</p>
|
|
92
|
+
<p>
|
|
93
|
+
Your support not only helps me sustain and grow as a developer, but also enables me to dedicate more time and
|
|
94
|
+
resources to producing high-quality mods. It allows me to explore new ideas, enhance my skills, and bring even more
|
|
95
|
+
meaningful and enjoyable content to you.
|
|
96
|
+
</p>
|
|
97
|
+
<p>Thank you all~</p>
|
|
98
|
+
<p>With love, Monikka♥</p>
|
|
99
|
+
`;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SettingsModel, _String, bcSdkMod, modules } from '../DeepLib';
|
|
2
|
+
|
|
3
|
+
export const PlayerStorage = (): Readonly<SettingsModel> => (
|
|
4
|
+
typeof Player?.[bcSdkMod.ModInfo.name] === 'object' ?
|
|
5
|
+
CommonCloneDeep(Player?.[bcSdkMod.ModInfo.name]) :
|
|
6
|
+
undefined
|
|
7
|
+
);
|
|
8
|
+
export const ExtensionStorage = (): Readonly<string> => Player.ExtensionSettings[bcSdkMod.ModInfo.name];
|
|
9
|
+
|
|
10
|
+
export function dataTake(modName: string = bcSdkMod.ModInfo.name) {
|
|
11
|
+
if (ExtensionStorage()) {
|
|
12
|
+
const parsed = JSON.parse(LZString.decompressFromBase64(ExtensionStorage()) || '');
|
|
13
|
+
Player[modName] = Object.hasOwn(parsed, 'Version') ? parsed : undefined;
|
|
14
|
+
} else {
|
|
15
|
+
Player[modName] = {};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function dataStore() {
|
|
20
|
+
const modName = bcSdkMod.ModInfo.name;
|
|
21
|
+
const modVersion = bcSdkMod.ModInfo.version;
|
|
22
|
+
|
|
23
|
+
if (!ExtensionStorage()) Player.ExtensionSettings[modName] = '';
|
|
24
|
+
const Data: SettingsModel = {
|
|
25
|
+
GlobalModule: {
|
|
26
|
+
modEnabled: false,
|
|
27
|
+
doShowNewVersionMessage: false
|
|
28
|
+
},
|
|
29
|
+
Version: modVersion
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
for (const module of modules()) {
|
|
33
|
+
if (!module.settingsStorage) continue;
|
|
34
|
+
|
|
35
|
+
Data[module.settingsStorage] = PlayerStorage()[module.settingsStorage];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
Player.ExtensionSettings[modName] = _String.encode(Data);
|
|
39
|
+
ServerPlayerExtensionSettingsSync(modName);
|
|
40
|
+
}
|