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
파일 보기 프로젝트 열기: vmohan7/Navi 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
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,