DiscoverTenerife
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
StoredPlace Class Reference

Class that stores the data of one of the stored places. More...

Public Member Functions

string getName ()
 getter of the name_ property. More...
 
string getAddress ()
 getter of the address_ property. More...
 
double getLatitude ()
 getter of the latitude_ property. More...
 
double getLongitude ()
 getter of the longitude_ property. More...
 
bool visited ()
 getter of the visited_ property. More...
 
long lastVisitTimestamp ()
 getter of the lastVisitTimestamp_ property. More...
 
string getZone ()
 getter of the zone_ property. More...
 
void oneMoreVisit ()
 Register a new visit to the represented stored place. It uses the current timestamp. It changes the visited_ property to true. It also set the changesToUpdtate_ static property to true. More...
 
int newVisitsForThisPlace ()
 getter of the newVisitsForThisPlace_ property. More...
 

Static Public Member Functions

static bool storePlace (Place place)
 This method stores the properties of the stored place on the current device. If the user cant save more places it returns false, it returns true in other case. The maximum quantity of places that the user can store is defined on the gameRules class. More...
 
static StoredPlace loadStoredPlace (int index)
 It checks if the current device has stored the asked place, if that is not the case, it returns null, if that is the case it returns a StoredPlace object with the stored information on the given index. More...
 
static bool thereIsAPlaceStoredIn (int index)
 This method return true if exists a place stored on the given position, it returns false in other case. More...
 
static bool isPlaceStoredByName (string name)
 This method returns true if there is a place stored that has the given name, false in other case. More...
 
static bool thereIsAnyPlaceStored ()
 This method returns false if you dont have any place stored, it returns true in other case. More...
 
static bool thereIsSpaceForOtherPlaceStored ()
 This method returns true if the current user can store one or more places, it returns false if the current user cant store more places. More...
 
static void eraseStoredData ()
 This method delete all the stored information on the current device. It also sets the static property changesToUpdate_ to false. More...
 
static void eraseStoredDataOf (int index)
 This method deletes all the information of the place that is on the given index. If there isnt any information on that position it wont do nothing. More...
 
static void saveStoredPlace (StoredPlace storedPlace)
 This method saves on the current device the changes of the given stored place. If the given place isnt stored, it will show a message on the console. More...
 
static void saveAll ()
 Calls the PlayerPrefs's Save method in order to write on the current device all the stored information. More...
 
static void UploadChanges ()
 This method calls the userVisitedPlaceByName with each of the stored places that have been visited and they didnt uploaded the changes. More...
 

Static Public Attributes

static bool changesToUpdate_ = true
 true if any of the stored places has changes to update. More...
 

Private Member Functions

 StoredPlace (Dictionary< string, string > data)
 Constructor, it initialices all the properties of the class. It expects a dictionary with the following entries: name_, address_, latitude_, longitude_, zone_, lastVisitTimestamp_, newVisitsForThisPlace_ and visited_. More...
 

Private Attributes

string name_
 string that stores the name of the stored place. More...
 
string address_
 string that stores the address of the stored place. More...
 
float latitude_
 float that stores the latitude of the stored place. More...
 
float longitude_
 float that stores the longitude of the stored place. More...
 
int newVisitsForThisPlace_
 int that stores the number of new visits to this stored place. More...
 
string zone_
 string that stores the zone that the stored place belongs. More...
 
long lastVisitTimestamp_
 long that contains the timestamp of the last visit. More...
 
bool visited_
 Boolean value, its true when the stored place was already visited. More...
 

Detailed Description

Class that stores the data of one of the stored places.

Constructor & Destructor Documentation

◆ StoredPlace()

StoredPlace.StoredPlace ( Dictionary< string, string >  data)
private

Constructor, it initialices all the properties of the class. It expects a dictionary with the following entries: name_, address_, latitude_, longitude_, zone_, lastVisitTimestamp_, newVisitsForThisPlace_ and visited_.

Parameters
Dictionarywith the string conversion of the data of the stored place.

Member Function Documentation

◆ eraseStoredData()

static void StoredPlace.eraseStoredData ( )
static

This method delete all the stored information on the current device. It also sets the static property changesToUpdate_ to false.

◆ eraseStoredDataOf()

static void StoredPlace.eraseStoredDataOf ( int  index)
static

This method deletes all the information of the place that is on the given index. If there isnt any information on that position it wont do nothing.

Parameters
intposition of the place that you want to erase.

◆ getAddress()

string StoredPlace.getAddress ( )

getter of the address_ property.

Returns
string that contains the property address_'s value.

◆ getLatitude()

double StoredPlace.getLatitude ( )

getter of the latitude_ property.

Returns
double that contains the property latitude_'s value.

◆ getLongitude()

double StoredPlace.getLongitude ( )

getter of the longitude_ property.

Returns
double that contains the property longitude_'s value.

◆ getName()

string StoredPlace.getName ( )

getter of the name_ property.

Returns
string that contains the property name_'s value.

◆ getZone()

string StoredPlace.getZone ( )

getter of the zone_ property.

Returns
string that contains the property zone_'s value.

◆ isPlaceStoredByName()

static bool StoredPlace.isPlaceStoredByName ( string  name)
static

This method returns true if there is a place stored that has the given name, false in other case.

Parameters
stringname of the place that you want to check if its stored.
Returns
bool true if there is a place stored with the given name.

◆ lastVisitTimestamp()

long StoredPlace.lastVisitTimestamp ( )

getter of the lastVisitTimestamp_ property.

Returns
long that contains the property lastVisitTimestamp_'s value.

◆ loadStoredPlace()

static StoredPlace StoredPlace.loadStoredPlace ( int  index)
static

It checks if the current device has stored the asked place, if that is not the case, it returns null, if that is the case it returns a StoredPlace object with the stored information on the given index.

Parameters
intindex of the stored place you want to obtain.
Returns
StoredPlace that is on the index-th position, It can be null.

◆ newVisitsForThisPlace()

int StoredPlace.newVisitsForThisPlace ( )

getter of the newVisitsForThisPlace_ property.

Returns
int that contains the property newVisitsForThisPlace_'s value.

◆ oneMoreVisit()

void StoredPlace.oneMoreVisit ( )

Register a new visit to the represented stored place. It uses the current timestamp. It changes the visited_ property to true. It also set the changesToUpdtate_ static property to true.

◆ saveAll()

static void StoredPlace.saveAll ( )
static

Calls the PlayerPrefs's Save method in order to write on the current device all the stored information.

◆ saveStoredPlace()

static void StoredPlace.saveStoredPlace ( StoredPlace  storedPlace)
static

This method saves on the current device the changes of the given stored place. If the given place isnt stored, it will show a message on the console.

Parameters
StoredPlacethat you want to save the changes.

◆ storePlace()

static bool StoredPlace.storePlace ( Place  place)
static

This method stores the properties of the stored place on the current device. If the user cant save more places it returns false, it returns true in other case. The maximum quantity of places that the user can store is defined on the gameRules class.

Parameters
Placeplace to store.
Returns
true if the given place was stored, false in other case.

◆ thereIsAnyPlaceStored()

static bool StoredPlace.thereIsAnyPlaceStored ( )
static

This method returns false if you dont have any place stored, it returns true in other case.

Returns
true if there is one or more places stored, false in other case.

◆ thereIsAPlaceStoredIn()

static bool StoredPlace.thereIsAPlaceStoredIn ( int  index)
static

This method return true if exists a place stored on the given position, it returns false in other case.

Parameters
intposition that you want to check if there is a stored place.
Returns
bool true if exists a place stored on that position, false in other case.

◆ thereIsSpaceForOtherPlaceStored()

static bool StoredPlace.thereIsSpaceForOtherPlaceStored ( )
static

This method returns true if the current user can store one or more places, it returns false if the current user cant store more places.

Returns
true if the current user can store another place.

◆ UploadChanges()

static void StoredPlace.UploadChanges ( )
static

This method calls the userVisitedPlaceByName with each of the stored places that have been visited and they didnt uploaded the changes.

◆ visited()

bool StoredPlace.visited ( )

getter of the visited_ property.

Returns
bool that contains the property visited_'s value.

Member Data Documentation

◆ address_

string StoredPlace.address_
private

string that stores the address of the stored place.

◆ changesToUpdate_

bool StoredPlace.changesToUpdate_ = true
static

true if any of the stored places has changes to update.

◆ lastVisitTimestamp_

long StoredPlace.lastVisitTimestamp_
private

long that contains the timestamp of the last visit.

◆ latitude_

float StoredPlace.latitude_
private

float that stores the latitude of the stored place.

◆ longitude_

float StoredPlace.longitude_
private

float that stores the longitude of the stored place.

◆ name_

string StoredPlace.name_
private

string that stores the name of the stored place.

◆ newVisitsForThisPlace_

int StoredPlace.newVisitsForThisPlace_
private

int that stores the number of new visits to this stored place.

◆ visited_

bool StoredPlace.visited_
private

Boolean value, its true when the stored place was already visited.

◆ zone_

string StoredPlace.zone_
private

string that stores the zone that the stored place belongs.


The documentation for this class was generated from the following file: