together - TogetherGames/Public-Corona-Lua GitHub Wiki
Together::Together
The Together class is the root class in the Together api. It contains essential configuration settings, an object representing the logged in User, and various Managers for creating, deleting, and retrieving various Together objects.
number PingInterval
How often the ping message is sent to the server.
number LastPingTime
The last time a ping message was sent to the server.
string ApnsDeviceToken
The DeviceToken for Apple push notifications.
boolean RegisteredPushEnabledDevice
A boolean indicates whether the push enabled Device has been registered with the server.
string CacheUserGuid
The cached UserGuid of the last logged in User.
TogetherCache TogetherCache
A TogetherCache class instance used to Load and Save the together cache on the Device.
string TogetherServerIP
The IP address of the together server.
string ClientPublicKey
The PublicKey of the Together Client the Game belongs to.
string ClientPrivateKey
The PrivateKey of the Together Client that Game belongs to.
string GameKey
The Key of the Together Game.
string PlatformName
The name of the platform the Game is running on. (IOS, Android, Mac OS, Unity, HTML5/JS)
string FacebookAppID
The ApplicationID of the Facebook application.
string FacebookPrivileges
The Facebook privileges to ask for when logging into Facebook.
TogetherSocial Social
A TogetherSocial class instance containing various social apis.
TogetherUser TogetherUser
A TogetherUser class instance representing the logged in User.
TogetherUserSession TogetherUserSession
A TogetherUserSession class instance representing the logged in UserSession.
GameInstanceManager GameInstanceManager
A GameInstanceManager class instance useful for storing GameInstances the logged in User is a member of.
LeaderboardManager LeaderboardManager
A LeaderboardManager class instance useful for storing Leaderboards.
UserMessageManager UserMessageManager
A UserMessageManager class instance for sending and receiving in game messages or emails
UserNotificationManager UserNotificationManager
A UserNotificationManager class instance useful for storing UserNotifications.
AchievementManager AchievementManager
A AchievementManager class instance useful for storing Achievements.
ItemManager ItemManager
A ItemManager class instance useful for storing Items.
ChatRoomManager ChatRoomManager
A ChatRoomManager class instance useful for storing ChatRooms.
FriendManager FriendManager
A FriendManager class instance useful for storing together Friends.
UserPurchaseManager UserPurchaseManager
A UserPurchaseManager class instance useful for storing UserPurchases.
Gets or creates the instance of global 'g_Together'
Returns Together
Together:GetInstance( )
Shorthand for fetching the TogetherUser.UserID property.
Returns number
Together:GetUserID( )
Shorthand for fetching the TogetherUser.Username property.
Returns string
Together:GetUsername( )
Shorthand for fetching the TogetherUser.Name property.
Returns string
Together:GetNameOfUser( )
Shorthand for calling the TogetherUser:GetViewName method.
Returns string
Together:GetUserViewName( )
Checks to see if the User is registered via Facebook.
Returns boolean
Together:IsUserFacebookRegistered( )
Checks to see if the User is registered via Custom.
Returns boolean
Together:IsUserCustomRegistered( )
Finds the TogetherFriend with the specified UserID.
Returns TogetherFriend
Together:FindTogetherFriendByUserID( userID )
number userID
The ID of User to retrieve.
--------------------------------------------------------------------------------Finds the TogetherFriend with the specified SocialID (FacebookID). Finds the FacebookFriend with the specified SocialID (FacebookID).
Returns TogetherFriend
Together:FindTogetherFriendBySocialID( userID, userID )
number userID
The ID of User to retrieve.
[number](#) userIDThe ID of User to retrieve.
--------------------------------------------------------------------------------Gets the session token returned when the User logged in.
Returns string
Together:GetSessionToken( )
Initializes the Together class so it's ready to make API requests.
Returns void
Together:Initialize( clientPublicKey, clientPrivateKey, gameKey, platformName )
string clientPublicKey
The PublicKey assigned to your account. This is accessible from the playstogether developer portal.
[string](#) clientPrivateKeyThe PrivateKey assigned to your account. This is accessible from the playstogether developer portal.
[string](#) gameKeyThe GameKey of the game you are connecting to. This is accessible from the playstogether developer portal.
[string](#) platformNameThe Name of the Platform the game is running on. Supported Platforms are:
("IOS", "Android", "Mac OS", "Unity", "HTML5/JS")
Sets the ApnsDeviceToken that will be used when registering the device for push notifications.
Returns void
Together:SetApnsDeviceToken( apnsDeviceToken )
string apnsDeviceToken
The device token.
--------------------------------------------------------------------------------Sets the ServerAddress all network messages will be sent to when talking to the together servers. This defaults to the primary Together servers and does not need to be called unless you are working with a form of private/local server instance. If you are interested in private hosting and want more information, contact [email protected].
Returns void
Together:SetServerAddress( serverAddress )
string serverAddress
The server address of the together server.
--------------------------------------------------------------------------------Gets the ServerAddress all requests are being sent to.
Returns string
Together:GetServerAddress( )
Sets the Facebook ApplicationID all Facebook related calls will use.
Returns void
Together:SetFacebookAppID( facebookAppID, facebookPrivileges )
string facebookAppID
The ApplicationID of the Facebook application.
[table](#) facebookPrivilegesA table full of Facebook privileges to ask for when logging into Facebook.
--------------------------------------------------------------------------------Gets the cached UserGuid.
Returns string
Together:GetCacheUserGuid( )
Loads the Together Cache from the Device. The only thing stored in the TogetherCache currently is the UserGuid of the last logged in user for the application.
Returns void
Together:LoadTogetherCache( )
Saves the Together Cache to the Device. The only thing stored in the TogetherCache currently is the UserGuid of the last logged in user for the application.
Returns void
Together:SaveTogetherCache( )
Erases the Together Cache from the Device. The only thing stored in the TogetherCache currently is the UserGuid of the last logged in user for the application.
Returns void
Together:EraseTogetherCache( )
Logs in the User. This should always be the first Together network message called. If no User GUID is provided, a new user account will be created anonymously and assigned a GUID which can be used to log the user in again later or register them with Facebook or via Custom form.
Note
Currently anonymous users will NOT be deleted. However it is possible that a user cleansing system will be implemented in the future that removes unregistered accounts after 3 to 6 months of inactivity.
Returns void
Together:LoginUser( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Gets the Server Timestamp(UTC+0). The timestamp will be returned in the data member of the callback as a long.
Returns void
Together:GetServerTimeUTC( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Fetches your developer global profile of data set through the portal or by atomic operations. The callback object will contain the profile in the data member as a PropertyCollection type.
Returns void
Together:GetGlobalProfile( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Fetches the game's profile of data set through the portal or by atomic operations. The callback object will contain the profile in the data member as a PropertyCollection type.
Returns void
Together:GetGameProfile( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Fetches the current, logged in user's profile for the game. The callback object will contain the profile in the data member as a PropertyCollection type. This is also retrieved when the User object for the local player is fetched and can be modified with the User.Modify() call.
Returns void
Together:GetUserProfile( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Adds an atomic field to either the game profile or the global profile. The callback object will contain a Property type in the data field.
Returns void
Together:AddAtomic( global, parentName, propertyName, propertyValue, callbackFunc )
boolean global
Pass TRUE to add the atomic entry to the global profile, FALSE to add it to the game profile
[string](#) parentNameThe name of an existing parent collection in which to add the atomic entry to
[string](#) propertyNameThe name of the atomic field to add
[string](#) propertyValueThe value of the atomic entry to apply
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Increments an existing atomic property in either the game profile or global profile without an upper limit. The callback object will contain a Property type in the data field.
Returns void
Together:IncrementAtomic( global, parentName, propertyName, callbackFunc )
boolean global
Pass TRUE to increment an entry in the global profile, FALSE to increment an entry in the game profile
[string](#) parentNameThe name of an existing parent collection containing the property
[string](#) propertyNameThe name of the property to increment
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Increments an existing atomic property in either the game profile or global profile with a passed upper limit. The callback object will contain a Property type in the data field.
Returns void
Together:IncrementAtomicWithLimit( global, parentName, propertyName, limit, callbackFunc )
boolean global
Pass TRUE to increment an entry in the global profile, FALSE to increment an entry in the game profile
[string](#) parentNameThe name of an existing parent collection containing the property
[string](#) propertyNameThe name of the property to increment
[number](#) limitThe upper limit of the atomic operation as an integer
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Increments an existing atomic property in either the game profile or global profile with a reference to a limit elsewhere in the profile. The callback object will contain a Property type in the data field.
Returns void
Together:IncrementAtomicWithLimitRef( global, parentName, propertyName, refParent, refProperty, callbackFunc )
boolean global
Pass TRUE to increment an entry in the global profile, FALSE to increment an entry in the game profile
[string](#) parentNameThe name of an existing parent collection containing the property
[string](#) propertyNameThe name of the property to increment
[string](#) refParentThe name of the parent collection containing the property to be used as the limit
[string](#) refPropertyThe name of the property in the referenced parent to be used as the limit
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Registers the User with Facebook. TogetherSocialFacebook:Login() calls this method upon successfully logging into facebook.
Returns void
Together:RegisterFacebook( facebookID, name, firstName, lastName, link, username, gender, locale, callbackFunc )
string facebookID
The FacebookID of the facebook user.
[string](#) nameThe name of the facebook user.
[string](#) firstNameThe first name of the facebook user.
[string](#) lastNameThe last name of the facebook user.
[string](#) linkThe link to the facebook user.
[string](#) usernameThe username of the facebook user.
[string](#) genderThe gender of the facebook user.
[string](#) localeThe locale of the facebook user.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Registers the User with the custom registration system.
Returns void
Together:RegisterCustom( email, password, name, callbackFunc )
string email
The email of the Custom user.
[string](#) passwordThe password of the Custom user.
[string](#) nameThe name of the Custom user.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Logs out the User. If the user did not registered, this will mark the account inactive but is reactivated at the next login with the same user GUID.
Note
Currently anonymous users will NOT be deleted. However it is possible that a user cleansing system will be implemented in the future that removes unregistered accounts after 3 to 6 months of inactivity.
Returns void
Together:Logout( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Registers a push enabled Device. Use by setting ApnsDeviceToken and/or GcmDeviceToken and/or WnsDeviceToken first then calling.
Returns void
Together:RegisterPushEnabledDevice( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Sends a push notification message.
Note
This counts towards Push Notifications on your developer account and does not count as a System Request.
Returns void
Together:SendPushNotification( destUserID, notificationMessage, platform, data, callbackFunc )
number destUserID
The ID of the User to send the push notification to.
[string](#) notificationMessageThe message to send.
[string](#) platformthe platform that the message is being sent to: ios or android
[TogetherNotification](./togethernotification) datathe TogetherNotification to be sent to the server
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Pings the Server for the User as a keep-alive.
Returns void
Together:Ping( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Adds an Analytic event for the User with simple options.
Returns void
Together:AddAnalytic( eventName, propName, propValue, callbackFunc )
string eventName
The name of the event to assign to the analytic record.
[string](#) propNameThe name of the property to assign to the analytic record.
[string](#) propValueThe value of the property to assign to the analytic record.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Adds an Analytic event for the User with extended options.
Returns void
Together:AddAnalyticEx( eventName, propertyCollection, callbackFunc )
string eventName
The name of the event to assign to the analytic record.
[PropertyCollection](./propertycollection) propertyCollectionCollection of data to add to the event record
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------