Skip to content

Commit eb7d01c

Browse files
committed
chore: formatting!
1 parent 831356e commit eb7d01c

3 files changed

Lines changed: 44 additions & 47 deletions

File tree

scripts/hud/cc.ts

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CaptionEntry {
4646
break;
4747

4848
case 2:
49-
style += `font-family: 'GorDIN';line-height: ${Math.ceil(CloseCaptioning.settings.fontSize / 20 * 24)}px`;
49+
style += `font-family: 'GorDIN';line-height: ${Math.ceil((CloseCaptioning.settings.fontSize / 20) * 24)}px`;
5050
break;
5151

5252
case 3:
@@ -173,7 +173,7 @@ class CloseCaptioning {
173173
this.showBox();
174174
}
175175

176-
static checkSizeAndPopIfNecessary(bIsNewLowPriority: boolean) : boolean {
176+
static checkSizeAndPopIfNecessary(bIsNewLowPriority: boolean): boolean {
177177
return true;
178178
const lowestTimeGlobal = { token: '', emitTime: 999999999 };
179179
const lowestTimeLowPriority = { token: '', emitTime: 999999999 };
@@ -200,16 +200,20 @@ class CloseCaptioning {
200200
// replace lowest priority ones if there are any
201201
if (lowPriorityCount > 0) {
202202
// existence of lowestTimeLowPriority is implicit
203-
$.Msg(`Caption count exceeded (${captionCount} > ${this.MAX_ENTRIES}), removing: '${lowestTimeLowPriority.token}'`);
203+
$.Msg(
204+
`Caption count exceeded (${captionCount} > ${this.MAX_ENTRIES}), removing: '${lowestTimeLowPriority.token}'`
205+
);
204206
ClosedCaptionsAPI.RemoveCaption(lowestTimeLowPriority.token);
205207
return true;
206-
// if the incoming caption is low priority and there's no space, give up
208+
// if the incoming caption is low priority and there's no space, give up
207209
} else if (bIsNewLowPriority) {
208210
$.Warning(`Caption count exceeded (${captionCount} > ${this.MAX_ENTRIES}), no space for any more!`);
209211
return false;
210212
}
211213
// for everything else, get rid of the least lifetime one
212-
$.Msg(`Caption count exceeded (${captionCount} > ${this.MAX_ENTRIES}), removing: '${lowestTimeGlobal.token}'`);
214+
$.Msg(
215+
`Caption count exceeded (${captionCount} > ${this.MAX_ENTRIES}), removing: '${lowestTimeGlobal.token}'`
216+
);
213217
ClosedCaptionsAPI.RemoveCaption(lowestTimeGlobal.token);
214218
return true;
215219
}
@@ -232,32 +236,37 @@ class CloseCaptioning {
232236
const captionList = this.captions.get(token);
233237
if (!captionList) {
234238
return;
235-
};
239+
}
236240
if (captionList.length === 0) {
237241
return;
238-
};
242+
}
239243
const caption = captionList[0];
240244
caption.FadeOut();
241245
});
242246

243247
// when a caption is missing. must have cc_captiontrace
244-
$.RegisterEventHandler('BadCaption', $.GetContextPanel(), (token: string, lifetime: number, emitTime: number) => {
245-
this.addCaption(token,
246-
new CaptionEntry(
248+
$.RegisterEventHandler(
249+
'BadCaption',
250+
$.GetContextPanel(),
251+
(token: string, lifetime: number, emitTime: number) => {
252+
this.addCaption(
247253
token,
248-
{
249-
bLowPriority: false,
250-
bSFX: false,
251-
nNoRepeat: 0,
252-
nDelay: 0,
253-
flLifetimeOverride: -1.0,
254-
text: `[MISSING] ${token}`,
255-
options: new Map<string, string>()
256-
},
257-
emitTime
258-
)
259-
);
260-
});
254+
new CaptionEntry(
255+
token,
256+
{
257+
bLowPriority: false,
258+
bSFX: false,
259+
nNoRepeat: 0,
260+
nDelay: 0,
261+
flLifetimeOverride: -1.0,
262+
text: `[MISSING] ${token}`,
263+
options: new Map<string, string>()
264+
},
265+
emitTime
266+
)
267+
);
268+
}
269+
);
261270

262271
// display standard captions via token, usually from scenes
263272
$.RegisterEventHandler(
@@ -286,8 +295,7 @@ class CloseCaptioning {
286295
// hide caption box when no more captions are being displayed
287296
static updateVisibility() {
288297
for (const [token, list] of this.captions) {
289-
if (list.length > 0)
290-
return;
298+
if (list.length > 0) return;
291299
}
292300
this.hideBox();
293301
}

scripts/pages/main-menu/menu-manager.ts

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -213,24 +213,15 @@ class MenuManager {
213213
// CC
214214
// This is here because CC panel reconstructs itself
215215
// which will re register these events. Don't want that!
216-
$.RegisterConVarChangeListener(
217-
'cc_panorama_entry_margin',
218-
(value: string) => {
219-
$.DispatchEvent('ReloadCCSettings');
220-
}
221-
);
222-
$.RegisterConVarChangeListener(
223-
'cc_panorama_font_size',
224-
(value: string) => {
225-
$.DispatchEvent('ReloadCCSettings');
226-
}
227-
);
228-
$.RegisterConVarChangeListener(
229-
'cc_panorama_bg_opacity',
230-
(value: string) => {
231-
$.DispatchEvent('ReloadCCSettings');
232-
}
233-
);
216+
$.RegisterConVarChangeListener('cc_panorama_entry_margin', (value: string) => {
217+
$.DispatchEvent('ReloadCCSettings');
218+
});
219+
$.RegisterConVarChangeListener('cc_panorama_font_size', (value: string) => {
220+
$.DispatchEvent('ReloadCCSettings');
221+
});
222+
$.RegisterConVarChangeListener('cc_panorama_bg_opacity', (value: string) => {
223+
$.DispatchEvent('ReloadCCSettings');
224+
});
234225

235226
$.RegisterForUnhandledEvent(
236227
'PanoramaComponent_Campaign_OnCampaignEvaluationRequested',

styles/hud/cc.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
background-color: rgba(0, 0, 0, 0.75);
1414
border-radius: 5px;
1515
width: 1152px;
16-
transition:
17-
opacity 0.25s ease-in-out 0s;
16+
transition: opacity 0.25s ease-in-out 0s;
1817
opacity: 0;
1918

2019
.MainMenu & {
@@ -28,8 +27,7 @@
2827
vertical-align: center;
2928
font-size: 20px;
3029
font-family: 'GorDIN';
31-
transition:
32-
opacity 0.25s ease-in-out 0s;
30+
transition: opacity 0.25s ease-in-out 0s;
3331
opacity: 0;
3432
width: 100%;
3533
text-overflow: noclip;

0 commit comments

Comments
 (0)