C# Класс 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
Наследование: MonoBehaviour
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
DeviceLocationPrefab NaviDevice,
Instance NaviConnectionSDK,

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

AnimObjLocation() публичный Метод

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
Результат void

Awake() публичный Метод

First function that is called when scene is loading
public Awake ( ) : void
Результат void

CallComponentMethod() публичный Метод

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
Результат void

ClearMobileKeyboard() публичный Метод

Method to clear the text on the mobile keyboard
public ClearMobileKeyboard ( int player_id ) : void
player_id int
Результат void

CloseMobileKeyboard() публичный Метод

Method to close mobile keyboard on device
public CloseMobileKeyboard ( int player_id ) : void
player_id int
Результат void

DestroyObj() публичный Метод

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
Результат void

DuplicateObj() публичный Метод

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
Результат void

GetMobileHotspotObj() публичный Метод

public GetMobileHotspotObj ( ) : AndroidJavaObject
Результат UnityEngine.AndroidJavaObject

GetPlayerPose() публичный Метод

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
Результат NaviDevice,

OnDestroy() публичный Метод

Called when object is destroyed i.e. when game ends
public OnDestroy ( ) : void
Результат void

OpenMobileKeyboard() публичный Метод

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
Результат void

RenderObj() публичный Метод

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
Результат void

ResetDevice() публичный Метод

Public Method to reset just the smart device
public ResetDevice ( ) : void
Результат void

ResetVR() публичный Метод

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
Результат void

SendAssetBundle() публичный Метод

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
Результат void

SendData() публичный Метод

Method that is called on an interval to broadcast the ipAddress for listening devices
public SendData ( ) : void
Результат void

SetDeviceOrientaton() публичный Метод

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
Результат void

SetInstructions() публичный Метод

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
Результат void

SetObjLocation() публичный Метод

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
Результат void

SetObjRotation() публичный Метод

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
Результат void

Start() публичный Метод

Called after Gameobject is initalized. We start sending packets to find Navi-compatible devices
public Start ( ) : void
Результат void

StartPlayerSwitchIds() публичный Метод

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
Результат void

SwitchPlayerIds() публичный Метод

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
Результат void

TouchUp() публичный Метод

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
Результат void

Update() публичный Метод

Called every frame to process Network events.
public Update ( ) : void
Результат void

UpdateComponentProperty() публичный Метод

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
Результат void

Описание свойств

DeviceLocationPrefab публичное свойство

public NaviDevice, DeviceLocationPrefab
Результат NaviDevice,

Instance публичное статическое свойство

public static NaviConnectionSDK, Instance
Результат NaviConnectionSDK,