mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-18 21:36:27 +01:00
Fix purse
This commit is contained in:
parent
b52d7c41fc
commit
abccffa713
@ -1,4 +1,4 @@
|
||||
import { MouseEventType, TouchEventType } from '@nitrots/nitro-renderer';
|
||||
import { MouseEventType } from '@nitrots/nitro-renderer';
|
||||
import { NitroSoundEvent } from '@nitrots/nitro-renderer/src/nitro/events/NitroSoundEvent';
|
||||
import { DispatchMainEvent } from '../../hooks';
|
||||
|
||||
@ -11,7 +11,7 @@ export const PlaySound = (sampleCode: string) =>
|
||||
DispatchMainEvent(new NitroSoundEvent(NitroSoundEvent.PLAY_SOUND, sampleCode));
|
||||
}
|
||||
|
||||
const eventTypes = [ MouseEventType.MOUSE_CLICK, MouseEventType.MOUSE_MOVE, MouseEventType.MOUSE_MOVE, TouchEventType.TOUCH_MOVE, 'focus' ];
|
||||
const eventTypes = [ MouseEventType.MOUSE_CLICK ];
|
||||
|
||||
const startListening = () =>
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ export const PurseView: FC<{}> = props =>
|
||||
|
||||
setPurse(prevValue =>
|
||||
{
|
||||
const newValue = { ...prevValue };
|
||||
const newValue = Purse.from(prevValue as Purse);
|
||||
|
||||
newValue.credits = parseFloat(parser.credits);
|
||||
|
||||
@ -90,7 +90,7 @@ export const PurseView: FC<{}> = props =>
|
||||
|
||||
setPurse(prevValue =>
|
||||
{
|
||||
const newValue = { ...prevValue };
|
||||
const newValue = Purse.from(prevValue as Purse);
|
||||
|
||||
newValue.activityPoints = parser.currencies;
|
||||
|
||||
@ -106,7 +106,7 @@ export const PurseView: FC<{}> = props =>
|
||||
|
||||
setPurse(prevValue =>
|
||||
{
|
||||
const newValue = { ...prevValue };
|
||||
const newValue = Purse.from(prevValue as Purse);
|
||||
|
||||
newValue.activityPoints = new Map(newValue.activityPoints);
|
||||
|
||||
@ -129,7 +129,7 @@ export const PurseView: FC<{}> = props =>
|
||||
|
||||
setPurse(prevValue =>
|
||||
{
|
||||
const newValue = { ...prevValue };
|
||||
const newValue = Purse.from(prevValue as Purse);
|
||||
|
||||
newValue.clubDays = Math.max(0, parser.daysToPeriodEnd);
|
||||
newValue.clubPeriods = Math.max(0, parser.periodsSubscribedAhead);
|
||||
|
@ -13,8 +13,27 @@ export class Purse implements IPurse
|
||||
private _pastVipDays: number = 0;
|
||||
private _isExpiring: boolean = false;
|
||||
private _minutesUntilExpiration: number = 0;
|
||||
private _minutesSinceLastModified: number;
|
||||
private _lastUpdated: number;
|
||||
private _minutesSinceLastModified: number = 0;
|
||||
private _lastUpdated: number = 0;
|
||||
|
||||
public static from(purse: Purse): Purse
|
||||
{
|
||||
const newPurse = new Purse();
|
||||
|
||||
newPurse._credits = purse._credits;
|
||||
newPurse._activityPoints = purse._activityPoints;
|
||||
newPurse._clubDays = purse._clubDays;
|
||||
newPurse._clubPeriods = purse._clubPeriods;
|
||||
newPurse._isVIP = purse._isVIP;
|
||||
newPurse._pastClubDays = purse._pastClubDays;
|
||||
newPurse._pastVipDays = purse._pastVipDays;
|
||||
newPurse._isExpiring = purse._isExpiring;
|
||||
newPurse._minutesUntilExpiration = purse._minutesUntilExpiration;
|
||||
newPurse._minutesSinceLastModified = purse._minutesSinceLastModified;
|
||||
newPurse._lastUpdated = purse._lastUpdated;
|
||||
|
||||
return newPurse;
|
||||
}
|
||||
|
||||
public get credits(): number
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user