Breakroom is now Sinewave Campus. Book a meeting

SGrid

ClientScène
Dans cette classeGetEnabledUserRegions
  1. Fonctions
  2. GetEnabledUserRegions
  3. GetRegionTexture
  4. GetOutfits
  5. Propriétés
  6. IsWhiteLabel
  7. PlayerIsAdmin
  8. PlayerIsModerator
  9. PlayerIsDeveloper
  10. PlayerIsTrusted
  11. ThemeColor1
  12. ThemeColor2
  13. ThemeColor3
  14. ThemeColor4
  15. TextColor1
  16. TextColor2
  17. Name
  18. SiteURL
  19. DefaultRegion
  20. Avatars
  21. OrientationRegion
Membres 19
FonctionGetEnabledUserRegionsCalling this function will asynchronously get and return information about this player's regions as SUserRegions. (This is the same information in the "Region List" window).
FonctionGetRegionTextureReturns the Region Texture (the image seen while loading the region) as a resource.
FonctionGetOutfitsCalling this function will asynchronously get and return information about this player's outfits as a List of SOutfit.
PropriétéIsWhiteLabelReturns true if this Grid is a white-label Grid.
PropriétéPlayerIsAdminReturns true if this player's Grid role is Admin.(white-label grid only)
PropriétéPlayerIsModeratorReturns true if this player's Grid role is Moderator. (white-label grid only)
PropriétéPlayerIsDeveloperReturns true if this player's Grid role is Developer.(white-label grid only)
PropriétéPlayerIsTrustedReturns true if this player's Grid role is Trusted.(white-label grid only)
PropriétéThemeColor1The viewer's Theme Color 1.
PropriétéThemeColor2The viewer's Theme Color 2.
PropriétéThemeColor3The viewer's Theme Color 3.
PropriétéThemeColor4The viewer's Theme Color 4.
PropriétéTextColor1The viewer's Text Color 1.
PropriétéTextColor2The viewer's Text Color 2.
PropriétéNameReturns the Grid's Name. (white-label grid only)
PropriétéSiteURLReturns the Grid's Site URL. (white-label grid only)
PropriétéDefaultRegionReturns the Region ID of the Default Region.
PropriétéAvatarsReturns the IDs of all Avatars in the grid. (white-label grid only)
PropriétéOrientationRegionReturns the Region ID of the "Orientation Region".

Fonctions​

GetEnabledUserRegions​

void GetEnabledUserRegions(Closure onComplete)

Calling this function will asynchronously get and return information about this player's regions as SUserRegions. (This is the same information in the "Region List" window).

Paramètres

ParamètreTypeDescription
onCompleteClosure (Callback)

onComplete is a function that will be called on completion with SUserRegions as a parameter.
onComplete(SUserRegions)

Valeurs de retour

void

Exemple

Lua
function GetUserRegionsComplete(SUserRegions)
--
end
Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
Lua
--Make's a UIText show this Grid's current Subscription Tier

textObject = Space.Host.GetReference("TheTextReference") --add to References section in Scripting Runtime

function GetUserRegionsComplete(SUserRegions)
local r = SUserRegions.SubscriptionTier
text.UIText.Text = r
end

Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)

GetRegionTexture​

void GetRegionTexture(SPublicRegion region, Closure onComplete)
void GetRegionTexture(string json, Closure onComplete)

Returns the Region Texture (the image seen while loading the region) as a resource. This function requires an SPublicRegion object to identify which region. (white-label grids only)

Paramètres

NomTypeValeur par défaut
regionSPublicRegion –
onCompleteClosure–
jsonstring–

Valeurs de retour

void

Exemple

Lua
Space.Grid.GetRegionTexture(AnSPublicRegionObject,OnCompleteFunction)
--see below example
Lua
--When this object is clicked, it's material becomes the Region Texture of the user's first region

thisObject = Space.Host.ExecutingObject

function GetTextureComplete(textureResource)
thisObject.Renderer.Material.SetTexture("_MainTex",textureResource)
end

function GetUserRegionsComplete(SUserRegions)
r = SUserRegions.AvailableRegions
Space.Grid.GetRegionTexture(r[1],GetTextureComplete)
end

function OnClickFunction()
Space.Grid.GetEnabledUserRegions(GetUserRegionsComplete)
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)

GetOutfits​

void GetOutfits(Closure onComplete)

Calling this function will asynchronously get and return information about this player's outfits as a List of SOutfit.

Paramètres

ParamètreTypeDescription
onCompleteClosure (Callback)onComplete is a function that will be called on completion with a List of SOutfit as a parameter.

Valeurs de retour

void

Exemple

Lua
function OnGetOutfitsComplete(TableSOutfits)
--
end
Space.Grid.GetOutfits(OnGetOutfitsComplete)

Propriétés​

IsWhiteLabelLecture seule​

bool IsWhiteLabel {get; }

Returns true if this Grid is a white-label Grid.

Exemple

Lua
isWhiteLabel = Space.Grid.IsWhiteLabel
Lua
--Clicking this object will turn it green color if this grid is white-label
--and will turn it red color if not

thisObject = Space.Host.ExecutingObject

function OnClickFunction()

if Space.Grid.IsWhiteLabel then
thisObject.Renderer.Material.SetColor("_Color",Color.Green)
else
thisObject.Renderer.Material.SetColor("_Color",Color.Red)
end
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)

PlayerIsAdminLecture seule​

bool PlayerIsAdmin {get; }

Returns true if this player's Grid role is Admin.(white-label grid only)

Exemple

Lua
isAdmin = Space.Grid.PlayerIsAdmin
Lua
--Clicking this object will turn it green color if your grid role is Admin
--and will turn it red color if not

thisObject = Space.Host.ExecutingObject

function OnClickFunction()

if Space.Grid.PlayerIsAdmin then
thisObject.Renderer.Material.SetColor("_Color",Color.Green)
else
thisObject.Renderer.Material.SetColor("_Color",Color.Red)
end
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)

PlayerIsModeratorLecture seule​

bool PlayerIsModerator {get; }

Returns true if this player's Grid role is Moderator. (white-label grid only)

Exemple

Lua
isModerator = Space.Grid.PlayerIsModerator
Lua
--Clicking this object will turn it green color if your grid role is Moderator
--and will turn it red color if not

thisObject = Space.Host.ExecutingObject

function OnClickFunction()

if Space.Grid.PlayerIsModerator then
thisObject.Renderer.Material.SetColor("_Color",Color.Green)
else
thisObject.Renderer.Material.SetColor("_Color",Color.Red)
end
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)

PlayerIsDeveloperLecture seule​

bool PlayerIsDeveloper {get; }

Returns true if this player's Grid role is Developer.(white-label grid only)

Exemple

Lua
isDeveloper = Space.Grid.PlayerIsDeveloper
Lua
--Clicking this object will turn it green color if your grid role is Developer
--and will turn it red color if not

thisObject = Space.Host.ExecutingObject

function OnClickFunction()

if Space.Grid.PlayerIsDeveloper then
thisObject.Renderer.Material.SetColor("_Color",Color.Green)
else
thisObject.Renderer.Material.SetColor("_Color",Color.Red)
end
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)

PlayerIsTrustedLecture seule​

bool PlayerIsTrusted {get; }

Returns true if this player's Grid role is Trusted.(white-label grid only)

Exemple

Lua
isTrusted = Space.Grid.PlayerIsTrusted
Lua
--Clicking this object will turn it green color if your grid role is Trusted
--and will turn it red color if not

thisObject = Space.Host.ExecutingObject

function OnClickFunction()

if Space.Grid.PlayerIsTrusted then
thisObject.Renderer.Material.SetColor("_Color",Color.Green)
else
thisObject.Renderer.Material.SetColor("_Color",Color.Red)
end
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)

ThemeColor1Lecture seule​

SColor ThemeColor1 {get; }

The viewer's Theme Color 1.

The viewer's theme consist of 4 Theme Colors and 2 Text Colors.

Exemple

Lua
themeColor1 = Space.Grid.ThemeColor1

ThemeColor2Lecture seule​

SColor ThemeColor2 {get; }

The viewer's Theme Color 2.

The viewer's theme consist of 4 Theme Colors and 2 Text Colors.

Exemple

Lua
themeColor2 = Space.Grid.ThemeColor2

ThemeColor3Lecture seule​

SColor ThemeColor3 {get; }

The viewer's Theme Color 3.

The viewer's theme consist of 4 Theme Colors and 2 Text Colors.

Exemple

Lua
themeColor3 = Space.Grid.ThemeColor3

ThemeColor4Lecture seule​

SColor ThemeColor4 {get; }

The viewer's Theme Color 4.

The viewer's theme consist of 4 Theme Colors and 2 Text Colors.

Exemple

Lua
themeColor4 = Space.Grid.ThemeColor4

TextColor1Lecture seule​

SColor TextColor1 {get; }

The viewer's Text Color 1.

The viewer's theme consist of 4 Theme Colors and 2 Text Colors.

Exemple

Lua
textColor1 = Space.Grid.TextColor1

TextColor2Lecture seule​

SColor TextColor2 {get; }

The viewer's Text Color 2.

The viewer's theme consist of 4 Theme Colors and 2 Text Colors.

Exemple

Lua
textColor2 = Space.Grid.TextColor2

NameLecture seule​

string Name {get; }

Returns the Grid's Name. (white-label grid only)

Exemple

Lua
gridName = Space.Grid.Name
Lua
--Clicking this object will populate a UIText field with the current Grid's Name
thisObject = Space.Host.ExecutingObject
textObject = Space.Host.GetReference("TheTextReference")


function OnClickFunction()
local gridName = Space.Grid.Name
textObject.UIText.Text = gridName
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction

SiteURLLecture seule​

string SiteURL {get; }

Returns the Grid's Site URL. (white-label grid only)

Exemple

Lua
siteUrl = Space.Grid.SiteURL
Lua
--Clicking this object will populate a UIText field with the current Grid's Site URL
thisObject = Space.Host.ExecutingObject
textObject = Space.Host.GetReference("TheTextReference")


function OnClickFunction()
local siteURL = Space.Grid.SiteURL
textObject.UIText.Text = siteURL
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction

DefaultRegionLecture seule​

int DefaultRegion {get; }

Returns the Region ID of the Default Region. The Default Region is set in the grid's Dashboard. (white-label grid only)

Exemple

Lua
defaultRegion = Space.Grid.DefaultRegion
Lua
--Clicking this object will teleport the user to the grid's Default Region
thisObject = Space.Host.ExecutingObject


function OnClickFunction()
local defaultRegion = Space.Grid.DefaultRegion
Space.PlayerAvatar.Teleport(defaultRegion)
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)

AvatarsLecture seule​

int[] Avatars {get; }

Returns the IDs of all Avatars in the grid. (white-label grid only)

Exemple

Lua
avatars = Space.Grid.Avatars
Lua
--Clicking this object will populate a UIText field with the current Grid's Avatars
thisObject = Space.Host.ExecutingObject
textObject = Space.Host.GetReference("TheTextReference")


function OnClickFunction()
local avatars = Space.Grid.Avatars
av = json.serialize(avatars)
textObject.UIText.Text = av
end

thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)

OrientationRegionLecture seule​

int OrientationRegion {get; }

Returns the Region ID of the "Orientation Region".

Exemple

Lua
orientationRegion = Space.Grid.OrientationRegion
Lua
--Clicking this object will teleport the user to the grid's Orientation Region
thisObject = Space.Host.ExecutingObject


function OnClickFunction()
local orientationRegionRegion = Space.Grid.OrientationRegion
Space.PlayerAvatar.Teleport(orientationRegion)
end


thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClickFunction)