@drincs/nqtr 0.1.14 → 0.1.16
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/dist/ActivityProps-B1IaFbGD.d.ts +124 -0
- package/dist/ActivityProps-BmIzqtXr.d.mts +124 -0
- package/dist/{index-Cu8ZAiqF.d.ts → Commitment-BjkhJtTx.d.ts} +227 -220
- package/dist/{index-DhsRZJ3g.d.mts → Commitment-BxUQoZST.d.mts} +227 -220
- package/dist/{index-gJ26gdgL.d.mts → Quest-Bdm0R9LA.d.mts} +7 -12
- package/dist/{index-BjOzVDyw.d.ts → Quest-CxJcXETG.d.ts} +7 -12
- package/dist/classes/Activity.d.mts +41 -127
- package/dist/classes/Activity.d.ts +41 -127
- package/dist/classes/Activity.js +2 -151
- package/dist/classes/Activity.js.map +1 -1
- package/dist/classes/Activity.mjs +2 -148
- package/dist/classes/Activity.mjs.map +1 -1
- package/dist/classes/ActivityStoredAbstract.d.mts +3 -0
- package/dist/classes/ActivityStoredAbstract.d.ts +3 -0
- package/dist/classes/ActivityStoredAbstract.js +399 -0
- package/dist/classes/ActivityStoredAbstract.js.map +1 -0
- package/dist/classes/ActivityStoredAbstract.mjs +397 -0
- package/dist/classes/ActivityStoredAbstract.mjs.map +1 -0
- package/dist/classes/Commitment.d.mts +4 -1
- package/dist/classes/Commitment.d.ts +4 -1
- package/dist/classes/Commitment.js +5 -4
- package/dist/classes/Commitment.js.map +1 -1
- package/dist/classes/Commitment.mjs +5 -4
- package/dist/classes/Commitment.mjs.map +1 -1
- package/dist/classes/index.d.mts +9 -2
- package/dist/classes/index.d.ts +9 -2
- package/dist/classes/index.js +868 -5
- package/dist/classes/index.js.map +1 -1
- package/dist/classes/index.mjs +863 -6
- package/dist/classes/index.mjs.map +1 -1
- package/dist/classes/navigation/ActivityRoom.d.mts +5 -2
- package/dist/classes/navigation/ActivityRoom.d.ts +5 -2
- package/dist/classes/navigation/ActivityRoom.js +3 -3
- package/dist/classes/navigation/ActivityRoom.js.map +1 -1
- package/dist/classes/navigation/ActivityRoom.mjs +3 -3
- package/dist/classes/navigation/ActivityRoom.mjs.map +1 -1
- package/dist/classes/navigation/Location.d.mts +5 -2
- package/dist/classes/navigation/Location.d.ts +5 -2
- package/dist/classes/navigation/Location.js.map +1 -1
- package/dist/classes/navigation/Location.mjs.map +1 -1
- package/dist/classes/navigation/Map.d.mts +5 -2
- package/dist/classes/navigation/Map.d.ts +5 -2
- package/dist/classes/navigation/Map.js.map +1 -1
- package/dist/classes/navigation/Map.mjs.map +1 -1
- package/dist/classes/navigation/Room.d.mts +4 -1
- package/dist/classes/navigation/Room.d.ts +4 -1
- package/dist/classes/navigation/Room.js +3 -3
- package/dist/classes/navigation/Room.js.map +1 -1
- package/dist/classes/navigation/Room.mjs +3 -3
- package/dist/classes/navigation/Room.mjs.map +1 -1
- package/dist/classes/quest/Goal.d.mts +3 -6
- package/dist/classes/quest/Goal.d.ts +3 -6
- package/dist/classes/quest/Goal.js.map +1 -1
- package/dist/classes/quest/Goal.mjs.map +1 -1
- package/dist/classes/quest/Quest.d.mts +3 -1
- package/dist/classes/quest/Quest.d.ts +3 -1
- package/dist/classes/quest/Quest.js.map +1 -1
- package/dist/classes/quest/Quest.mjs.map +1 -1
- package/dist/classes/quest/Stage.d.mts +3 -1
- package/dist/classes/quest/Stage.d.ts +3 -1
- package/dist/classes/quest/Stage.js.map +1 -1
- package/dist/classes/quest/Stage.mjs.map +1 -1
- package/dist/decorators/ActivityDecorator.d.mts +16 -0
- package/dist/decorators/ActivityDecorator.d.ts +16 -0
- package/dist/decorators/ActivityDecorator.js.map +1 -1
- package/dist/decorators/ActivityDecorator.mjs.map +1 -1
- package/dist/decorators/CommitmentDecorator.d.mts +5 -2
- package/dist/decorators/CommitmentDecorator.d.ts +5 -2
- package/dist/decorators/CommitmentDecorator.js +3 -3
- package/dist/decorators/CommitmentDecorator.js.map +1 -1
- package/dist/decorators/CommitmentDecorator.mjs +3 -3
- package/dist/decorators/CommitmentDecorator.mjs.map +1 -1
- package/dist/decorators/RoomDecorator.d.mts +9 -2
- package/dist/decorators/RoomDecorator.d.ts +9 -2
- package/dist/decorators/RoomDecorator.js.map +1 -1
- package/dist/decorators/RoomDecorator.mjs.map +1 -1
- package/dist/decorators/index.d.mts +4 -1
- package/dist/decorators/index.d.ts +4 -1
- package/dist/decorators/index.js +3 -3
- package/dist/decorators/index.js.map +1 -1
- package/dist/decorators/index.mjs +3 -3
- package/dist/decorators/index.mjs.map +1 -1
- package/dist/functions/ActivityFunctions.d.mts +5 -2
- package/dist/functions/ActivityFunctions.d.ts +5 -2
- package/dist/functions/ActivityFunctions.js.map +1 -1
- package/dist/functions/ActivityFunctions.mjs.map +1 -1
- package/dist/functions/NavigationFunctions.d.mts +5 -2
- package/dist/functions/NavigationFunctions.d.ts +5 -2
- package/dist/functions/NavigationFunctions.js.map +1 -1
- package/dist/functions/NavigationFunctions.mjs.map +1 -1
- package/dist/functions/RoutineFunctions.d.mts +5 -2
- package/dist/functions/RoutineFunctions.d.ts +5 -2
- package/dist/functions/RoutineFunctions.js.map +1 -1
- package/dist/functions/RoutineFunctions.mjs.map +1 -1
- package/dist/functions/index.d.mts +5 -2
- package/dist/functions/index.d.ts +5 -2
- package/dist/functions/index.js.map +1 -1
- package/dist/functions/index.mjs.map +1 -1
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +155 -154
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +155 -154
- package/dist/index.mjs.map +1 -1
- package/dist/interface/ActivityProps.d.mts +3 -0
- package/dist/interface/ActivityProps.d.ts +3 -0
- package/dist/{override/GraphicHTMLElement.js → interface/ActivityProps.js} +1 -1
- package/dist/interface/ActivityProps.mjs +3 -0
- package/dist/interface/CommitmentProps.d.mts +8 -0
- package/dist/interface/CommitmentProps.d.ts +8 -0
- package/dist/{override/OnRunActivityProps.js → interface/CommitmentProps.js} +1 -1
- package/dist/interface/CommitmentProps.mjs +3 -0
- package/dist/interface/RoomActivityMemory.d.mts +9 -0
- package/dist/interface/RoomActivityMemory.d.ts +9 -0
- package/dist/interface/RoomActivityMemory.js +4 -0
- package/dist/interface/RoomActivityMemory.js.map +1 -0
- package/dist/interface/RoomActivityMemory.mjs +3 -0
- package/dist/interface/RoomActivityMemory.mjs.map +1 -0
- package/dist/interface/RoomProps.d.mts +8 -0
- package/dist/interface/RoomProps.d.ts +8 -0
- package/dist/interface/RoomProps.js +4 -0
- package/dist/interface/RoomProps.js.map +1 -0
- package/dist/interface/RoomProps.mjs +3 -0
- package/dist/interface/RoomProps.mjs.map +1 -0
- package/dist/interface/index.d.mts +12 -0
- package/dist/interface/index.d.ts +12 -0
- package/dist/interface/index.js +4 -0
- package/dist/interface/index.js.map +1 -0
- package/dist/interface/index.mjs +3 -0
- package/dist/interface/index.mjs.map +1 -0
- package/dist/interface/navigation/LocationProps.d.mts +8 -0
- package/dist/interface/navigation/LocationProps.d.ts +8 -0
- package/dist/interface/navigation/LocationProps.js +4 -0
- package/dist/interface/navigation/LocationProps.js.map +1 -0
- package/dist/interface/navigation/LocationProps.mjs +3 -0
- package/dist/interface/navigation/LocationProps.mjs.map +1 -0
- package/dist/interface/navigation/MapProps.d.mts +8 -0
- package/dist/interface/navigation/MapProps.d.ts +8 -0
- package/dist/interface/navigation/MapProps.js +4 -0
- package/dist/interface/navigation/MapProps.js.map +1 -0
- package/dist/interface/navigation/MapProps.mjs +3 -0
- package/dist/interface/navigation/MapProps.mjs.map +1 -0
- package/dist/interface/quest/GoalProps.d.mts +7 -0
- package/dist/interface/quest/GoalProps.d.ts +7 -0
- package/dist/interface/quest/GoalProps.js +4 -0
- package/dist/interface/quest/GoalProps.js.map +1 -0
- package/dist/interface/quest/GoalProps.mjs +3 -0
- package/dist/interface/quest/GoalProps.mjs.map +1 -0
- package/dist/interface/quest/QuestProps.d.mts +9 -0
- package/dist/interface/quest/QuestProps.d.ts +9 -0
- package/dist/interface/quest/QuestProps.js +4 -0
- package/dist/interface/quest/QuestProps.js.map +1 -0
- package/dist/interface/quest/QuestProps.mjs +3 -0
- package/dist/interface/quest/QuestProps.mjs.map +1 -0
- package/dist/interface/quest/StageProps.d.mts +5 -0
- package/dist/interface/quest/StageProps.d.ts +5 -0
- package/dist/interface/quest/StageProps.js +4 -0
- package/dist/interface/quest/StageProps.js.map +1 -0
- package/dist/interface/quest/StageProps.mjs +3 -0
- package/dist/interface/quest/StageProps.mjs.map +1 -0
- package/dist/managers/TimeManager.d.mts +1 -1
- package/dist/managers/TimeManager.d.ts +1 -1
- package/dist/managers/TimeManager.js +1 -1
- package/dist/managers/TimeManager.js.map +1 -1
- package/dist/managers/TimeManager.mjs +1 -1
- package/dist/managers/TimeManager.mjs.map +1 -1
- package/dist/managers/index.js +1 -1
- package/dist/managers/index.js.map +1 -1
- package/dist/managers/index.mjs +1 -1
- package/dist/managers/index.mjs.map +1 -1
- package/dist/override/GraphicItemType.d.mts +3 -4
- package/dist/override/GraphicItemType.d.ts +3 -4
- package/dist/override/{OnRunActivityProps.d.mts → OnRunProps.d.mts} +3 -3
- package/dist/override/{OnRunActivityProps.d.ts → OnRunProps.d.ts} +3 -3
- package/dist/override/OnRunProps.js +4 -0
- package/dist/override/OnRunProps.js.map +1 -0
- package/dist/override/OnRunProps.mjs +3 -0
- package/dist/override/OnRunProps.mjs.map +1 -0
- package/dist/override/index.d.mts +1 -2
- package/dist/override/index.d.ts +1 -2
- package/dist/types/OnRunActivityEvent.d.mts +8 -0
- package/dist/types/OnRunActivityEvent.d.ts +8 -0
- package/dist/types/OnRunActivityEvent.js +4 -0
- package/dist/types/OnRunActivityEvent.js.map +1 -0
- package/dist/types/OnRunActivityEvent.mjs +3 -0
- package/dist/types/OnRunActivityEvent.mjs.map +1 -0
- package/dist/types/OnRunCommitmentEvent.d.mts +8 -0
- package/dist/types/OnRunCommitmentEvent.d.ts +8 -0
- package/dist/types/OnRunCommitmentEvent.js +4 -0
- package/dist/types/OnRunCommitmentEvent.js.map +1 -0
- package/dist/types/OnRunCommitmentEvent.mjs +3 -0
- package/dist/types/OnRunCommitmentEvent.mjs.map +1 -0
- package/dist/types/QuestsRequired.d.mts +4 -2
- package/dist/types/QuestsRequired.d.ts +4 -2
- package/dist/types/index.d.mts +4 -2
- package/dist/types/index.d.ts +4 -2
- package/package.json +1 -1
- package/dist/classes/navigation/index.d.mts +0 -5
- package/dist/classes/navigation/index.d.ts +0 -5
- package/dist/classes/navigation/index.js +0 -987
- package/dist/classes/navigation/index.js.map +0 -1
- package/dist/classes/navigation/index.mjs +0 -983
- package/dist/classes/navigation/index.mjs.map +0 -1
- package/dist/classes/quest/index.d.mts +0 -3
- package/dist/classes/quest/index.d.ts +0 -3
- package/dist/classes/quest/index.js +0 -133
- package/dist/classes/quest/index.js.map +0 -1
- package/dist/classes/quest/index.mjs +0 -129
- package/dist/classes/quest/index.mjs.map +0 -1
- package/dist/override/GraphicHTMLElement.d.mts +0 -7
- package/dist/override/GraphicHTMLElement.d.ts +0 -7
- package/dist/override/GraphicHTMLElement.mjs +0 -3
- package/dist/override/OnRunActivityProps.mjs +0 -3
- /package/dist/{override/GraphicHTMLElement.js.map → interface/ActivityProps.js.map} +0 -0
- /package/dist/{override/GraphicHTMLElement.mjs.map → interface/ActivityProps.mjs.map} +0 -0
- /package/dist/{override/OnRunActivityProps.js.map → interface/CommitmentProps.js.map} +0 -0
- /package/dist/{override/OnRunActivityProps.mjs.map → interface/CommitmentProps.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -195,7 +195,7 @@ var TimeManager = class _TimeManager {
|
|
|
195
195
|
* Get the current TimeManager.timeSlots index.
|
|
196
196
|
* You can use this property to create "Image that changes based on the time period":
|
|
197
197
|
* @example
|
|
198
|
-
* ```
|
|
198
|
+
* ```tsx
|
|
199
199
|
* import { TimeManager } from '@drincs/nqtr';
|
|
200
200
|
*
|
|
201
201
|
* function changeBackground() {
|
|
@@ -262,152 +262,6 @@ var TimeManager = class _TimeManager {
|
|
|
262
262
|
};
|
|
263
263
|
|
|
264
264
|
// src/classes/Activity.ts
|
|
265
|
-
var ActivityStoredAbstract = class {
|
|
266
|
-
/**
|
|
267
|
-
* @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
|
|
268
|
-
* @param props The activity properties.
|
|
269
|
-
*/
|
|
270
|
-
constructor(onRun, props) {
|
|
271
|
-
this.defaultName = props.name;
|
|
272
|
-
this.defaultFromHour = props.fromHour;
|
|
273
|
-
this.defaultToHour = props.toHour;
|
|
274
|
-
this.defaultFromDay = props.fromDay;
|
|
275
|
-
this.defaultToDay = props.toDay;
|
|
276
|
-
this.defaultDisabled = props.disabled || false;
|
|
277
|
-
this.defaultHidden = props.hidden || false;
|
|
278
|
-
this._renderIcon = props.renderIcon;
|
|
279
|
-
this._onRun = onRun;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* The name
|
|
283
|
-
*/
|
|
284
|
-
get name() {
|
|
285
|
-
return this.getStorageProperty("name") || this.defaultName || "";
|
|
286
|
-
}
|
|
287
|
-
set name(value) {
|
|
288
|
-
this.setStorageProperty("name", value);
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
292
|
-
*/
|
|
293
|
-
get fromHour() {
|
|
294
|
-
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
295
|
-
}
|
|
296
|
-
set fromHour(value) {
|
|
297
|
-
this.setStorageProperty("fromHour", value);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
301
|
-
*/
|
|
302
|
-
get toHour() {
|
|
303
|
-
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
304
|
-
}
|
|
305
|
-
set toHour(value) {
|
|
306
|
-
this.setStorageProperty("toHour", value);
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
310
|
-
*/
|
|
311
|
-
get fromDay() {
|
|
312
|
-
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
313
|
-
}
|
|
314
|
-
set fromDay(value) {
|
|
315
|
-
this.setStorageProperty("fromDay", value);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
319
|
-
*/
|
|
320
|
-
get toDay() {
|
|
321
|
-
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
322
|
-
}
|
|
323
|
-
set toDay(value) {
|
|
324
|
-
this.setStorageProperty("toDay", value);
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Whether is disabled.
|
|
328
|
-
*/
|
|
329
|
-
get disabled() {
|
|
330
|
-
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
331
|
-
if (typeof value === "string") {
|
|
332
|
-
return pixiVn.getFlag(value);
|
|
333
|
-
}
|
|
334
|
-
return value;
|
|
335
|
-
}
|
|
336
|
-
set disabled(value) {
|
|
337
|
-
this.setStorageProperty("disabled", value);
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
341
|
-
*/
|
|
342
|
-
get hidden() {
|
|
343
|
-
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
347
|
-
return true;
|
|
348
|
-
}
|
|
349
|
-
if (!this.isExpired) {
|
|
350
|
-
return true;
|
|
351
|
-
}
|
|
352
|
-
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
353
|
-
if (typeof value === "string") {
|
|
354
|
-
return pixiVn.getFlag(value);
|
|
355
|
-
}
|
|
356
|
-
return value;
|
|
357
|
-
}
|
|
358
|
-
set hidden(value) {
|
|
359
|
-
this.setStorageProperty("hidden", value);
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* The function for rendering the icon of the activity.
|
|
363
|
-
*/
|
|
364
|
-
get renderIcon() {
|
|
365
|
-
let render = this._renderIcon;
|
|
366
|
-
if (render === void 0) {
|
|
367
|
-
return void 0;
|
|
368
|
-
}
|
|
369
|
-
if (typeof render === "function") {
|
|
370
|
-
return (props) => {
|
|
371
|
-
return render(this, props);
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
return (props) => render;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* The function that is called when the activity is runned.
|
|
378
|
-
*/
|
|
379
|
-
get onRun() {
|
|
380
|
-
return (props) => {
|
|
381
|
-
return this._onRun(this, props);
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Whether the activity is a deadline.
|
|
386
|
-
* @returns Whether the activity is a deadline.
|
|
387
|
-
*/
|
|
388
|
-
isExpired() {
|
|
389
|
-
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
390
|
-
return true;
|
|
391
|
-
}
|
|
392
|
-
return false;
|
|
393
|
-
}
|
|
394
|
-
/**
|
|
395
|
-
* Export the activity properties.
|
|
396
|
-
* @returns The activity properties.
|
|
397
|
-
*/
|
|
398
|
-
export() {
|
|
399
|
-
return {
|
|
400
|
-
name: this.getStorageProperty("name") || this.defaultName,
|
|
401
|
-
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
402
|
-
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
403
|
-
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
404
|
-
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
405
|
-
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
406
|
-
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
407
|
-
renderIcon: this._renderIcon
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
};
|
|
411
265
|
var ActivityModel = class {
|
|
412
266
|
/**
|
|
413
267
|
* @param id The activity id, that must be unique.
|
|
@@ -652,11 +506,12 @@ var CommitmentBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
652
506
|
* Is a function that is called when the player interacts with the character.
|
|
653
507
|
*/
|
|
654
508
|
onRun() {
|
|
655
|
-
|
|
509
|
+
let onRun = this._onRun;
|
|
510
|
+
if (!onRun) {
|
|
656
511
|
console.warn("[NQTR] onRun() is not defined for commitmen, so it will not run.", this);
|
|
657
|
-
|
|
658
|
-
this._onRun(this);
|
|
512
|
+
return;
|
|
659
513
|
}
|
|
514
|
+
return (props) => onRun(this, props);
|
|
660
515
|
}
|
|
661
516
|
/**
|
|
662
517
|
* Whether is disabled. You can also pass a Pixi'VN flag name.
|
|
@@ -998,13 +853,13 @@ function getCommitmentById(id) {
|
|
|
998
853
|
}
|
|
999
854
|
function setFixedCommitments(commitments) {
|
|
1000
855
|
if (Array.isArray(commitments)) {
|
|
1001
|
-
commitments.forEach((c) =>
|
|
856
|
+
commitments.forEach((c) => setFixedCommitments(c));
|
|
1002
857
|
return;
|
|
1003
858
|
}
|
|
1004
|
-
if (
|
|
859
|
+
if (fixedCommitments[commitments.id]) {
|
|
1005
860
|
console.warn(`[NQTR] Commitment id ${commitments.id} already exists, it will be overwritten`);
|
|
1006
861
|
}
|
|
1007
|
-
|
|
862
|
+
fixedCommitments[commitments.id] = commitments;
|
|
1008
863
|
}
|
|
1009
864
|
function addTemporaryCommitment(commitment) {
|
|
1010
865
|
if (!Array.isArray(commitment)) {
|
|
@@ -1080,6 +935,152 @@ function getCommitmentByCharacter(character) {
|
|
|
1080
935
|
});
|
|
1081
936
|
return void 0;
|
|
1082
937
|
}
|
|
938
|
+
var ActivityStoredAbstract = class {
|
|
939
|
+
/**
|
|
940
|
+
* @param onRun The function that is called when the activity is runned. Have 2 parameters: the runned activity and the yourParams object, that is an object with the parameters that you want to pass to the onRun function.
|
|
941
|
+
* @param props The activity properties.
|
|
942
|
+
*/
|
|
943
|
+
constructor(onRun, props) {
|
|
944
|
+
this.defaultName = props.name;
|
|
945
|
+
this.defaultFromHour = props.fromHour;
|
|
946
|
+
this.defaultToHour = props.toHour;
|
|
947
|
+
this.defaultFromDay = props.fromDay;
|
|
948
|
+
this.defaultToDay = props.toDay;
|
|
949
|
+
this.defaultDisabled = props.disabled || false;
|
|
950
|
+
this.defaultHidden = props.hidden || false;
|
|
951
|
+
this._renderIcon = props.renderIcon;
|
|
952
|
+
this._onRun = onRun;
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* The name
|
|
956
|
+
*/
|
|
957
|
+
get name() {
|
|
958
|
+
return this.getStorageProperty("name") || this.defaultName || "";
|
|
959
|
+
}
|
|
960
|
+
set name(value) {
|
|
961
|
+
this.setStorageProperty("name", value);
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* The hour when the activity starts. If the activity is not started yet, it will be hidden.
|
|
965
|
+
*/
|
|
966
|
+
get fromHour() {
|
|
967
|
+
return this.getStorageProperty("fromHour") || this.defaultFromHour || TimeManager.minDayHours;
|
|
968
|
+
}
|
|
969
|
+
set fromHour(value) {
|
|
970
|
+
this.setStorageProperty("fromHour", value);
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* The hour when the activity ends. If the activity is ended yet, it will be hidden.
|
|
974
|
+
*/
|
|
975
|
+
get toHour() {
|
|
976
|
+
return this.getStorageProperty("toHour") || this.defaultToHour || TimeManager.maxDayHours + 1;
|
|
977
|
+
}
|
|
978
|
+
set toHour(value) {
|
|
979
|
+
this.setStorageProperty("toHour", value);
|
|
980
|
+
}
|
|
981
|
+
/**
|
|
982
|
+
* The day when the activity starts. If the activity is not started yet, it will be hidden.
|
|
983
|
+
*/
|
|
984
|
+
get fromDay() {
|
|
985
|
+
return this.getStorageProperty("fromDay") || this.defaultFromDay;
|
|
986
|
+
}
|
|
987
|
+
set fromDay(value) {
|
|
988
|
+
this.setStorageProperty("fromDay", value);
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* The day when the activity ends. If the activity is ended yet, it will be deleted or hidden.
|
|
992
|
+
*/
|
|
993
|
+
get toDay() {
|
|
994
|
+
return this.getStorageProperty("toDay") || this.defaultToDay;
|
|
995
|
+
}
|
|
996
|
+
set toDay(value) {
|
|
997
|
+
this.setStorageProperty("toDay", value);
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Whether is disabled.
|
|
1001
|
+
*/
|
|
1002
|
+
get disabled() {
|
|
1003
|
+
let value = this.getStorageProperty("disabled") || this.defaultDisabled;
|
|
1004
|
+
if (typeof value === "string") {
|
|
1005
|
+
return pixiVn.getFlag(value);
|
|
1006
|
+
}
|
|
1007
|
+
return value;
|
|
1008
|
+
}
|
|
1009
|
+
set disabled(value) {
|
|
1010
|
+
this.setStorageProperty("disabled", value);
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Whether is hidden. If the activity is not started yet, it will be hidden.
|
|
1014
|
+
*/
|
|
1015
|
+
get hidden() {
|
|
1016
|
+
if (this.fromDay && this.fromDay > TimeManager.currentDay) {
|
|
1017
|
+
return true;
|
|
1018
|
+
}
|
|
1019
|
+
if (!TimeManager.nowIsBetween(this.fromHour, this.toHour)) {
|
|
1020
|
+
return true;
|
|
1021
|
+
}
|
|
1022
|
+
if (!this.isExpired) {
|
|
1023
|
+
return true;
|
|
1024
|
+
}
|
|
1025
|
+
let value = this.getStorageProperty("hidden") || this.defaultHidden;
|
|
1026
|
+
if (typeof value === "string") {
|
|
1027
|
+
return pixiVn.getFlag(value);
|
|
1028
|
+
}
|
|
1029
|
+
return value;
|
|
1030
|
+
}
|
|
1031
|
+
set hidden(value) {
|
|
1032
|
+
this.setStorageProperty("hidden", value);
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* The function for rendering the icon of the activity.
|
|
1036
|
+
*/
|
|
1037
|
+
get renderIcon() {
|
|
1038
|
+
let render = this._renderIcon;
|
|
1039
|
+
if (render === void 0) {
|
|
1040
|
+
return void 0;
|
|
1041
|
+
}
|
|
1042
|
+
if (typeof render === "function") {
|
|
1043
|
+
return (props) => {
|
|
1044
|
+
return render(this, props);
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
return (props) => render;
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* The function that is called when the activity is runned.
|
|
1051
|
+
*/
|
|
1052
|
+
get onRun() {
|
|
1053
|
+
return (props) => {
|
|
1054
|
+
return this._onRun(this, props);
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Whether the activity is a deadline.
|
|
1059
|
+
* @returns Whether the activity is a deadline.
|
|
1060
|
+
*/
|
|
1061
|
+
isExpired() {
|
|
1062
|
+
if (this.toDay && this.toDay <= TimeManager.currentDay) {
|
|
1063
|
+
return true;
|
|
1064
|
+
}
|
|
1065
|
+
return false;
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* Export the activity properties.
|
|
1069
|
+
* @returns The activity properties.
|
|
1070
|
+
*/
|
|
1071
|
+
export() {
|
|
1072
|
+
return {
|
|
1073
|
+
name: this.getStorageProperty("name") || this.defaultName,
|
|
1074
|
+
fromHour: this.getStorageProperty("fromHour") || this.defaultFromHour,
|
|
1075
|
+
toHour: this.getStorageProperty("toHour") || this.defaultToHour,
|
|
1076
|
+
fromDay: this.getStorageProperty("fromDay") || this.defaultFromDay,
|
|
1077
|
+
toDay: this.getStorageProperty("toDay") || this.defaultToDay,
|
|
1078
|
+
disabled: this.getStorageProperty("disabled") || this.defaultDisabled,
|
|
1079
|
+
hidden: this.getStorageProperty("hidden") || this.defaultHidden,
|
|
1080
|
+
renderIcon: this._renderIcon
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1083
1084
|
|
|
1084
1085
|
// src/classes/navigation/ActivityRoom.ts
|
|
1085
1086
|
var ActivityRoom = class extends ActivityStoredAbstract {
|
|
@@ -1214,7 +1215,7 @@ var RoomBaseModel = class extends pixiVn.StoredClassModel {
|
|
|
1214
1215
|
get activities() {
|
|
1215
1216
|
let activities = this.activityIds.map((id) => {
|
|
1216
1217
|
return this.getActivity(id);
|
|
1217
|
-
}).filter((activity) => activity !== void 0);
|
|
1218
|
+
}).filter((activity) => activity !== void 0 && !activity.hidden);
|
|
1218
1219
|
return activities;
|
|
1219
1220
|
}
|
|
1220
1221
|
/**
|