forked from 0xDC00/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPC_Steam_Unity_Children.of.Silentown.js
More file actions
134 lines (108 loc) · 4.17 KB
/
Copy pathPC_Steam_Unity_Children.of.Silentown.js
File metadata and controls
134 lines (108 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// ==UserScript==
// @name Children of Silentown
// @version
// @author [DC]
// @description Steam
// * Elf Games Works, Luna2 Studio
// * Unity (JIT)
//
// https://store.steampowered.com/app/1108000/Children_of_Silentown/
// ==/UserScript==
const Mono = require('./libMono.js');
const handlerLine = trans.send((s) => s, '250+');
// public void PrepareDialogue(GameObject speaker, string newText, bool thinking, Vector2 offset)
Mono.setHook('', 'Game.UI.BalloonMessageController', 'PrepareDialogue', -1, {
onEnter(args) {
console.log('onEnter: BalloonMessageController.PrepareDialogue');
const s = args[2].readMonoString();
handlerLine(s);
}
});
// public IEnumerator SetNarrator(string message, NarratorOptions options = null)
Mono.setHook('', 'Game.UI.MessageFacade', 'SetNarrator', -1, {
onEnter(args) {
console.log('onEnter: SetNarrator');
const s = args[1].readMonoString();
handlerLine(s);
}
});
// public IEnumerator Show(string message, NarratorOptions options = null)
Mono.setHook('', 'Game.UI.NarratorController', 'Show', -1, {
onEnter(args) {
console.log('onEnter: NarratorController.Show');
const s = args[1].readMonoString();
handlerLine(s);
}
});
// public IEnumerator ShowOnScreen(string text, Spotlight[] spotlights, GameEventBus.EventNames expectedEvent, Params options = null)
Mono.setHook('', 'Game.UI.TutorialManager', 'ShowOnScreen', -1, {
onEnter(args) {
console.log('onEnter: TutorialManager.ShowOnScreen');
const s = args[1].readMonoString();
handlerLine(s);
}
});
// public IEnumerator ShowRoutine(string text, InventoryDatabase.ICollectible inventoryItem, Params parameters = null)
Mono.setHook('', 'Game.UI.Dialog.DialogPopup', 'ShowRoutine', -1, {
onEnter(args) {
console.log('onEnter: DialogPopup.ShowRoutine');
const s = args[1].readMonoString();
handlerLine(s);
}
});
// public IEnumerator SetChoice(Dictionary<string, bool> choices)
Mono.setHook('', 'Game.UI.MessageFacade', 'SetChoice', -1, {
onEnter(args) {
console.log('onEnter: SetChoice');
const choices = args[1].wrap();
for (const item of choices) {
const s = item.wrap().get_Key().readMonoString();
handlerLine(s);
}
//// another way
// const iter = choices.GetEnumerator().wrap();
// while (iter.MoveNext().value === true) {
// const pair = iter.get_Current().wrap();
// const s = pair.get_Key().readMonoString();
// handlerLine(s);
// }
}
});
// It's a loop | IEnumerator
// Game.Video.AddressableVideoController
// private IEnumerator HandleSubtitlesAndSoundEffects(AddressableVideoConfiguration configuration)
const TMP_Text = Mono.use('Unity.TextMeshPro', 'TMPro.TextMeshProUGUI'); // TextMeshProUGUI TMP_Text
Mono.setHook('', 'Game.Video.AddressableVideoController', 'HandleSubtitlesAndSoundEffects', -1, {
onEnter() {
console.log('onEnter: HandleSubtitlesAndSoundEffects');
let hookStop;
let previous = null;
let hookTMP_Text = TMP_Text.set_text.attach({
onEnter(args) {
const thiz = args[0];
console.log('onEnter: setSubtitle ' + thiz + ' ' + this.returnAddress);
// HandleVideoEnd
if (previous === null) previous = thiz;
else if (thiz.compare(previous) !== 0) {
console.log('onEnter: HandleVideoEnd');
hookTMP_Text.detach();
hookStop.detach();
previous = null;
return;
}
const s = args[1].readMonoString();
if (s === '') return;
handlerLine(s);
}
});
// HandleVideoSkipping
hookStop = Mono.setHook('', 'Game.Video.AddressableVideoController', 'PrepareStopPlayback', -1, {
onEnter() {
previous = null;
console.log('onEnter: PrepareStopPlayback');
hookTMP_Text.detach();
hookStop.detach();
}
});
}
});