C# Class NaviConnectionSDK, Navi

This class does most of the heavy-lifting for connecting the PC to the smart device. This class can only have one Instance running for a given game and can be accessed via the Instance variable. The Instance variable allows you access all public methods and variables. The smart device sends data on two connections: one that sends pose data and another that sends RPC touch data
Inheritance: MonoBehaviour
Afficher le fichier Open project: vmohan7/Navi Class Usage Examples

Méthodes publiques

Свойство Type Description
DeviceLocationPrefab NaviDevice,
Instance NaviConnectionSDK,

Méthodes publiques

Méthode Description
AnimObjLocation ( int player_id, string objName, Vector3 location, float time ) : void

Animates a gameobject to a given location on the mobile device. This should be used after you have uploaded an asset bundle to the device.

Awake ( ) : void

First function that is called when scene is loading

CallComponentMethod ( int player_id, string objName, string componentName, string methodName, object parameters ) : void

If an asset bundle has been sent to the screen, this methd allows you to edit any component on game objects in the asset bundle. if there are no parameters, set parameters to null

ClearMobileKeyboard ( int player_id ) : void

Method to clear the text on the mobile keyboard

CloseMobileKeyboard ( int player_id ) : void

Method to close mobile keyboard on device

DestroyObj ( int player_id, string objName ) : void

Destroys a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.

DuplicateObj ( int player_id, string objName, string newName, Vector3 pos, Quaternion rot ) : void

Duplicate a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.

GetMobileHotspotObj ( ) : AndroidJavaObject
GetPlayerPose ( int playerID ) : NaviDevice,

Gets the device information for the specific player

OnDestroy ( ) : void

Called when object is destroyed i.e. when game ends

OpenMobileKeyboard ( int player_id, string initalText, bool hideInputOnKeyboards ) : void

Method to tell connected device that it should open its mobile keyboard

RenderObj ( int player_id, string objName, bool render ) : void

Sets whether to render a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.

ResetDevice ( ) : void

Public Method to reset just the smart device

ResetVR ( int playerID ) : void

Resets the HMD and smart device. Will call OnGameStart once both the device and HMD have been reset. This method is mapped to a 5 finger tap. So whenever a user taps with 5 fingers they will be reset

SendAssetBundle ( int player_id, TextAsset assetFile ) : void

Sends an asset bundle to to the mobile device in order to render the scene

SendData ( ) : void

Method that is called on an interval to broadcast the ipAddress for listening devices

SetDeviceOrientaton ( int player_id, ScreenOrientation, orient, bool canUserChange ) : void

Method to set the device orientation on the mobile device. This uses Unity's enum and sends that to the device

SetInstructions ( int player_id, string instructions ) : void

Method to set the instructions on the instruction panel screen of the mobile device

SetObjLocation ( int player_id, string objName, Vector3 location ) : void

Sets the location of a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.

SetObjRotation ( int player_id, string objName, Quaternion rot ) : void

Sets the rotation of a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.

Start ( ) : void

Called after Gameobject is initalized. We start sending packets to find Navi-compatible devices

StartPlayerSwitchIds ( int playerID, int fingerID, Vector2 pos ) : void

After a reset this method is called, if the player would like to change which device number they are. To change which device number they are, they need to hold & press the number of fingers of the device they want to become. I.e. if they want to become player 2, they touch their device with 2 fingers.

SwitchPlayerIds ( int playerID, int fingerID, Vector2 pos ) : void

Method that is called when a player wants to switch to a given device id.

TouchUp ( int playerID, int fingerID, Vector2 pos ) : void

Listener for when the user touches up on the device

Update ( ) : void

Called every frame to process Network events.

UpdateComponentProperty ( int player_id, string objName, string componentName, string propName, object value, object indicies ) : void

If an asset bundle has been sent to the screen, this method allows you to edit any component on game objects in the asset bundle. if there are no indices, set indices to null

Private Methods

Méthode Description
ChangePlayerID ( int newID, int currConnection ) : void

Method to tell that device that it has changed to a different player number

CreateSocket ( ) : void

Method that creates the socket on the PC that will be used for receiving data

DeviceConnected ( int connectionID ) : void

Method that is called when a smart device connects

GetPlayerID ( int connectionID ) : int

Given the connection id, we get the player id index

HandlePoseData ( int connectionID, byte recBuffer ) : void

Method to parse and send an event when Pose Data is transfer from smart device

HandleRPC ( int connectionID, byte recBuffer ) : void

Method to parse and send an RPC event from smart device such as recieving touch input

OnConnection ( int connectionID ) : void

Method that is called when a connection is made. We then send a message back to the smart device so that the smart device knows which connection it should use to send different types of data. OnDeviceConnected is called when all connections have been made.

OnDisconnect ( int connectionID ) : void

Method that is called when one of the connection disconnects.

SendAssetData ( int player_id, byte file ) : IEnumerator

Private method to iteratively send asset data to the mobile device, because in general that file will be too big

StartSendingIP ( ) : void

Method that will start broadcasting packets to find a smart device

Method Details

AnimObjLocation() public méthode

Animates a gameobject to a given location on the mobile device. This should be used after you have uploaded an asset bundle to the device.
public AnimObjLocation ( int player_id, string objName, Vector3 location, float time ) : void
player_id int
objName string
location Vector3
time float
Résultat void

Awake() public méthode

First function that is called when scene is loading
public Awake ( ) : void
Résultat void

CallComponentMethod() public méthode

If an asset bundle has been sent to the screen, this methd allows you to edit any component on game objects in the asset bundle. if there are no parameters, set parameters to null
public CallComponentMethod ( int player_id, string objName, string componentName, string methodName, object parameters ) : void
player_id int
objName string
componentName string
methodName string
parameters object
Résultat void

ClearMobileKeyboard() public méthode

Method to clear the text on the mobile keyboard
public ClearMobileKeyboard ( int player_id ) : void
player_id int
Résultat void

CloseMobileKeyboard() public méthode

Method to close mobile keyboard on device
public CloseMobileKeyboard ( int player_id ) : void
player_id int
Résultat void

DestroyObj() public méthode

Destroys a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.
public DestroyObj ( int player_id, string objName ) : void
player_id int
objName string
Résultat void

DuplicateObj() public méthode

Duplicate a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.
public DuplicateObj ( int player_id, string objName, string newName, Vector3 pos, Quaternion rot ) : void
player_id int
objName string
newName string
pos Vector3
rot Quaternion
Résultat void

GetMobileHotspotObj() public méthode

public GetMobileHotspotObj ( ) : AndroidJavaObject
Résultat UnityEngine.AndroidJavaObject

GetPlayerPose() public méthode

Gets the device information for the specific player
public GetPlayerPose ( int playerID ) : NaviDevice,
playerID int The id of the player, where 0 is the controller that is used by the headset
Résultat NaviDevice,

OnDestroy() public méthode

Called when object is destroyed i.e. when game ends
public OnDestroy ( ) : void
Résultat void

OpenMobileKeyboard() public méthode

Method to tell connected device that it should open its mobile keyboard
public OpenMobileKeyboard ( int player_id, string initalText, bool hideInputOnKeyboards ) : void
player_id int
initalText string
hideInputOnKeyboards bool
Résultat void

RenderObj() public méthode

Sets whether to render a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.
public RenderObj ( int player_id, string objName, bool render ) : void
player_id int
objName string
render bool
Résultat void

ResetDevice() public méthode

Public Method to reset just the smart device
public ResetDevice ( ) : void
Résultat void

ResetVR() public méthode

Resets the HMD and smart device. Will call OnGameStart once both the device and HMD have been reset. This method is mapped to a 5 finger tap. So whenever a user taps with 5 fingers they will be reset
public ResetVR ( int playerID ) : void
playerID int
Résultat void

SendAssetBundle() public méthode

Sends an asset bundle to to the mobile device in order to render the scene
public SendAssetBundle ( int player_id, TextAsset assetFile ) : void
player_id int
assetFile UnityEngine.TextAsset
Résultat void

SendData() public méthode

Method that is called on an interval to broadcast the ipAddress for listening devices
public SendData ( ) : void
Résultat void

SetDeviceOrientaton() public méthode

Method to set the device orientation on the mobile device. This uses Unity's enum and sends that to the device
public SetDeviceOrientaton ( int player_id, ScreenOrientation, orient, bool canUserChange ) : void
player_id int
orient ScreenOrientation,
canUserChange bool
Résultat void

SetInstructions() public méthode

Method to set the instructions on the instruction panel screen of the mobile device
public SetInstructions ( int player_id, string instructions ) : void
player_id int
instructions string
Résultat void

SetObjLocation() public méthode

Sets the location of a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.
public SetObjLocation ( int player_id, string objName, Vector3 location ) : void
player_id int
objName string
location Vector3
Résultat void

SetObjRotation() public méthode

Sets the rotation of a gameobject located on the mobile device. This should be used after you have uploaded an asset bundle to the device.
public SetObjRotation ( int player_id, string objName, Quaternion rot ) : void
player_id int
objName string
rot Quaternion
Résultat void

Start() public méthode

Called after Gameobject is initalized. We start sending packets to find Navi-compatible devices
public Start ( ) : void
Résultat void

StartPlayerSwitchIds() public méthode

After a reset this method is called, if the player would like to change which device number they are. To change which device number they are, they need to hold & press the number of fingers of the device they want to become. I.e. if they want to become player 2, they touch their device with 2 fingers.
public StartPlayerSwitchIds ( int playerID, int fingerID, Vector2 pos ) : void
playerID int
fingerID int
pos Vector2
Résultat void

SwitchPlayerIds() public méthode

Method that is called when a player wants to switch to a given device id.
public SwitchPlayerIds ( int playerID, int fingerID, Vector2 pos ) : void
playerID int
fingerID int
pos Vector2
Résultat void

TouchUp() public méthode

Listener for when the user touches up on the device
public TouchUp ( int playerID, int fingerID, Vector2 pos ) : void
playerID int
fingerID int
pos Vector2
Résultat void

Update() public méthode

Called every frame to process Network events.
public Update ( ) : void
Résultat void

UpdateComponentProperty() public méthode

If an asset bundle has been sent to the screen, this method allows you to edit any component on game objects in the asset bundle. if there are no indices, set indices to null
public UpdateComponentProperty ( int player_id, string objName, string componentName, string propName, object value, object indicies ) : void
player_id int
objName string
componentName string
propName string
value object
indicies object
Résultat void

Property Details

DeviceLocationPrefab public_oe property

public NaviDevice, DeviceLocationPrefab
Résultat NaviDevice,

Instance public_oe static_oe property

public static NaviConnectionSDK, Instance
Résultat NaviConnectionSDK,