@drincs/nqtr
Version:
A complete system introducing the concepts of location, time and event, producing the framework of a not-quite-point-and-click adventure game.
75 lines (72 loc) • 2.98 kB
TypeScript
import { TimeSettings, ITimeStlot } from '../types/TimeSettings.js';
declare class TimeManager {
initialize(settings: TimeSettings): void;
get minDayHours(): number;
get maxDayHours(): number;
get defaultTimeSpent(): number;
get timeSlots(): ITimeStlot[];
get weekLength(): number;
get weekendStartDay(): number;
get weekDaysNames(): string[];
/**
* Get the current hour
*/
get currentHour(): number;
set currentHour(value: number | undefined);
/**
* Get the current day
*/
get currentDay(): number;
set currentDay(value: number | undefined);
/**
* If the current day is greater than or equal to the weekend start day, then it will return true.
*/
get isWeekend(): boolean;
/**
* Get the current week day number (1 - {@link weekLength}).
* For example, if the week length is 7 and the current day is 10, then the result will be 4.
*/
get currentWeekDayNumber(): number;
/**
* Get the current week day name. If the week days names are not defined, then it will return undefined.
* For example, if the week days names are ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] and the current day is 10, then the result will be 'Thursday'.
* @default ""
*/
get currentDayName(): string;
/**
* Get the current {@link timeSlots} index.
* You can use this property to create "Image that changes based on the time period":
* @example
* ```tsx
* import { weekLength } from '@drincs/nqtr';
*
* function changeBackground() {
* return (
* <img src={`background-currentTimeSlot.currentTimeSlot.png`} />
* )
* }
*/
get currentTimeSlot(): number;
/**
* This function will increase the current hour by the given time spent.
* If the new hour is greater than or equal to the max day hours, then it will increase the day and set the new hour.
* @param timeSpent is the time spent in hours (default: {@link defaultTimeSpent})
* @returns currentTimeSlot.currentHour
*/
increaseHour(timeSpent?: number): number;
/**
* This function will increase the current day by the given days.
* @param newDayHour is the hour of the new day (default: {@link minDayHours})
* @param days is the number of days to increase (default: 1)
* @returns timeTracker.currentDay
*/
increaseDay(newDayHour?: number, days?: number): number;
/**
* This function will check if the current hour is between the given hours.
* @param fromHour the starting hour. If the {@link currentHour} is equal to this hour, the function will return true.
* @param toHour the ending hour.
* @returns true if the current hour is between the given hours, otherwise false.
*/
nowIsBetween(fromHour: number | undefined, toHour: number | undefined): boolean;
}
export { TimeManager as default };